[PATCH] D22455: [ELF] Create output sections in LinkerScript class

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 13:55:32 PDT 2016


evgeny777 added inline comments.

================
Comment at: ELF/LinkerScript.cpp:245
@@ +244,3 @@
+      if (!isDiscarded(C))
+        addInputSection(Factory, C, getOutputSectionName(C), Result);
+
----------------
ruiu wrote:
> Does this work? It adds the same section again if it is mentioned in a linker script.
Yes. When input section is added to output section, the OutSec member variable of InputSectionBase<ELFT> class points to output section class instance. It is being checked inside LinkerScript<ELFT>::isDiscarded method:
```
return !S || !S->Live || S->OutSec || getOutputSection(S) == "/DISCARD/";
```

So input section can't be added twice


Repository:
  rL LLVM

https://reviews.llvm.org/D22455





More information about the llvm-commits mailing list