Prompted by the suggestions in the PR what to do about the new exports of _ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv _ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv
at GLIBCXX_3.4.5 on Solaris, I've followed the preprocess *.ver files route Jakub suggested to just omit those two on Solaris. I considered several different preprocessors, but ultimately settled for cpp/gcc -E: * m4 is currently a developer-only requirement, and feels clumsy. * Likewise for perl, which so far is only required for symbol versioning support on Solaris, but would now be required for every platform. * Both options suffer from the requirement to provide at set of defines per target while some (like the current HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT) are already defined for cpp. One should probably provide the components of the target triplet later, if need be. Using cpp works fine after filtering out *.ver file comments that are not cpp directives. At the same time, it allowed to remove the hacky #ifdef handling in make_sunver.pl or via sed. The latter was handled by the ENABLE_SYMVERS_SOL2 conditional so far, which can now go. Since libgomp uses the same hack to handle HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, I applied the same solution there, too. There are two caveats: * The preprocessed libgomp.map has to be called something else (libgomp.ver), otherwise make complains about a circular dependency between $(top_srcdir)/libgomp.map and libgomp.map. * I need to remove the libtool-only -Wc, option from $(COMPILE), otherwise gcc -E complains. Bootstrapped without regressions on {sparc-sun,i386-pc}-solaris2.{8, 9, 10, 11} with as/ld, gas/ld, gas/gld and x86_64-unknown-linux-gnu. With updates libstdc++ baselines, there are now errors and the undesired symbols are gone, while on Linux/x86_64 there are no differences in the readelf output from libstdc++-v3/scripts/extract_symvers.in without and with the patch. Ok for mainline? Rainer 2012-02-12 Rainer Orth <r...@cebitec.uni-bielefeld.de> contrib: PR libstdc++/52188 * make_sunver.pl: Remove #ifdef handling. libgomp: PR libstdc++/52188 * acinclude.m4 (LIBGOMP_ENABLE_SYMVERS): Remove symvers_renaming. Remove ENABLE_SYMVERS_SOL2. * configure: Regenerate. * Makefile.am [LIBGOMP_BUILD_VERSIONED_SHLIB] (comma): New variable. (PREPROCESS): New variable. (libgomp.ver): New target. [LIBGOMP_BUILD_VERSIONED_SHLIB && LIBGOMP_BUILD_VERSIONED_SHLIB_GNU]: Remove LIBGOMP_BUILD_VERSIONED_SHLIB_SOL2 handling. Use libgomp.ver. [LIBGOMP_BUILD_VERSIONED_SHLIB_SUN]: Use libgomp.ver, libgomp.ver-sun. * Makefile.in: Regenerate. libstdc++-v3: PR libstdc++/52188 * acinclude.m4 (GLIBCXX_ENABLE_SYMVERS): Remove symvers_renaming. Remove ENABLE_SYMVERS_SOL2. * configure: Regenerate. * src/Makefile.am [ENABLE_SYMVERS] (libstdc++-symbols.ver): Postprocess mapfile. [ENABLE_SYMVERS_GNU]: Remove ENABLE_SYMVERS_SOL2 handling. * src/Makefile.in: Regenerate. * config/abi/pre/gnu.ver (GLIBCXX_3.4.5) [!__sun__ && !__svr4__]: Don't export _ZNSt19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEppEv.
# HG changeset patch # Parent a310ee31985e25bd0e53f4eaddd686e1cb21c5fd Fix Solaris symbol versioning (PR libstdc++/52188, libstdc++/52189) diff --git a/contrib/make_sunver.pl b/contrib/make_sunver.pl --- a/contrib/make_sunver.pl +++ b/contrib/make_sunver.pl @@ -156,9 +156,6 @@ my $glob = 'glob'; # We're currently inside `extern "C++"', which Sun ld doesn't understand. my $in_extern = 0; -# We're currently inside a conditional section: just skip it. -my $in_ifdef = 0; - # The c++filt command to use. This *must* be GNU c++filt; the Sun Studio # c++filt doesn't handle the GNU mangling style. my $cxxfilt = $ENV{'CXXFILT'} || "c++filt"; @@ -183,15 +180,6 @@ printf "# Omitted archives with correspo print "#\n\n"; while (<F>) { - # End of skipped section. - if (/^[ \t]*\#endif/) { - $in_ifdef = 0; - next; - } - - # Just skip a conditional section. - if ($in_ifdef) { next; } - # Lines of the form '};' if (/^([ \t]*)(\}[ \t]*;[ \t]*)$/) { $glob = 'glob'; @@ -216,15 +204,6 @@ while (<F>) { print; next; } - # Special comments that look like C preprocessor conditionals. - # Just skip the contents for now. - # FIXME: Allow passing in conditionals from the command line to really - # control the skipping. - if (/^[ \t]*\#ifdef/) { - $in_ifdef = 1; - next; - } - # Comment and blank lines if (/^[ \t]*\#/) { print; next; } if (/^[ \t]*$/) { print; next; } diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am --- a/libgomp/Makefile.am +++ b/libgomp/Makefile.am @@ -22,26 +22,26 @@ toolexeclib_LTLIBRARIES = libgomp.la nodist_toolexeclib_HEADERS = libgomp.spec if LIBGOMP_BUILD_VERSIONED_SHLIB +# -Wc is only a libtool option. +comma = , +PREPROCESS = $(subst -Wc$(comma), , $(COMPILE)) -E + +libgomp.ver: $(top_srcdir)/libgomp.map + $(EGREP) -v '#(#| |$$)' $< | \ + $(PREPROCESS) -P -include config.h - > $@ || (rm -f $@ ; exit 1) + if LIBGOMP_BUILD_VERSIONED_SHLIB_GNU -if LIBGOMP_BUILD_VERSIONED_SHLIB_SOL2 -libgomp_version_script = -Wl,--version-script,libgomp.map-sol2 -libgomp_version_dep = libgomp.map-sol2 -libgomp.map-sol2 : $(top_srcdir)/libgomp.map - sed -e '/^#ifdef HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT/,/^#endif/d' $< \ - > $@ || (rm -f $@ ; exit 1) -else -libgomp_version_script = -Wl,--version-script,$(top_srcdir)/libgomp.map -libgomp_version_dep = $(top_srcdir)/libgomp.map -endif +libgomp_version_script = -Wl,--version-script,libgomp.ver +libgomp_version_dep = libgomp.ver endif if LIBGOMP_BUILD_VERSIONED_SHLIB_SUN -libgomp_version_script = -Wl,-M,libgomp.map-sun -libgomp_version_dep = libgomp.map-sun -libgomp.map-sun : $(top_srcdir)/libgomp.map \ +libgomp_version_script = -Wl,-M,libgomp.ver-sun +libgomp_version_dep = libgomp.ver-sun +libgomp.ver-sun : libgomp.ver \ $(top_srcdir)/../contrib/make_sunver.pl \ $(libgomp_la_OBJECTS) $(libgomp_la_LIBADD) perl $(top_srcdir)/../contrib/make_sunver.pl \ - $(top_srcdir)/libgomp.map \ + libgomp.ver \ $(libgomp_la_OBJECTS:%.lo=.libs/%.o) \ `echo $(libgomp_la_LIBADD) | \ sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \ diff --git a/libgomp/acinclude.m4 b/libgomp/acinclude.m4 --- a/libgomp/acinclude.m4 +++ b/libgomp/acinclude.m4 @@ -355,15 +355,12 @@ if test $enable_symvers != no ; then # The Solaris 2 runtime linker doesn't support the GNU extension of # binding the same symbol to different versions solaris2*) - symvers_renaming=no ;; + ;; # Other platforms with GNU symbol versioning (GNU/Linux, more?) do. *) AC_DEFINE(HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, 1, [Define to 1 if the target runtime linker supports binding the same symbol to different versions.]) - symvers_renaming=yes ;; + ;; esac -else - symvers_renaming=no fi -AM_CONDITIONAL(LIBGOMP_BUILD_VERSIONED_SHLIB_SOL2, test $symvers_renaming = no) ]) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -3264,17 +3264,14 @@ if test $enable_symvers != no ; then # The Solaris 2 runtime linker doesn't support the GNU extension of # binding the same symbol to different versions solaris2*) - symvers_renaming=no ;; + ;; # Other platforms with GNU symbol versioning (GNU/Linux, more?) do. *) AC_DEFINE(HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, 1, [Define to 1 if the target runtime linker supports binding the same symbol to different versions.]) - symvers_renaming=yes ;; + ;; esac -else - symvers_renaming=no fi -GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SOL2, test $symvers_renaming = no) # Now, set up compatibility support, if any. # In addition, need this to deal with std::size_t mangling in diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -1,7 +1,7 @@ ## Linker script for GNU versioning (GNU ld 2.13.91+ only.) ## -## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -## Free Software Foundation, Inc. +## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +## 2011, 2012 Free Software Foundation, Inc. ## ## This file is part of the GNU ISO C++ Library. This library is free ## software; you can redistribute it and/or modify it under the @@ -890,8 +890,12 @@ GLIBCXX_3.4.5 { _ZNSt11char_traitsI[cw]E2eqERK[cw]S2_; + # Those template instantiations weren't exported on Solaris in GCC 4.6 + # aren't necessary for correct operation, so don't emit them now + # (PR libstdc++/52188). +#if !defined(__sun__) && !defined(__svr4__) _ZNSt19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEppEv; - +#endif } GLIBCXX_3.4.4; GLIBCXX_3.4.6 { diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -102,34 +102,29 @@ CXXLINK = $(LIBTOOL) --tag CXX $(AM_LIBT if ENABLE_SYMVERS libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \ $(port_specific_symbol_files) - cp ${glibcxx_srcdir}/$(SYMVER_FILE) ./libstdc++-symbols.ver - chmod +w ./libstdc++-symbols.ver + cp ${glibcxx_srcdir}/$(SYMVER_FILE) $@.tmp + chmod +w $@.tmp if test "x$(port_specific_symbol_files)" != x; then \ if grep '^# Appended to version file.' \ $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \ - cat $(port_specific_symbol_files) >> $@; \ + cat $(port_specific_symbol_files) >> $@.tmp; \ else \ - sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \ - sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \ - cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \ + sed -n '1,/DO NOT DELETE/p' $@.tmp > tmp.top; \ + sed -n '/DO NOT DELETE/,$$p' $@.tmp > tmp.bottom; \ + cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@.tmp; \ rm tmp.top tmp.bottom; \ fi; \ fi + $(EGREP) -v '#(#| |$$)' $@.tmp | \ + $(COMPILE) -E -P -include config.h - > $@ || (rm -f $@ ; exit 1) + rm -f $@.tmp CLEANFILES = libstdc++-symbols.ver if ENABLE_SYMVERS_GNU -if ENABLE_SYMVERS_SOL2 -version_arg = -Wl,--version-script,libstdc++-symbols.ver-sol2 -version_dep = libstdc++-symbols.ver-sol2 -libstdc++-symbols.ver-sol2 : libstdc++-symbols.ver - sed -e '/^#ifdef HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT/,/^#endif/d' $< \ - > $@ || (rm -f $@ ; exit 1) -else version_arg = -Wl,--version-script=libstdc++-symbols.ver version_dep = libstdc++-symbols.ver endif -endif if ENABLE_SYMVERS_GNU_NAMESPACE version_arg = -Wl,--version-script=libstdc++-symbols.ver version_dep = libstdc++-symbols.ver
-- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University