[PATCH] gas: check section size against entry size
Alan Modra
amodra@gmail.com
Mon Jul 14 10:14:21 GMT 2025
On Mon, Jul 14, 2025 at 11:11:36AM +0200, Jan Beulich wrote:
> If a section has a non-zero entry size, its total size would generally
> better be a multiple of the entry size. Warn if that's not the case.
Makes sense.
> Does the warning perhaps need hiding behind a (default-off) command line
> option?
Not unless it triggers too much. :-)
> For ELF, the spec doesn't mandate that only SHF_MERGE and SHF_STRINGS
> sections may have a non-zero entry size. Should we permit other sections
> to also have an entry size specified (e.g. via one of the presently
> unused section letters 'E', 'z', or 'Z')? That way custom sections with
> fixed element size could leverage e.g. the warning being added here.
I wouldn't be inclined to add such support until someone wants it
enough to provide a patch.
> As far as the linker is concerned, I find it difficult to establish a
> sensible checking strategy:
Maybe only for ld -r?
--
Alan Modra
More information about the Binutils
mailing list