[PATCH] elf: Keep SHT_NULL sections in executable and shared library
Jan Beulich
jbeulich@suse.com
Sun Jun 29 13:30:12 GMT 2025
On 29.06.2025 09:56, H.J. Lu wrote:
> Some linkers generate SHT_NULL sections in executable and shared
> library:
>
> Section Headers:
> [Nr] Name Type Address Offset
> Size EntSize Flags Link Info Align
> [ 0] NULL 0000000000000000 00000000
> 0000000000000000 0000000000000000 A 0 0 0
> [ 1] .phdr NULL 0000000000000040 00000040
> 0000000000000000 0000000000000000 A 0 0 0
> [ 2] .shdr NULL 0000000000000238 00000238
> 0000000000000000 0000000000000000 A 0 0 0
> [ 3] .note.gnu.pr[...] NOTE 0000000000000938 00000938
> ...
> Section to Segment mapping:
> Segment Sections...
> 00
> 01 .phdr .shdr .note.gnu.property .gnu.hash .dynsym .dynstr .gnu.version
> .gnu.version_r .rela.dyn .rodata .eh_frame_hdr .eh_frame
>
> We must keep SHT_NULL sections in executable and shared library if there
> is a non-empty SHT_DYNSYM section since removing them may change section
> indexes in SHT_DYNSYM section.
Question: Why would it every be okay to remove / re-use them? IOW
shouldn't we unconditionally keep them?
Jan
More information about the Binutils
mailing list