summaryrefslogtreecommitdiffstats
path: root/scripts/extract_symbol_offset
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/extract_symbol_offset')
-rwxr-xr-xscripts/extract_symbol_offset14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/extract_symbol_offset b/scripts/extract_symbol_offset
new file mode 100755
index 0000000000..1a1260f526
--- /dev/null
+++ b/scripts/extract_symbol_offset
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+symbol="$1"
+file="$2"
+
+# extract symbol offset from file, remove leading zeros
+ofs=$(nm -t d $file | grep "$symbol" | cut -d ' ' -f1 | sed "s/^[0]*//")
+
+if [ -z "${ofs}" ]; then
+ echo "symbol $symbol not found in $file"
+ exit 1
+fi
+
+echo $ofs