[PATCH] D21294: ELF/AMDGPU: Add support for R_AMDGPU_REL32 relocations
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 12:55:18 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273192: ELF/AMDGPU: Add support for R_AMDGPU_REL32 relocations (authored by tstellar).
Changed prior to commit:
http://reviews.llvm.org/D21294?vs=60787&id=61295#toc
Repository:
rL LLVM
http://reviews.llvm.org/D21294
Files:
lld/trunk/ELF/Target.cpp
lld/trunk/test/ELF/amdgpu-relocs.s
Index: lld/trunk/test/ELF/amdgpu-relocs.s
===================================================================
--- lld/trunk/test/ELF/amdgpu-relocs.s
+++ lld/trunk/test/ELF/amdgpu-relocs.s
@@ -0,0 +1,18 @@
+# RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa -mcpu=fiji %s -o %t.o
+# RUN: ld.lld -shared %t.o -o %t.so
+# RUN: llvm-readobj -r %t.so | FileCheck %s
+
+# REQUIRES: amdgpu
+
+# Make sure that the reloc for local_var is resolved by lld.
+
+ .text
+
+kernel0:
+ s_mov_b32 s0, local_var+4
+ s_endpgm
+
+ .local local_var
+
+# CHECK: Relocations [
+# CHECK-NEXT: ]
Index: lld/trunk/ELF/Target.cpp
===================================================================
--- lld/trunk/ELF/Target.cpp
+++ lld/trunk/ELF/Target.cpp
@@ -1405,17 +1405,16 @@
llvm_unreachable("invalid relocation for TLS IE to LE relaxation");
}
-// Implementing relocations for AMDGPU is low priority since most
-// programs don't use relocations now. Thus, this function is not
-// actually called (relocateOne is called for each relocation).
-// That's why the AMDGPU port works without implementing this function.
void AMDGPUTargetInfo::relocateOne(uint8_t *Loc, uint32_t Type,
uint64_t Val) const {
- llvm_unreachable("not implemented");
+ assert(Type == R_AMDGPU_REL32);
+ write32le(Loc, Val);
}
RelExpr AMDGPUTargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const {
- llvm_unreachable("not implemented");
+ if (Type != R_AMDGPU_REL32)
+ error("do not know how to handle relocation");
+ return R_PC;
}
ARMTargetInfo::ARMTargetInfo() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21294.61295.patch
Type: text/x-patch
Size: 1594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160620/33c54366/attachment.bin>
More information about the llvm-commits
mailing list