Re: [PATCH 04/11] s390: vmlinux.lds.S: Discard unnecessary sections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> > ---
> >  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@xxxxxxxxxxxxx: keep sections instead of discarding]
> Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> Link: https://lore.kernel.org/r/20240207-s390-lld-and-orphan-warn-v1-4-8a665b3346ab@xxxxxxxxxx
> Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
> ---
>  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
> 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux