Not every x86 relocation is relative.
Without this predicate we were not producing R_386_RELATIVE relocations.
llvm-svn: 264160
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index 65fb032..0cf8de9 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -85,6 +85,7 @@
void writePltZero(uint8_t *Buf) const override;
void writePlt(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr,
int32_t Index, unsigned RelOff) const override;
+ bool isRelRelative(uint32_t Type) const override;
bool needsCopyRelImpl(uint32_t Type) const override;
bool needsDynRelative(uint32_t Type) const override;
bool needsGot(uint32_t Type, SymbolBody &S) const override;
@@ -396,6 +397,17 @@
PltZeroSize = 16;
}
+bool X86TargetInfo::isRelRelative(uint32_t Type) const {
+ switch (Type) {
+ default:
+ return false;
+ case R_386_PC32:
+ case R_386_PLT32:
+ case R_386_TLS_LDO_32:
+ return true;
+ }
+}
+
void X86TargetInfo::writeGotPltHeader(uint8_t *Buf) const {
write32le(Buf, Out<ELF32LE>::Dynamic->getVA());
}