[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 04:39:37 PDT 2019


MaskRay marked 2 inline comments as done.
MaskRay added inline comments.


================
Comment at: ELF/LinkerScript.cpp:883
     if (Sec->Live)
       Flags = Sec->Flags;
 
----------------
ruiu wrote:
> Sec->Flags can have  SHF_ALLOC bit on while Sec->NonAlloc is true? If so, it sounds like a contradiction... Maybe we should fix that?
In this function (`adjustSectionBeforeSorting`), `Sec->Flags` is consistent with `Sec->NonAlloc`. This is because `processSectionCommands` runs before and does if (Sec->NonAlloc) Sec->Flags &= ~(uint64_t)SHF_ALLOC;`.

This patch makes the inferred flags for empty output sections correct.


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