[PATCH] D39058: [ELF] - Simplify reporting of garbage collected sections.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 21:28:40 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/LinkerScript.cpp:286
     for (InputSectionBase *Sec : InputSections) {
-      if (Sec->Assigned)
+      if (Sec->Assigned || !Sec->Live)
         continue;
----------------
grimar wrote:
> ruiu wrote:
> > Question: is it possible that a section is assigned to some output section but is not live? It sounds like a bad state to me.
> Yes, it is possible for following case:
> `/DISCARD/ : {*(.text*)}`
> Here we set Assigned flag for .text. It is probably OK it seems ?
> 
> (I would probably try to completely get rid of 'Assigned' flag, I think we should be able to do that).
No, I don't think that is OK. `/DISCARD/` is a keyword and not a real section. Sections discarded by `/DISCARD/` should be not Assigned and not Live.


https://reviews.llvm.org/D39058





More information about the llvm-commits mailing list