[v3] Handle NOTY in extract_symvers.pl

Message ID yddmxjra1n9.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth April 15, 2011, 5:02 p.m.
While testing the close-to-final version of my COMDAT-group-with-Sun as

	[build, c++, lto] Support COMDAT group with Sun as (PR target/40483)

which only awaits the release of a linker with the required fixes, I
noticed that extract_symvers.pl doesn't handly NOTY/NOTYPE entries, but
chokes instead, whereas the readelf based version handles them just
fine.  Although the final patch won't create them anymore, I'm
installing the following patch that makes the script more robust.  It
was tested while putting the finishing touches on the as-comdat patch.

Installed on mainline.


2011-04-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* scripts/extract_symvers.pl: Handle NOTY.


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
@@ -1,6 +1,6 @@ 
 #!/usr/bin/perl -w
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 2010, 2011 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
@@ -108,6 +108,7 @@  while (<ELFDUMP>) {
     die "unhandled symbol:\n$_" if ($bind !~ /^(GLOB|WEAK)/ or $oth !~ /[DP]/);
     # Adapt to readelf type naming convention.
+    $type = "NOTYPE" if ($type eq "NOTY");
     $type = "OBJECT" if ($type eq "OBJT");
     # Use correct symbol type.
@@ -116,7 +117,7 @@  while (<ELFDUMP>) {
 close ELFDUMP or die "elfdump error";
 foreach $symbol (keys %type) {
-    if ($type{$symbol} eq "FUNC") {
+    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) {
 	push @lines, "$type{$symbol}:$size{$symbol}:$version{$symbol}\n";