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

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 6 13:05:04 PDT 2018


pcc added a comment.

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


https://reviews.llvm.org/D50174





More information about the llvm-commits mailing list