2 # SPDX-License-Identifier: GPL-2.0
4 # Disassemble a single function.
6 # usage: objdump-func <file> <func> [<func> ...]
11 OBJDUMP="${CROSS_COMPILE:-}objdump"
13 command -v gawk >/dev/null 2>&1 || die "gawk isn't installed"
16 echo "usage: objdump-func <file> <func> [<func> ...]" >&2
20 [[ $# -lt 2 ]] && usage
25 ${OBJDUMP} -wdr $OBJ | gawk -M -v _funcs="${FUNCS[*]}" '
26 BEGIN { split(_funcs, funcs); }
27 /^$/ { func_match=0; }
29 f = gensub(/.*<(.*)>:/, "\\1", 1);
31 # match compiler-added suffixes like ".cold", etc
32 if (f ~ "^" funcs[i] "(\\..*)?") {
34 base = strtonum("0x" $1);
41 addr = strtonum("0x" $1);
42 printf("%04x ", addr - base);