Fix PR26818.
The hack of using a plt address as the address of an undefined function
only works in executables. Don't try it with shared libraries.
llvm-svn: 262642
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index 893bb5e..9672723 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -328,7 +328,8 @@
// plt. That is identified by special relocation types (R_X86_64_JUMP_SLOT,
// R_386_JMP_SLOT, etc).
if (auto *SS = dyn_cast<SharedSymbol<ELFT>>(&S))
- if (SS->Sym.getType() == STT_FUNC && !refersToGotEntry(Type))
+ if (!Config->Shared && SS->Sym.getType() == STT_FUNC &&
+ !refersToGotEntry(Type))
return Plt_Implicit;
return Plt_No;