From e219bc7c1b3a82b1c35b61cf07217c084480f752 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 22 Oct 2009 01:12:47 -0400 Subject: test/plt: add a script to find PLT usage Signed-off-by: Mike Frysinger Signed-off-by: Austin Foxley --- test/plt/check-plt.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 test/plt/check-plt.sh (limited to 'test/plt') diff --git a/test/plt/check-plt.sh b/test/plt/check-plt.sh new file mode 100755 index 000000000..bedc8fd35 --- /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: +# : +# +function symstrip(name) { + return gensub(/.*<([^>@]*).*/, "\\1", "", name); +} + +{ +# Match the start of the symbol disassembly +# 00009720 : +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 -- cgit v1.2.3