Fix missing libc-internal.h include.
[glibc.git] / scripts / rpm2dynsym.sh
blobce3fc4030a04f7f66367f62f00bd12db0be33b88
1 #!/bin/sh
3 # This script takes rpm package files, finds *.so.N files in them,
4 # and runs objdump --dynamic-syms on them. The arguments are rpm file
5 # names. For each rpm, it creates an output file with the name
6 # "NAME-VERSION-RELEASE.ARCH.dynsym", the variable parts being extracted
7 # from the rpm's headers (not its file name). Each file contains the
8 # collected objdump output for all the *.so.N files in the corresponding rpm.
9 # This can be processed with abilist.awk or sent to someone who will do that.
10 # This does not do a lot of error-checking, so you should always watch stderr
11 # and sanity-check the resulting output files.
13 RPM=${RPM:-rpm}
14 RPM2CPIO=${RPM2CPIO:-rpm2cpio}
15 CPIO=${CPIO:-cpio}
16 OBJDUMP=${OBJDUMP:-objdump}
18 unpackdir=/tmp/rpm2dynsym$$
19 trap 'rm -rf $unpackdir' 0 1 2 15
21 for rpm; do
22 name=`$RPM -qp $rpm --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n'`
23 mkdir $unpackdir || exit
24 $RPM2CPIO "$rpm" | {
25 cd $unpackdir
26 $CPIO -i -d --no-absolute-filenames -uv '*.so.*' '*.so' 2>&1 |
27 while read file b; do
28 test x"$b" = x || break
29 case "$file" in
30 *.so.[0-9]*) $OBJDUMP --dynamic-syms $file ;;
31 esac
32 done
33 } > $name.dynsym
34 echo wrote $name.dynsym for $rpm
35 rm -rf $unpackdir
36 done