Message ID | 20240207-s390-lld-and-orphan-warn-v1-4-8a665b3346ab@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-57321-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2587414dyb; Wed, 7 Feb 2024 16:16:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlw/Op4XswMU9kufHaxsgPDa4oz10Qucic6vFnNkfqnyrvsOzEfRVyNRX0uBPNs7oe57Ew X-Received: by 2002:a17:907:174f:b0:a38:89a9:4206 with SMTP id lf15-20020a170907174f00b00a3889a94206mr2169139ejc.75.1707351413000; Wed, 07 Feb 2024 16:16:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707351412; cv=pass; d=google.com; s=arc-20160816; b=jAWf+5fpRkp+ECufI3txLq+b6ffyyOp8OC3E8zmd6dm5BMpBxVvZ9gw0tNShygZ86b 8cxfzqcnNAAR9SQfQraB/8G3SySgkX6J3MvrdIRyPlXrx35iINLJtjx+6nTHO3kn6DoD gsuLNNqDj1XH/sPJ2+AhPS7bkvGsexWWcsW4S4X9/IfJqq8sMnlYEp5Ho6lq65wEhCAa tT6fYIDQeYtRI3RrrdamYR2I8aPsTf9y1ETY+8UP4O9D+E82mlDno4zuj08PfTSnNoU8 MPHo06/ijdsNF5ZbcpqZdvn9wnT5lzy1NhlZ7HpWRaeayvFbk3LvpWCoXhIfPPK9bD6q YY0Q== 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=UAxhJ3+3iOdviAfn+0SxufBH0gM1P65AycyTaO08xt8=; fh=3LhxCWwa29jz6mg5nBM/B1HGXWU/arh4ZExet1TahNU=; b=LwXtQWWYxFjXYjSNWqugH552uNViF1g6Wq4OkkXRwRzClbsChRNHrTfL9kYy6ap9oy G5/d4xLqZgtsJIn9Q37oDwdP1d4S8o3wgMzR+fP9KLxnbmQ65Lk/QQVQrFhUF3dXdg7C UxDNcOeatb92qNGFz0qy81SHUvonwvFvoxOBHDMLsz35njs8jhP0BJmnxNq1+ztVRn05 sWmJpoldge8zlAivLIrr8g5rR5YjQnCsA3KLpNNiXns+RObOY61e1wvuif1uHHuUxHW0 J0IXwrvT+dsKGYsBAlPFlWDZOc0MtOb6wIKDMJhZOxqx2BmReSC86pjMiCc34qnNVEcn Ertw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fOJBJaUB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-57321-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57321-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWhKGzA69Ej+qNj+SmP0H/hbWwES3cg1UMaNz91EWirG/jv40z6lg+7QZhVvbyPpLCWDid8HAl4f9mjC4QNoFRpOMZwIQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n14-20020a170906118e00b00a385556f8d5si1463333eja.405.2024.02.07.16.16.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 16:16:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57321-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fOJBJaUB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-57321-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57321-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 911181F22062 for <ouuuleilei@gmail.com>; Thu, 8 Feb 2024 00:16:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E17ACC8C7; Thu, 8 Feb 2024 00:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fOJBJaUB" 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 0BA201E4A7; Thu, 8 Feb 2024 00:15:08 +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=1707351309; cv=none; b=AARwuX+rI9zyO/T0g6eWf6rZcowQYfTbXz/Khr6BIpus6UNvnogHowqRr4lmMOK+Y6nEFQ2AZpUiA08CHzBtCKd5Ha6ZOr2xoYaCUxy1jHA2HtyucKfLX3o+DmIe7GK9rBsvhm/V2Pye8smgvwBxEqI0fyoQFBtOHwBxc3pDxEE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707351309; c=relaxed/simple; bh=0Khy05nhsc8IVw6OcGxTD0wL0pcsnDmwXjS5CQyzon0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EL2W0NMKyKZswuvrnTrNGzhlI6v0ZAP9tkhttgLoXmBYJHEelbq1+D0VwZCnZJkiYbRef9LTbDryekjMaXeDrcEBeVckYcPsw5G2sC9xF+sLhqdVqhg+kGtddAHI5xjYBcJmfPydsir/uCtl/YBFiLwwp4JBLxRAJ32Yaum+pWo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fOJBJaUB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9523C43143; Thu, 8 Feb 2024 00:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707351308; bh=0Khy05nhsc8IVw6OcGxTD0wL0pcsnDmwXjS5CQyzon0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fOJBJaUBcLAQwoILyMM5cB1A99wqwoQealbZLTQEtUvDIRDszPPWHDIE6fu1D9h+z c0N5ravztR0NdvZihHAIdpDL0QcCW6egIZXuGd575StCX0b+I2eFTyID9sUV6H4OcB gg3kbKBt6E9+e+petluXLdTBWi8MijbmYrM2MnlYAq6nCjahioTxHhcfx5/FdhfLDi YgRYxgENlmbbIti1mD47gj4b4AFVe/qNIGDKjR9/o91fuJA63VXbGXuc6OuIvqRXTP 4oLkVl1V3ouvcuzY21Kdxcn6RKJbcAYrNJZQsj3bxYshfrVXWn4QTAbw40t5MjP0jB UadiusbGZ5mjw== From: Nathan Chancellor <nathan@kernel.org> Date: Wed, 07 Feb 2024 17:14:56 -0700 Subject: [PATCH 04/11] s390: vmlinux.lds.S: Discard unnecessary 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-4-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=1280; i=nathan@kernel.org; h=from:subject:message-id; bh=0Khy05nhsc8IVw6OcGxTD0wL0pcsnDmwXjS5CQyzon0=; b=owGbwMvMwCUmm602sfCA1DTG02pJDKlHZNmnGd0+tUxwadNrSd+EJ9rR1cWdk5OuvQn+33C0k u98oVx9RykLgxgXg6yYIkv1Y9XjhoZzzjLeODUJZg4rE8gQBi5OAZjI0puMDCt/M736/lcgXEN4 p/7aoBDnH4fjN97dfGvTWyEfocn1kZcY/odp2O/tfaOWWy8i8m26zZdd7smrLEQnce4qmCl1W/b tGz4A X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790287715312305533 X-GMAIL-MSGID: 1790287715312305533 |
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 some warnings around certain
ELF sections that are unnecessary for the kernel's purposes.
s390-linux-ld: warning: orphan section `.dynstr' from `arch/s390/kernel/head64.o' being placed in section `.dynstr'
s390-linux-ld: warning: orphan section `.dynamic' from `arch/s390/kernel/head64.o' being placed in section `.dynamic'
s390-linux-ld: warning: orphan section `.hash' from `arch/s390/kernel/head64.o' being placed in section `.hash'
s390-linux-ld: warning: orphan section `.gnu.hash' from `arch/s390/kernel/head64.o' being placed in section `.gnu.hash'
Add them to the discards to clear up the warnings, which matches other
architectures.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
arch/s390/kernel/vmlinux.lds.S | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Wed, Feb 07, 2024 at 05:14:56PM -0700, Nathan Chancellor wrote: > When building with CONFIG_LD_ORPHAN_WARN after selecting > CONFIG_ARCH_HAS_LD_ORPHAN_WARN, there are some warnings around certain > ELF sections that are unnecessary for the kernel's purposes. > > s390-linux-ld: warning: orphan section `.dynstr' from `arch/s390/kernel/head64.o' being placed in section `.dynstr' > s390-linux-ld: warning: orphan section `.dynamic' from `arch/s390/kernel/head64.o' being placed in section `.dynamic' > s390-linux-ld: warning: orphan section `.hash' from `arch/s390/kernel/head64.o' being placed in section `.hash' > s390-linux-ld: warning: orphan section `.gnu.hash' from `arch/s390/kernel/head64.o' being placed in section `.gnu.hash' > > Add them to the discards to clear up the warnings, which matches other > architectures. > > Signed-off-by: Nathan Chancellor <nathan@kernel.org> > --- > arch/s390/kernel/vmlinux.lds.S | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) .. > - *(.interp) > + *(.interp .dynamic) > + *(.dynstr .hash .gnu.hash) This seems to be wrong, since it leads to 1000s of error messages when using the "crash" utility e.g. when looking into a live dump of system with the generated debug info: BFD: /usr/lib/debug/usr/lib/modules/6.8.0-20240211.rc3.git0.bdca9b8dcf3f.300.fc39.s390x/vmlinux: attempt to load strings from a non-string section (number 0) I will change this commit to the below; it seems to work and is in line with other architectures: ----- When building with CONFIG_LD_ORPHAN_WARN after selecting CONFIG_ARCH_HAS_LD_ORPHAN_WARN, there are some warnings around certain ELF sections: s390-linux-ld: warning: orphan section `.dynstr' from `arch/s390/kernel/head64.o' being placed in section `.dynstr' s390-linux-ld: warning: orphan section `.dynamic' from `arch/s390/kernel/head64.o' being placed in section `.dynamic' s390-linux-ld: warning: orphan section `.hash' from `arch/s390/kernel/head64.o' being placed in section `.hash' s390-linux-ld: warning: orphan section `.gnu.hash' from `arch/s390/kernel/head64.o' being placed in section `.gnu.hash' Explicitly keep those sections like other architectures when CONFIG_RELOCATABLE is enabled, which is always true for s390. [hca@linux.ibm.com: keep sections instead of discarding] Signed-off-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20240207-s390-lld-and-orphan-warn-v1-4-8a665b3346ab@kernel.org Signed-off-by: Heiko Carstens <hca@linux.ibm.com> --- arch/s390/kernel/vmlinux.lds.S | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 661a487a3048..d46e3c383952 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -200,6 +200,21 @@ SECTIONS *(.rela*) __rela_dyn_end = .; } + .dynamic ALIGN(8) : { + *(.dynamic) + } + .dynsym ALIGN(8) : { + *(.dynsym) + } + .dynstr ALIGN(8) : { + *(.dynstr) + } + .hash ALIGN(8) : { + *(.hash) + } + .gnu.hash ALIGN(8) : { + *(.gnu.hash) + } . = ALIGN(PAGE_SIZE); __init_end = .; /* freed after init ends here */
On Mon, Feb 12, 2024 at 02:55:11PM +0100, Heiko Carstens wrote: > Explicitly keep those sections like other architectures when > CONFIG_RELOCATABLE is enabled, which is always true for s390. .. > + .dynstr ALIGN(8) : { > + *(.dynstr) > + } Except for this, which is already present (copy-paste-error).
On Mon, Feb 12, 2024 at 02:55:11PM +0100, Heiko Carstens wrote: > On Wed, Feb 07, 2024 at 05:14:56PM -0700, Nathan Chancellor wrote: > > When building with CONFIG_LD_ORPHAN_WARN after selecting > > CONFIG_ARCH_HAS_LD_ORPHAN_WARN, there are some warnings around certain > > ELF sections that are unnecessary for the kernel's purposes. > > > > s390-linux-ld: warning: orphan section `.dynstr' from `arch/s390/kernel/head64.o' being placed in section `.dynstr' > > s390-linux-ld: warning: orphan section `.dynamic' from `arch/s390/kernel/head64.o' being placed in section `.dynamic' > > s390-linux-ld: warning: orphan section `.hash' from `arch/s390/kernel/head64.o' being placed in section `.hash' > > s390-linux-ld: warning: orphan section `.gnu.hash' from `arch/s390/kernel/head64.o' being placed in section `.gnu.hash' > > > > Add them to the discards to clear up the warnings, which matches other > > architectures. > > > > Signed-off-by: Nathan Chancellor <nathan@kernel.org> > > --- > > arch/s390/kernel/vmlinux.lds.S | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > ... > > - *(.interp) > > + *(.interp .dynamic) > > + *(.dynstr .hash .gnu.hash) > > This seems to be wrong, since it leads to 1000s of error messages when > using the "crash" utility e.g. when looking into a live dump of system > with the generated debug info: > > BFD: /usr/lib/debug/usr/lib/modules/6.8.0-20240211.rc3.git0.bdca9b8dcf3f.300.fc39.s390x/vmlinux: attempt to load strings from a non-string section (number 0) > > I will change this commit to the below; it seems to work and is in > line with other architectures: Thanks a lot for catching that, your final change seems good to me. Here's to hoping I did not get anything else wrong :) Cheers, Nathan > ----- > > When building with CONFIG_LD_ORPHAN_WARN after selecting > CONFIG_ARCH_HAS_LD_ORPHAN_WARN, there are some warnings around certain > ELF sections: > > s390-linux-ld: warning: orphan section `.dynstr' from `arch/s390/kernel/head64.o' being placed in section `.dynstr' > s390-linux-ld: warning: orphan section `.dynamic' from `arch/s390/kernel/head64.o' being placed in section `.dynamic' > s390-linux-ld: warning: orphan section `.hash' from `arch/s390/kernel/head64.o' being placed in section `.hash' > s390-linux-ld: warning: orphan section `.gnu.hash' from `arch/s390/kernel/head64.o' being placed in section `.gnu.hash' > > Explicitly keep those sections like other architectures when > CONFIG_RELOCATABLE is enabled, which is always true for s390. > > [hca@linux.ibm.com: keep sections instead of discarding] > Signed-off-by: Nathan Chancellor <nathan@kernel.org> > Link: https://lore.kernel.org/r/20240207-s390-lld-and-orphan-warn-v1-4-8a665b3346ab@kernel.org > Signed-off-by: Heiko Carstens <hca@linux.ibm.com> > --- > arch/s390/kernel/vmlinux.lds.S | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S > index 661a487a3048..d46e3c383952 100644 > --- a/arch/s390/kernel/vmlinux.lds.S > +++ b/arch/s390/kernel/vmlinux.lds.S > @@ -200,6 +200,21 @@ SECTIONS > *(.rela*) > __rela_dyn_end = .; > } > + .dynamic ALIGN(8) : { > + *(.dynamic) > + } > + .dynsym ALIGN(8) : { > + *(.dynsym) > + } > + .dynstr ALIGN(8) : { > + *(.dynstr) > + } > + .hash ALIGN(8) : { > + *(.hash) > + } > + .gnu.hash ALIGN(8) : { > + *(.gnu.hash) > + } > > . = ALIGN(PAGE_SIZE); > __init_end = .; /* freed after init ends here */ > -- > 2.40.1 >
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 661a487a3048..35a6b3e6cc50 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -264,6 +264,7 @@ SECTIONS DISCARDS /DISCARD/ : { *(.eh_frame) - *(.interp) + *(.interp .dynamic) + *(.dynstr .hash .gnu.hash) } }