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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 27 08:03:16 PDT 2019


MaskRay added inline comments.


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




================
Comment at: test/ELF/linkerscript/discard-phdr.s:16
+# RUN: ld.lld -o %t --script %t.script %t.o
+# RUN: llvm-readelf -S -l %t | FileCheck %s
+
----------------
Are all these `.foo` `.bar` `.baz` relevant? This script can probably be simplified to contain just `/DISCARD/ : { *(.comment) } :NONE` and just one another input section description.

Currently we'll see a section named `/DISCARD/` in the `readelf -S %t` output. This patch fixes that.


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

https://reviews.llvm.org/D61186





More information about the llvm-commits mailing list