diff options
Diffstat (limited to 'tools/apbuild/buildlist.i686')
-rwxr-xr-x | tools/apbuild/buildlist.i686 | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/apbuild/buildlist.i686 b/tools/apbuild/buildlist.i686 new file mode 100755 index 00000000..d40f60d4 --- /dev/null +++ b/tools/apbuild/buildlist.i686 @@ -0,0 +1,51 @@ +#!/bin/bash + +# get a list of all symbols - YOU MUST RUN THIS SCRIPT WITH THE LATEST VERSIONS OF GLIBC +# currently blacklists all newer than 2.3.0 + +if [ -e syms ]; then rm syms; fi +if [ -e allsym ]; then rm allsym; fi + +#host=`gcc -v 2>&1 | grep 'Target:' | sed 's/Target: //'` +host=i386-linux-gnu +for f in /lib/$host/*; do + if [ ! -f $f ]; then continue; fi + readelf -s --wide $f >>syms + objdump -T $f | grep "GLIBC_" | sed 's/\(.*\)GLIBC_//; s/)//' | grep -v PRIVATE | column -t >>allsym +done + + +# get a list of all symbol versions only available in 2.3+ +grep @GLIBC_ syms | awk ' { print $8 } ' | sed 's/@\+/ /; /GLIBC_P/d; s/GLIBC_//' | awk ' { split($2, Ver, "."); if (Ver[2] > 3) print $1 " " $2 } ' | column -t >glibc2.4.syms + +# select the symbols that already existed, but were obsoleted by 2.2+ versions +cat glibc2.4.syms | awk '{print $1}' | while read; do grep $REPLY allsym; done | sed '/2\.4/d' >syms-to-header + +# select the latest symbols of that set +# build a header from them +cat syms-to-header | awk '{print $2 " " $1 }' | sort -V | uniq >output +cat glibc2.4.syms | sort -V | uniq >> output + +cat output | sort | uniq | awk '{print $2 " " $1}' | sort -k2,1 | awk '{ split($1, Ver, "."); if (Ver[2] <= 3) print $1 " " $2 }' | column -t | sort -k2 | uniq -f1 >output2 + +# output the symbols that are brand new to 2.3+, ie not the ones that had earlier versions +cat glibc2.4.syms | awk '{ print $1 }' | while read; do if ! grep "$REPLY" output2 >/dev/null; then echo "DONT_USE_THIS_SYMBOL $REPLY" >>output2; fi; done; + +cat output2 | column -t | awk '{ print "__asm__(\".symver " $2 "," $2 "@GLIBC_" $1 "\");" }' > output + +# now remove dl_iterate_phdr as it's weak anyway (we should probably do this for all weak syms) +cat output | sed 's/__asm__("\.symver dl_iterate_phdr.*//' >output2 + +cat <<EOF >apsymbols.h.i686 +/* apbuild embedded metadata */ +#define APBUILD_NOTE_METADATA(s) \ + __asm__(".section .metadata, \"MS\", @note, 1\n\t.string \"" s "\"\n\t.previous\n\t") + +#ifdef APBUILD_VERSION +APBUILD_NOTE_METADATA("apbuild.version=" APBUILD_VERSION); +#endif + +/* apbuild generated symbol exclusion list */ +EOF +cat output2 >> apsymbols.h.i686 +rm output2 |