[PATCH] D61186: [LLD][ELF] /DISCARD/ output sections should not be orphans

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 07:56:05 PDT 2019


grimar added a comment.

>From what I see in the output for this case LLD creates an `/DISCARD/` output section. 
This does not look correct to me, because `/DISCARD/` is kind of key word, but not a section name I believe.
Also, bfd does not do that.

So I think issue first of all is that we are trying to create output section with this name, it should never be in the output.



================
Comment at: ELF/LinkerScript.cpp:485
         Sec->SectionCommands.clear();
+        Sec->SectionIndex = 0; // Not an orphan.
         continue;
----------------
For other reviewers, this is for the following place, right?
https://github.com/llvm-mirror/lld/blob/master/ELF/Writer.cpp#L1385


================
Comment at: test/ELF/linkerscript/discard-phdr.s:13
+# RUN:  .baz : { *(.baz) } \
+# RUN:  /DISCARD/ : { *(.comment) } :NONE \
+# RUN: }" > %t.script
----------------
I would suggest to use section explicitly listed in the asm.



================
Comment at: test/ELF/linkerscript/discard-phdr.s:44
+.section .baz,"aw"
+ .byte 0
----------------
Does not seem you need all of this sections for the test? Please reduce the number.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61186/new/

https://reviews.llvm.org/D61186





More information about the llvm-commits mailing list