Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2761130rdb; Mon, 12 Feb 2024 16:16:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUUXmV8QVuwxqS2QzQPaVDM0IT2HPsVvoJ6Dk9arJW4jpDRm+Q3fm1ZzJOTlwhw/5Hiw26dCMpvaCa9TDhCnMOwe4OuKkhvW669+Crf2Q== X-Google-Smtp-Source: AGHT+IGhnQbAQK2kQX1DmoH9+OE3HwYRv8PzYEif+kThesNBEJWyKIRroI3KxgCNYaQCyy1pqwxH X-Received: by 2002:a05:6808:3089:b0:3c0:453b:ef16 with SMTP id bl9-20020a056808308900b003c0453bef16mr100952oib.38.1707783406563; Mon, 12 Feb 2024 16:16:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707783406; cv=pass; d=google.com; s=arc-20160816; b=ikEjQWZp4lNSDN1ISDem4AfWkKsKfBno3pLIn87YilzjGdJxMLveuatuvluX1/IKs9 POPKwP+noKAQDGEV3+pea6hfHZvFoQTHvcKCCex757dO6lD2n8eZ75RRdUBrdxdT7dMm mhrMVjywefd7AQOvWnRRvA48TO4KCjXcQytLhrwilCJ5wzrNI6S4Fv2iU6Kz0UW7szRW f7C25ChxxsHRtYmLZgdh+IVy/97ZmjTVvofu2ip59KqMFOeTSKCjmsNV0kHtD0PBuZ1g OOWV/LBEhyJHUp3orJDMml3b11GTUDUnZIvJB6vPXO5klEJfzWJmz5bVxmZ6Q72pMtl0 N+AA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+1wJ+EFd1ab+CtKIoLUYRZP31LYsvm9jGs7YI2k/TIw=; fh=ofhFSOXS3N8rBv8Hfm4KUcW0VROHcrJUByMadDLqECc=; b=sOUhlIcEQwP4OwjyHvMgmNKHhW9ESWTKKkujFfPDSIm0LWjbQiRnvMXmJ+n/Uf9gh2 rNHY7/w3f5iMDed/2+Nfx6o95exZk3UMKFPyi6krEOsbLW29n/TmeKJeGnofV9/bnekG BJ0/GaKMC1c8heqfz82fJxhxBolOQID9NDoU8U+z6ZwjYJS7iPtP4gY7BIY8BcPTOB4l UWLNinbGrVyvNkxruNy7wW48WPZeD8Lf2/oovDyWlReXk72Vpg37UiDY4Wm4aX/39Pbo 7mDr3E1UPTeqcARBBsxfala5luLl7+9EC2C5+WJR3kVEM3rW9WYNGaygPfhGBiKptQw3 0k9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HRu7Kq5N; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62569-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62569-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCXKT96zqeDm3Eu4t5+ESOgxMa49OJWUs14/OOPgEthQZSjS4cefKk3WMkebDI5zAvvkMljDh70JqvHpRyv3yy535iHgJGZ3ytOFY8NxpQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d8-20020a05622a15c800b0042da7adc161si1650224qty.611.2024.02.12.16.16.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 16:16:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62569-linux.lists.archive=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=HRu7Kq5N; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62569-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62569-linux.lists.archive=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 52D901C22FA8 for ; Tue, 13 Feb 2024 00:16:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3975B23A0; Tue, 13 Feb 2024 00:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HRu7Kq5N" 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 59A1A8F4D; Tue, 13 Feb 2024 00:15:50 +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=1707783351; cv=none; b=QMqStliUnZ9FNemRheOolVdzBYxE9TWPk/BYUEIhQd+gfydM+KnKn0UmclDv2Ur/iPKknojuC2spg/H5MLealwEvPaHnVUMGxwes8Uk4duBhpcB0hYLQmT7772wnr2cgiIon4Er0s0UYj2Adu2CMSiUZ4d/JQa+TqZl+U7+YaLM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707783351; c=relaxed/simple; bh=pGauPJe3pc7ZiPndNvLC3iAdr8bnuuyJx3XLyQ1nH+w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SbEb/2IKfxuZi/U/wStm/6irA3oNrvghU+I82kB9OVEqOOgjVIarOQuGQqDExE9NUQK7bd24YAVb8X9BB2S9JuUgEplyGL7etbhSAp2Qa+6pLaIbopMki4IJ/5p0+i0HNgLzxTmXwqo9DaPCdSY0eYinuMK4YwhUMKKnE1VrKbM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HRu7Kq5N; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DF56C433C7; Tue, 13 Feb 2024 00:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707783350; bh=pGauPJe3pc7ZiPndNvLC3iAdr8bnuuyJx3XLyQ1nH+w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HRu7Kq5N/r4Q6jC40gbj2fXRkIiJyYdybBD3jAEG3u44DQawDKCCRf+OriNIkmHaM O3xoK/t+u2mlk2oGrPlWC1AVzhoCdxc4H/vMthGgbSyd2JPogTpSca5HWd1ojKQ+Hu /I0MMY0o/MgkV63FyVi9cNFSYbRPOIURWXvlLAUpTxLJzeO6/LGRxtHp3q4jOh0tf3 kFviHv6324k/eNaAEuPr5p815McbZcv53aZhuxFNiZwumJpmJiH/e2/hT+y/Cj1od2 uI4ynLfy+l2Uv8xkpD76mgu2SIMTCWDt1l2CkMICuGW4EHWSEaGv/DuvHsMH5z4oeL kFMgaFSlAMBMA== Date: Mon, 12 Feb 2024 17:15:48 -0700 From: Nathan Chancellor To: Heiko Carstens Cc: gor@linux.ibm.com, agordeev@linux.ibm.com, 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 Subject: Re: [PATCH 04/11] s390: vmlinux.lds.S: Discard unnecessary sections Message-ID: <20240213001548.GA3272429@dev-arch.thelio-3990X> References: <20240207-s390-lld-and-orphan-warn-v1-0-8a665b3346ab@kernel.org> <20240207-s390-lld-and-orphan-warn-v1-4-8a665b3346ab@kernel.org> <20240212135511.65142-A-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240212135511.65142-A-hca@linux.ibm.com> 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 > > --- > > 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 > Link: https://lore.kernel.org/r/20240207-s390-lld-and-orphan-warn-v1-4-8a665b3346ab@kernel.org > Signed-off-by: Heiko Carstens > --- > 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 >