[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix -export-symbols for Linux [patch]

From: James Henstridge
Subject: fix -export-symbols for Linux [patch]
Date: Thu, 18 Jul 2002 00:14:05 +0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020606

Currently the -export-symbols and -export-symbols-regex link flags for libtool do not function correctly under Linux.

The non matched symbols still seem available for dynamic linking (as can be seen with nm -D). Instead, it seems to be removing debug information which makes things harder to debug (it is using the --retain-symbols-file argument, which doesn't affect the exported symbols list). From what I can tell, this will occur for any other platforms where libtool is using --retain-symbols-file.

I put together a little patch that makes libtool create a version script and use the --version-script link flag. It is only set to activate for linux, because that is all I have been able to test it on. For all I know, the change may be appropriate for the *) case.

From my testing so far, it seems to be working correctly. Any chance of this getting applied and a new 1.4.x release being made? It has been over 6 months since the last 1.4.x release, and there are known problems in 1.4.2.


Email: address@hidden              | 2003 Call for Papers out
WWW: |

  This patch makes -export-symbols and -export-symbols-regex work under
  Linux.  It probably works under other architectures, but I can't test
  that; so it is only triggering for linux* now.

--- libtool-1.4.2/libtool.m4.expsyms    Mon May 27 12:33:14 2002
+++ libtool-1.4.2/libtool.m4    Wed Jul 17 23:05:33 2002
@@ -1399,10 +1399,27 @@
+  linux*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname 
$wl$soname -o $lib'
+      archive_expsym_cmds='echo "{" > $output_objdir/$libname.ver;
+        echo "global:" >> $output_objdir/$libname.ver;
+       cat $export_symbols | while read symbol; do
+         echo "  \$symbol;" >> $output_objdir/$libname.ver;
+       done;
+        echo "local: *;" >> $output_objdir/$libname.ver;
+        echo "};" >> $output_objdir/$libname.ver~
+        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname 
${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib~
+        rm -f $output_objdir/$libname.ver'
+    else
+      ld_shlibs=no
+    fi
+    ;;
     if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname 
$wl$soname -o $lib'
       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags 
${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'

reply via email to

[Prev in Thread] Current Thread [Next in Thread]