From: Mark Wooding Date: Wed, 4 Sep 2019 18:10:52 +0000 (+0100) Subject: bin/datasyms: New utility to print the writable-data symbols in object files. X-Git-Url: https://git.distorted.org.uk/~mdw/profile/commitdiff_plain/878a38bd893a92b5a8d5b5f941cb4ec0c1abeba4 bin/datasyms: New utility to print the writable-data symbols in object files. It turns out that I have a habit of forgetting to declare constant tables as being `const'. This tool is one of the few ways to notice that I've done this. --- diff --git a/Makefile b/Makefile index 9899824..85978dd 100644 --- a/Makefile +++ b/Makefile @@ -222,6 +222,7 @@ SCRIPTLINKS += mdw-conf SCRIPTLINKS += svnwrap SCRIPTLINKS += guest-console SCRIPTLINKS += hyperspec +SCRIPTLINKS += datasyms ## Random odds and ends. DOTLINKS += .infokey .sqliterc diff --git a/bin/datasyms b/bin/datasyms new file mode 100755 index 0000000..d54ede6 --- /dev/null +++ b/bin/datasyms @@ -0,0 +1,7 @@ +#! /bin/sh -e +objdump -t "$@" | sed -En ' + /^(.*\.o:) .*$/ { s//\1/; h; } + /(\.data|\.bss|\*COM\*)[[:space:]]+[0-9]+ [^.]/ { + x; /./ p; s/.*//; x + s/^/ /; p + }'