[PATCH] D38239: [ELF] - Define linkerscript symbols early.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 04:16:35 PST 2017


grimar added a comment.

I investigated it and problem is deeper than I expected.

With this patch (without check for Cmd->IsDefsym),
defsym.ll testcase fails with

  ld.lld.EXE : error : duplicate symbol: bar2
  >>> defined in <internal>
  >>> defined in lto.tmp

It happens because of -defsym:
ld.lld %t.o %t1.o -shared -o %t.so -defsym=bar2=bar3

In this patch I define script symbols early and so define `bar2`, and
after `LTO->compile()'
it fails with duplicate error in `SymbolTable::addRegular()`, because
LTO returns defined symbol `bar2` again.

I tried playing with `Prevailing` flag and undefining them before LTO,
but no luck for now. 
May be somebody knows how this can/should be solved ?


https://reviews.llvm.org/D38239





More information about the llvm-commits mailing list