Skip to content

Commit b71dca9

Browse files
sfrothwellmpe
authored andcommitted
powerpc: unrel_branch_check.sh: use nm to find symbol value
This is considerably faster then parsing the objdump asm output. It will also make the enabling of llvm-objdump a little easier. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200812081036.7969-2-sfr@canb.auug.org.au
1 parent af13a22 commit b71dca9

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎arch/powerpc/Makefile.postlink‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ quiet_cmd_relocs_check = CHKREL $@
1818
ifdef CONFIG_PPC_BOOK3S_64
1919
cmd_relocs_check = \
2020
$(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@" ; \
21-
$(BASH) $(srctree)/arch/powerpc/tools/unrel_branch_check.sh "$(OBJDUMP)" "$@"
21+
$(BASH) $(srctree)/arch/powerpc/tools/unrel_branch_check.sh "$(OBJDUMP)" "$(NM)" "$@"
2222
else
2323
cmd_relocs_check = \
2424
$(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@"

‎arch/powerpc/tools/unrel_branch_check.sh‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@
55
# This script checks the unrelocated code of a vmlinux for "suspicious"
66
# branches to relocated code (head_64.S code).
77

8-
# Have Kbuild supply the path to objdump so we handle cross compilation.
8+
# Have Kbuild supply the path to objdump and nm so we handle cross compilation.
99
objdump="$1"
10-
vmlinux="$2"
10+
nm="$2"
11+
vmlinux="$3"
1112

12-
#__end_interrupts should be located within the first 64K
1313
kstart=0xc000000000000000
14-
printf -v kend '0x%x' $(( kstart + 0x10000 ))
1514

16-
end_intr=0x$(
17-
$objdump -R -d --start-address="$kstart" --stop-address="$kend" "$vmlinux" 2>/dev/null |
18-
awk '$2 == "<__end_interrupts>:" { print $1 }'
19-
)
15+
end_intr=0x$($nm -p "$vmlinux" |
16+
sed -E -n '/\s+[[:alpha:]]\s+__end_interrupts\s*$/{s///p;q}')
2017
if [ "$end_intr" = "0x" ]; then
2118
exit 0
2219
fi

0 commit comments

Comments
 (0)