2016-06-21 03:48:29 +08:00
|
|
|
# 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
|
2016-07-21 23:30:13 +08:00
|
|
|
# RUN: llvm-objdump -s %t.so | FileCheck %s --check-prefix=OBJDUMP
|
2016-06-21 03:48:29 +08:00
|
|
|
|
|
|
|
# REQUIRES: amdgpu
|
|
|
|
|
2016-10-21 02:34:58 +08:00
|
|
|
.text
|
2016-06-21 03:48:29 +08:00
|
|
|
|
|
|
|
kernel0:
|
2016-10-14 12:51:43 +08:00
|
|
|
s_mov_b32 s0, common_var0@GOTPCREL+4
|
|
|
|
s_mov_b32 s0, common_var1@gotpcrel32@lo+4
|
|
|
|
s_mov_b32 s0, common_var2@gotpcrel32@hi+4
|
|
|
|
|
|
|
|
s_mov_b32 s0, global_var0@GOTPCREL+4
|
|
|
|
s_mov_b32 s0, global_var1@gotpcrel32@lo+4
|
|
|
|
s_mov_b32 s0, global_var2@gotpcrel32@hi+4
|
|
|
|
|
|
|
|
s_mov_b32 s0, extern_var0@GOTPCREL+4
|
|
|
|
s_mov_b32 s0, extern_var1@gotpcrel32@lo+4
|
|
|
|
s_mov_b32 s0, extern_var2@gotpcrel32@hi+4
|
|
|
|
|
|
|
|
s_mov_b32 s0, weak_var0@GOTPCREL+4
|
|
|
|
s_mov_b32 s0, weak_var1@gotpcrel32@lo+4
|
|
|
|
s_mov_b32 s0, weak_var2@gotpcrel32@hi+4
|
|
|
|
|
|
|
|
s_mov_b32 s0, weakref_var0@GOTPCREL+4
|
|
|
|
s_mov_b32 s0, weakref_var1@gotpcrel32@lo+4
|
|
|
|
s_mov_b32 s0, weakref_var2@gotpcrel32@hi+4
|
|
|
|
|
|
|
|
s_mov_b32 s0, local_var0+4
|
|
|
|
s_mov_b32 s0, local_var1@rel32@lo+4
|
|
|
|
s_mov_b32 s0, local_var2@rel32@hi+4
|
|
|
|
|
2016-06-21 03:48:29 +08:00
|
|
|
s_endpgm
|
|
|
|
|
2016-10-14 12:51:43 +08:00
|
|
|
.comm common_var0,1024,4
|
|
|
|
.comm common_var1,1024,4
|
|
|
|
.comm common_var2,1024,4
|
|
|
|
.globl global_var0
|
|
|
|
.globl global_var1
|
|
|
|
.globl global_var1
|
|
|
|
.weak weak_var0
|
|
|
|
.weak weak_var1
|
|
|
|
.weak weak_var2
|
|
|
|
.weakref weakref_var0, weakref_alias_var0
|
|
|
|
.weakref weakref_var1, weakref_alias_var1
|
|
|
|
.weakref weakref_var2, weakref_alias_var2
|
|
|
|
.local local_var0
|
|
|
|
.local local_var1
|
|
|
|
.local local_var2
|
2016-06-21 03:48:29 +08:00
|
|
|
|
2016-10-21 02:34:58 +08:00
|
|
|
# R_AMDGPU_ABS32:
|
2016-07-21 23:30:13 +08:00
|
|
|
.section nonalloc, "w", @progbits
|
2016-10-14 12:51:43 +08:00
|
|
|
.long var0, common_var2+4
|
|
|
|
.long var1, common_var1+8
|
|
|
|
.long var2, common_var0+12
|
2016-07-21 23:30:13 +08:00
|
|
|
|
2016-10-21 02:34:58 +08:00
|
|
|
# R_AMDGPU_ABS64:
|
|
|
|
.type ptr, @object
|
|
|
|
.data
|
|
|
|
.globl ptr
|
|
|
|
.p2align 3
|
|
|
|
ptr:
|
|
|
|
.quad temp
|
|
|
|
.size ptr, 8
|
|
|
|
|
2016-10-14 12:51:43 +08:00
|
|
|
# The relocation for local_var{0, 1, 2} and var should be resolved by the
|
|
|
|
# linker.
|
2016-06-21 03:48:29 +08:00
|
|
|
# CHECK: Relocations [
|
2016-07-05 03:19:07 +08:00
|
|
|
# CHECK: .rela.dyn {
|
2016-10-14 12:51:43 +08:00
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 common_var0 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 common_var1 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 common_var2 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 extern_var0 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 extern_var1 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 extern_var2 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 global_var0 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 global_var1 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 global_var2 0x0
|
2016-10-21 02:34:58 +08:00
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 temp 0x0
|
2016-10-14 12:51:43 +08:00
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 weak_var0 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 weak_var1 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 weak_var2 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 weakref_alias_var0 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 weakref_alias_var1 0x0
|
|
|
|
# CHECK-NEXT: R_AMDGPU_ABS64 weakref_alias_var2 0x0
|
2016-07-05 03:19:07 +08:00
|
|
|
# CHECK-NEXT: }
|
2016-06-21 03:48:29 +08:00
|
|
|
# CHECK-NEXT: ]
|
2016-07-21 23:30:13 +08:00
|
|
|
|
|
|
|
# OBJDUMP: Contents of section nonalloc:
|
2017-01-10 09:21:30 +08:00
|
|
|
# OBJDUMP-NEXT: 0000 00000000 04480000 00000000 08440000
|
|
|
|
# OBJDUMP-NEXT: 00000000 0c400000
|