From patchwork Tue Aug 11 14:04:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Rothwell X-Patchwork-Id: 1343340 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BQwCf4b33z9sRN for ; Wed, 12 Aug 2020 00:27:42 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=kSTtjXO3; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BQwCd47dBzDqS8 for ; Wed, 12 Aug 2020 00:27:41 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BQvjh2hXZzDqMm for ; Wed, 12 Aug 2020 00:05:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=kSTtjXO3; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BQvjc1fHYz9sTd; Wed, 12 Aug 2020 00:05:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1597154708; bh=Uc1DFmj6GDVlR0S2M6HTMamhLfv5jYMemm15PEIauk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kSTtjXO3FoiKxtQvLOkHcYdNtiIS6prr+GFclsMrf79a6P5W0OeeULiGKlaod5GA8 7li3Po61vMaKyhNmI4RzJUju3982Fx8zQI/JtQLTo3tRsPY0wKvKZvGHuJEk8PyobC RJ4X/asVsvByoHtZNhh6XnfGKwazPHQxKah9VOHDCq7ZWfEERn3ha9RCvZDJTTPsiD XszFnAzRhuOb0H2tBy7NYWd4tGs+fsUPaN3UzM23VrHXYNhXZQwV5BqxDgQDrpN6cq vqn589SAuUDVuagY7XG6KU2Z/ZhGgj1b/HjDBqlsxT8Bgc3HEmFHngntoYKfphtu3s fl9oQXmo6m9Vg== From: Stephen Rothwell To: Michael Ellerman Subject: [PATCH 5/7] powerpc: unrel_branch_check.sh: simplify and tidy up the final loop Date: Wed, 12 Aug 2020 00:04:32 +1000 Message-Id: <20200811140435.20957-6-sfr@canb.auug.org.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200811140435.20957-1-sfr@canb.auug.org.au> References: <20200811140435.20957-1-sfr@canb.auug.org.au> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux PowerPC List , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Cc: Nicholas Piggin Signed-off-by: Stephen Rothwell --- arch/powerpc/tools/unrel_branch_check.sh | 26 +++++++++--------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/tools/unrel_branch_check.sh b/arch/powerpc/tools/unrel_branch_check.sh index dc82289b2252..54ebd05615d4 100755 --- a/arch/powerpc/tools/unrel_branch_check.sh +++ b/arch/powerpc/tools/unrel_branch_check.sh @@ -25,7 +25,6 @@ $objdump -R -d --start-address="$kstart" --stop-address="$kend" "$vmlinux" | awk '$2 == "<__end_interrupts>:" { print $1 }' ) -BRANCHES=$( $objdump -R -D --no-show-raw-insn --start-address="$kstart" --stop-address="$end_intr" "$vmlinux" | sed -E -n ' # match lines that start with a kernel address @@ -45,24 +44,19 @@ sed -E -n ' # strip out condition registers s/:0xcr[0-7],/:0x/ p -}' -) - -for tuple in $BRANCHES; do - from=$(echo "$tuple" | cut -d':' -f1) - branch=$(echo "$tuple" | cut -d':' -f2) - to=$(echo "$tuple" | cut -d':' -f3) - sym=$(echo "$tuple" | cut -d':' -f4) +}' | { +all_good=true +while IFS=: read -r from branch to sym; do if (( to > end_intr )); then - if [ -z "$bad_branches" ]; then - echo "WARNING: Unrelocated relative branches" - bad_branches="yes" + if $all_good; then + printf '%s\n' 'WARNING: Unrelocated relative branches' + all_good=false fi - echo "$from $branch-> $to $sym" + printf '%s %s-> %s %s\n' "$from" "$branch" "$to" "$sym" fi done -if [ -z "$bad_branches" ]; then - exit 0 -fi +$all_good + +}