This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [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: Fri, 01 Oct 2010 13:54:12 +0200
- Subject: Re: [v3] Provide Solaris 2 libstdc++ baseline files
- References: <ydd4od9vjwi.fsf@manam.CeBiTec.Uni-Bielefeld.DE> <alpine.DEB.2.00.1009301953450.14823@laptop-mg.saclay.inria.fr> <yddiq1nawie.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> Marc Glisse <marc.glisse@inria.fr> writes:
>
>> On Tue, 28 Sep 2010, Rainer Orth wrote:
>>
>>> * 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.
>>
>> Generating two versions of the constructor is what g++ usually does, as can
>> be seen on any trivial example:
>> struct A{A();}; A::A(){}
>>
>> (although now on several platforms the 2 names will actually point to the
>> same address)
>
> Indeed, confirmed by compiling that example on both Solaris 11/SPARC and x86.
>
>> I find it more surprising that one of them is missing on sparc. And since
>> you get this with both Sun and GNU linkers, it doesn't seem like it can
>> have removed the unused one.
>
> Right, there was something really fishy going on: the slightly older
> baselines I've used so far (created with the current extract_symvers
> script) show this anomaly, while the current ones (created with
> pvs-based extract_symvers) do not ;-) Oh well, I'll re-compare the
> baselines before checkin to make sure the remaining differences seem
> sane.
I've now found what was going on: the two separate instances only occur
with COMDAT group support. At present, this is only available with Sun
ld on Solaris 11 and gas. I've got a patch ready to support the same
with Sun as, but that's on hold waiting for a final fix to Sun as be
provided.
Final testing found one issue, though: on Solaris 11/x86 with Sun as,
the 64-bit libstdc++.so lacks _GLOBAL_OFFSET_TABLE_ bound to the shared
object's base version. All is fine if using gas, and Solaris 11/SPARC
isn't affected as well. I'll raise a bug with the Sun linker
maintainers for that.
> Based on Paolo's description, I'll probably go for a slightly simpler
> scheme to store the Solaris 2 baselines:
>
> solaris2.8
> solaris2.8/sparcv9
> solaris2.10
> solaris2.10/amd64
> solaris2.10/sparcv9
>
> The solaris2.8 directories will be used for Solaris 8 and 9, both SPARC
> and x86, with 64-bit SPARC included as well (AMD64 support only appeared
> in Solaris 10).
>
> I need a separate solaris2.10 directory for Solaris 10 and 11 since
> between Solaris 9 and 10, the ISO C99 math functions were added to libm
> and so the replacement functions don't any longer appear in
> libstdc++.so.
>
> Otherwise every other change seems to be an addition as expected.
I'll go with that scheme, tested across the whole matrix: Solaris 8 to
11, both SPARC and x86, both 32 and 64-bit.
At the moment, all invocations of the 64-bit SPARC abi_check fail with
SIGFPE (division by zero) in the depths of some hashtable code. Given
that current_symbols.txt and baseline_symbols.txt are identical, I'll
attribute this to the fact that the Solaris/SPARC port is in a terrible
state right now with hundreds of testsuite failures.
Actual testing found two other issues:
* In extract_symvers, I need to use nawk instead of awk. The latter
doesn't support sub(). Additionally, the [BASE] field in the the pvs
output was only added in Solaris 11, so we need to determine the base
version in a different way.
* The testsuite/Makefile.am (new-abi-baseline) lacked a /
- -@$(mkinstalldirs) ${baseline_dir}${baseline_subdir}
+ -@$(mkinstalldirs) ${baseline_dir}/${baseline_subdir}
Here's the final patch I've checked in, apart from the actual baselines.
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.
* configure.host (i?86-*-solaris2*): Remove.
(sparc*-*-solaris2*): Remove.
(*-*-solaris2.[89]): Use solaris2.8 baseline.
(*-*-solaris2.1[0-9]): Use solaris2.10 baseline.
* testsuite/Makefile.am (new-abi-baseline): Add missing /.
* testsuite/Makefile.in: Regenerate.
diff -r d3581e5ebf43 libstdc++-v3/configure.host
--- a/libstdc++-v3/configure.host Wed Sep 29 12:39:54 2010 +0200
+++ b/libstdc++-v3/configure.host Fri Oct 01 13:39:00 2010 +0200
@@ -320,13 +320,13 @@
;;
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.1[0-9])
+ abi_baseline_pair=solaris2.10
;;
esac
diff -r d3581e5ebf43 libstdc++-v3/scripts/extract_symvers
--- a/libstdc++-v3/scripts/extract_symvers Wed Sep 29 12:39:54 2010 +0200
+++ b/libstdc++-v3/scripts/extract_symvers Fri Oct 01 13:39:00 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,53 @@
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. Need to use nawk on Solaris 2 since Solaris 8/9 awk
+# (oawk) cannot handle sub.
+if [ -n ${pvs} ]; then
+ ${pvs} ${lib} | \
+ nawk '# Remove colon separator from version field, trailing semicolon.
+ {
+ sub (/:$/, "", $3);
+ sub (/;$/, "");
+ }
+ # Record base version. The [BASE] field was only added in Solaris 11,
+ # so simply use the first record instead.
+ NR == 1 {
+ 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.
diff -r d3581e5ebf43 libstdc++-v3/testsuite/Makefile.am
--- a/libstdc++-v3/testsuite/Makefile.am Wed Sep 29 12:39:54 2010 +0200
+++ b/libstdc++-v3/testsuite/Makefile.am Fri Oct 01 13:39:00 2010 +0200
@@ -80,7 +80,7 @@
fi; true)
new-abi-baseline:
- -@$(mkinstalldirs) ${baseline_dir}${baseline_subdir}
+ -@$(mkinstalldirs) ${baseline_dir}/${baseline_subdir}
-@(output=${baseline_dir}/${baseline_subdir}/baseline_symbols.txt; \
if test -f $${output}; then \
output=$${output}.new; \
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University