summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2022-02-14 07:59:52 +0100
committerAndreas Schneider <asn@cryptomilk.org>2022-02-15 11:35:31 +0000
commit2b9917d7a3cb88cf48517e4a93a94fa3ca6ff3d9 (patch)
tree81d46a650ba08e3c7683604443d7cfc1585ebb4b /buildtools
parent17d792e9aa38c3d8a2211c7b8ee3e2d88b438922 (diff)
downloadsamba-2b9917d7a3cb88cf48517e4a93a94fa3ca6ff3d9.tar.gz
builtools: Make abi_gen.sh less prone to errors
The mold linker has more hidden symbols and we would need to filter them out with nm, where objdump tells us which symbols are actually hidden. So we just need to filter out whatever is hidden. The use of awk makes it also easier to get what we want. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'buildtools')
-rwxr-xr-xbuildtools/scripts/abi_gen.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/buildtools/scripts/abi_gen.sh b/buildtools/scripts/abi_gen.sh
index 6dd6d321f77..ddb0a7cc36f 100755
--- a/buildtools/scripts/abi_gen.sh
+++ b/buildtools/scripts/abi_gen.sh
@@ -10,9 +10,14 @@ cat <<EOF
set height 0
set width 0
EOF
-nm "$SHAREDLIB" | cut -d' ' -f2- | egrep '^[BDGTRVWS]' | grep -v @ | egrep -v ' (__bss_start|_edata|_init|_fini|_end)' | cut -c3- | sort | while read s; do
+
+# On older linker versions _init|_fini symbols are not hidden.
+objdump --dynamic-syms "${SHAREDLIB}" | \
+ awk '$0 !~ /.hidden/ {if ($2 == "g" && $3 ~ /D(F|O)/ && $4 ~ /(.bss|.rodata|.text)/) print $NF}' | \
+ sort | \
+ while read -r s; do
echo "echo $s: "
- echo p $s
+ echo p "${s}"
done
) > $GDBSCRIPT