diff mbox series

[1/2] powerpc: unrel_branch_check.sh: use nm to find symbol value

Message ID 20200812081036.7969-2-sfr@canb.auug.org.au (mailing list archive)
State Accepted
Commit b71dca9891b330d5c2d3ff5d41704aa6f64f8e32
Headers show
Series powerpc: unrel_branch_check.sh: enable llvm-objdump | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (f04b169e953c4db1a3a3c1d23eea09c726f01ee5)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (a7aaa2f26bfd932a654706b19859e7adf802bee2)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (fb893de323e2d39f7a1f6df425703a2edbdf56ea)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (6553fb799f601497ca0703682e2aff131197dc5c)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (bc09acc9f224c0923794b69534c9bfa999c27b64)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Stephen Rothwell Aug. 12, 2020, 8:10 a.m. UTC
This is considerably faster then parsing the objdump asm output.  It will
also make the enabling of llvm-objdump a little easier.

Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Bill Wendling <morbo@google.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/Makefile.postlink           |  2 +-
 arch/powerpc/tools/unrel_branch_check.sh | 13 +++++--------
 2 files changed, 6 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/arch/powerpc/Makefile.postlink b/arch/powerpc/Makefile.postlink
index 2268396ff4bb..a6c77f4d32b2 100644
--- a/arch/powerpc/Makefile.postlink
+++ b/arch/powerpc/Makefile.postlink
@@ -18,7 +18,7 @@  quiet_cmd_relocs_check = CHKREL  $@
 ifdef CONFIG_PPC_BOOK3S_64
       cmd_relocs_check =						\
 	$(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@" ; \
-	$(BASH) $(srctree)/arch/powerpc/tools/unrel_branch_check.sh "$(OBJDUMP)" "$@"
+	$(BASH) $(srctree)/arch/powerpc/tools/unrel_branch_check.sh "$(OBJDUMP)" "$(NM)" "$@"
 else
       cmd_relocs_check =						\
 	$(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@"
diff --git a/arch/powerpc/tools/unrel_branch_check.sh b/arch/powerpc/tools/unrel_branch_check.sh
index 70da90270c78..0369eb2e7e4b 100755
--- a/arch/powerpc/tools/unrel_branch_check.sh
+++ b/arch/powerpc/tools/unrel_branch_check.sh
@@ -5,18 +5,15 @@ 
 # This script checks the unrelocated code of a vmlinux for "suspicious"
 # branches to relocated code (head_64.S code).
 
-# Have Kbuild supply the path to objdump so we handle cross compilation.
+# Have Kbuild supply the path to objdump and nm so we handle cross compilation.
 objdump="$1"
-vmlinux="$2"
+nm="$2"
+vmlinux="$3"
 
-#__end_interrupts should be located within the first 64K
 kstart=0xc000000000000000
-printf -v kend '0x%x' $(( kstart + 0x10000 ))
 
-end_intr=0x$(
-$objdump -R -d --start-address="$kstart" --stop-address="$kend" "$vmlinux" 2>/dev/null |
-awk '$2 == "<__end_interrupts>:" { print $1 }'
-)
+end_intr=0x$($nm -p "$vmlinux" |
+	sed -E -n '/\s+[[:alpha:]]\s+__end_interrupts\s*$/{s///p;q}')
 if [ "$end_intr" = "0x" ]; then
 	exit 0
 fi