Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp309763ybg; Wed, 3 Jun 2020 01:09:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWqYtwonp4XuqG78mQZvIeH7CYVQv5EQ813wJVjjDvMbikPW0rmOJQiMoDIfzh5fGZSd7f X-Received: by 2002:a17:906:cd03:: with SMTP id oz3mr28351177ejb.391.1591171762522; Wed, 03 Jun 2020 01:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591171762; cv=none; d=google.com; s=arc-20160816; b=NJyhp6oRSls8EX5Tcp2bZdV55XSRzZij6v6hDH829bv36BlAhugyMAgkX7Mf0J8TBN ebPqEX5nvov393MzXxsq/ziG61WmBG0j7benf/Gx0+Fo97U5ipUdC5aF4mZ7r9uQqCTh Vok7dc9NbN1zNqVYZxYf9SEQHQGoF7KYOIee3qy97PMdazSNn8JQf5hBtdfjXjX7wM80 8V+VTRZp9py0PREZ6YX0X5v1CazhhFACZKo4SnEvH7qAaVPEZ7L6zIEr44SQn7qIUuTv dKb//lqyZfOy1clGYAdqRukLvjy7Q5SsEA3oSKnPC1RTWcZnViY82Zm7JTQ15xOq2z98 X6iw== 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=VRS7aJByiMqXBvu9t0uoM+aR7NsG8F7N7QOid5VEKSmLzeuzdn8SlRxBzQ2M58f86e 7SSsVu0oxbX8h5NJ9ZlXi/0rWFH5grxnxjxAIqnyXophg7EViOYFkhUgOtayhyVdivMt ukLzgkmqwhR1zHlIxg388E0U92EJgkFNHN01NDXa6NVIi/ak4ETlBjHp96PtWshw1RNw gTOI1kr6Te9IDGxvZKJeWhrIrNkNje+hZ7Lq4gnR49C8tcJPYCWWpL87YWE1syOdQaCq oV7+xS6RMNlndwojFmS0stEiUpvXMl6CROj5jCs7dXegp+J97zPW3K7+4+KHz/WA8VPn AIlA== 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 r29si699298edx.420.2020.06.03.01.08.59; Wed, 03 Jun 2020 01:09:22 -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 S1726324AbgFCIDq (ORCPT + 99 others); Wed, 3 Jun 2020 04:03:46 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:44895 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725275AbgFCIDl (ORCPT ); Wed, 3 Jun 2020 04:03:41 -0400 X-Originating-IP: 90.112.45.105 Received: from debian.home (lfbn-gre-1-325-105.w90-112.abo.wanadoo.fr [90.112.45.105]) (Authenticated sender: alex@ghiti.fr) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id A6CDC2000B; Wed, 3 Jun 2020 08:03:36 +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 v4 3/4] powerpc: Move script to check relocations at compile time in scripts/ Date: Wed, 3 Jun 2020 04:00:09 -0400 Message-Id: <20200603080010.13366-4-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200603080010.13366-1-alex@ghiti.fr> References: <20200603080010.13366-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 '\