[PATCH] D13579: ELF2: Implement --as-needed.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 14:25:08 PDT 2015


On Fri, Oct 9, 2015 at 2:18 PM, Rafael Ávila de Espíndola <
rafael.espindola at gmail.com> wrote:

> rafael added inline comments.
>
> ================
> Comment at: ELF/Writer.cpp:245
> @@ -242,1 +244,3 @@
> +    if (auto *S = dyn_cast<SharedSymbol<ELFT>>(Body))
> +      S->File->IsUsed = true;
>    }
> ----------------
> I don't think this correctly handles weak symbols.
>
> It should not set the bit if the symbol is only used to satisfy a weak
> undefined.  For that it looks like you need to fetch the original
> SymbolBody, not the replacement.
>

Hrm, that's not something easily be done. Maybe I need to do something in
the symbol table. Let me try.


> ================
> Comment at: test/elf2/as-needed.s:8
> @@ +7,3 @@
> +
> +// RUN: ld.lld2 %t.o %t2.so %t3.so -o %t2
> +// RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s
> ----------------
> Please also add a test for the weak undefined case.
>
>
> http://reviews.llvm.org/D13579
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151009/baf3dd57/attachment.html>


More information about the llvm-commits mailing list