[PATCH] D50174: [LLD][ELF] - Remove dead code from ArchiveFile.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 6 23:08:31 PDT 2018


grimar added a comment.

In https://reviews.llvm.org/D50174#1189892, @pcc wrote:

> The issue is that if two object files depend on one another, we can end up in a situation where `SymbolTable::fetchLazy` is called recursively multiple times on the same object file, so we need to make sure to do nothing on the second call. Reproducer:
>
>   $ cat a.s
>   .globl a, b
>   a:
>   $ cat b.s
>   .globl a, b
>   b:
>   $ as -o a.o a.s
>   $ as -o b.o b.s
>   $ ar cru foo.a a.o b.o
>   $ ld.lld -eb foo.a -m elf_x86_64
>
>
> With your patch I get:
>
>    ld.lld: error: duplicate symbol: b
>   >>> defined at b.o:(.text+0x0) in archive foo.a
>   >>> defined at b.o:(.text+0x0) in archive foo.a
>   


Thanks a lot for the reproducer, Peter! I'll check it and add a test to LLD.


https://reviews.llvm.org/D50174





More information about the llvm-commits mailing list