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 }; 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/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: 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: 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/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"); }