[lld] r257141 - ELF: Remove SIZE relocs from isRelRelative.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 7 19:25:27 PST 2016


Author: ruiu
Date: Thu Jan  7 21:25:26 2016
New Revision: 257141

URL: http://llvm.org/viewvc/llvm-project?rev=257141&view=rev
Log:
ELF: Remove SIZE relocs from isRelRelative.

SIZE relocations are not PC-relative, so isRelRelative should return false.

Modified:
    lld/trunk/ELF/Target.cpp
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=257141&r1=257140&r2=257141&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Thu Jan  7 21:25:26 2016
@@ -714,8 +714,6 @@ bool X86_64TargetInfo::isRelRelative(uin
   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;
   }
 }

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=257141&r1=257140&r2=257141&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Jan  7 21:25:26 2016
@@ -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())




More information about the llvm-commits mailing list