[lld] [lld] Fix undefined behavior with misaligned SHT_GROUP section. (PR #180848)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 09:48:33 PST 2026


MaskRay wrote:

> This looks good to me. I couldn't find anything in the ELF spec that requires groups to have a minimum of 4-byte alignment, although arguably it should have. With that in mind I think supporting it is better than refusing to support it.

I have noticed that the search recall on groups.google.com has significantly degraded. I remember a previous discussion suggesting that a description like " an array of Elf32_Word/Elf64_Word" implies the alignment, but I cannot find the thread.
However, I don't read that as a requirement.

For example, searching by title fails to find https://groups.google.com/g/generic-abi/c/vT-_QVcckXo ("Alignment and sizes of note sections in 64-bit ELF objects") - a post related to binutils or gnu-gabi discussion how some new Linux SHT_NOTE sections transitioned from alignment 4 to alignment 8.

That said, I agree that we should support 1-byte aligned SHT_GROUP sections. Furthermore, I believe ELF's design emphasizes natural size and alignment guidelines for its control structures is outdated.


https://github.com/llvm/llvm-project/pull/180848


More information about the llvm-commits mailing list