Skip to content

Commit b84eaab

Browse files
sfrothwellmpe
authored andcommitted
powerpc: unrel_branch_check.sh: simplify and tidy up the final loop
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-6-sfr@canb.auug.org.au
1 parent 3d97abb commit b84eaab

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

‎arch/powerpc/tools/unrel_branch_check.sh‎

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ $objdump -R -d --start-address="$kstart" --stop-address="$kend" "$vmlinux" |
2525
awk '$2 == "<__end_interrupts>:" { print $1 }'
2626
)
2727

28-
BRANCHES=$(
2928
$objdump -R -D --no-show-raw-insn --start-address="$kstart" --stop-address="$end_intr" "$vmlinux" |
3029
sed -E -n '
3130
# match lines that start with a kernel address
@@ -45,24 +44,19 @@ sed -E -n '
4544
# strip out condition registers
4645
s/:0xcr[0-7],/:0x/
4746
p
48-
}'
49-
)
50-
51-
for tuple in $BRANCHES; do
52-
from=$(echo "$tuple" | cut -d':' -f1)
53-
branch=$(echo "$tuple" | cut -d':' -f2)
54-
to=$(echo "$tuple" | cut -d':' -f3)
55-
sym=$(echo "$tuple" | cut -d':' -f4)
47+
}' | {
5648

49+
all_good=true
50+
while IFS=: read -r from branch to sym; do
5751
if (( to > end_intr )); then
58-
if [ -z "$bad_branches" ]; then
59-
echo "WARNING: Unrelocated relative branches"
60-
bad_branches="yes"
52+
if $all_good; then
53+
printf '%s\n' 'WARNING: Unrelocated relative branches'
54+
all_good=false
6155
fi
62-
echo "$from $branch-> $to $sym"
56+
printf '%s %s-> %s %s\n' "$from" "$branch" "$to" "$sym"
6357
fi
6458
done
6559

66-
if [ -z "$bad_branches" ]; then
67-
exit 0
68-
fi
60+
$all_good
61+
62+
}

0 commit comments

Comments
 (0)