2 # RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa -mcpu=fiji %s -o %t.o
3 # RUN: ld.lld --hash-style=sysv -shared %t.o -o %t.so
4 # RUN: llvm-readobj -r %t.so | FileCheck %s
5 # RUN: llvm-nm %t.so | FileCheck %s --check-prefix=NM
6 # RUN: llvm-readelf -x .rodata -x nonalloc %t.so | FileCheck %s --check-prefix=HEX
8 ## ABS64 and RELATIVE64 relocs do not cause --check-dynamic-relocations errors.
9 # RUN: ld.lld --hash-style=sysv -shared %t.o -o /dev/null --apply-dynamic-relocs
14 s_mov_b32 s0
, common_var0@GOTPCREL+
4
15 s_mov_b32 s0
, common_var1@gotpcrel32@lo+
4
16 s_mov_b32 s0
, common_var2@gotpcrel32@hi+
4
18 s_mov_b32 s0
, global_var0@GOTPCREL+
4
19 s_mov_b32 s0
, global_var1@gotpcrel32@lo+
4
20 s_mov_b32 s0
, global_var2@gotpcrel32@hi+
4
22 s_mov_b32 s0
, extern_var0@GOTPCREL+
4
23 s_mov_b32 s0
, extern_var1@gotpcrel32@lo+
4
24 s_mov_b32 s0
, extern_var2@gotpcrel32@hi+
4
26 s_mov_b32 s0
, weak_var0@GOTPCREL+
4
27 s_mov_b32 s0
, weak_var1@gotpcrel32@lo+
4
28 s_mov_b32 s0
, weak_var2@gotpcrel32@hi+
4
30 s_mov_b32 s0
, weakref_var0@GOTPCREL+
4
31 s_mov_b32 s0
, weakref_var1@gotpcrel32@lo+
4
32 s_mov_b32 s0
, weakref_var2@gotpcrel32@hi+
4
34 s_mov_b32 s0
, local_var0+
4
35 s_mov_b32 s0
, local_var1@rel32@lo+
4
36 s_mov_b32 s0
, local_var2@rel32@hi+
4
40 .comm common_var0,1024,4
41 .comm common_var1,1024,4
42 .comm common_var2,1024,4
49 .weakref weakref_var0, weakref_alias_var0
50 .weakref weakref_var1, weakref_alias_var1
51 .weakref weakref_var2, weakref_alias_var2
60 .section nonalloc, "w", @progbits
61 .long var0, common_var2+4
62 .long var1, common_var1+8
63 .long var2, common_var0+12
74 # R_AMDGPU_RELATIVE64:
96 # The relocation for local_var{0, 1, 2} and var should be resolved by the
98 # CHECK: Relocations [
100 # CHECK-NEXT: R_AMDGPU_RELATIVE64 - 0x3928
101 # CHECK-NEXT: R_AMDGPU_ABS64 common_var0 0x0
102 # CHECK-NEXT: R_AMDGPU_ABS64 common_var1 0x0
103 # CHECK-NEXT: R_AMDGPU_ABS64 common_var2 0x0
104 # CHECK-NEXT: R_AMDGPU_ABS64 global_var0 0x0
105 # CHECK-NEXT: R_AMDGPU_ABS64 global_var1 0x0
106 # CHECK-NEXT: R_AMDGPU_ABS64 global_var2 0x0
107 # CHECK-NEXT: R_AMDGPU_ABS64 extern_var0 0x0
108 # CHECK-NEXT: R_AMDGPU_ABS64 extern_var1 0x0
109 # CHECK-NEXT: R_AMDGPU_ABS64 extern_var2 0x0
110 # CHECK-NEXT: R_AMDGPU_ABS64 weak_var0 0x0
111 # CHECK-NEXT: R_AMDGPU_ABS64 weak_var1 0x0
112 # CHECK-NEXT: R_AMDGPU_ABS64 weak_var2 0x0
113 # CHECK-NEXT: R_AMDGPU_ABS64 weakref_alias_var0 0x0
114 # CHECK-NEXT: R_AMDGPU_ABS64 weakref_alias_var1 0x0
115 # CHECK-NEXT: R_AMDGPU_ABS64 weakref_alias_var2 0x0
116 # CHECK-NEXT: R_AMDGPU_ABS64 temp 0x0
120 # NM: 0000000000003930 B common_var0
121 # NM: 0000000000003d30 B common_var1
122 # NM: 0000000000004130 B common_var2
123 # NM: 0000000000003928 d temp2
125 # temp2 - foo = 0x3928-0x768 = 0x31c0
126 # HEX: section '.rodata':
127 # HEX-NEXT: 0x00000768 c0310000 00000000
129 # common_var2+4, common_var1+8, and common_var0+12.
130 # HEX: section 'nonalloc':
131 # HEX-NEXT: 0x00000000 00000000 34410000 00000000 383d0000
132 # HEX-NEXT: 0x00000010 00000000 3c390000