[PATCH] D59986: [ELF] Respect NonAlloc when copying flags from the previous sections
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 1 22:08:22 PDT 2019
MaskRay marked an inline comment as done.
MaskRay added a comment.
> So the rule you said is that, if a section is empty, its section attribute is copied from the previous (non-empty) section.
Yes. `(SHF_ALLOC | SHF_WRITE | SHF_EXECINSTR)` may be copied.
> Therefore, if the previous section is SHF_ALLOC, the empty section would have SHF_ALLOC, and vice versa.
The empty OutputSection may have its `NonAlloc` bit set. In that case, The `SHF_ALLOC` bit shouldn't be copied.
> But you are doing more than copying section attributes -- nullifying only SHF_ALLOC using other bits. Why?
If `Sec->NonAlloc`, `Sec->Flags` can't have the `SHF_ALLOC` bit set. The bit (if set originally) has been cleared by:
void LinkerScript::processSectionCommands() {
...
if (Sec->NonAlloc)
Sec->Flags &= ~(uint64_t)SHF_ALLOC;
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59986/new/
https://reviews.llvm.org/D59986
More information about the llvm-commits
mailing list