Skip to content

Commit 20ff8ec

Browse files
sfrothwellmpe
authored andcommitted
powerpc: unrel_branch_check.sh: simplify and combine some executions
Also some minor style changes. There should still be no change in behaviour. 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/20200811140435.20957-3-sfr@canb.auug.org.au
1 parent d9de6b0 commit 20ff8ec

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

‎arch/powerpc/tools/unrel_branch_check.sh‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,34 @@ objdump="$1"
1717
vmlinux="$2"
1818

1919
#__end_interrupts should be located within the first 64K
20+
kstart=0xc000000000000000
21+
printf -v kend '0x%x' $(( kstart + 0x10000 ))
2022

2123
end_intr=0x$(
22-
$objdump -R "$vmlinux" -d --start-address=0xc000000000000000 \
23-
--stop-address=0xc000000000010000 |
24-
grep '\<__end_interrupts>:' |
25-
awk '{print $1}'
24+
$objdump -R -d --start-address="$kstart" --stop-address="$kend" "$vmlinux" |
25+
awk '$2 == "<__end_interrupts>:" { print $1 }'
2626
)
2727

2828
BRANCHES=$(
29-
$objdump -R "$vmlinux" -D --start-address=0xc000000000000000 \
30-
--stop-address="$end_intr" |
29+
$objdump -R -D --start-address="$kstart" --stop-address="$end_intr" "$vmlinux" |
3130
grep -e "^c[0-9a-f]*:[[:space:]]*\([0-9a-f][0-9a-f][[:space:]]\)\{4\}[[:space:]]*b" |
32-
grep -v '\<__start_initialization_multiplatform>' |
33-
grep -v -e 'b.\?.\?ctr' |
34-
grep -v -e 'b.\?.\?lr' |
35-
sed -e 's/\bbt.\?[[:space:]]*[[:digit:]][[:digit:]]*,/beq/' \
31+
sed -e '/\<__start_initialization_multiplatform>/d' \
32+
-e '/b.\?.\?ctr/d' \
33+
-e '/b.\?.\?lr/d' \
34+
-e 's/\bbt.\?[[:space:]]*[[:digit:]][[:digit:]]*,/beq/' \
3635
-e 's/\bbf.\?[[:space:]]*[[:digit:]][[:digit:]]*,/bne/' \
3736
-e 's/[[:space:]]0x/ /' \
3837
-e 's/://' |
3938
awk '{ print $1 ":" $6 ":0x" $7 ":" $8 " "}'
4039
)
4140

42-
for tuple in $BRANCHES
43-
do
41+
for tuple in $BRANCHES; do
4442
from=$(echo "$tuple" | cut -d':' -f1)
4543
branch=$(echo "$tuple" | cut -d':' -f2)
4644
to=$(echo "$tuple" | cut -d':' -f3 | sed 's/cr[0-7],//')
4745
sym=$(echo "$tuple" | cut -d':' -f4)
4846

49-
if (( to > end_intr ))
50-
then
47+
if (( to > end_intr )); then
5148
if [ -z "$bad_branches" ]; then
5249
echo "WARNING: Unrelocated relative branches"
5350
bad_branches="yes"

0 commit comments

Comments
 (0)