[ELF] Simplify processRelocAux and allow a corner-case error
authorFangrui Song <maskray@google.com>
Mon, 19 Aug 2019 15:52:29 +0000 (15:52 +0000)
committerFangrui Song <maskray@google.com>
Mon, 19 Aug 2019 15:52:29 +0000 (15:52 +0000)
commitec4540d8a62cfef017173ce7309adcb9beca4e53
tree2142b8673a3f885b9c1e2515644c5f5e571dd64d
parent471bbb6e72830ad24d8079c5ee2acf0ec1fac961
[ELF] Simplify processRelocAux and allow a corner-case error

After D66007/r369262, if the control flow reaches `if (sym.isUndefined())`, we know:

* The relocation is not a link-time constant => symbol is preemptable => Undefined or SharedSymbol
* Not an undef weak.
* -no-pie.
* The symbol type is neither STT_OBJECT nor STT_FUNC.

ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o can satisfy
these conditions. Delete the isUndefined() test so that we error
`symbol '...' has no type`, because we don't know the type to make the
decision to create copy relocation/canonical PLT.

llvm-svn: 369271
lld/ELF/Relocations.cpp
lld/test/ELF/x86-64-dyn-rel-error.s