]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/scripts/extract_symvers.in
Update Copyright years for files modified in 2011 and/or 2012.
[thirdparty/gcc.git] / libstdc++-v3 / scripts / extract_symvers.in
CommitLineData
7433ab8f 1#!/bin/sh
2
71e45bc2 3# Copyright (C) 2002, 2003, 2009, 2010, 2011 Free Software Foundation, Inc.
7433ab8f 4#
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
6bc9506f 8# Free Software Foundation; either version 3, or (at your option)
7433ab8f 9# any later version.
10#
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.
15#
16# You should have received a copy of the GNU General Public License along
6bc9506f 17# with this library; see the file COPYING3. If not see
18# <http://www.gnu.org/licenses/>.
7433ab8f 19
20
21if test ${#} -lt 2 || test $1 = '--help'; then
22 echo "Usage: extract_symvers shared_lib output_file" 1>&2
23 exit 1
24fi
25
26lib=$1
27output=$2
28
7433ab8f 29# This avoids weird sorting problems later.
4cce0a93 30LC_ALL=C
31export LC_ALL
32LANG=C
33export LANG
7433ab8f 34
35tmp=extract.$$
36
562ffb7d 37case `uname -s` in
38SunOS)
04f8b8f3 39 # Ensure that output on Solaris 2 matches readelf below without requiring
40 # GNU binutils to be installed. This requires a combination of pvs and
41 # elfdump, which is easier handled in a perl script.
42 perl @glibcxx_srcdir@/scripts/extract_symvers.pl ${lib} > $tmp 2>&1
562ffb7d 43 ;;
44*)
45 # GNU binutils, somewhere after version 2.11.2, requires -W/--wide to
46 # avoid default line truncation. -W is not supported and truncation did
47 # not occur by default before that point.
48 readelf="readelf --symbols"
49 if readelf --help | grep -- --wide > /dev/null; then
50 readelf="$readelf --wide"
51 fi
52 ${readelf} ${lib} |\
53 sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
54 egrep -v ' (LOCAL|UND) ' |\
738b9e08 55 sed -e 's/ <processor specific>: / <processor_specific>:_/g' |\
56 sed -e 's/ <OS specific>: / <OS_specific>:_/g' |\
57 sed -e 's/ <unknown>: / <unknown>:_/g' |\
562ffb7d 58 awk '{ if ($4 == "FUNC" || $4 == "NOTYPE")
59 printf "%s:%s\n", $4, $8;
60 else if ($4 == "OBJECT" || $4 == "TLS")
61 printf "%s:%s:%s\n", $4, $3, $8;
62 }' | sort | uniq > $tmp 2>&1
63# else printf "Huh? What is %s?\n", $8;
64 ;;
65esac
7433ab8f 66
67# I think we'll be doing some more with this file, but for now, dump.
68mv $tmp $output
69
70exit 0