diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-10-24 20:22:12 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-10-24 20:22:12 +0200 |
commit | 7988979a722b4cdf287b2093956a76a3f19b9897 (patch) | |
tree | d35e251d0472ceca55a2eef61cff261c8ee68fab /test/plt/check-plt.sh |
add uClibc-ng test directory
Diffstat (limited to 'test/plt/check-plt.sh')
-rwxr-xr-x | test/plt/check-plt.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/plt/check-plt.sh b/test/plt/check-plt.sh new file mode 100755 index 0000000..bedc8fd --- /dev/null +++ b/test/plt/check-plt.sh @@ -0,0 +1,38 @@ +#!/bin/sh +allowed=" +calloc +free +malloc +memalign +realloc +" + +${OBJDUMP:-objdump} -d ${top_builddir:-../..}/lib/libc.so.? | \ +gawk -v allowed="${allowed}" ' +BEGIN { + COUNT = split(" " allowed, ALLOWED); +} + +# Strip away the noise. The name will be like: +# <brk>: +# <foo@plt> +function symstrip(name) { + return gensub(/.*<([^>@]*).*/, "\\1", "", name); +} + +{ +# Match the start of the symbol disassembly +# 00009720 <brk>: +if ($2 ~ />:$/) { + f = symstrip($2); + +} else if ($NF ~ /@plt>/) { + rf = symstrip($NF); + for (a in ALLOWED) { + a = ALLOWED[a]; + if (a == rf) + next; + } + print "Func " f " references " rf; +} +}' | sort -u |