[PATCH] D21482: Support/ELF: Add R_AMDGPU_GOTPCREL relocation
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 23 16:18:22 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273628: Support/ELF: Add R_AMDGPU_GOTPCREL relocation (authored by tstellar).
Changed prior to commit:
http://reviews.llvm.org/D21482?vs=61154&id=61742#toc
Repository:
rL LLVM
http://reviews.llvm.org/D21482
Files:
llvm/trunk/docs/CodeGenerator.rst
llvm/trunk/include/llvm/Support/ELFRelocs/AMDGPU.def
llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
llvm/trunk/test/MC/AMDGPU/reloc.s
Index: llvm/trunk/test/MC/AMDGPU/reloc.s
===================================================================
--- llvm/trunk/test/MC/AMDGPU/reloc.s
+++ llvm/trunk/test/MC/AMDGPU/reloc.s
@@ -3,10 +3,14 @@
// CHECK: Relocations [
// CHECK: R_AMDGPU_ABS32_LO SCRATCH_RSRC_DWORD0 0x0
// CHECK: R_AMDGPU_ABS32_HI SCRATCH_RSRC_DWORD1 0x0
+// CHECK: R_AMDGPU_GOTPCREL global_var 0x0
// CHECK: ]
kernel:
s_mov_b32 s0, SCRATCH_RSRC_DWORD0
s_mov_b32 s1, SCRATCH_RSRC_DWORD1
+ s_mov_b32 s2, global_var at GOTPCREL
+
+.globl global_var
.globl SCRATCH_RSRC_DWORD0
Index: llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
+++ llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
@@ -45,6 +45,13 @@
if (Target.getSymA()->getSymbol().getName() == "SCRATCH_RSRC_DWORD1")
return ELF::R_AMDGPU_ABS32_HI;
+ switch (Target.getAccessVariant()) {
+ default:
+ break;
+ case MCSymbolRefExpr::VK_GOTPCREL:
+ return ELF::R_AMDGPU_GOTPCREL;
+ }
+
switch (Fixup.getKind()) {
default: break;
case FK_PCRel_4:
Index: llvm/trunk/docs/CodeGenerator.rst
===================================================================
--- llvm/trunk/docs/CodeGenerator.rst
+++ llvm/trunk/docs/CodeGenerator.rst
@@ -2676,6 +2676,9 @@
* **A** --- Represents the addend used to compute the value of the relocatable
field
+* **G** --- Represents the offset into the global offset table at which the
+ relocation entry’s symbol will reside during execution.
+* **GOT** --- Represents the address of the global offset table.
* **P** --- Represents the place (section offset or address) of the storage unit
being relocated (computed using ``r_offset``)
* **S** --- Represents the value of the symbol whose index resides in the
@@ -2694,4 +2697,5 @@
``R_AMDGPU_REL32`` 4 ``word32`` S + A - P
``R_AMDGPU_REL64`` 5 ``word64`` S + A - P
``R_AMDGPU_ABS32`` 6 ``word32`` S + A
+ ``R_AMDGPU_GOTPCREL`` 7 ``word32`` G + GOT + A - P
===================== ===== ========== ====================
Index: llvm/trunk/include/llvm/Support/ELFRelocs/AMDGPU.def
===================================================================
--- llvm/trunk/include/llvm/Support/ELFRelocs/AMDGPU.def
+++ llvm/trunk/include/llvm/Support/ELFRelocs/AMDGPU.def
@@ -9,3 +9,4 @@
ELF_RELOC(R_AMDGPU_REL32, 4)
ELF_RELOC(R_AMDGPU_REL64, 5)
ELF_RELOC(R_AMDGPU_ABS32, 6)
+ELF_RELOC(R_AMDGPU_GOTPCREL, 7)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21482.61742.patch
Type: text/x-patch
Size: 2623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160623/29415f23/attachment.bin>
More information about the llvm-commits
mailing list