[PATCH] D85867: [ELF] Assign file offsets of non-SHF_ALLOC after SHF_ALLOC and set sh_addr=0 to non-SHF_ALLOC
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 14 07:59:56 PDT 2020
MaskRay added inline comments.
================
Comment at: lld/ELF/LinkerScript.cpp:925
}
+
+ if (!(sec->flags & SHF_ALLOC))
----------------
psmith wrote:
> I think it's worth adding a comment. Suggest something like:
> // Non-SHF_ALLOC sections do not affect the addresses of other OutputSections as they are not part of the process image.
Adopted. Thanks
================
Comment at: lld/ELF/Writer.cpp:1236
findOrphanPos(std::vector<BaseCommand *>::iterator b,
std::vector<BaseCommand *>::iterator e) {
OutputSection *sec = cast<OutputSection>(*e);
----------------
psmith wrote:
> I guess we've removed this as it is not strictly necessary any more?
Correct. Non-SHF_ALLOC sections affected address ranges so we moved orphan sections to the end to avoid their side effect. Now non-SHF_ALLOC orphan sections do not affect SHF_ALLOC.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85867/new/
https://reviews.llvm.org/D85867
More information about the llvm-commits
mailing list