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