[lld] [ELF] adjustOutputSections: don't copy SHF_EXECINSTR when an output does not contain input sections (PR #70911)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 1 09:17:31 PDT 2023


MaskRay wrote:

> With this change I think we would have flags of A instead of AX. Leaving a non writeable BSS section which looks a bit odd.

This change makes our behavior similar to GNU ld regarding X.

Regarding W, `SHT_PROGBITS` and `SHT_NOBITS` are handled the same in `map_input_to_output_sections` in binutils.
We could make a special case to say every `. += x;` sets W (the code would be a bit complex), but there would be some inconsistency with pure symbol assignments and data commands.
For NOBITS, I think it is reasonable to expect the user provide at least one writable input section.


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


More information about the llvm-commits mailing list