[PATCH v3] elf: Don't set sh_offset of .tbss sections beyond EOF
Alan Modra
amodra@gmail.com
Tue Apr 29 23:14:44 GMT 2025
On Wed, Apr 30, 2025 at 05:38:00AM +0800, H.J. Lu wrote:
> If there is no .tdata section, put meaningless sh_offset of .tbss sections
> without file contents somewhere within the first page, in an attempt to
> not point past EOF and avoid sh_offset of zero.
1) Do we have any real world binaries where .tbss alignment is such
that it places sh_offset for the section past all other following
sections? (.tbss has a lot of section following it, in contrast with
.bss.)
2) Even if such binaries exist, do tools that manipulate the binary
still have bugs in their SHT_NOBITS handling?
ie. Is any of this necessary?
I'm inclined to think we should consider going the opposite direction,
removing the hack trying to prevent p_offset from being past
end-of-file if (2) is no longer true.
--
Alan Modra
More information about the Binutils
mailing list