[lld] r250540 - [ELF2/PPC64] Invert PPC64TargetInfo::isRelRelative's default

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 12:01:50 PDT 2015


Author: hfinkel
Date: Fri Oct 16 14:01:50 2015
New Revision: 250540

URL: http://llvm.org/viewvc/llvm-project?rev=250540&view=rev
Log:
[ELF2/PPC64] Invert PPC64TargetInfo::isRelRelative's default

When I initially implemented PPC64TargetInfo::isRelRelative, I included a fixed
set of relative relocations, and made the default false. In retrospect, this
seems unwise in two respects: First, most PPC64 relocations are relative
(either to the base address, the TOC, etc.). Second, most relocation targets
are not appropriate for R_PPC64_RELATIVE (which writes a 64-bit absolute
address). Thus, back off, and include only those relocations for which we test
(or soon will), and are obviously appropriate for R_PPC64_RELATIVE.

Modified:
    lld/trunk/ELF/Target.cpp

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=250540&r1=250539&r2=250540&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Fri Oct 16 14:01:50 2015
@@ -423,14 +423,10 @@ bool PPC64TargetInfo::relocNeedsPlt(uint
 bool PPC64TargetInfo::isRelRelative(uint32_t Type) const {
   switch (Type) {
   default:
-    return false;
-  case R_PPC64_REL24:
-  case R_PPC64_REL14:
-  case R_PPC64_REL14_BRTAKEN:
-  case R_PPC64_REL14_BRNTAKEN:
-  case R_PPC64_REL32:
-  case R_PPC64_REL64:
     return true;
+  case R_PPC64_TOC:
+  case R_PPC64_ADDR64:
+    return false;
   }
 }
 




More information about the llvm-commits mailing list