[lld] [ELF] Set sh_entsize of .{init, fini, preinit}_array to the word size (PR #226697)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 27 20:02:41 PDT 2026


MaskRay wrote:

Reject. writeHeaderTo can't tell "no input provided an entry size" from "inputs disagreed". commitSection sets entsize = 0 for the second case on purpose, and this patch overrides that. 

GNU ld's behavior comes from BFD's generic section setup, not from a requirement. The gABI permits 0, and nothing I know of reads `sh_entsize` of these sections (loaders use DT_INIT_ARRAYSZ, static linking  uses  __init_array_start`/`__init_array_end`). Is there a consumer that needs this?

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


More information about the llvm-commits mailing list