diff options
-rw-r--r-- | lld/ELF/Target.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index ccc59fdc3c4..6db1f9044ac 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -714,8 +714,6 @@ bool X86_64TargetInfo::isRelRelative(uint32_t Type) const { case R_X86_64_PC32: case R_X86_64_PC64: case R_X86_64_PLT32: - case R_X86_64_SIZE32: - case R_X86_64_SIZE64: return true; } } diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index bbe0a46011d..f79d400ec78 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -299,9 +299,15 @@ void Writer<ELFT>::scanRelocs( Body->setUsedInDynamicReloc(); continue; } + + // Here we are creating a relocation for the dynamic linker based on + // a relocation from an object file, but some relocations need no + // load-time fixup. Skip such relocation. bool CBP = canBePreempted(Body, NeedsGot); - if (!CBP && (!Config->Shared || Target->isRelRelative(Type))) + bool NoDynrel = Target->isRelRelative(Type) || Target->isSizeReloc(Type); + if (!CBP && (NoDynrel || !Config->Shared)) continue; + if (CBP) Body->setUsedInDynamicReloc(); if (NeedsPlt && Target->supportsLazyRelocations()) |