Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3344446pxv; Sun, 4 Jul 2021 16:07:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT+wA8HkxgFisv0vGxN2PcWX0hLriti3K+5lVCwXd2h4Sod/+45b66cvx1El+FNPnF16Hs X-Received: by 2002:a05:6638:43:: with SMTP id a3mr9658175jap.41.1625440039680; Sun, 04 Jul 2021 16:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625440039; cv=none; d=google.com; s=arc-20160816; b=SvGX6Ro993oB40PbSNAA16bFUdIwuCeHCkBgj+KVae2801jvj/RoxVLSJ6nCnO5QCM 91jjA67Md6e4ylclfaQAIiT6A0iuP7ci3IylU2H6+u/VcH/arbtnrxJF5IdvfFnLcTjA QxRcNvQaPA8XltotV4hnF9REWWnpMiUoaj6lF9km0ROm+54nkzHp9abpBQkWc9OaL/dI P7Vo7ERcO3U1faAcW2lFb8AagqgQeorv0POcCOCtioqj5jTkWZoixjlBEPJWRnksdiRJ 75TudN0xm0njWYoktNG/1fNU0/4GvfGqJQiABwmAleYGHZWEleteiUy7pMFKWkIU2m0H ARGA== 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 :dkim-signature; bh=ULkwWblzuiSSm4kZiozHLhcz8ufdT04Zzk5bIKdYRBQ=; b=BJX5AktY9nYHaXix7P9q3NOZEvQ8dcZJhn8zE/yZ8wGf0axhjfzRbPS9OFZgV37MX3 6RXFGXpn2hrJQTzxzFQUW6l8u5HUgOMr6pdx/8SkleYdmgnwfZeXclp17MSbZ5s8wT/I MvEdSKT3icRF6+std6aJT6uDaRzzS/tm8IAI0HHFI+C+HHLpNPLcJEghmDrnnx9OrqhU 2Wul1+MWRzDZCL0SWK2bsn1oKRc/KySPDTIP/UVhT1Xgd4NaTOGau9WOi6EN0wH2Wcyl SnFH8GzNofJxJTgY9WRnSRjVAywjbdrXJW+Czv/6lgKBpFw/nLFN4vzmsv0SCvS1RRD7 Tmng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Zl5aK3wC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si12685999ilj.66.2021.07.04.16.07.08; Sun, 04 Jul 2021 16:07:19 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Zl5aK3wC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230141AbhGDXIm (ORCPT + 99 others); Sun, 4 Jul 2021 19:08:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:46804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbhGDXIE (ORCPT ); Sun, 4 Jul 2021 19:08:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4F33D611ED; Sun, 4 Jul 2021 23:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439928; bh=Dk48NbV8rLWqDR+JaOsvZjWWOogARq/S0oZtHIEKpAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zl5aK3wCO1rrxXTNmJc/c134jCqBGo3Iu6JOEf4E5ca5f0XthO2TsmtzT9KnOxylV 7ZFXQ7YpoQVnzd3W2DNYFSDmHfi7FPTS90YTPRU08XxSqBrUXsqA4J1ayT3tsl1Bk0 f5EL11NotXjpwUGIdzW5eKR/olicQ0k5mJtB6CFv1ROwNPwqFIqWWtn+97Dn32cGca 5sVoe1UEdPBmIovQIyNuP0WfBKU2hdtUVtaMABRpSOyQ3khkRXAdgD1beWKd31mYft ZdCjrxPbSu0JqNk4cHeZLMAixEXBWTBnUrVYAqy0Xc1dKvAWVATsXGV3f0hNN0g/fA RhMDHLNf10Weg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nick Desaulniers , Peter Collingbourne , Nathan Chancellor , Will Deacon , Sasha Levin , linux-kbuild@vger.kernel.org Subject: [PATCH AUTOSEL 5.13 49/85] Makefile: fix GDB warning with CONFIG_RELR Date: Sun, 4 Jul 2021 19:03:44 -0400 Message-Id: <20210704230420.1488358-49-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230420.1488358-1-sashal@kernel.org> References: <20210704230420.1488358-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nick Desaulniers [ Upstream commit 27f2a4db76e8d8a8b601fc1c6a7a17f88bd907ab ] GDB produces the following warning when debugging kernels built with CONFIG_RELR: BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn' when loading a kernel built with CONFIG_RELR into GDB. It can also prevent debugging symbols using such relocations. Peter sugguests: [That flag] means that lld will use dynamic tags and section type numbers in the OS-specific range rather than the generic range. The kernel itself doesn't care about these numbers; it determines the location of the RELR section using symbols defined by a linker script. Link: https://github.com/ClangBuiltLinux/linux/issues/1057 Suggested-by: Peter Collingbourne Reviewed-by: Nathan Chancellor Signed-off-by: Nick Desaulniers Link: https://lore.kernel.org/r/20210522012626.2811297-1-ndesaulniers@google.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- Makefile | 2 +- scripts/tools-support-relr.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0565caea0362..88888fff4c62 100644 --- a/Makefile +++ b/Makefile @@ -1039,7 +1039,7 @@ LDFLAGS_vmlinux += $(call ld-option, -X,) endif ifeq ($(CONFIG_RELR),y) -LDFLAGS_vmlinux += --pack-dyn-relocs=relr +LDFLAGS_vmlinux += --pack-dyn-relocs=relr --use-android-relr-tags endif # We never want expected sections to be placed heuristically by the diff --git a/scripts/tools-support-relr.sh b/scripts/tools-support-relr.sh index 45e8aa360b45..cb55878bd5b8 100755 --- a/scripts/tools-support-relr.sh +++ b/scripts/tools-support-relr.sh @@ -7,7 +7,8 @@ trap "rm -f $tmp_file.o $tmp_file $tmp_file.bin" EXIT cat << "END" | $CC -c -x c - -o $tmp_file.o >/dev/null 2>&1 void *p = &p; END -$LD $tmp_file.o -shared -Bsymbolic --pack-dyn-relocs=relr -o $tmp_file +$LD $tmp_file.o -shared -Bsymbolic --pack-dyn-relocs=relr \ + --use-android-relr-tags -o $tmp_file # Despite printing an error message, GNU nm still exits with exit code 0 if it # sees a relr section. So we need to check that nothing is printed to stderr. -- 2.30.2