On 2008-09-04 08:10-0700 Rafael wrote the attached message concerning
reducing the number of symbols that are exported from our libraries.

I brought up this issue myself a month ago, and I think that wiki
reference is worth repeating:

"The wiki (http://gcc.gnu.org/wiki/Visibility) on visibility for libraries
compiled by gcc, g++, etc., has just been mentioned on the CMake list...."

According to that wiki, the advantages of limiting symbols that are exported
is smaller libraries and less loading latency.  I would love to see that
happen so I agree with Rafael this is well worth doing. However, an
alternative implementation would be to follow the cookbook in the above wiki
to extend what we currently do for windows in include/pldll.h to handle the
gcc case.  The obvious advantage of this approach is once include/pldll.h is
changed it affects both current API and future API so there is some benefit
in terms of not having to maintain an additional file such as included in
Rafael's patch whenever we add to our API.

Thus, I lean toward the approach of modifying include/pldll.h, but I also
admit to being non-expert in this field, and there may be some practical
limitation I am missing.  Therefore, I would prefer the C/C++ experts here
to make the decision about which approach to take, and I will be happy to go
along with whatever is decided by them.  The important thing is to clean up
our exported symbols!

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
--- Begin Message ---
Debian has now a nifty tool called dpkg-gensymbols for improving the
maintenance of packages providing shared libraries.  It works essentially by
checking the list of symbols exported by the shared library, which should
correspond to the published API.

I tried to apply this to the Debian plplot package and noticed that there is
a huge number of symbols that are exported by libplplot.so that actually
should not be.  You can check this yourself by doing (in Linux):

    nm src/libplplotd.so.9.5.0 | grep " T "

Many of these symbols must be flagged "t" (local) instead of "T" (global).
Only the c_pl* symbols should be exported.

I prepared a simple patch (attached below) that fixes the problem.  Note
that it only works when the compiler/linker is gcc.  The trick is done by
passing:

    -Wl,--retain-symbols-file=${CMAKE_SOURCE_DIR}/symbols"

to the linker command, where the symbols file, which is also in the patch,
contains the list of API functions in doc/docbook/api.xml.

I hope you will consider this improvement in the next release of PLplot.

[Please, Cc replies to me, since I am not subscribed to the mailing list.]

-- 
Rafael
--- plplot-5.9.0.orig/symbols
+++ plplot-5.9.0/symbols
@@ -0,0 +1,143 @@
+c_pl_setcontlabelformat
+c_pl_setcontlabelparam
+c_pladv
+c_plaxes
+c_plbin
+c_plbop
+c_plbox
+c_plbox3
+c_plcalc_world
+c_plclear
+c_plcol0
+c_plcol1
+c_plcont
+c_plcpstrm
+c_plend
+c_plend1
+c_plenv0
+c_plenv
+c_pleop
+c_plerrx
+c_plerry
+c_plfamadv
+c_plfill
+c_plfill3
+c_plflush
+c_plfont
+c_plfontld
+c_plgchr
+c_plgcol0
+c_plgcol0a
+c_plgcolbg
+c_plgcolbga
+c_plgcompression
+c_plgdev
+c_plgdidev
+c_plgdiori
+c_plgdiplt
+c_plgfam
+c_plgfci
+c_plgfnam
+c_plglevel
+c_plgpage
+c_plgra
+c_plgriddata
+c_plgspa
+c_plgstrm
+c_plgver
+c_plgvpd
+c_plgvpw
+c_plgxax
+c_plgyax
+c_plgzax
+c_plhist
+c_plhlsrgb
+c_plinit
+c_pljoin
+c_pllab
+c_pllightsource
+c_plline
+c_plline3
+c_pllsty
+c_plmap
+c_plmeridians
+c_plmesh
+c_plmeshc
+c_plmkstrm
+c_plmtex
+c_plmtex3
+c_plot3d
+c_plot3dc
+c_plparseopts
+c_plpat
+c_plpoin
+c_plpoin3
+c_plpoly3
+c_plprec
+c_plpsty
+c_plptex
+c_plptex3
+c_plreplot
+c_plrgbhls
+c_plschr
+c_plscmap0
+c_plscmap0a
+c_plscmap0n
+c_plscmap1
+c_plscmap1a
+c_plscmap1l
+c_plscmap1la
+c_plscmap1n
+c_plscol0
+c_plscol0a
+c_plscolbg
+c_plscolbga
+c_plscolor
+c_plscompression
+c_plsdev
+c_plsdidev
+c_plsdimap
+c_plsdiori
+c_plsdiplt
+c_plsdiplz
+c_plsesc
+c_plsetopt
+c_plsfam
+c_plsfci
+c_plsfnam
+c_plshades
+c_plshade
+c_plshade1
+c_plsmaj
+c_plsmem
+c_plsmin
+c_plsori
+c_plspage
+c_plspause
+c_plsstrm
+c_plssub
+c_plssym
+c_plstar
+c_plstart
+c_plstripa
+c_plstripc
+c_plstripd
+c_plstyl
+c_plsurf3d
+c_plsvect
+c_plsvpa
+c_plsxax
+c_plsyax
+c_plsym
+c_plszax
+c_pltext
+c_pltimefmt
+c_plvasp
+c_plvect
+c_plvpas
+c_plvpor
+c_plvsta
+c_plw3d
+c_plwid
+c_plwind
+c_plxormod
--- plplot-5.9.0.orig/src/CMakeLists.txt
+++ plplot-5.9.0/src/CMakeLists.txt
@@ -294,3 +294,6 @@
   install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
 endif(PKG_CONFIG_EXECUTABLE)
 
+IF(CMAKE_COMPILER_IS_GNUCC)
+  SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS 
"${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} 
-Wl,--retain-symbols-file=${CMAKE_SOURCE_DIR}/symbols")
+ENDIF(CMAKE_COMPILER_IS_GNUCC)

--- End Message ---
--- plplot-5.9.0.orig/symbols
+++ plplot-5.9.0/symbols
@@ -0,0 +1,143 @@
+c_pl_setcontlabelformat
+c_pl_setcontlabelparam
+c_pladv
+c_plaxes
+c_plbin
+c_plbop
+c_plbox
+c_plbox3
+c_plcalc_world
+c_plclear
+c_plcol0
+c_plcol1
+c_plcont
+c_plcpstrm
+c_plend
+c_plend1
+c_plenv0
+c_plenv
+c_pleop
+c_plerrx
+c_plerry
+c_plfamadv
+c_plfill
+c_plfill3
+c_plflush
+c_plfont
+c_plfontld
+c_plgchr
+c_plgcol0
+c_plgcol0a
+c_plgcolbg
+c_plgcolbga
+c_plgcompression
+c_plgdev
+c_plgdidev
+c_plgdiori
+c_plgdiplt
+c_plgfam
+c_plgfci
+c_plgfnam
+c_plglevel
+c_plgpage
+c_plgra
+c_plgriddata
+c_plgspa
+c_plgstrm
+c_plgver
+c_plgvpd
+c_plgvpw
+c_plgxax
+c_plgyax
+c_plgzax
+c_plhist
+c_plhlsrgb
+c_plinit
+c_pljoin
+c_pllab
+c_pllightsource
+c_plline
+c_plline3
+c_pllsty
+c_plmap
+c_plmeridians
+c_plmesh
+c_plmeshc
+c_plmkstrm
+c_plmtex
+c_plmtex3
+c_plot3d
+c_plot3dc
+c_plparseopts
+c_plpat
+c_plpoin
+c_plpoin3
+c_plpoly3
+c_plprec
+c_plpsty
+c_plptex
+c_plptex3
+c_plreplot
+c_plrgbhls
+c_plschr
+c_plscmap0
+c_plscmap0a
+c_plscmap0n
+c_plscmap1
+c_plscmap1a
+c_plscmap1l
+c_plscmap1la
+c_plscmap1n
+c_plscol0
+c_plscol0a
+c_plscolbg
+c_plscolbga
+c_plscolor
+c_plscompression
+c_plsdev
+c_plsdidev
+c_plsdimap
+c_plsdiori
+c_plsdiplt
+c_plsdiplz
+c_plsesc
+c_plsetopt
+c_plsfam
+c_plsfci
+c_plsfnam
+c_plshades
+c_plshade
+c_plshade1
+c_plsmaj
+c_plsmem
+c_plsmin
+c_plsori
+c_plspage
+c_plspause
+c_plsstrm
+c_plssub
+c_plssym
+c_plstar
+c_plstart
+c_plstripa
+c_plstripc
+c_plstripd
+c_plstyl
+c_plsurf3d
+c_plsvect
+c_plsvpa
+c_plsxax
+c_plsyax
+c_plsym
+c_plszax
+c_pltext
+c_pltimefmt
+c_plvasp
+c_plvect
+c_plvpas
+c_plvpor
+c_plvsta
+c_plw3d
+c_plwid
+c_plwind
+c_plxormod
--- plplot-5.9.0.orig/src/CMakeLists.txt
+++ plplot-5.9.0/src/CMakeLists.txt
@@ -294,3 +294,6 @@
   install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
 endif(PKG_CONFIG_EXECUTABLE)
 
+IF(CMAKE_COMPILER_IS_GNUCC)
+  SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -Wl,--retain-symbols-file=${CMAKE_SOURCE_DIR}/symbols")
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to