[llvm] r334443 - AMDGPU: Add 64-bit relative variant kind
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 11 14:37:58 PDT 2018
Author: kzhuravl
Date: Mon Jun 11 14:37:57 2018
New Revision: 334443
URL: http://llvm.org/viewvc/llvm-project?rev=334443&view=rev
Log:
AMDGPU: Add 64-bit relative variant kind
Differential Revision: https://reviews.llvm.org/D47601
Modified:
llvm/trunk/include/llvm/MC/MCExpr.h
llvm/trunk/lib/MC/MCExpr.cpp
llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
llvm/trunk/test/MC/AMDGPU/reloc.s
Modified: llvm/trunk/include/llvm/MC/MCExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=334443&r1=334442&r2=334443&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCExpr.h (original)
+++ llvm/trunk/include/llvm/MC/MCExpr.h Mon Jun 11 14:37:57 2018
@@ -286,6 +286,7 @@ public:
VK_AMDGPU_GOTPCREL32_HI, // symbol at gotpcrel32@hi
VK_AMDGPU_REL32_LO, // symbol at rel32@lo
VK_AMDGPU_REL32_HI, // symbol at rel32@hi
+ VK_AMDGPU_REL64, // symbol at rel64
VK_TPREL,
VK_DTPREL
Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=334443&r1=334442&r2=334443&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Mon Jun 11 14:37:57 2018
@@ -303,6 +303,7 @@ StringRef MCSymbolRefExpr::getVariantKin
case VK_AMDGPU_GOTPCREL32_HI: return "gotpcrel32 at hi";
case VK_AMDGPU_REL32_LO: return "rel32 at lo";
case VK_AMDGPU_REL32_HI: return "rel32 at hi";
+ case VK_AMDGPU_REL64: return "rel64";
}
llvm_unreachable("Invalid variant kind");
}
@@ -410,6 +411,7 @@ MCSymbolRefExpr::getVariantKindForName(S
.Case("gotpcrel32 at hi", VK_AMDGPU_GOTPCREL32_HI)
.Case("rel32 at lo", VK_AMDGPU_REL32_LO)
.Case("rel32 at hi", VK_AMDGPU_REL32_HI)
+ .Case("rel64", VK_AMDGPU_REL64)
.Default(VK_Invalid);
}
Modified: llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp?rev=334443&r1=334442&r2=334443&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp Mon Jun 11 14:37:57 2018
@@ -66,6 +66,8 @@ unsigned AMDGPUELFObjectWriter::getReloc
return ELF::R_AMDGPU_REL32_LO;
case MCSymbolRefExpr::VK_AMDGPU_REL32_HI:
return ELF::R_AMDGPU_REL32_HI;
+ case MCSymbolRefExpr::VK_AMDGPU_REL64:
+ return ELF::R_AMDGPU_REL64;
}
switch (Fixup.getKind()) {
Modified: llvm/trunk/test/MC/AMDGPU/reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AMDGPU/reloc.s?rev=334443&r1=334442&r2=334443&view=diff
==============================================================================
--- llvm/trunk/test/MC/AMDGPU/reloc.s (original)
+++ llvm/trunk/test/MC/AMDGPU/reloc.s Mon Jun 11 14:37:57 2018
@@ -13,6 +13,7 @@
// CHECK: }
// CHECK: .rel.data {
// CHECK: R_AMDGPU_ABS64 temp 0x0
+// CHECK: R_AMDGPU_REL64 temp 0x0
// CHECK: }
// CHECK: ]
@@ -36,12 +37,15 @@ kernel:
.section nonalloc, "w", @progbits
.long var, common_var
-
// 8 byte relocations
.type ptr, at object
.data
.globl ptr
+ .globl foo
.p2align 3
ptr:
.quad temp
.size ptr, 8
+foo:
+ .quad temp at rel64
+ .size foo, 8
More information about the llvm-commits
mailing list