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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 14:01:59 PDT 2016


On Tue, Jul 19, 2016 at 3:55 PM, Eugene Leviant <evgeny.leviant at gmail.com>
wrote:

> 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
>

I see. The reason why I didn't find it is probably because it is inside
isDiscarded -- it does more than what the name implies. I'd remove
`S->OutSec` and move that piece of code to LinkerScript::createSections to
make it explicit.


>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D22455
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160719/c11b2e51/attachment.html>


More information about the llvm-commits mailing list