Back in 2003, libtool got a patch to use -version-script instead of -retain-symbols-file under Linux (in the repo it's commit fb5e6cda96bd9dcae9e4f62ec8b6b3e572a32743).
While I was toying with a few things, I've noticed, that this patch doesn't affect C++. I don't know if there was a technical reason for this. I've came up with a patch, that kind of works, though it's most likely not really correct. It's against libtool 2.4. If this mail reaches the list, I'd like to know: - was skipping C++ back then done on purpose ? - just how incorrect is the attched patch ? PS: CC me with the replies.
--- libtool.m4.old 2011-09-06 09:54:13.000000000 +0200 +++ libtool.m4 2013-02-03 07:45:11.446790391 +0100 @@ -4503,6 +4503,40 @@ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac + if test "$with_gnu_ld" = yes; then + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + fi + case $host_os in + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global: extern \"C++\" {" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "}; local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + fi + ;; + esac + ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)=
_______________________________________________ https://lists.gnu.org/mailman/listinfo/libtool