[PATCH] D13563: [ELF2] Implement PPC64TargetInfo::isRelRelative

hfinkel@anl.gov via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 10:09:12 PDT 2015


hfinkel created this revision.
hfinkel added reviewers: ruiu, rafael, davide.
hfinkel added a subscriber: llvm-commits.
hfinkel added a project: lld.

This is essentially patern-matching against the x86 target. It is still missing a test case, but feedback is certainly appreciated.


http://reviews.llvm.org/D13563

Files:
  ELF/Target.cpp
  ELF/Target.h

Index: ELF/Target.h
===================================================================
--- ELF/Target.h
+++ ELF/Target.h
@@ -87,6 +87,7 @@
   void relocateOne(uint8_t *Buf, const void *RelP, uint32_t Type,
                    uint64_t BaseAddr, uint64_t SymVA,
                    uint64_t GotVA) const override;
+  bool isRelRelative(uint32_t Type) const override;
 };
 
 class PPCTargetInfo final : public TargetInfo {
Index: ELF/Target.cpp
===================================================================
--- ELF/Target.cpp
+++ ELF/Target.cpp
@@ -240,6 +240,7 @@
   PCRelReloc = R_PPC64_REL24;
   GotReloc = R_PPC64_GLOB_DAT;
   GotRefReloc = R_PPC64_REL64;
+  RelativeReloc = R_PPC64_RELATIVE;
   PltEntrySize = 32;
   PageSize = 0x10000;
   VAStart = 0x10000000;
@@ -300,6 +301,18 @@
     return S.isShared() || (S.isUndefined() && S.isWeak());
   }
 }
+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:
+    return true;
+  }
+}
 void PPC64TargetInfo::relocateOne(uint8_t *Buf, const void *RelP, uint32_t Type,
                                   uint64_t BaseAddr, uint64_t SymVA,
                                   uint64_t GotVA) const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13563.36871.patch
Type: text/x-patch
Size: 1341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151008/368bc89d/attachment.bin>


More information about the llvm-commits mailing list