lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | allowed=" |
| 3 | calloc |
| 4 | free |
| 5 | malloc |
| 6 | memalign |
| 7 | realloc |
| 8 | " |
| 9 | |
| 10 | ${OBJDUMP:-objdump} -d ${top_builddir:-../..}/lib/libc.so.? | \ |
| 11 | gawk -v allowed="${allowed}" ' |
| 12 | BEGIN { |
| 13 | COUNT = split(" " allowed, ALLOWED); |
| 14 | } |
| 15 | |
| 16 | # Strip away the noise. The name will be like: |
| 17 | # <brk>: |
| 18 | # <foo@plt> |
| 19 | function symstrip(name) { |
| 20 | return gensub(/.*<([^>@]*).*/, "\\1", "", name); |
| 21 | } |
| 22 | |
| 23 | { |
| 24 | # Match the start of the symbol disassembly |
| 25 | # 00009720 <brk>: |
| 26 | if ($2 ~ />:$/) { |
| 27 | f = symstrip($2); |
| 28 | |
| 29 | } else if ($NF ~ /@plt>/) { |
| 30 | rf = symstrip($NF); |
| 31 | for (a in ALLOWED) { |
| 32 | a = ALLOWED[a]; |
| 33 | if (a == rf) |
| 34 | next; |
| 35 | } |
| 36 | print "Func " f " references " rf; |
| 37 | } |
| 38 | }' | sort -u |