Re: [PATCH 2/2] x86/boot/compressed: Remove unnecessary sections from bzImage

From: Arvind Sankar
Date: Sat Feb 22 2020 - 11:22:31 EST


On Sat, Feb 22, 2020 at 08:42:54AM +0100, Borislav Petkov wrote:
> On Fri, Feb 21, 2020 at 11:21:44PM -0800, Fangrui Song wrote:
> > In GNU ld, it seems that .shstrtab .symtab and .strtab are special
> > cased. Neither the input section description *(.shstrtab) nor *(*)
> > discards .shstrtab . I feel that this is a weird case (probably even a bug)
> > that lld should not implement.
>
> Ok, forget what the tools do for a second: why is .shstrtab special and
> why would one want to keep it?
>
> Because one still wants to know what the section names of an object are
> or other tools need it or why?
>
> Thx.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette

.shstrtab is required by the ELF specification. The e_shstrndx field in
the ELF header is the index of .shstrtab, and each section in the
section table is required to have an sh_name that points into the
.shstrtab.