Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp1610871lkv; Wed, 19 May 2021 14:02:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYYYLa0qQOI2g0jOeBqd843Jk97AR4wiI7KnwutagOKYdB0Qq3SGqHp16UsBFUda7KUquL X-Received: by 2002:a6b:f602:: with SMTP id n2mr1728683ioh.174.1621458121042; Wed, 19 May 2021 14:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621458121; cv=none; d=google.com; s=arc-20160816; b=dmiW0/aXQalt8kSg3BtTjCT84fwL0w/rnuLlfehyIHkPNS8cn75LcoDPkmwE0lbmqd gyoVNDZUdIvBNM2aq41zzJzASNwgdeZkD6byVmYF2qg9SvvO+5Z2ROD8gk7K0nejfw6K zczqlB+bmUU+SMBBi88SWwn3EXi1GiBkUD3ulbdPpcfjfPDScUF8eDTMqEfuZeyRQsjc +rThV3LVECsNCf79NFczgt3Rc/V5ea41Cuzk7omAMn8mqnF7MQqz9ICI1d3q6VOSO5yj ZRxjsIMm5+l+u1hDhzf46FMwVbDlrBG+VWOulVDfgHAo94Xkyp91QA6EBAQh3WIerkHr jatA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=M9dDDHzMfR3R6pJCYVEIL/GRl5YZ0w6tBTuK0cpNRvY=; b=o08TDoMri5fQl69NLzCZ7le2MbZm3FoAQNCU3oRGBA/929oTHGWOuwFnrjlE6RfKqq DjgOfBzc4PtXnGUdYLrGk5Y2PD6b5Nh2n8lyQDgYL0BrlLZC+iZfep55OYbAREFfwxqr 9KF8e7yFXuS47l9LP4KRIR8tU3TLl1BuOZxgia1Xp6JGdrNa+uWUzfsncKVe0qvnobhl tzPU2lAITTZ2eYOB3NrULkSN95S67u3QFU018zKrr57v8W9936U73QV85qlCfKv0mGF9 A6vuTDrShkhX3lV8EK97TIm/T4+ewqjyUN10SmSZLLvaNC+0cJl75OpCl6fcbnQrhto0 REEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x23si404237jab.92.2021.05.19.14.01.48; Wed, 19 May 2021 14:02:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348429AbhERKQe (ORCPT + 99 others); Tue, 18 May 2021 06:16:34 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:39971 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348417AbhERKQd (ORCPT ); Tue, 18 May 2021 06:16:33 -0400 Received: (Authenticated sender: alex@ghiti.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 2B23C24000D; Tue, 18 May 2021 10:15:09 +0000 (UTC) From: Alexandre Ghiti To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Alexandre Ghiti , Anup Patel Subject: [PATCH v6 2/3] powerpc: Move script to check relocations at compile time in scripts/ Date: Tue, 18 May 2021 12:12:51 +0200 Message-Id: <20210518101252.1484465-3-alex@ghiti.fr> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210518101252.1484465-1-alex@ghiti.fr> References: <20210518101252.1484465-1-alex@ghiti.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Relocating kernel at runtime is done very early in the boot process, so it is not convenient to check for relocations there and react in case a relocation was not expected. Powerpc architecture has a script that allows to check at compile time for such unexpected relocations: extract the common logic to scripts/ so that other architectures can take advantage of it. Signed-off-by: Alexandre Ghiti Reviewed-by: Anup Patel --- arch/powerpc/tools/relocs_check.sh | 18 ++---------------- scripts/relocs_check.sh | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 16 deletions(-) create mode 100755 scripts/relocs_check.sh diff --git a/arch/powerpc/tools/relocs_check.sh b/arch/powerpc/tools/relocs_check.sh index 014e00e74d2b..e367895941ae 100755 --- a/arch/powerpc/tools/relocs_check.sh +++ b/arch/powerpc/tools/relocs_check.sh @@ -15,21 +15,8 @@ if [ $# -lt 3 ]; then exit 1 fi -# Have Kbuild supply the path to objdump and nm so we handle cross compilation. -objdump="$1" -nm="$2" -vmlinux="$3" - -# Remove from the bad relocations those that match an undefined weak symbol -# which will result in an absolute relocation to 0. -# Weak unresolved symbols are of that form in nm output: -# " w _binary__btf_vmlinux_bin_end" -undef_weak_symbols=$($nm "$vmlinux" | awk '$1 ~ /w/ { print $2 }') - bad_relocs=$( -$objdump -R "$vmlinux" | - # Only look at relocation lines. - grep -E '\