Patchwork Make libstdc++'s abi_check more robust against readelf output format

login
register
mail settings
Submitter Simon Baldwin
Date May 20, 2011, 3:05 p.m.
Message ID <20110520150530.1A9281DA1DE@topo.tor.corp.google.com>
Download mbox | patch
Permalink /patch/96618/
State New
Headers show

Comments

Simon Baldwin - May 20, 2011, 3:05 p.m.
Make libstdc++'s abi_check more robust against readelf output format.

libstdc++-abi/abi_check in the libstdc++-v3 testsuite relies on a fixed
number of space separated fields in readelf output.  However, the field
count for readelf output can vary where the library contains OS or processor
specific bindings, or other unknown bindings.

This patch replaces the strings that readelf outputs for such bindings
with alternative strings that use underscores in place of space.  It
preserves the count of fields for such cases, and allows the awk statement
that follows to find the desired field correctly with $n.

OK for trunk?

libstdc++-v3/ChangeLog:
2011-05-20  Simon Baldwin  <simonb@google.com>

	* scripts/extract_symvers.in: Handle processor/OS specific or
	unknown symbol binding strings from readelf.
Ollie Wild - May 20, 2011, 3:10 p.m.
Ok, for google/integration.  Please integrate to google/main and
google/gcc-4_6 as well.

Ollie

On Fri, May 20, 2011 at 10:05 AM, Simon Baldwin <simonb@google.com> wrote:
>
> Make libstdc++'s abi_check more robust against readelf output format.
>
> libstdc++-abi/abi_check in the libstdc++-v3 testsuite relies on a fixed
> number of space separated fields in readelf output.  However, the field
> count for readelf output can vary where the library contains OS or processor
> specific bindings, or other unknown bindings.
>
> This patch replaces the strings that readelf outputs for such bindings
> with alternative strings that use underscores in place of space.  It
> preserves the count of fields for such cases, and allows the awk statement
> that follows to find the desired field correctly with $n.
>
> OK for trunk?
>
> libstdc++-v3/ChangeLog:
> 2011-05-20  Simon Baldwin  <simonb@google.com>
>
>        * scripts/extract_symvers.in: Handle processor/OS specific or
>        unknown symbol binding strings from readelf.
>
>
> Index: libstdc++-v3/scripts/extract_symvers.in
> ===================================================================
> --- libstdc++-v3/scripts/extract_symvers.in     (revision 173951)
> +++ libstdc++-v3/scripts/extract_symvers.in     (working copy)
> @@ -52,6 +52,9 @@ SunOS)
>   ${readelf} ${lib} |\
>   sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
>   egrep -v ' (LOCAL|UND) ' |\
> +  sed -e 's/ <processor specific>: / <processor_specific>:_/g' |\
> +  sed -e 's/ <OS specific>: / <OS_specific>:_/g' |\
> +  sed -e 's/ <unknown>: / <unknown>:_/g' |\
>   awk '{ if ($4 == "FUNC" || $4 == "NOTYPE")
>            printf "%s:%s\n", $4, $8;
>          else if ($4 == "OBJECT" || $4 == "TLS")
Paul Pluzhnikov - May 20, 2011, 4:19 p.m.
On Fri, May 20, 2011 at 8:10 AM, Ollie Wild <aaw@google.com> wrote:
> Ok, for google/integration.  Please integrate to google/main and
> google/gcc-4_6 as well.

Done: r173959, r173960, r173961.

Thanks,

Patch

Index: libstdc++-v3/scripts/extract_symvers.in
===================================================================
--- libstdc++-v3/scripts/extract_symvers.in	(revision 173951)
+++ libstdc++-v3/scripts/extract_symvers.in	(working copy)
@@ -52,6 +52,9 @@  SunOS)
   ${readelf} ${lib} |\
   sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
   egrep -v ' (LOCAL|UND) ' |\
+  sed -e 's/ <processor specific>: / <processor_specific>:_/g' |\
+  sed -e 's/ <OS specific>: / <OS_specific>:_/g' |\
+  sed -e 's/ <unknown>: / <unknown>:_/g' |\
   awk '{ if ($4 == "FUNC" || $4 == "NOTYPE")
            printf "%s:%s\n", $4, $8;
          else if ($4 == "OBJECT" || $4 == "TLS")