Patchwork [v3] Filter out basever symbols on Solaris

login
register
mail settings
Submitter Rainer Orth
Date Feb. 26, 2013, 11:48 a.m.
Message ID <ydd38wj2t4l.fsf@lokon.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/223212/
State New
Headers show

Comments

Rainer Orth - Feb. 26, 2013, 11:48 a.m.
Currently, the Solaris baselines include several symbols that are not
libstdc++-specific, but are (or should be) present in every Solaris
shared object (like _DYNAMIC, _GLOBAL_OFFSET_TABLE_, and several
others).  Unfortunately, under some circumstances (combination of
assembler and linker used) they may be missing, leading to spurious
abi_check failures that are completely unrelated to the libstdc++.so.6
ABI.  To avoid this, the following patch skips them in
extract_symvers.{pl, in} and drops them from the baselines.

Bootstrapped without regressions on i386-pc-solaris2.{9,10,11},
sparc-sun-solaris2.{9,10,11}, and x86_64-unknown-linux-gnu, fixes the
64-bit abi_check failures on Solaris 10 and 11/x86.

To make sure that the fix to the readelf version is correct, I've run a
version of extract_symvers with the SunOS case removed in a
i386-pc-solaris2.11 build with gas and gld and verified that the output
is identical.

Ok for mainline?

	Rainer


2013-02-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* scripts/extract_symvers.pl: Omit symbols bound to base
	versions.
	* scripts/extract_symvers.in: Likewise.
	* config/abi/post/solaris2.9/baseline_symbols.txt: Regenerate.
	* config/abi/post/solaris2.9/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.
Andreas Schwab - Feb. 26, 2013, 11:57 a.m.
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> diff --git a/libstdc++-v3/scripts/extract_symvers.in b/libstdc++-v3/scripts/extract_symvers.in
> --- a/libstdc++-v3/scripts/extract_symvers.in
> +++ b/libstdc++-v3/scripts/extract_symvers.in
> @@ -49,9 +49,12 @@ SunOS)
>    if readelf --help | grep -- --wide > /dev/null; then
>      readelf="$readelf --wide"
>    fi
> +  # Omit _DYNAMIC etc. for consistency with extract_symvers.pl, only
> +  # present on Solaris.
>    ${readelf} ${lib} |\
>    sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
>    egrep -v ' (LOCAL|UND) ' |\
> +  egrep -v '(_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_end|_etext)$' |\

Shouldn't the regexp also be anchored (with a space) at the beginning?

Andreas.
Rainer Orth - Feb. 27, 2013, 10:16 a.m.
Andreas Schwab <schwab@suse.de> writes:

> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
>> diff --git a/libstdc++-v3/scripts/extract_symvers.in b/libstdc++-v3/scripts/extract_symvers.in
>> --- a/libstdc++-v3/scripts/extract_symvers.in
>> +++ b/libstdc++-v3/scripts/extract_symvers.in
>> @@ -49,9 +49,12 @@ SunOS)
>>    if readelf --help | grep -- --wide > /dev/null; then
>>      readelf="$readelf --wide"
>>    fi
>> +  # Omit _DYNAMIC etc. for consistency with extract_symvers.pl, only
>> +  # present on Solaris.
>>    ${readelf} ${lib} |\
>>    sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
>>    egrep -v ' (LOCAL|UND) ' |\
>> +  egrep -v '(_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_end|_etext)$' |\
>
> Shouldn't the regexp also be anchored (with a space) at the beginning?

This works indeed.  I was a bit worried if a space was guaranteed at
that position, rather than general whitespace.  Consider the patch
amended accordingly.

	Rainer
Rainer Orth - March 6, 2013, 11:08 a.m.
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> Andreas Schwab <schwab@suse.de> writes:
>
>> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>>
>>> diff --git a/libstdc++-v3/scripts/extract_symvers.in b/libstdc++-v3/scripts/extract_symvers.in
>>> --- a/libstdc++-v3/scripts/extract_symvers.in
>>> +++ b/libstdc++-v3/scripts/extract_symvers.in
>>> @@ -49,9 +49,12 @@ SunOS)
>>>    if readelf --help | grep -- --wide > /dev/null; then
>>>      readelf="$readelf --wide"
>>>    fi
>>> +  # Omit _DYNAMIC etc. for consistency with extract_symvers.pl, only
>>> +  # present on Solaris.
>>>    ${readelf} ${lib} |\
>>>    sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
>>>    egrep -v ' (LOCAL|UND) ' |\
>>> +  egrep -v '(_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_end|_etext)$' |\
>>
>> Shouldn't the regexp also be anchored (with a space) at the beginning?
>
> This works indeed.  I was a bit worried if a space was guaranteed at
> that position, rather than general whitespace.  Consider the patch
> amended accordingly.

Any word on this patch?  Is has remained unreviewed for a week.

Thanks.
        Rainer
Paolo Carlini - March 6, 2013, 1:11 p.m.
Hi,

On 03/06/2013 12:08 PM, Rainer Orth wrote:
> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
>> Andreas Schwab <schwab@suse.de> writes:
>>
>>> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>>>
>>>> diff --git a/libstdc++-v3/scripts/extract_symvers.in b/libstdc++-v3/scripts/extract_symvers.in
>>>> --- a/libstdc++-v3/scripts/extract_symvers.in
>>>> +++ b/libstdc++-v3/scripts/extract_symvers.in
>>>> @@ -49,9 +49,12 @@ SunOS)
>>>>     if readelf --help | grep -- --wide > /dev/null; then
>>>>       readelf="$readelf --wide"
>>>>     fi
>>>> +  # Omit _DYNAMIC etc. for consistency with extract_symvers.pl, only
>>>> +  # present on Solaris.
>>>>     ${readelf} ${lib} |\
>>>>     sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
>>>>     egrep -v ' (LOCAL|UND) ' |\
>>>> +  egrep -v '(_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_end|_etext)$' |\
>>> Shouldn't the regexp also be anchored (with a space) at the beginning?
>> This works indeed.  I was a bit worried if a space was guaranteed at
>> that position, rather than general whitespace.  Consider the patch
>> amended accordingly.
> Any word on this patch?  Is has remained unreviewed for a week.
Sorry about the delay. If you can convince me that the change is 
guaranteed to affect only Solaris, then you will not need a specific 
approval.

Paolo.
Rainer Orth - March 6, 2013, 1:25 p.m.
Hi Paolo,

>>>> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>>>>
>>>>> diff --git a/libstdc++-v3/scripts/extract_symvers.in b/libstdc++-v3/scripts/extract_symvers.in
>>>>> --- a/libstdc++-v3/scripts/extract_symvers.in
>>>>> +++ b/libstdc++-v3/scripts/extract_symvers.in
>>>>> @@ -49,9 +49,12 @@ SunOS)
>>>>>     if readelf --help | grep -- --wide > /dev/null; then
>>>>>       readelf="$readelf --wide"
>>>>>     fi
>>>>> +  # Omit _DYNAMIC etc. for consistency with extract_symvers.pl, only
>>>>> +  # present on Solaris.
>>>>>     ${readelf} ${lib} |\
>>>>>     sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
>>>>>     egrep -v ' (LOCAL|UND) ' |\
>>>>> +  egrep -v '(_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_end|_etext)$' |\
>>>> Shouldn't the regexp also be anchored (with a space) at the beginning?
>>> This works indeed.  I was a bit worried if a space was guaranteed at
>>> that position, rather than general whitespace.  Consider the patch
>>> amended accordingly.
>> Any word on this patch?  Is has remained unreviewed for a week.
> Sorry about the delay. If you can convince me that the change is guaranteed
> to affect only Solaris, then you will not need a specific approval.

Unless those symbols were explicitly exported in config/abi/pre/gnu*.ver
(which they are not, otherwise the x86_64-unknown-linux-bootstrap would
have shown a failure), they couldn't make it into libstdc++.so.  They
only occur on Solaris because gld explicitly adds them itself.

	Rainer
Paolo Carlini - March 6, 2013, 1:27 p.m.
On 03/06/2013 02:25 PM, Rainer Orth wrote:
> Unless those symbols were explicitly exported in config/abi/pre/gnu*.ver
> (which they are not, otherwise the x86_64-unknown-linux-bootstrap would
> have shown a failure), they couldn't make it into libstdc++.so.  They
> only occur on Solaris because gld explicitly adds them itself.
Ok then. In fact, I noticed only now that you already managed to boot & 
test on x86_64-linux too.

Thanks,
Paolo.

Patch

# HG changeset patch
# Parent ba2042b7917dbcad588329f47c3cc0b47d6e7788
Filter out basever symbols on Solaris

diff --git a/libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt b/libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt
@@ -2485,12 +2485,6 @@  OBJECT:0:GLIBCXX_3.4.6
 OBJECT:0:GLIBCXX_3.4.7
 OBJECT:0:GLIBCXX_3.4.8
 OBJECT:0:GLIBCXX_3.4.9
-OBJECT:0:_DYNAMIC
-OBJECT:0:_GLOBAL_OFFSET_TABLE_
-OBJECT:0:_PROCEDURE_LINKAGE_TABLE_
-OBJECT:0:_edata
-OBJECT:0:_end
-OBJECT:0:_etext
 OBJECT:104:_ZTVSt10moneypunctIcLb0EE@@GLIBCXX_3.4
 OBJECT:104:_ZTVSt10moneypunctIcLb1EE@@GLIBCXX_3.4
 OBJECT:104:_ZTVSt10moneypunctIwLb0EE@@GLIBCXX_3.4
diff --git a/libstdc++-v3/config/abi/post/solaris2.10/baseline_symbols.txt b/libstdc++-v3/config/abi/post/solaris2.10/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/solaris2.10/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/solaris2.10/baseline_symbols.txt
@@ -2485,12 +2485,6 @@  OBJECT:0:GLIBCXX_3.4.6
 OBJECT:0:GLIBCXX_3.4.7
 OBJECT:0:GLIBCXX_3.4.8
 OBJECT:0:GLIBCXX_3.4.9
-OBJECT:0:_DYNAMIC
-OBJECT:0:_GLOBAL_OFFSET_TABLE_
-OBJECT:0:_PROCEDURE_LINKAGE_TABLE_
-OBJECT:0:_edata
-OBJECT:0:_end
-OBJECT:0:_etext
 OBJECT:1028:_ZNSt3tr18__detail12__prime_listE@@GLIBCXX_3.4.10
 OBJECT:1028:_ZNSt8__detail12__prime_listE@@GLIBCXX_3.4.10
 OBJECT:12:_ZTIN10__cxxabiv116__enum_type_infoE@@CXXABI_1.3
diff --git a/libstdc++-v3/config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt b/libstdc++-v3/config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt
@@ -2485,12 +2485,6 @@  OBJECT:0:GLIBCXX_3.4.6
 OBJECT:0:GLIBCXX_3.4.7
 OBJECT:0:GLIBCXX_3.4.8
 OBJECT:0:GLIBCXX_3.4.9
-OBJECT:0:_DYNAMIC
-OBJECT:0:_GLOBAL_OFFSET_TABLE_
-OBJECT:0:_PROCEDURE_LINKAGE_TABLE_
-OBJECT:0:_edata
-OBJECT:0:_end
-OBJECT:0:_etext
 OBJECT:104:_ZTVSt10moneypunctIcLb0EE@@GLIBCXX_3.4
 OBJECT:104:_ZTVSt10moneypunctIcLb1EE@@GLIBCXX_3.4
 OBJECT:104:_ZTVSt10moneypunctIwLb0EE@@GLIBCXX_3.4
diff --git a/libstdc++-v3/config/abi/post/solaris2.9/baseline_symbols.txt b/libstdc++-v3/config/abi/post/solaris2.9/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/solaris2.9/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/solaris2.9/baseline_symbols.txt
@@ -2499,12 +2499,6 @@  OBJECT:0:GLIBCXX_3.4.6
 OBJECT:0:GLIBCXX_3.4.7
 OBJECT:0:GLIBCXX_3.4.8
 OBJECT:0:GLIBCXX_3.4.9
-OBJECT:0:_DYNAMIC
-OBJECT:0:_GLOBAL_OFFSET_TABLE_
-OBJECT:0:_PROCEDURE_LINKAGE_TABLE_
-OBJECT:0:_edata
-OBJECT:0:_end
-OBJECT:0:_etext
 OBJECT:1028:_ZNSt3tr18__detail12__prime_listE@@GLIBCXX_3.4.10
 OBJECT:1028:_ZNSt8__detail12__prime_listE@@GLIBCXX_3.4.10
 OBJECT:12:_ZTIN10__cxxabiv116__enum_type_infoE@@CXXABI_1.3
diff --git a/libstdc++-v3/config/abi/post/solaris2.9/sparcv9/baseline_symbols.txt b/libstdc++-v3/config/abi/post/solaris2.9/sparcv9/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/solaris2.9/sparcv9/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/solaris2.9/sparcv9/baseline_symbols.txt
@@ -2499,12 +2499,6 @@  OBJECT:0:GLIBCXX_3.4.6
 OBJECT:0:GLIBCXX_3.4.7
 OBJECT:0:GLIBCXX_3.4.8
 OBJECT:0:GLIBCXX_3.4.9
-OBJECT:0:_DYNAMIC
-OBJECT:0:_GLOBAL_OFFSET_TABLE_
-OBJECT:0:_PROCEDURE_LINKAGE_TABLE_
-OBJECT:0:_edata
-OBJECT:0:_end
-OBJECT:0:_etext
 OBJECT:104:_ZTVSt10moneypunctIcLb0EE@@GLIBCXX_3.4
 OBJECT:104:_ZTVSt10moneypunctIcLb1EE@@GLIBCXX_3.4
 OBJECT:104:_ZTVSt10moneypunctIwLb0EE@@GLIBCXX_3.4
diff --git a/libstdc++-v3/scripts/extract_symvers.in b/libstdc++-v3/scripts/extract_symvers.in
--- a/libstdc++-v3/scripts/extract_symvers.in
+++ b/libstdc++-v3/scripts/extract_symvers.in
@@ -49,9 +49,12 @@  SunOS)
   if readelf --help | grep -- --wide > /dev/null; then
     readelf="$readelf --wide"
   fi
+  # Omit _DYNAMIC etc. for consistency with extract_symvers.pl, only
+  # present on Solaris.
   ${readelf} ${lib} |\
   sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
   egrep -v ' (LOCAL|UND) ' |\
+  egrep -v '(_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_end|_etext)$' |\
   sed -e 's/ <processor specific>: / <processor_specific>:_/g' |\
   sed -e 's/ <OS specific>: / <OS_specific>:_/g' |\
   sed -e 's/ <unknown>: / <unknown>:_/g' |\
diff --git a/libstdc++-v3/scripts/extract_symvers.pl b/libstdc++-v3/scripts/extract_symvers.pl
--- a/libstdc++-v3/scripts/extract_symvers.pl
+++ b/libstdc++-v3/scripts/extract_symvers.pl
@@ -67,7 +67,11 @@  while (<PVS>) {
     if ($version eq $symbol or $version eq $basever) {
 	# Emit versions or symbols bound to base versions as objects.
 	$type{$symbol} = "OBJECT";
-	$version{$symbol} = $symbol;
+	if ($version eq $basever) {
+	    $version{$symbol} = $version;
+	} else {
+	    $version{$symbol} = $symbol;
+	}
 	$size{$symbol} = 0;
     } else {
 	# Everything else without a size field is a function.
@@ -120,6 +124,10 @@  foreach $symbol (keys %type) {
     if ($type{$symbol} eq "FUNC" || $type{$symbol} eq "NOTYPE") {
 	push @lines, "$type{$symbol}:$symbol\@\@$version{$symbol}\n";
     } elsif ($type{$symbol} eq "OBJECT" and $size{$symbol} == 0) {
+	# Omit symbols bound to base version; details can differ depending
+	# on the toolchain used.
+	next if $version{$symbol} eq $basever;
+
 	push @lines, "$type{$symbol}:$size{$symbol}:$version{$symbol}\n";
     } else {
 	push @lines, "$type{$symbol}:$size{$symbol}:$symbol\@\@$version{$symbol}\n";