1 // RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
3 // Test that we produce the correct relocation types and that the relocations
4 // correctly point to the section or the symbol.
6 // CHECK: # Relocation 0
7 // CHECK-NEXT: (('r_offset', 0x00000002)
8 // CHECK-NEXT: ('r_sym', 0x000001)
9 // CHECK-NEXT: ('r_type', 0x09)
11 // CHECK-NEXT: # Relocation 1
12 // CHECK-NEXT: (('r_offset',
13 // CHECK-NEXT: ('r_sym',
14 // CHECK-NEXT: ('r_type', 0x04)
16 // CHECK-NEXT: # Relocation 2
17 // CHECK-NEXT: (('r_offset',
18 // CHECK-NEXT: ('r_sym',
19 // CHECK-NEXT: ('r_type', 0x0a)
22 // Relocation 3 (bar3@GOTOFF) is done with symbol 7 (bss)
23 // CHECK-NEXT: # Relocation 3
24 // CHECK-NEXT: (('r_offset',
25 // CHECK-NEXT: ('r_sym', 0x000007
26 // CHECK-NEXT: ('r_type',
29 // Relocation 4 (bar2@GOT) is of type R_386_GOT32
30 // CHECK-NEXT: # Relocation 4
31 // CHECK-NEXT: (('r_offset',
32 // CHECK-NEXT: ('r_sym',
33 // CHECK-NEXT: ('r_type', 0x03
36 // Relocation 5 (foo@TLSGD) is of type R_386_TLS_GD
37 // CHECK-NEXT: # Relocation 5
38 // CHECK-NEXT: (('r_offset', 0x00000020)
39 // CHECK-NEXT: ('r_sym', 0x00000d)
40 // CHECK-NEXT: ('r_type', 0x12)
43 // Relocation 6 ($foo@TPOFF) is of type R_386_TLS_LE_32
44 // CHECK-NEXT: # Relocation 6
45 // CHECK-NEXT: (('r_offset', 0x00000025)
46 // CHECK-NEXT: ('r_sym', 0x00000d)
47 // CHECK-NEXT: ('r_type', 0x22)
50 // Relocation 7 (foo@INDNTPOFF) is of type R_386_TLS_IE
51 // CHECK-NEXT: # Relocation 7
52 // CHECK-NEXT: (('r_offset', 0x0000002b)
53 // CHECK-NEXT: ('r_sym', 0x00000d)
54 // CHECK-NEXT: ('r_type', 0x0f)
57 // Relocation 8 (foo@NTPOFF) is of type R_386_TLS_LE
58 // CHECK-NEXT: # Relocation 8
59 // CHECK-NEXT: (('r_offset', 0x00000031)
60 // CHECK-NEXT: ('r_sym', 0x00000d)
61 // CHECK-NEXT: ('r_type', 0x11)
64 // Relocation 9 (foo@GOTNTPOFF) is of type R_386_TLS_GOTIE
65 // CHECK-NEXT: # Relocation 9
66 // CHECK-NEXT: (('r_offset', 0x00000037)
67 // CHECK-NEXT: ('r_sym', 0x00000d)
68 // CHECK-NEXT: ('r_type', 0x10)
71 // Relocation 10 (foo@TLSLDM) is of type R_386_TLS_LDM
72 // CHECK-NEXT: # Relocation 10
73 // CHECK-NEXT: (('r_offset', 0x0000003d)
74 // CHECK-NEXT: ('r_sym', 0x00000d)
75 // CHECK-NEXT: ('r_type', 0x13)
78 // Relocation 11 (foo@DTPOFF) is of type R_386_TLS_LDO_32
79 // CHECK-NEXT: # Relocation 11
80 // CHECK-NEXT: (('r_offset', 0x00000043)
81 // CHECK-NEXT: ('r_sym', 0x00000d)
82 // CHECK-NEXT: ('r_type', 0x20)
84 // Relocation 12 (calll 4096) is of type R_386_PC32
85 // CHECK-NEXT: # Relocation 12
86 // CHECK-NEXT: (('r_offset', 0x00000048)
87 // CHECK-NEXT: ('r_sym', 0x000000)
88 // CHECK-NEXT: ('r_type', 0x02)
90 // Relocation 13 (zed@GOT) is of type R_386_GOT32 and uses the symbol
91 // CHECK-NEXT: # Relocation 13
92 // CHECK-NEXT: (('r_offset', 0x0000004e)
93 // CHECK-NEXT: ('r_sym', 0x000004)
94 // CHECK-NEXT: ('r_type', 0x03)
96 // Relocation 14 (zed@GOTOFF) is of type R_386_GOTOFF and uses the symbol
97 // CHECK-NEXT: # Relocation 14
98 // CHECK-NEXT: (('r_offset', 0x00000054)
99 // CHECK-NEXT: ('r_sym', 0x000004)
100 // CHECK-NEXT: ('r_type', 0x09)
102 // Relocation 15 (zed@INDNTPOFF) is of type R_386_TLS_IE and uses the symbol
103 // CHECK-NEXT: # Relocation 15
104 // CHECK-NEXT: (('r_offset', 0x0000005a)
105 // CHECK-NEXT: ('r_sym', 0x000004)
106 // CHECK-NEXT: ('r_type', 0x0f)
108 // Relocation 16 (zed@NTPOFF) is of type R_386_TLS_LE and uses the symbol
109 // CHECK-NEXT: # Relocation 16
110 // CHECK-NEXT: (('r_offset', 0x00000060)
111 // CHECK-NEXT: ('r_sym', 0x000004)
112 // CHECK-NEXT: ('r_type', 0x11)
114 // Relocation 17 (zed@GOTNTPOFF) is of type R_386_TLS_GOTIE and uses the symbol
115 // CHECK-NEXT: # Relocation 17
116 // CHECK-NEXT: (('r_offset', 0x00000066)
117 // CHECK-NEXT: ('r_sym', 0x000004)
118 // CHECK-NEXT: ('r_type', 0x10)
120 // Relocation 18 (zed@PLT) is of type R_386_PLT32 and uses the symbol
121 // CHECK-NEXT: # Relocation 18
122 // CHECK-NEXT: (('r_offset', 0x0000006b)
123 // CHECK-NEXT: ('r_sym', 0x000004)
124 // CHECK-NEXT: ('r_type', 0x04)
126 // Relocation 19 (zed@TLSGD) is of type R_386_TLS_GD and uses the symbol
127 // CHECK-NEXT: # Relocation 19
128 // CHECK-NEXT: (('r_offset', 0x00000071)
129 // CHECK-NEXT: ('r_sym', 0x000004)
130 // CHECK-NEXT: ('r_type', 0x12)
132 // Relocation 20 (zed@TLSLDM) is of type R_386_TLS_LDM and uses the symbol
133 // CHECK-NEXT: # Relocation 20
134 // CHECK-NEXT: (('r_offset', 0x00000077)
135 // CHECK-NEXT: ('r_sym', 0x000004)
136 // CHECK-NEXT: ('r_type', 0x13)
138 // Relocation 21 (zed@TPOFF) is of type R_386_TLS_LE_32 and uses the symbol
139 // CHECK-NEXT:# Relocation 21
140 // CHECK-NEXT: (('r_offset', 0x0000007d)
141 // CHECK-NEXT: ('r_sym', 0x000004)
142 // CHECK-NEXT: ('r_type', 0x22)
144 // Relocation 22 (zed@DTPOFF) is of type R_386_TLS_LDO_32 and uses the symbol
145 // CHECK-NEXT: Relocation 22
146 // CHECK-NEXT: (('r_offset', 0x00000083)
147 // CHECK-NEXT: ('r_sym', 0x000004)
148 // CHECK-NEXT: ('r_type', 0x20)
150 // Relocation 23 ($bar) is of type R_386_32 and uses the section
151 // CHECK-NEXT: Relocation 23
152 // CHECK-NEXT: (('r_offset',
153 // CHECK-NEXT: ('r_sym',
154 // CHECK-NEXT: ('r_type', 0x01)
156 // Relocation 24 (foo@GOTTPOFF(%edx)) is of type R_386_TLS_IE_32 and uses the
158 // CHECK-NEXT: Relocation 24
159 // CHECK-NEXT: (('r_offset', 0x0000008e)
160 // CHECK-NEXT: ('r_sym', 0x00000d)
161 // CHECK-NEXT: ('r_type', 0x21)
165 // CHECK: # Section 4
166 // CHECK-NEXT: (('sh_name', 0x0000000b) # '.bss'
169 // CHECK-NEXT: (('st_name', 0x00000005) # '.Lfoo'
173 // CHECK-NEXT: (('st_name', 0x00000035) # 'zed'
174 // CHECK-NEXT: ('st_value', 0x00000000)
175 // CHECK-NEXT: ('st_size', 0x00000000)
176 // CHECK-NEXT: ('st_bind', 0x0)
177 // CHECK-NEXT: ('st_type', 0x6)
178 // CHECK-NEXT: ('st_other', 0x00)
179 // CHECK-NEXT: ('st_shndx', 0x0005)
181 // Symbol 7 is section 4
183 // CHECK-NEXT: (('st_name', 0x00000000) # ''
184 // CHECK-NEXT: ('st_value', 0x00000000)
185 // CHECK-NEXT: ('st_size', 0x00000000)
186 // CHECK-NEXT: ('st_bind', 0x0)
187 // CHECK-NEXT: ('st_type', 0x3)
188 // CHECK-NEXT: ('st_other', 0x00)
189 // CHECK-NEXT: ('st_shndx', 0x0004)
194 leal .Lfoo@GOTOFF(%ebx), %eax
199 addl $_GLOBAL_OFFSET_TABLE_, %ebx
200 movb bar3@GOTOFF(%ebx), %al
206 movl bar2j@GOT(%eax), %eax
208 leal foo@TLSGD(, %ebx,1), %eax
209 movl $foo@TPOFF, %edx
210 movl foo@INDNTPOFF, %ecx
211 addl foo@NTPOFF(%eax), %eax
212 addl foo@GOTNTPOFF(%ebx), %ecx
213 leal foo@TLSLDM(%ebx), %eax
214 leal foo@DTPOFF(%eax), %edx
216 movl zed@GOT(%eax), %eax
217 movl zed@GOTOFF(%eax), %eax
218 movl zed@INDNTPOFF(%eax), %eax
219 movl zed@NTPOFF(%eax), %eax
220 movl zed@GOTNTPOFF(%eax), %eax
222 movl zed@TLSGD(%eax), %eax
223 movl zed@TLSLDM(%eax), %eax
224 movl zed@TPOFF(%eax), %eax
225 movl zed@DTPOFF(%eax), %eax
227 addl foo@GOTTPOFF(%edx), %eax
229 .section zedsec,"awT",@progbits
233 .section .rodata.str1.16,"aMS",@progbits,1
235 .asciz "bool llvm::llvm_start_multithreaded()"