summaryrefslogtreecommitdiff
path: root/tools/apbuild/buildlist
diff options
context:
space:
mode:
Diffstat (limited to 'tools/apbuild/buildlist')
-rwxr-xr-xtools/apbuild/buildlist48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/apbuild/buildlist b/tools/apbuild/buildlist
new file mode 100755
index 00000000..24e789fd
--- /dev/null
+++ b/tools/apbuild/buildlist
@@ -0,0 +1,48 @@
+#!/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
+for f in /lib/*; 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 ' { if ($2 > 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 | uniq >output
+cat glibc2.4.syms | sort | uniq >> output
+
+cat output | sort | uniq | awk '{print $2 " " $1}' | sort -k2,1 | awk '{ if ($1 <= 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
+/* 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
+rm output2