From 5d4d137132d719d0d20d119375b205d6a2c721ee Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 4 Jan 2017 22:11:50 +0000 Subject: Vendor import of lld trunk r291012: https://llvm.org/svn/llvm-project/lld/trunk@291012 --- ELF/Target.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ELF/Target.cpp') diff --git a/ELF/Target.cpp b/ELF/Target.cpp index edae7c65c1b4..d82e654b9c4c 100644 --- a/ELF/Target.cpp +++ b/ELF/Target.cpp @@ -1730,8 +1730,11 @@ void ARMTargetInfo::writePlt(uint8_t *Buf, uint64_t GotEntryAddr, RelExpr ARMTargetInfo::getThunkExpr(RelExpr Expr, uint32_t RelocType, const InputFile &File, const SymbolBody &S) const { - // If S is an undefined weak symbol we don't need a Thunk - if (S.isUndefined()) + // If S is an undefined weak symbol in an executable we don't need a Thunk. + // In a DSO calls to undefined symbols, including weak ones get PLT entries + // which may need a thunk. + if (S.isUndefined() && !S.isLocal() && S.symbol()->isWeak() + && !Config->Shared) return Expr; // A state change from ARM to Thumb and vice versa must go through an // interworking thunk if the relocation type is not R_ARM_CALL or -- cgit v1.3