[PATCH] D21646: AMDGPU/SI: Add support for R_AMDGPU_ABS32
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 19 10:47:06 PDT 2016
kzhuravl updated this revision to Diff 64524.
kzhuravl added a comment.
Update test
https://reviews.llvm.org/D21646
Files:
include/llvm/Object/RelocVisitor.h
lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
test/MC/AMDGPU/reloc.s
Index: test/MC/AMDGPU/reloc.s
===================================================================
--- test/MC/AMDGPU/reloc.s
+++ test/MC/AMDGPU/reloc.s
@@ -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 @@
.globl global_var
.globl SCRATCH_RSRC_DWORD0
+
+.section .data.foo, "w", @progbits
+ .long var, global_var
Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
===================================================================
--- lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
+++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
@@ -56,6 +56,7 @@
default: break;
case FK_PCRel_4:
return ELF::R_AMDGPU_REL32;
+ case FK_Data_4:
case FK_SecRel_4:
return ELF::R_AMDGPU_ABS32;
}
Index: include/llvm/Object/RelocVisitor.h
===================================================================
--- include/llvm/Object/RelocVisitor.h
+++ include/llvm/Object/RelocVisitor.h
@@ -139,6 +139,14 @@
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 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21646.64524.patch
Type: text/x-patch
Size: 1933 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160719/2793ec7b/attachment.bin>
More information about the llvm-commits
mailing list