[lld] [ELF] Set sh_entsize of .{init, fini, preinit}_array to the word size (PR #226697)
dong jianqiang via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 21:29:32 PDT 2026
dongjianqiang2 wrote:
> If we want parity with GNU, the change belongs to the LLVM integrated assembler (LLVMMC). See #226875
We found this while migrating from GNU ld to lld: our bare-metal runtime reads sh_entsize of .init_array from the linked ELF to walk the entries, and lld's 0 breaks it (GNU ld always writes the word size).
Agreed the writeHeaderTo approach can't tell the two zero cases apart.
#226875 fixes the common case, thanks. The gap left for us is linker-script sections with no input sections (.init_array (TYPE=SHT_INIT_ARRAY) : { ... }). Would a fallback limited to that case be acceptable? If not, we'll carry it downstream.
https://github.com/llvm/llvm-project/pull/226697
More information about the llvm-commits
mailing list