Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp3491488ybg; Sun, 7 Jun 2020 01:06:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/4osLtRnYcrTyc/r5p5LF63dBgBg3cfUPuMj3vKUwd+RiSWQWL4D+dXFYTdcSdyPfro3t X-Received: by 2002:a50:f18f:: with SMTP id x15mr17217623edl.228.1591517166836; Sun, 07 Jun 2020 01:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591517166; cv=none; d=google.com; s=arc-20160816; b=vYYjlPRU7sKZfLywjqQ2ibQK66ZzVuiPkxlnU825Tz7egQtQvghBdTHCGbGVYk7Mu4 jBcpPRXSA45dhQM6bSx6DmjmXcL1d+zcpuWlFHu0b/c1w/B7hyEaYzBhtcLFmEVvOIcE LLExOgSgqTnHlLqXV2ARBpMtsSbTRQZHAIDiPavSHZ1ETx1FTBImgTJm7ZOEssLt7Z0G QtdeXL1lSPqhWyej9WvVphqJYGE4q/C5x1huOOnJueTKGSJ9/jIfiwRREf/AJs7L37ZM LuNP4BbixPFAmXH+BzrFilB/7vZ1JszEoS7iNQ/2LKbzbwq/472eW9GSPI8/UzkTIiuV wd/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5xBowyd+D0SkmJ1xr5wrgpLBpQeKlH46Z8dJHQImyRQ=; b=NIHRxy3PVRT6rhbZ4Zu64fkC+Ual01PhFajc+Rh2QATOdFE2GB/Jcf7kdVV9WVghi/ xMC2STMA3Vgal1oGNDKkupWG78w/gcnRQ+7MeLKQ3DIvzRIkasR3gjVr5FuNsvqjDMZ5 johoIa2qFeNFcNU8NHmIAM9ea5DJYM1KOEpVZMLsMuHq6Zvqhr0SF/pkIQvN7dZ+lFjW lC+XSMIcPdJhvm5Cvkfb4gpXR5Du0bm5vMOE35yTWSDuHO7IerZdmXG4RS8Llx/qgEAE 0Rprv9kPC7HFp61KK0NMFO3KbvRZQc0XuEuVLE5QyuphRFHxnJb0wYJ+NYlmFH0MjoZ5 5WJw== 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 d10si6647703eds.465.2020.06.07.01.05.44; Sun, 07 Jun 2020 01:06:06 -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 S1726465AbgFGIDO (ORCPT + 99 others); Sun, 7 Jun 2020 04:03:14 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:43269 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbgFGIDO (ORCPT ); Sun, 7 Jun 2020 04:03:14 -0400 Received: from localhost.localdomain (lfbn-gre-1-325-105.w90-112.abo.wanadoo.fr [90.112.45.105]) (Authenticated sender: alex@ghiti.fr) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 00E37200003; Sun, 7 Jun 2020 08:03:05 +0000 (UTC) From: Alexandre Ghiti To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Atish Patra , Zong Li , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org Cc: Alexandre Ghiti , Anup Patel Subject: [PATCH v5 3/4] powerpc: Move script to check relocations at compile time in scripts/ Date: Sun, 7 Jun 2020 03:59:48 -0400 Message-Id: <20200607075949.665-4-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200607075949.665-1-alex@ghiti.fr> References: <20200607075949.665-1-alex@ghiti.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org 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 '\