[PATCH] D21654: ELF/AMDGPU: Add support for R_AMDGPU_ABS32

Konstantin Zhuravlyov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 08:37:45 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL276295: ELF/AMDGPU: Add support for R_AMDGPU_ABS32 (authored by kzhuravl).

Changed prior to commit:
  https://reviews.llvm.org/D21654?vs=64535&id=64903#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D21654

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
@@ -1,6 +1,7 @@
 # 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
+# RUN: llvm-objdump -s %t.so | FileCheck %s --check-prefix=OBJDUMP
 
 # REQUIRES: amdgpu
 
@@ -21,7 +22,10 @@
   .weak   weak_var
   .weakref weakref_var, weakref_alias_var
 
-# The relocation for local_var should be resolved by the linker.
+.section nonalloc, "w", @progbits
+  .long var, common_var
+
+# The relocation for local_var and var should be resolved by the linker.
 # CHECK: Relocations [
 # CHECK: .rela.dyn {
 # CHECK-NEXT: R_AMDGPU_ABS64 common_var 0x0
@@ -31,3 +35,6 @@
 # CHECK-NEXT: R_AMDGPU_ABS64 weakref_alias_var 0x0
 # CHECK-NEXT: }
 # CHECK-NEXT: ]
+
+# OBJDUMP: Contents of section nonalloc:
+# OBJDUMP-NEXT: 0000 00000000 00300000
Index: lld/trunk/ELF/Target.cpp
===================================================================
--- lld/trunk/ELF/Target.cpp
+++ lld/trunk/ELF/Target.cpp
@@ -1461,6 +1461,7 @@
 void AMDGPUTargetInfo::relocateOne(uint8_t *Loc, uint32_t Type,
                                    uint64_t Val) const {
   switch (Type) {
+  case R_AMDGPU_ABS32:
   case R_AMDGPU_GOTPCREL:
   case R_AMDGPU_REL32:
     write32le(Loc, Val);
@@ -1472,6 +1473,8 @@
 
 RelExpr AMDGPUTargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const {
   switch (Type) {
+  case R_AMDGPU_ABS32:
+    return R_ABS;
   case R_AMDGPU_REL32:
     return R_PC;
   case R_AMDGPU_GOTPCREL:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21654.64903.patch
Type: text/x-patch
Size: 1678 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160721/37a50e4d/attachment.bin>


More information about the llvm-commits mailing list