summaryrefslogtreecommitdiffstats
path: root/scripts/extract_symbol_offset
blob: 1a1260f526e0721c3a076ba6c6d60049af45bed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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