This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3] Provide Solaris 2 libstdc++ baseline files
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: libstdc++ at gcc dot gnu dot org
- Date: Tue, 28 Sep 2010 19:48:45 +0200
- Subject: [v3] Provide Solaris 2 libstdc++ baseline files
[Please keep me on the Cc: since I'm not subscribed to libstdc++.]
As a followup to supporting symbol versioning on Solaris 2 with Sun ld
PATCH: Support Sun symbol versioning in libstdc++-v3
http://gcc.gnu.org/ml/gcc-patches/2010-02/msg01001.html
http://gcc.gnu.org/ml/gcc-patches/2010-06/msg03182.html
this patch provides the corresponding baseline files for Solaris 8 to
11, all of 32 and 64-bit SPARC and x86.
I'm not including the baseline_symbols.txt files themselves (which seems
pointless), but report on my finding while developing the exact layout
in config/abi/post.
* For 32-bit Solaris 8 and 9, the file is identical between SPARC and
x86, while 64-bit Solaris 8/9 SPARC needs a separate file.
* For 32-bit Solaris 10, there's again a common baseline, while there
are only two differences between the amd64 and sparcv9 files:
--- i386-pc-solaris2.10/amd64/baseline_symbols.txt 2010-06-28 16:27:34.393997700 +0200
+++ sparc-sun-solaris2.10/sparcv9/baseline_symbols.txt 2010-06-29 18:56:13.799641000 +0200
@@ -43 +43 @@
-FUNC:_ZN9__gnu_cxx12__atomic_addEPVii
+FUNC:_ZN9__gnu_cxx12__atomic_addEPVli
@@ -47 +47 @@
-FUNC:_ZN9__gnu_cxx18__exchange_and_addEPVii
+FUNC:_ZN9__gnu_cxx18__exchange_and_addEPVli
Demangled, this gives
-FUNC:__gnu_cxx::__atomic_add(int volatile*, int)
+FUNC:__gnu_cxx::__atomic_add(long volatile*, int)
In config/cpu/sparc/atomicty.h, I find the corresponding prototype:
__atomic_add(volatile _Atomic_word* __mem, int __val) throw ()
with _Atomic_word defined in config/cpu/sparc/atomic_word.h:
#ifdef __arch64__
typedef long _Atomic_word;
#else
typedef int _Atomic_word;
#endif
So there is a 32 vs. 64-bit difference which cannot be reconciled
without breaking the ABI.
* For Solaris 11, there's a strange difference: in both 32 and 64-bit
cases, I get
--- sparc-sun-solaris2.11/baseline_symbols.txt 2010-09-22 11:55:52.651907686 +0
200
+++ i386-pc-solaris2.11/baseline_symbols.txt 2010-09-22 11:55:52.604358688 +0
200
@@ -1235,6 +1235,7 @@
FUNC:_ZNSt12system_errorC1ESt10error_code
+FUNC:_ZNSt12system_errorC2ESt10error_code
Both functions demangle as
std::system_error::system_error(std::error_code); I've no idea why
there's an additional one on i386.
Based on that, I arrive at the structure documented in configure.host
below.
When I recently regtested the patch on i386-pc-solaris2.11 after some
time with both Sun ld and GNU ld, I noticed an additional complication:
while abi_check with GNU ld just noticed two compatible added symbols
and was fine with that
2 added symbols
0
_ZSt15_Fnv_hash_bytesPKvjj
std::_Fnv_hash_bytes(void const*, unsigned int, unsigned int)
version status: compatible
GLIBCXX_3.4.15
type: function
status: added
1
_ZSt11_Hash_bytesPKvjj
std::_Hash_bytes(void const*, unsigned int, unsigned int)
version status: compatible
GLIBCXX_3.4.15
type: function
status: added
=== libstdc++-v3 check-abi Summary ===
# of added symbols: 2
# of missing symbols: 0
# of incompatible symbols: 0
using: baseline_symbols.txt
PASS: libstdc++-abi/abi_check
abi_check failed with Sun ld:
2 added symbols
0
_ZSt15_Fnv_hash_bytesPKvjj
std::_Fnv_hash_bytes(void const*, unsigned int, unsigned int)
version status: incompatible
type: function
status: added
1
_ZSt11_Hash_bytesPKvjj
std::_Hash_bytes(void const*, unsigned int, unsigned int)
version status: incompatible
type: function
status: added
2 incompatible symbols
0
_ZSt15_Fnv_hash_bytesPKvjj
std::_Fnv_hash_bytes(void const*, unsigned int, unsigned int)
version status: incompatible
type: function
status: added
1
_ZSt11_Hash_bytesPKvjj
std::_Hash_bytes(void const*, unsigned int, unsigned int)
version status: incompatible
type: function
status: added
=== libstdc++-v3 check-abi Summary ===
# of added symbols: 2
# of missing symbols: 0
# of incompatible symbols: 2
using: baseline_symbols.txt
FAIL: libstdc++-abi/abi_check
I could trace this to the fact that unlike GNU ld the Sun linker doesn't
record the version names in the .dynsym table, so they don't show up in
the extract_symvers output and abi_check cannot detect the added symbols
as compatible. Unfortunately, the output of readelf --version-info
cannot be used to extract the necessary information since it is
unparsable and extremely low-level. Therefore I've decided to use the
Solaris native pvs tool which provides all the information I need and
optionally provides parsable output like this (from pvs -dsvo):
libstdc++.so - GLIBCXX_3.4: _ZNSt6locale5_Impl21_M_replace_categoriesEPKS0_i;
I've augmented extract_symvers to check for the availability of pvs and
use it if present. The output of the updated extract_symvers is
identical to that generated by readelf for GNU ld-produced libstdc++.so,
independent of the presence of <symbol>@@<version> in .dynsym, so this
works with both Sun ld and GNU ld.
There's a single difference in the output, though, which may be a bug in
the existing extract_symvers: with the pvs-based script, I find two
additional symbols:
+OBJECT:8:_ZSt11__once_call@@GLIBCXX_3.4.11
+OBJECT:8:_ZSt15__once_callable@@GLIBCXX_3.4.11
i.e.
+OBJECT:8:std::__once_call@@GLIBCXX_3.4.11
+OBJECT:8:std::__once_callable@@GLIBCXX_3.4.11
Both show up als type TLS in nm -D output and seem to be part of the
libstdc++.so ABI, so they should probably be included when using
readelf, too?
Before committing, I'd like to retest the whole thing on the whole range
of Solaris versions above, at least once also using GNU ld, to
regenerate the baseline files with the updated extract_symvers and the
two added symbols (and eventually the TLS symbols) included.
Unfortunately, Solaris/SPARC bootstrap is broken right now, but I hope
to have that fixed soon.
Ok for mainline after that testing has passed?
And what about updating the baselines in the future if new symbols are
added? I suppose I can do that myself without explicit approval?
Thanks.
Rainer
2010-07-03 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* scripts/extract_symvers: Use pvs if present.
* config/abi/post/solaris2.8/baseline_symbols.txt: New file.
* config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/amd64/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt: Likewise.
* config/abi/post/i386-pc-solaris2.11/amd64/baseline_symbols.txt:
Likewise.
* config/abi/post/i386-pc-solaris2.11/baseline_symbols.txt:
Likewise.
* config/abi/post/sparc-sun-solaris2.11/baseline_symbols.txt:
Likewise.
* config/abi/post/sparc-sun-solaris2.11/sparcv9/baseline_symbols.txt:
Likewise.
* configure.host (i?86-*-solaris2*): Remove.
(sparc*-*-solaris2*): Remove.
(*-*-solaris2.[89]): Use solaris2.8 baseline.
(*-*-solaris2.10): Use solaris2.10 baseline.
(i?86-*-solaris2.11): Use i386-pc-solaris2.11 baseline.
(sparc*-*-solaris2.11): Use sparc-sun-solaris2.11 baseline.
diff -r f5cac9b68735 libstdc++-v3/configure.host
--- a/libstdc++-v3/configure.host Wed Sep 22 11:55:52 2010 +0200
+++ b/libstdc++-v3/configure.host Sun Sep 26 00:44:22 2010 +0200
@@ -320,13 +320,19 @@
;;
esac
;;
- i?86-*-solaris2*)
- abi_baseline_pair=i386-solaris2
- ;;
powerpc*-*-darwin*)
port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
;;
- sparc*-*-solaris2*)
- abi_baseline_pair=sparc-solaris2
+ *-*-solaris2.[89])
+ abi_baseline_pair=solaris2.8
+ ;;
+ *-*-solaris2.10)
+ abi_baseline_pair=solaris2.10
+ ;;
+ i?86-*-solaris2.11)
+ abi_baseline_pair=i386-pc-solaris2.11
+ ;;
+ sparc*-*-solaris2.11)
+ abi_baseline_pair=sparc-sun-solaris2.11
;;
esac
diff -r f5cac9b68735 libstdc++-v3/scripts/extract_symvers
--- a/libstdc++-v3/scripts/extract_symvers Wed Sep 22 11:55:52 2010 +0200
+++ b/libstdc++-v3/scripts/extract_symvers Sun Sep 26 00:44:22 2010 +0200
@@ -26,6 +26,14 @@
lib=$1
output=$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.
+if type pvs 2>&1 | grep 'not found' > /dev/null; then
+ :
+else
+ pvs="pvs -dsvo"
+fi
+
# 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.
@@ -42,15 +50,51 @@
tmp=extract.$$
-${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")
- printf "%s:%s:%s\n", $4, $3, $8;
- }' | sort | uniq > $tmp 2>&1
-# else printf "Huh? What is %s?\n", $8;
+# Prefer pvs if found.
+if [ -n ${pvs} ]; then
+ ${pvs} ${lib} | \
+ awk '# Remove colon separator from version field, trailing semicolon.
+ {
+ sub (/:$/, "", $3);
+ sub (/;$/, "");
+ }
+ # Record base version.
+ $4 ~ /\[BASE\]/ {
+ basever = $3;
+ next;
+ }
+ # Ignore version dependencies.
+ $4 ~ /\{.*\}/ {
+ next;
+ }
+ NF == 4 {
+ if ($3 == $4 || $3 == basever)
+ # Emit versions or symbols bound to base versions as objects.
+ printf "OBJECT:0:%s\n", $4;
+ else
+ # Everything else without a size field is a function.
+ printf "FUNC:%s@@%s\n", $4, $3;
+ next;
+ }
+ # Emit objects.
+ NF == 5 {
+ # Strip parens from object size.
+ sub (/^\(/, "", $5);
+ sub (/\)$/, "", $5);
+ printf "OBJECT:%s:%s@@%s\n", $5, $4, $3;
+ next;
+ }' | sort | uniq > $tmp 2>&1
+else
+ ${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")
+ printf "%s:%s:%s\n", $4, $3, $8;
+ }' | sort | uniq > $tmp 2>&1
+# else printf "Huh? What is %s?\n", $8;
+fi
# I think we'll be doing some more with this file, but for now, dump.
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University