3 # Copyright (C) 2002-2003, 2007, 2009-2012 Free Software Foundation, Inc.
5 # This file is part of the GNU ISO C++ Library. This library is free
6 # software; you can redistribute it and/or modify it under the
7 # terms of the GNU General Public License as published by the
8 # Free Software Foundation; either version 3, or (at your option)
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with this library. If not, see <http://www.gnu.org/licenses/>.
19 # As a special exception, you may use this file as part of a free software
20 # library without restriction. Specifically, if other files instantiate
21 # templates or use macros or inline functions from this file, or you compile
22 # this file and link it with other files to produce an executable, this
23 # file does not by itself cause the resulting executable to be covered by
24 # the GNU General Public License. This exception does not however
25 # invalidate any other reasons why the executable file might be covered by
26 # the GNU General Public License.
29 if test ${#} -lt 2 || test $1 = '--help'; then
30 echo "Usage: extract_symvers shared_lib output_file" 1>&2
37 # GNU binutils, somewhere after version 2.11.2, requires -W/--wide to avoid
38 # default line truncation. -W is not supported and truncation did not occur
39 # by default before that point.
40 readelf="readelf --symbols"
41 if readelf --help | grep -- --wide > /dev/null; then
42 readelf="$readelf --wide"
45 # This avoids weird sorting problems later.
53 ${readelf} ${lib} | sed '/\.dynsym/,/^$/p;d' | egrep -v ' (LOCAL|UND) ' |\
54 awk '{ if ($4 == "FUNC" || $4 == "NOTYPE")
55 printf "%s:%s\n", $4, $8;
56 else if ($4 == "OBJECT")
57 printf "%s:%s:%s\n", $4, $3, $8;
58 }' | sort | uniq > $tmp 2>&1
59 # else printf "Huh? What is %s?\n", $8;
62 # I think we'll be doing some more with this file, but for now, dump.