This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3] Update libstdc++ baseline on Solaris 2
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: libstdc++ at gcc dot gnu dot org
- Cc: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Mon, 29 Nov 2010 18:37:13 +0100
- Subject: [v3] Update libstdc++ baseline on Solaris 2
libstdc++-abi/abi_check currently fails on Solaris 2 like this:
2 added symbols
0
_ZSt15future_categoryv
std::future_category()
version status: compatible
GLIBCXX_3.4.16
type: function
status: added
1
GLIBCXX_3.4.16
version status: compatible
type: object
type size: 0
status: added
5 missing symbols
0
_ZSt10defer_lock
std::defer_lock
version status: unversioned
type: object
type size: 1
status: subtracted
1
_ZSt11try_to_lock
std::try_to_lock
version status: unversioned
type: object
type size: 1
status: subtracted
2
_ZNSt12system_errorC1ESt10error_code
std::system_error::system_error(std::error_code)
version status: unversioned
type: function
status: subtracted
3
_ZSt10adopt_lock
std::adopt_lock
version status: unversioned
type: object
type size: 1
status: subtracted
4
_ZSt15future_category
std::future_category
version status: unversioned
type: object
type size: 4
status: subtracted
5 incompatible symbols
0
_ZSt10defer_lock
std::defer_lock
version status: unversioned
type: object
type size: 1
status: subtracted
1
_ZSt11try_to_lock
std::try_to_lock
version status: unversioned
type: object
type size: 1
status: subtracted
2
_ZNSt12system_errorC1ESt10error_code
std::system_error::system_error(std::error_code)
version status: unversioned
type: function
status: subtracted
3
_ZSt10adopt_lock
std::adopt_lock
version status: unversioned
type: object
type size: 1
status: subtracted
4
_ZSt15future_category
std::future_category
version status: unversioned
type: object
type size: 4
status: subtracted
=== libstdc++-v3 check-abi Summary ===
# of added symbols: 2
# of missing symbols: 5
# of incompatible symbols: 5
The removal of std::defer_lock, std::try_to_lock, std::adopt_lock was
introduced by this change:
2010-11-01 Benjamin Kosnik <bkoz@redhat.com>
[...]
* include/bits/allocator.h: Add constexpr as per N3126 draft.
* include/bits/ios_base.h: Same.
* include/bits/shared_ptr.h: Same.
* include/bits/unique_ptr.h: Same.
* include/bits/stl_iterator.h: Same.
* include/bits/stl_pair.h: Same.
* include/std/tuple: Same.
* include/tr1_impl/type_traits: Same.
* include/std/chrono: Same.
* include/std/ratio: Same.
* include/std/mutex: Same.
* src/mutex.cc: Same.
On Linux, this is hidden by this code in src/mutex.cc:
// XXX GLIBCXX_ABI Deprecated
// gcc-4.6.0
// <mutex> export changes
#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \
&& defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
&& defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
[...]
#define _GLIBCXX_ASM_SYMVER(cur, old, version) \
asm (".symver " #cur "," #old "@@" #version);
_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx10adopt_lockE, _ZSt10adopt_lock, GLIBCXX_3.4.11)
This does not work on Solaris, so strictly speaking we'd have to
increment the libstdc++.so major version due to the symbol removal.
Given that symbol versioning is only introduced in 4.6, I'm not too
worried about this, but we should have some solution for this kind of
problem on non-Linux platforms to avoid breaking compatiblity.
The removal of std::future_category was done here:
2010-11-01 Benjamin Kosnik <bkoz@redhat.com>
* include/std/chrono: Extend constexpr application.
[...]
but is missing from the ChangeLog entry:
diff -r a5f64678b939 -r 904df32dbfa6 libstdc++-v3/src/future.cc
--- a/libstdc++-v3/src/future.cc Tue Nov 02 01:31:50 2010 +0000
+++ b/libstdc++-v3/src/future.cc Tue Nov 02 02:35:28 2010 +0000
@@ -66,7 +66,8 @@
namespace std
{
- const error_category* const future_category = &__future_category_instance();
+ const error_category& future_category()
+ { return __future_category_instance(); }
future_error::~future_error() throw() { }
There's no fix/workaround even for Linux AFAICT.
Finally, std::system_error::system_error(std::error_code) was probably
removed by this patch:
2010-09-16 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/system_error (system_error::system_error(error_code),
system_error(error_code, const string&), system_error(int, const
error_category&), system_error(int, const error_category&,
const string&)): Fix for what() to return the NBTS recommended in
the Note in 19.5.6.2/14.
The following patch fixes this by updating the Solaris 2 baseline files.
Previously, this was done in scripts/extract_symvers using pvs on
Solaris, but this has the unfortunate effect that the baselines differ
from those generated with readelf in the cross-compilation case because
one cannot distinguish OBJECT and TLS with pvs alone. To avoid this,
I've chosen to move the generation of baseline_symbols.txt on native
Solaris 2 to a new perl script scripts/extract_symvers.pl because this
is far easier to do than in shell/awk alone. To allow for this, I need
to substitute glibcxx_srcdir in extract_symvers.
The following patch does all this and creates identical baselines with
pvs/elfdump and readelf. I only include a single baseline file for
reference, though, since the changes are identical between them.
Bootstrapped on i386-pc-solaris2.11. Ok for mainline?
Rainer
2010-11-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* scripts/extract_symvers.pl: New file.
* scripts/extract_symvers: Rename to ...
* scripts/extract_symvers.in: ... this.
Use extract_symvers.pl on SunOS.
* configure.ac: Add scripts/extract_symvers to AC_CONFIG_FILES.
* configure: Regenerate.
* testsuite/Makefile.am (extract_symvers): Call extract_symvers
from $(glibcxx_builddir).
* testsuite/Makefile.in: Regenerate.
* testsuite/libstdc++-abi/abi.exp: Call extract_symvers from
$objdir.
* config/abi/post/solaris2.8/baseline_symbols.txt: Regenerate.
* config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/amd64/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt: Likewise.
diff -r 019a7f0b8438 libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt Sat Nov 27 11:36:38 2010 +0100
+++ b/libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt Sat Nov 27 11:43:07 2010 +0100
@@ -1234,7 +1234,6 @@
FUNC:_ZNSt12strstreambufD0Ev@@GLIBCXX_3.4
FUNC:_ZNSt12strstreambufD1Ev@@GLIBCXX_3.4
FUNC:_ZNSt12strstreambufD2Ev@@GLIBCXX_3.4
-FUNC:_ZNSt12system_errorC1ESt10error_code@@GLIBCXX_3.4.11
FUNC:_ZNSt12system_errorD0Ev@@GLIBCXX_3.4.11
FUNC:_ZNSt12system_errorD1Ev@@GLIBCXX_3.4.11
FUNC:_ZNSt12system_errorD2Ev@@GLIBCXX_3.4.11
@@ -2115,6 +2114,7 @@
FUNC:_ZSt14__convert_to_vIfEvPKcRT_RSt12_Ios_IostateRKPi@@GLIBCXX_3.4
FUNC:_ZSt14set_unexpectedPFvvE@@GLIBCXX_3.4
FUNC:_ZSt15_Fnv_hash_bytesPKvmm@@CXXABI_1.3.5
+FUNC:_ZSt15future_categoryv@@GLIBCXX_3.4.16
FUNC:_ZSt15set_new_handlerPFvvE@@GLIBCXX_3.4
FUNC:_ZSt15system_categoryv@@GLIBCXX_3.4.11
FUNC:_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@@GLIBCXX_3.4.9
@@ -2398,6 +2398,7 @@
OBJECT:0:GLIBCXX_3.4.13
OBJECT:0:GLIBCXX_3.4.14
OBJECT:0:GLIBCXX_3.4.15
+OBJECT:0:GLIBCXX_3.4.16
OBJECT:0:GLIBCXX_3.4.2
OBJECT:0:GLIBCXX_3.4.3
OBJECT:0:GLIBCXX_3.4.4
@@ -2782,9 +2783,6 @@
OBJECT:1:_ZNSt21__numeric_limits_base9is_moduloE@@GLIBCXX_3.4
OBJECT:1:_ZNSt21__numeric_limits_base9is_signedE@@GLIBCXX_3.4
OBJECT:1:_ZNSt6chrono12system_clock12is_monotonicE@@GLIBCXX_3.4.11
-OBJECT:1:_ZSt10adopt_lock@@GLIBCXX_3.4.11
-OBJECT:1:_ZSt10defer_lock@@GLIBCXX_3.4.11
-OBJECT:1:_ZSt11try_to_lock@@GLIBCXX_3.4.11
OBJECT:1:_ZSt7nothrow@@GLIBCXX_3.4
OBJECT:20:_ZTSSt12ctype_bynameIcE@@GLIBCXX_3.4
OBJECT:20:_ZTSSt12ctype_bynameIwE@@GLIBCXX_3.4
@@ -3496,10 +3494,9 @@
OBJECT:8:_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE@@GLIBCXX_3.4
OBJECT:8:_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE@@GLIBCXX_3.4
OBJECT:8:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE@@GLIBCXX_3.4
-OBJECT:8:_ZSt11__once_call@@GLIBCXX_3.4.11
-OBJECT:8:_ZSt15__once_callable@@GLIBCXX_3.4.11
-OBJECT:8:_ZSt15future_category@@GLIBCXX_3.4.14
OBJECT:96:_ZTVSt12ctype_bynameIcE@@GLIBCXX_3.4
OBJECT:96:_ZTVSt5ctypeIcE@@GLIBCXX_3.4
OBJECT:96:_ZTVSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE@@GLIBCXX_3.4
OBJECT:96:_ZTVSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE@@GLIBCXX_3.4
+TLS:8:_ZSt11__once_call@@GLIBCXX_3.4.11
+TLS:8:_ZSt15__once_callable@@GLIBCXX_3.4.11
diff -r 019a7f0b8438 libstdc++-v3/configure.ac
--- a/libstdc++-v3/configure.ac Sat Nov 27 11:36:38 2010 +0100
+++ b/libstdc++-v3/configure.ac Sat Nov 27 11:43:07 2010 +0100
@@ -375,6 +375,7 @@
dnl AC_OUTPUT macro. This one lists the files to be created:
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES([scripts/testsuite_flags],[chmod +x scripts/testsuite_flags])
+AC_CONFIG_FILES([scripts/extract_symvers],[chmod +x scripts/extract_symvers])
# Multilibs need MULTISUBDIR defined correctly in certain makefiles so
# that multilib installs will end up installed in the correct place.
diff -r 019a7f0b8438 libstdc++-v3/scripts/extract_symvers.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libstdc++-v3/scripts/extract_symvers.in Sat Nov 27 11:43:07 2010 +0100
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# Copyright (C) 2002, 2003, 2009, 2010 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
+# terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this library; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+
+if test ${#} -lt 2 || test $1 = '--help'; then
+ echo "Usage: extract_symvers shared_lib output_file" 1>&2
+ exit 1
+fi
+
+lib=$1
+output=$2
+
+# This avoids weird sorting problems later.
+LC_ALL=C
+export LC_ALL
+LANG=C
+export LANG
+
+tmp=extract.$$
+
+case `uname -s` in
+SunOS)
+ # Ensure that output on Solaris 2 matches readelf below without requiring
+ # GNU binutils to be installed. This requires a combination of pvs and
+ # elfdump, which is easier handled in a perl script.
+ perl @glibcxx_srcdir@/scripts/extract_symvers.pl ${lib} > $tmp 2>&1
+ ;;
+*)
+ # GNU binutils, somewhere after version 2.11.2, requires -W/--wide to
+ # avoid default line truncation. -W is not supported and truncation did
+ # not occur by default before that point.
+ readelf="readelf --symbols"
+ if readelf --help | grep -- --wide > /dev/null; then
+ readelf="$readelf --wide"
+ fi
+ ${readelf} ${lib} |\
+ sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
+ egrep -v ' (LOCAL|UND) ' |\
+ awk '{ if ($4 == "FUNC" || $4 == "NOTYPE")
+ printf "%s:%s\n", $4, $8;
+ else if ($4 == "OBJECT" || $4 == "TLS")
+ printf "%s:%s:%s\n", $4, $3, $8;
+ }' | sort | uniq > $tmp 2>&1
+# else printf "Huh? What is %s?\n", $8;
+ ;;
+esac
+
+# I think we'll be doing some more with this file, but for now, dump.
+mv $tmp $output
+
+exit 0
diff -r 019a7f0b8438 libstdc++-v3/scripts/extract_symvers.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libstdc++-v3/scripts/extract_symvers.pl Sat Nov 27 11:43:07 2010 +0100
@@ -0,0 +1,127 @@
+#!/usr/bin/perl -w
+
+# Copyright (C) 2010 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
+# terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this library; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Extract symbol version information on Solaris 2.
+#
+# Sun ld doesn't record symbol versions in .dynsym entries and they cannot
+# easily be extracted from readelf --versions output, so use pvs instead.
+# This way, we don't require GNU binutils in the native case. Also ensures
+# that baseline_symbols.txt is identical between native (pvs, elfdump) and
+# cross (readelf) cases.
+
+my $lib = shift;
+
+open PVS, "pvs -dsvo $lib |" or die $!;
+while (<PVS>) {
+ chomp;
+
+ # Remove trailing semicolon.
+ s/;$//;
+
+ # shared object, dash, version, symbol, [size]
+ (undef, undef, $version, $symbol, $size) = split;
+
+ # Remove colon separator from version field.
+ $version =~ s/:$//;
+
+ # Record base version. The [BASE] field was only added in Solaris 11,
+ # so simply use the first record instead.
+ if ($. == 1) {
+ $basever = $version;
+ next;
+ }
+
+ # Skip version declarations.
+ next unless defined ($symbol);
+
+ # Ignore version dependencies.
+ next if ($symbol =~ /\{.*\}/);
+
+ # Emit objects.
+ if (defined ($size)) {
+ # Strip parens from object size.
+ $size =~ s/\((\d+)\)/$1/;
+
+ $type{$symbol} = "OBJECT";
+ $version{$symbol} = $version;
+ $size{$symbol} = $size;
+ next;
+ }
+
+ if ($version eq $symbol or $version eq $basever) {
+ # Emit versions or symbols bound to base versions as objects.
+ $type{$symbol} = "OBJECT";
+ $version{$symbol} = $symbol;
+ $size{$symbol} = 0;
+ } else {
+ # Everything else without a size field is a function.
+ $type{$symbol} = "FUNC";
+ $version{$symbol} = $version;
+ }
+}
+close PVS or die "pvs error";
+
+# Only look at .dynsym table, like readelf in extract_symvers.
+open ELFDUMP, "/usr/ccs/bin/elfdump -s -N .dynsym $lib |" or die $!;
+while (<ELFDUMP>) {
+ chomp;
+
+ # Ignore empty lines.
+ next if (/^$/);
+
+ # Ignore object name header.
+ next if (/:$/);
+
+ # Ignore table header lines.
+ next if (/^Symbol Table Section:/);
+ next if (/index.*value.*size/);
+
+ # Split table.
+ (undef, undef, undef, $type, $bind, $oth, undef, $shndx, $name) = split;
+
+ # Error out for unknown input.
+ die "unknown input line:\n$_" unless defined($bind);
+
+ # Ignore local symbols.
+ next if ($bind eq "LOCL");
+ # Ignore hidden symbols.
+ next if ($oth eq "H");
+ # Ignore undefined symbols.
+ next if ($shndx eq "UNDEF");
+ # Error out for unhandled cases. _GLOBAL_OFFSET_TABLE_ is P (protected).
+ die "unhandled symbol:\n$_" if ($bind !~ /^(GLOB|WEAK)/ or $oth !~ /[DP]/);
+
+ # Adapt to readelf type naming convention.
+ $type = "OBJECT" if ($type eq "OBJT");
+
+ # Use correct symbol type.
+ $type{$name} = $type if ($type{$name} ne $type);
+}
+close ELFDUMP or die "elfdump error";
+
+foreach $symbol (keys %type) {
+ if ($type{$symbol} eq "FUNC") {
+ push @lines, "$type{$symbol}:$symbol\@\@$version{$symbol}\n";
+ } elsif ($type{$symbol} eq "OBJECT" and $size{$symbol} == 0) {
+ push @lines, "$type{$symbol}:$size{$symbol}:$version{$symbol}\n";
+ } else {
+ push @lines, "$type{$symbol}:$size{$symbol}:$symbol\@\@$version{$symbol}\n";
+ }
+}
+print sort @lines;
diff -r 019a7f0b8438 libstdc++-v3/testsuite/Makefile.am
--- a/libstdc++-v3/testsuite/Makefile.am Sat Nov 27 11:36:38 2010 +0100
+++ b/libstdc++-v3/testsuite/Makefile.am Sat Nov 27 11:43:07 2010 +0100
@@ -67,7 +67,7 @@
@mv site.tmp site.exp
-extract_symvers = $(glibcxx_srcdir)/scripts/extract_symvers
+extract_symvers = $(glibcxx_builddir)/scripts/extract_symvers
baseline_subdir := $(shell $(CXX) --print-multi-dir)
diff -r 019a7f0b8438 libstdc++-v3/testsuite/libstdc++-abi/abi.exp
--- a/libstdc++-v3/testsuite/libstdc++-abi/abi.exp Sat Nov 27 11:36:38 2010 +0100
+++ b/libstdc++-v3/testsuite/libstdc++-abi/abi.exp Sat Nov 27 11:43:07 2010 +0100
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@
send_log "Checking $lib against $baseline_file\n"
# Figure out what symbols are defined by the active build of the library.
-remote_exec "build" "$srcdir/../scripts/extract_symvers" \
+remote_exec "build" "$objdir/../scripts/extract_symvers" \
[list $lib "current_symbols.txt"]
# Build the abi_check program.
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University