summaryrefslogtreecommitdiffstats
path: root/lld/ELF
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2015-12-10 09:03:39 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2015-12-10 09:03:39 +0000
commitb72a9c6f02e4b2db591257c4ea67ae00257950bb (patch)
tree9355b1b2b57a5c10f22b67c45de019d6f20d597d /lld/ELF
parenta92ffb011eef742665cf1d96358af4383de44353 (diff)
downloadbcm5719-llvm-b72a9c6f02e4b2db591257c4ea67ae00257950bb.tar.gz
bcm5719-llvm-b72a9c6f02e4b2db591257c4ea67ae00257950bb.zip
[ELF] - Resolve R_386_PLT32 statically in some cases.
If R_386_PLT32 relocation is applied against symbol that can not be preempted then it can be resolved statically. Patch implements it for x86 target. Differential revision: http://reviews.llvm.org/D15376 llvm-svn: 255233
Diffstat (limited to 'lld/ELF')
-rw-r--r--lld/ELF/Target.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index c98e694e49d..3751655e1d6 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -333,7 +333,8 @@ bool X86TargetInfo::relocNeedsGot(uint32_t Type, const SymbolBody &S) const {
}
bool X86TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
- return Type == R_386_PLT32 || (Type == R_386_PC32 && S.isShared());
+ return (Type == R_386_PLT32 && canBePreempted(&S, true)) ||
+ (Type == R_386_PC32 && S.isShared());
}
void X86TargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
@@ -350,6 +351,7 @@ void X86TargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
add32le(Loc, SA + Out<ELF32LE>::Got->getVA() - P);
break;
case R_386_PC32:
+ case R_386_PLT32:
add32le(Loc, SA - P);
break;
case R_386_TLS_GD:
OpenPOWER on IntegriCloud