From: Stephen Rothwell <hidden> Date: 2020-08-11 14:11:25
Michael Ellerman: "who wants to make
arch/powerpc/tools/unrel_branch_check.sh suck less"
This series is based off the current powerpc/next branch and keeps the
same functionaity as the original except that it suppresses some error
messages for early failures that still cause this script to succeed
(as it always did).
I did this as a series so that people can see the (mostly obvious)
transofrmations at each step. As a single patch, it basically replaces
the whole file.
Hopefully this fulfills your definition of "sucks less" :-)
arch/powerpc/tools/unrel_branch_check.sh | 88 ++++++++++++++++----------------
1 file changed, 43 insertions(+), 45 deletions(-)
Cc: Nicholas Piggin <npiggin@gmail.com>
--
Cheers,
Stephen Rothwell
From: Stephen Rothwell <hidden> Date: 2020-08-11 14:18:43
Also some minor style changes.
There should still be no change in behaviour.
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stephen Rothwell <redacted>
---
arch/powerpc/tools/unrel_branch_check.sh | 25 +++++++++++-------------
1 file changed, 11 insertions(+), 14 deletions(-)
From: Stephen Rothwell <hidden> Date: 2020-08-11 14:22:13
We don't use the raw hex instruction dump, so elide it and adjust the
following expressions.
Also use \s instead of [[:space:]] everywhere.
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stephen Rothwell <redacted>
---
arch/powerpc/tools/unrel_branch_check.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
From: Stephen Rothwell <hidden> Date: 2020-08-11 14:25:09
Also start using sed -E and make all the separate expressions into a
single one with comments. Pull the stripping of condition registers
back into the sed command.
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stephen Rothwell <redacted>
---
arch/powerpc/tools/unrel_branch_check.sh | 30 ++++++++++++++++--------
1 file changed, 20 insertions(+), 10 deletions(-)
@@ -27,21 +27,31 @@ awk '$2 == "<__end_interrupts>:" { print $1 }'BRANCHES=$($objdump-R-D--no-show-raw-insn--start-address="$kstart"--stop-address="$end_intr""$vmlinux"|-grep-e"^c[0-9a-f]*:\s*b"|-sed-e'/\<__start_initialization_multiplatform>/d'\--e'/b.\?.\?ctr/d'\--e'/b.\?.\?lr/d'\--e's/\bbt.\?\s*[[:digit:]][[:digit:]]*,/beq/'\--e's/\bbf.\?\s*[[:digit:]][[:digit:]]*,/bne/'\--e's/\s0x/ /'\--e's/://'|-awk'{ print $1 ":" $2 ":0x" $3 ":" $4 " "}'+sed-E-n'+# match lines that start with a kernel address+/^c[0-9a-f]*:\s*b/{+# drop a target that we do not care about+/\<__start_initialization_multiplatform>/d+# drop branches via ctr or lr+/\<b.?.?(ct|l)r/d+# cope with some differences between Clang and GNU objdumps+s/\<bt.?\s*[[:digit:]]+,/beq/+s/\<bf.?\s*[[:digit:]]+,/bne/+# tidy up+s/\s0x//+s/://+# format for the loop below+s/^(\S+)\s+(\S+)\s+(\S+)\s*(\S*).*$/\1:\2:0x\3:\4/+# strip out condition registers+s/:0xcr[0-7],/:0x/+p+}')fortuplein$BRANCHES;dofrom=$(echo"$tuple"|cut-d':'-f1)branch=$(echo"$tuple"|cut-d':'-f2)-to=$(echo"$tuple"|cut-d':'-f3|sed's/cr[0-7],//')+to=$(echo"$tuple"|cut-d':'-f3)sym=$(echo"$tuple"|cut-d':'-f4)if((to>end_intr));then
From: Stephen Rothwell <hidden> Date: 2020-08-11 14:35:59
If we can't find the address of __end_interrupts, then we still exit
successfully as that is the current behaviour.
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stephen Rothwell <redacted>
---
arch/powerpc/tools/unrel_branch_check.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
From: Michael Ellerman <hidden> Date: 2020-09-09 15:08:55
On Wed, 12 Aug 2020 00:04:27 +1000, Stephen Rothwell wrote:
Michael Ellerman: "who wants to make
arch/powerpc/tools/unrel_branch_check.sh suck less"
This series is based off the current powerpc/next branch and keeps the
same functionaity as the original except that it suppresses some error
messages for early failures that still cause this script to succeed
(as it always did).
[...]