[lld] [ELF] adjustOutputSections: don't copy SHF_EXECINSTR when an output does not contain input sections (PR #70911)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 02:27:37 PDT 2023
================
@@ -1193,8 +1193,8 @@ void LinkerScript::adjustOutputSections() {
// We do not want to keep any special flags for output section
// in case it is empty.
if (isEmpty)
- sec->flags = flags & ((sec->nonAlloc ? 0 : (uint64_t)SHF_ALLOC) |
- SHF_WRITE | SHF_EXECINSTR);
+ sec->flags =
----------------
smithp35 wrote:
Could be worth updating the comment on line 1170
```
// The other option is to pick flags that minimize the impact the section
// will have on the rest of the linker. That is why we copy the flags from
// the previous sections. Only a few flags are needed to keep the impact low.
```
Perhaps
"// We do not propagate SHF_EXECINSTR as in some cases this can lead to executable writeable SHT_NOBITS section."
https://github.com/llvm/llvm-project/pull/70911
More information about the llvm-commits
mailing list