diff options
Diffstat (limited to 'tc/make-static-syms.sh')
-rwxr-xr-x | tc/make-static-syms.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tc/make-static-syms.sh b/tc/make-static-syms.sh new file mode 100755 index 00000000..6a5972ae --- /dev/null +++ b/tc/make-static-syms.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# This is the rule from the end of Makefile, with $* instead of $^ on the +# first line, and $ instead of $$ on the other lines, but otherwise identical. +# (Which is why the indentation is weird!) + + files="$*" ; \ + for s in `grep -B 3 '\<dlsym' $files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ + sed -n '/'$s'[^ ]* =/{s:.* \([^ ]*'$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $files ; \ + done |