[llvm] r276294 - AMDGPU/SI: Add support for R_AMDGPU_ABS32
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 21 08:29:20 PDT 2016
Author: kzhuravl
Date: Thu Jul 21 10:29:19 2016
New Revision: 276294
URL: http://llvm.org/viewvc/llvm-project?rev=276294&view=rev
Log:
AMDGPU/SI: Add support for R_AMDGPU_ABS32
Differential Revision: https://reviews.llvm.org/D21646
Modified:
llvm/trunk/include/llvm/Object/RelocVisitor.h
llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
llvm/trunk/test/MC/AMDGPU/reloc.s
Modified: llvm/trunk/include/llvm/Object/RelocVisitor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/RelocVisitor.h?rev=276294&r1=276293&r2=276294&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/RelocVisitor.h (original)
+++ llvm/trunk/include/llvm/Object/RelocVisitor.h Thu Jul 21 10:29:19 2016
@@ -139,6 +139,14 @@ private:
HasError = true;
return RelocToApply();
}
+ case Triple::amdgcn:
+ switch (RelocType) {
+ case llvm::ELF::R_AMDGPU_ABS32:
+ return visitELF_AMDGPU_ABS32(R, Value);
+ default:
+ HasError = true;
+ return RelocToApply();
+ }
default:
HasError = true;
return RelocToApply();
@@ -403,6 +411,11 @@ private:
return RelocToApply(static_cast<uint32_t>(Res), 4);
}
+ RelocToApply visitELF_AMDGPU_ABS32(RelocationRef R, uint64_t Value) {
+ int64_t Addend = getELFAddend(R);
+ return RelocToApply(Value + Addend, 4);
+ }
+
/// I386 COFF
RelocToApply visitCOFF_I386_SECREL(RelocationRef R, uint64_t Value) {
return RelocToApply(static_cast<uint32_t>(Value), /*Width=*/4);
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=276294&r1=276293&r2=276294&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp Thu Jul 21 10:29:19 2016
@@ -56,6 +56,7 @@ unsigned AMDGPUELFObjectWriter::getReloc
default: break;
case FK_PCRel_4:
return ELF::R_AMDGPU_REL32;
+ case FK_Data_4:
case FK_SecRel_4:
return ELF::R_AMDGPU_ABS32;
}
Modified: llvm/trunk/test/MC/AMDGPU/reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AMDGPU/reloc.s?rev=276294&r1=276293&r2=276294&view=diff
==============================================================================
--- llvm/trunk/test/MC/AMDGPU/reloc.s (original)
+++ llvm/trunk/test/MC/AMDGPU/reloc.s Thu Jul 21 10:29:19 2016
@@ -4,6 +4,7 @@
// 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: R_AMDGPU_ABS32 var 0x0
// CHECK: ]
kernel:
@@ -14,3 +15,6 @@ kernel:
.globl global_var
.globl SCRATCH_RSRC_DWORD0
+
+.section nonalloc, "w", @progbits
+ .long var, common_var
More information about the llvm-commits
mailing list