[PATCH] D13808: ELF: Add AMDGPU relocation types

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 06:12:48 PDT 2015


tstellarAMD created this revision.
tstellarAMD added reviewers: rafael, arsenm.
tstellarAMD added a subscriber: llvm-commits.

http://reviews.llvm.org/D13808

Files:
  include/llvm/MC/MCExpr.h
  include/llvm/Support/ELF.h
  include/llvm/Support/ELFRelocs/AMDGPU.def
  lib/MC/MCExpr.cpp
  lib/Object/ELF.cpp
  lib/Object/ELFYAML.cpp

Index: lib/Object/ELFYAML.cpp
===================================================================
--- lib/Object/ELFYAML.cpp
+++ lib/Object/ELFYAML.cpp
@@ -475,6 +475,9 @@
   case ELF::EM_ARM:
 #include "llvm/Support/ELFRelocs/ARM.def"
     break;
+  case ELF::EM_AMDGPU:
+#include "llvm/Support/ELFRelocs/AMDGPU.def"
+    break;
   default:
     llvm_unreachable("Unsupported architecture");
   }
Index: lib/Object/ELF.cpp
===================================================================
--- lib/Object/ELF.cpp
+++ lib/Object/ELF.cpp
@@ -90,6 +90,13 @@
       break;
     }
     break;
+  case ELF::EM_AMDGPU:
+    switch (Type) {
+#include "llvm/Support/ELFRelocs/AMDGPU.def"
+    default:
+      break;
+    }
+    break;
   default:
     break;
   }
Index: lib/MC/MCExpr.cpp
===================================================================
--- lib/MC/MCExpr.cpp
+++ lib/MC/MCExpr.cpp
@@ -299,6 +299,8 @@
   case VK_Hexagon_LD_PLT: return "LDPLT";
   case VK_Hexagon_IE: return "IE";
   case VK_Hexagon_IE_GOT: return "IEGOT";
+  case VK_AMDGPU_32_LO: return "LO";
+  case VK_AMDGPU_32_HI: return "HI";
   case VK_TPREL: return "tprel";
   case VK_DTPREL: return "dtprel";
   }
Index: include/llvm/Support/ELFRelocs/AMDGPU.def
===================================================================
--- /dev/null
+++ include/llvm/Support/ELFRelocs/AMDGPU.def
@@ -0,0 +1,11 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_AMDGPU_NONE,                0)
+ELF_RELOC(R_AMDGPU_32_LO,               1)
+ELF_RELOC(R_AMDGPU_32_HI,               2)
+ELF_RELOC(R_AMDGPU_64,                  3)
+ELF_RELOC(R_AMDGPU_INIT_SAMPLER,        4)
+ELF_RELOC(R_AMDGPU_INIT_IMAGE,          5)
Index: include/llvm/Support/ELF.h
===================================================================
--- include/llvm/Support/ELF.h
+++ include/llvm/Support/ELF.h
@@ -550,6 +550,11 @@
   SHN_HEXAGON_SCOMMON_8   = 0xff04        // Double-word-size access
 };
 
+// ELF Relocation types for AMDGPU
+enum {
+#include "ELFRelocs/AMDGPU.def"
+};
+
 // ELF Relocation types for Hexagon
 enum {
 #include "ELFRelocs/Hexagon.def"
Index: include/llvm/MC/MCExpr.h
===================================================================
--- include/llvm/MC/MCExpr.h
+++ include/llvm/MC/MCExpr.h
@@ -289,6 +289,12 @@
     VK_Hexagon_LD_PLT,
     VK_Hexagon_IE,
     VK_Hexagon_IE_GOT,
+
+    VK_AMDGPU_32_LO,
+    VK_AMDGPU_32_HI,
+    VK_AMDGPU_64,
+    VK_AMDGPU_INIT_SAMPLER,
+    VK_AMDGPU_INIT_IMAGE,
     VK_TPREL,
     VK_DTPREL
   };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13808.37580.patch
Type: text/x-patch
Size: 2539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151016/dd9cbc84/attachment.bin>


More information about the llvm-commits mailing list