Message ID | 20240207-s390-lld-and-orphan-warn-v1-6-8a665b3346ab@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-57323-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2587631dyb; Wed, 7 Feb 2024 16:17:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBAIscYHpENj3Um0Q2H3GgVlmpiZDZkplLCw8ZRdX7jc90t7qWek6+7c1eMnQqDq3BR5l8 X-Received: by 2002:a05:6214:5011:b0:68c:74a7:9e21 with SMTP id jo17-20020a056214501100b0068c74a79e21mr10912776qvb.3.1707351443597; Wed, 07 Feb 2024 16:17:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707351443; cv=pass; d=google.com; s=arc-20160816; b=WPOTTNK6rQ+FGK0bKkdx2AFzmX4EdrQKGldwY7saEtBw/66eLB3q9axnIGCorA0/IS snmFWwRdgcdojRWyJ0wc/ExffMzwDZactYkbs+LyCs8yoIqfEI24RMydLs29WqtHWmdI 7pyhddSPRn3amKQ6FuXTotcft43IV4K84THg8bUwLUrHzxaGNv8Wvb3wfaxx3aKZGrIt YrN0h8wBuhyZfJd7eDe727/vWIZLgflBgpZTFfrmLK5TLDJW7jAHAQS8FN7mmSbz5/fF N7uK1GoxH49SoJpbLDZzV9juExS4M6H3FKjv63vykNmZYVA9Z11LW75G8V12HYCM62zn CabQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=xS/A68PfJ9KFLhtBPaxSKkUvm8RceqsJwPkM+Q8vvh4=; fh=aG5YmHuiqtvoO+jsQy3CCiNiWkE64AmKe0T7qqnlUQc=; b=zLsbulsEd66x0iccSXwVYpfBHebMRbXEQPXTh0fVRbuyQ1VGcIrpuF7CsQ1ELDXXqG HCrRI3jAXDjK/H+xkx3mcsuGXS8DPYhyaIE5RXHAXsLMn8xAETEOwzE7aG6xEdSKCDH5 hUhVoABbAwECdGPz9PWCTufdDPx9HfMhDuWy7ankHZWXj4sJ1wgbMYXwWFyTrSCrWOpJ PLcJydL8ESL3vLXyM5AWEInueoLzd/0UVdkp1rgBScBR7XA8T8kOnjAIkx9VaN3lt8sw bJZDZQXr3Q/UB58gkGng6Xf7nBaA1SEF4kc9z28yXHQhUcrV+1OuBFav9L9pF/rkWar+ An4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pQcPoXsg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-57323-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57323-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCXJHjXZLYg7e/SHDMJYK09mxjKShISWFAQI/jixvH8XKmobweKeMlMBXRRGG6g5LdnyImOKl8SW4icPlXMEv9rkAqKs6A== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id iu15-20020ad45ccf000000b0068cbbbaa936si2464509qvb.297.2024.02.07.16.17.23 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 16:17:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57323-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pQcPoXsg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-57323-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57323-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 619081C22BE7 for <ouuuleilei@gmail.com>; Thu, 8 Feb 2024 00:17:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 665DE364CF; Thu, 8 Feb 2024 00:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pQcPoXsg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E8DC29CFB; Thu, 8 Feb 2024 00:15:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707351310; cv=none; b=uQHK1xH+CvO7j/CEhxqoZrmr8mjzUmS7wk7863apdxYKRaInpTmB+Hsxclk54dksKaxq8n0QmRbGfGovYOQm1hYCJdRCcfahnTkBLaA1j3To5ToUGsaF7oYFQrA2hFYI2t3zPneC3lhGbk4y/2FX1RkXdG7xeFLLaDXqzj8A9Rk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707351310; c=relaxed/simple; bh=KRQSj+pCd28VbnV16E5i5W+KSoyksfan092qVAxtBJs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L04h1H+iZXYbWqf+e3wIOl62WjQU+8trubWh9lXyQQqPblTARuCQyutCI3Tms1b8K5aedk0pEGrKgjmb7AfxMcL1Z50OMXGbIe5N5motdwZvknJTQSnvmpk7oURWA0z5dtvBCcUKNqHxw6MDtMouuYhVfkWKRUfuKNJ1H10zgAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pQcPoXsg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BA59C433B1; Thu, 8 Feb 2024 00:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707351310; bh=KRQSj+pCd28VbnV16E5i5W+KSoyksfan092qVAxtBJs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pQcPoXsgBOiC3EZXF7EKZeBNRfnk5uYo2Op//tZzA/PAck1qoq5FAzzBkbQI6oW8/ qPU1uQkewIHyVSpCHq1i53jzBptofiKJo/ggIWiaPWwYHkvqZbphDvBPQjFyhxnZ5U URqNdlV1Qmz8T87Oqe6IKhXGChCNYZ5cd3eCgRIe9Org6GQcdMhdVxDAhCtrpiSQPI HluD+MbAeIBtG+3tY6+nEuWpDL1RRbfQr6yNT2YsvIRtIAknKFnZ7aYhR5yWqUmNOn aQjpO8XSm/UQjKqSqn/OAs4ev+mTjoF3uo6k13+xaJ1ps7G3GdDj+UWY44Sv92O9xy X6CCzQ0R7aN8w== From: Nathan Chancellor <nathan@kernel.org> Date: Wed, 07 Feb 2024 17:14:58 -0700 Subject: [PATCH 06/11] s390/boot: vmlinux.lds.S: Handle '.rela' sections Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240207-s390-lld-and-orphan-warn-v1-6-8a665b3346ab@kernel.org> References: <20240207-s390-lld-and-orphan-warn-v1-0-8a665b3346ab@kernel.org> In-Reply-To: <20240207-s390-lld-and-orphan-warn-v1-0-8a665b3346ab@kernel.org> To: hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, maskray@google.com, ndesaulniers@google.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor <nathan@kernel.org> X-Mailer: b4 0.13-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2359; i=nathan@kernel.org; h=from:subject:message-id; bh=KRQSj+pCd28VbnV16E5i5W+KSoyksfan092qVAxtBJs=; b=owGbwMvMwCUmm602sfCA1DTG02pJDKlHZNnLdM2i2RqEDtvvUo6Zrzm7s0liSoR8XciqxwUGs dsOnnjcUcrCIMbFICumyFL9WPW4oeGcs4w3Tk2CmcPKBDKEgYtTACayyoThv3/f89x/z8UDPj/Y 1c3qvnz//gnrrnzYLyn/9P3NiU8Ko14zMryTlw7PXbGlbknvRemJcxfwHZg861O15oPDLfvXaii tYWUCAA== X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790287747610663444 X-GMAIL-MSGID: 1790287747610663444 |
Series |
[01/11] s390: boot: Add support for CONFIG_LD_ORPHAN_WARN
|
|
Commit Message
Nathan Chancellor
Feb. 8, 2024, 12:14 a.m. UTC
When building with CONFIG_LD_ORPHAN_WARN after selecting
CONFIG_ARCH_HAS_LD_ORPHAN_WARN, there are several warnings from
arch/s390/boot/head.o due to the unhandled presence of '.rela' sections:
s390-linux-ld: warning: orphan section `.rela.iplt' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
s390-linux-ld: warning: orphan section `.rela.head.text' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
s390-linux-ld: warning: orphan section `.rela.got' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
s390-linux-ld: warning: orphan section `.rela.data' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
s390-linux-ld: warning: orphan section `.rela.data.rel.ro' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
s390-linux-ld: warning: orphan section `.rela.iplt' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
s390-linux-ld: warning: orphan section `.rela.head.text' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
s390-linux-ld: warning: orphan section `.rela.got' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
s390-linux-ld: warning: orphan section `.rela.data' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
s390-linux-ld: warning: orphan section `.rela.data.rel.ro' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
These sections are unneeded for the decompressor and they are not
emitted in the binary currently. In a manner similar to other
architectures, coalesce the sections into '.rela.dyn' and ensure it is
zero sized, which is a safe/tested approach versus full discard.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
arch/s390/boot/vmlinux.lds.S | 4 ++++
1 file changed, 4 insertions(+)
Comments
On Wed, Feb 7, 2024 at 4:15 PM Nathan Chancellor <nathan@kernel.org> wrote: > > When building with CONFIG_LD_ORPHAN_WARN after selecting > CONFIG_ARCH_HAS_LD_ORPHAN_WARN, there are several warnings from > arch/s390/boot/head.o due to the unhandled presence of '.rela' sections: > > s390-linux-ld: warning: orphan section `.rela.iplt' from `arch/s390/boot/head.o' being placed in section `.rela.dyn' > s390-linux-ld: warning: orphan section `.rela.head.text' from `arch/s390/boot/head.o' being placed in section `.rela.dyn' > s390-linux-ld: warning: orphan section `.rela.got' from `arch/s390/boot/head.o' being placed in section `.rela.dyn' > s390-linux-ld: warning: orphan section `.rela.data' from `arch/s390/boot/head.o' being placed in section `.rela.dyn' > s390-linux-ld: warning: orphan section `.rela.data.rel.ro' from `arch/s390/boot/head.o' being placed in section `.rela.dyn' > s390-linux-ld: warning: orphan section `.rela.iplt' from `arch/s390/boot/head.o' being placed in section `.rela.dyn' > s390-linux-ld: warning: orphan section `.rela.head.text' from `arch/s390/boot/head.o' being placed in section `.rela.dyn' > s390-linux-ld: warning: orphan section `.rela.got' from `arch/s390/boot/head.o' being placed in section `.rela.dyn' > s390-linux-ld: warning: orphan section `.rela.data' from `arch/s390/boot/head.o' being placed in section `.rela.dyn' > s390-linux-ld: warning: orphan section `.rela.data.rel.ro' from `arch/s390/boot/head.o' being placed in section `.rela.dyn' > > These sections are unneeded for the decompressor and they are not > emitted in the binary currently. In a manner similar to other > architectures, coalesce the sections into '.rela.dyn' and ensure it is > zero sized, which is a safe/tested approach versus full discard. > > Signed-off-by: Nathan Chancellor <nathan@kernel.org> > --- > arch/s390/boot/vmlinux.lds.S | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/s390/boot/vmlinux.lds.S b/arch/s390/boot/vmlinux.lds.S > index 2f0bc05664ed..ff8c62d84f98 100644 > --- a/arch/s390/boot/vmlinux.lds.S > +++ b/arch/s390/boot/vmlinux.lds.S > @@ -137,6 +137,10 @@ SECTIONS > *(.igot .igot.plt) > } > ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") > + .rela.dyn : { > + *(.rela.*) *(.rela_*) > + } > + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") > > /* Sections to be discarded */ > /DISCARD/ : { > > -- > 2.43.0 > Commit 5354e84598f264793265cc99b4be2a2295826c86 ("x86/build: Add asserts for unwanted sections") specifies `*(.rela.*) *(.rela_*)` but it's not clear why `.rela_*` is included. We only need .rela.* (see also ld.bfd --verbose) This patch LGTM with this changed.
On Mon, Feb 12, 2024 at 09:18:34PM -0800, Fangrui Song wrote: > > ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") > > + .rela.dyn : { > > + *(.rela.*) *(.rela_*) > > + } > > + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") .. > Commit 5354e84598f264793265cc99b4be2a2295826c86 ("x86/build: Add > asserts for unwanted sections") > specifies `*(.rela.*) *(.rela_*)` but it's not clear why `.rela_*` is > included. We only need .rela.* (see also ld.bfd --verbose) > > This patch LGTM with this changed. I'll keep it as it is, just to be consistent with x86.
On Wed, Feb 14, 2024 at 4:18 AM Heiko Carstens <hca@linux.ibm.com> wrote: > > On Mon, Feb 12, 2024 at 09:18:34PM -0800, Fangrui Song wrote: > > > ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") > > > + .rela.dyn : { > > > + *(.rela.*) *(.rela_*) > > > + } > > > + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") > ... > > Commit 5354e84598f264793265cc99b4be2a2295826c86 ("x86/build: Add > > asserts for unwanted sections") > > specifies `*(.rela.*) *(.rela_*)` but it's not clear why `.rela_*` is > > included. We only need .rela.* (see also ld.bfd --verbose) > > > > This patch LGTM with this changed. > > I'll keep it as it is, just to be consistent with x86. Sent https://lore.kernel.org/all/20240214212929.3753766-1-maskray@google.com/ ("[PATCH] x86/build: Simplify patterns for unwanted section") to simplify the patterns in x86 vmlinux.lds.S:)
diff --git a/arch/s390/boot/vmlinux.lds.S b/arch/s390/boot/vmlinux.lds.S index 2f0bc05664ed..ff8c62d84f98 100644 --- a/arch/s390/boot/vmlinux.lds.S +++ b/arch/s390/boot/vmlinux.lds.S @@ -137,6 +137,10 @@ SECTIONS *(.igot .igot.plt) } ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") + .rela.dyn : { + *(.rela.*) *(.rela_*) + } + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") /* Sections to be discarded */ /DISCARD/ : {