mips-got.test
21.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
## Check that we are able to dump MIPS GOT entries using -A properly.
## Check how we dump 64-bit inputs.
# RUN: yaml2obj --docnum=1 -DTYPE=ET_REL %s -o %t.got.o
# RUN: yaml2obj --docnum=1 -DTYPE=ET_DYN %s -o %t.got.so
# RUN: yaml2obj --docnum=1 -DTYPE=ET_EXEC %s -o %t.got.exe
# RUN: llvm-readobj -A %t.got.o 2>&1 | FileCheck %s -DOTHERNUM=0 -check-prefix=BASIC-LLVM
# RUN: llvm-readobj -A %t.got.so 2>&1 | FileCheck %s -DOTHERNUM=0 -check-prefix=BASIC-LLVM
# RUN: llvm-readobj -A %t.got.exe 2>&1 | FileCheck %s -DOTHERNUM=0 -check-prefix=BASIC-LLVM
# RUN: llvm-readelf -A %t.got.o 2>&1 | FileCheck %s -check-prefix=BASIC-GNU \
# RUN: --implicit-check-not="Number of" --strict-whitespace --match-full-lines
# RUN: llvm-readelf -A %t.got.so 2>&1 | FileCheck %s -check-prefix=BASIC-GNU \
# RUN: --implicit-check-not="Number of" --strict-whitespace --match-full-lines
# RUN: llvm-readelf -A %t.got.exe 2>&1 | FileCheck %s -check-prefix=BASIC-GNU \
# RUN: --implicit-check-not="Number of" --strict-whitespace --match-full-lines
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: [[TYPE=ET_EXEC]]
Machine: EM_MIPS
Sections:
- Name: .got
Type: SHT_PROGBITS
Address: 0x1122
ContentArray: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ## Lazy resolver.
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, ## Module pointer (GNU extension)
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, ## Local entry 1
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, ## Local entry 2
0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, ## Global entry 1
0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB ] ## Global entry 2
Size: [[SIZE=<none>]]
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 4
- Tag: DT_MIPS_GOTSYM
Value: 1
- Tag: DT_PLTGOT
Value: 0x1122
DynamicSymbols:
- Name: foo
- Name: bar
Type: STT_FUNC
# BASIC-LLVM: Primary GOT {
# BASIC-LLVM-NEXT: Canonical gp value: 0x9112
# BASIC-LLVM-NEXT: Reserved entries [
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x1122
# BASIC-LLVM-NEXT: Access: -32752
# BASIC-LLVM-NEXT: Initial: 0x0
# BASIC-LLVM-NEXT: Purpose: Lazy resolver
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x112A
# BASIC-LLVM-NEXT: Access: -32744
# BASIC-LLVM-NEXT: Initial: 0xFFFFFFFFFFFFFFFF
# BASIC-LLVM-NEXT: Purpose: Module pointer (GNU extension)
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: ]
# BASIC-LLVM-NEXT: Local entries [
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x1132
# BASIC-LLVM-NEXT: Access: -32736
# BASIC-LLVM-NEXT: Initial: 0x1111111111111111
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x113A
# BASIC-LLVM-NEXT: Access: -32728
# BASIC-LLVM-NEXT: Initial: 0x2222222222222222
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: ]
# BASIC-LLVM-NEXT: Global entries [
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x1142
# BASIC-LLVM-NEXT: Access: -32720
# BASIC-LLVM-NEXT: Initial: 0xAAAAAAAAAAAAAAAA
# BASIC-LLVM-NEXT: Value: 0x0
# BASIC-LLVM-NEXT: Type: None (0x0)
# BASIC-LLVM-NEXT: Section: Undefined (0x0)
# BASIC-LLVM-NEXT: Name: foo (5)
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x114A
# BASIC-LLVM-NEXT: Access: -32712
# BASIC-LLVM-NEXT: Initial: 0xBBBBBBBBBBBBBBBB
# BASIC-LLVM-NEXT: Value: 0x0
# BASIC-LLVM-NEXT: Type: Function (0x2)
# BASIC-LLVM-NEXT: Section: Undefined (0x0)
# BASIC-LLVM-NEXT: Name: bar (1)
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: ]
# BASIC-LLVM-NEXT: Number of TLS and multi-GOT entries: [[OTHERNUM]]
# BASIC-LLVM-NEXT: }
# BASIC-GNU:Primary GOT:
# BASIC-GNU-NEXT: Canonical gp value: 0000000000009112
# BASIC-GNU-EMPTY:
# BASIC-GNU-NEXT: Reserved entries:
# BASIC-GNU-NEXT: Address Access Initial Purpose
# BASIC-GNU-NEXT: 0000000000001122 -32752(gp) 0000000000000000 Lazy resolver
# BASIC-GNU-NEXT: 000000000000112a -32744(gp) ffffffffffffffff Module pointer (GNU extension)
# BASIC-GNU-EMPTY:
# BASIC-GNU-NEXT: Local entries:
# BASIC-GNU-NEXT: Address Access Initial
# BASIC-GNU-NEXT: 0000000000001132 -32736(gp) 1111111111111111 {{$}}
# BASIC-GNU-NEXT: 000000000000113a -32728(gp) 2222222222222222 {{$}}
# BASIC-GNU-EMPTY:
# BASIC-GNU-NEXT: Global entries:
# BASIC-GNU-NEXT: Address Access Initial Sym.Val. Type Ndx Name
# BASIC-GNU-NEXT: 0000000000001142 -32720(gp) aaaaaaaaaaaaaaaa 0000000000000000 NOTYPE UND foo
# BASIC-GNU-NEXT: 000000000000114a -32712(gp) bbbbbbbbbbbbbbbb 0000000000000000 FUNC UND bar
# BASIC-GNU-EMPTY:
# BASIC-GNU-OTHER-NEXT: Number of TLS and multi-GOT entries [[OTHERNUM]]
## Check we are able to print the number of TLS and multi-GOT entries properly.
# RUN: yaml2obj --docnum=1 %s -DSIZE=56 -o %t.other.entries1.exe
# RUN: yaml2obj --docnum=1 %s -DSIZE=64 -o %t.other.entries2.exe
# RUN: llvm-readobj -A %t.other.entries1.exe 2>&1 | FileCheck %s -DOTHERNUM=1 --check-prefix=BASIC-LLVM
# RUN: llvm-readobj -A %t.other.entries2.exe 2>&1 | FileCheck %s -DOTHERNUM=2 -check-prefix=BASIC-LLVM
# RUN: llvm-readelf -A %t.other.entries1.exe 2>&1 | FileCheck %s -DOTHERNUM=1 \
# RUN: --check-prefixes=BASIC-GNU,BASIC-GNU-OTHER --strict-whitespace --match-full-lines
# RUN: llvm-readelf -A %t.other.entries2.exe 2>&1 | FileCheck %s -DOTHERNUM=2 \
# RUN: --check-prefixes=BASIC-GNU,BASIC-GNU-OTHER --strict-whitespace --match-full-lines
## Check how we dump 32-bit inputs.
# RUN: yaml2obj --docnum=2 %s -o %t.got32.exe
# RUN: llvm-readobj -A %t.got32.exe 2>&1 | FileCheck %s -check-prefix=BASIC32-LLVM
# RUN: llvm-readelf -A %t.got32.exe 2>&1 | FileCheck %s -check-prefix=BASIC32-GNU \
# RUN: --strict-whitespace --match-full-lines
# BASIC32-LLVM: Primary GOT {
# BASIC32-LLVM-NEXT: Canonical gp value: 0x9112
# BASIC32-LLVM-NEXT: Reserved entries [
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x1122
# BASIC32-LLVM-NEXT: Access: -32752
# BASIC32-LLVM-NEXT: Initial: 0x0
# BASIC32-LLVM-NEXT: Purpose: Lazy resolver
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x1126
# BASIC32-LLVM-NEXT: Access: -32748
# BASIC32-LLVM-NEXT: Initial: 0xFFFFFFFF
# BASIC32-LLVM-NEXT: Purpose: Module pointer (GNU extension)
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: ]
# BASIC32-LLVM-NEXT: Local entries [
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x112A
# BASIC32-LLVM-NEXT: Access: -32744
# BASIC32-LLVM-NEXT: Initial: 0x11111111
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x112E
# BASIC32-LLVM-NEXT: Access: -32740
# BASIC32-LLVM-NEXT: Initial: 0x22222222
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: ]
# BASIC32-LLVM-NEXT: Global entries [
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x1132
# BASIC32-LLVM-NEXT: Access: -32736
# BASIC32-LLVM-NEXT: Initial: 0xAAAAAAAA
# BASIC32-LLVM-NEXT: Value: 0x0
# BASIC32-LLVM-NEXT: Type: None (0x0)
# BASIC32-LLVM-NEXT: Section: Undefined (0x0)
# BASIC32-LLVM-NEXT: Name: foo (5)
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x1136
# BASIC32-LLVM-NEXT: Access: -32732
# BASIC32-LLVM-NEXT: Initial: 0xBBBBBBBB
# BASIC32-LLVM-NEXT: Value: 0x0
# BASIC32-LLVM-NEXT: Type: Function (0x2)
# BASIC32-LLVM-NEXT: Section: Undefined (0x0)
# BASIC32-LLVM-NEXT: Name: bar (1)
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: ]
# BASIC32-LLVM-NEXT: Number of TLS and multi-GOT entries: 1
# BASIC32-LLVM-NEXT: }
# BASIC32-GNU:Primary GOT:
# BASIC32-GNU-NEXT: Canonical gp value: 00009112
# BASIC32-GNU-EMPTY:
# BASIC32-GNU-NEXT: Reserved entries:
# BASIC32-GNU-NEXT: Address Access Initial Purpose
# BASIC32-GNU-NEXT: 00001122 -32752(gp) 00000000 Lazy resolver
# BASIC32-GNU-NEXT: 00001126 -32748(gp) ffffffff Module pointer (GNU extension)
# BASIC32-GNU-EMPTY:
# BASIC32-GNU-NEXT: Local entries:
# BASIC32-GNU-NEXT: Address Access Initial
# BASIC32-GNU-NEXT: 0000112a -32744(gp) 11111111 {{$}}
# BASIC32-GNU-NEXT: 0000112e -32740(gp) 22222222 {{$}}
# BASIC32-GNU-EMPTY:
# BASIC32-GNU-NEXT: Global entries:
# BASIC32-GNU-NEXT: Address Access Initial Sym.Val. Type Ndx Name
# BASIC32-GNU-NEXT: 00001132 -32736(gp) aaaaaaaa 00000000 NOTYPE UND foo
# BASIC32-GNU-NEXT: 00001136 -32732(gp) bbbbbbbb 00000000 FUNC UND bar
# BASIC32-GNU-EMPTY:
# BASIC32-GNU-NEXT: Number of TLS and multi-GOT entries 1
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_MIPS
Sections:
- Name: .got
Type: SHT_PROGBITS
Address: 0x1122
ContentArray: [ 0x00, 0x00, 0x00, 0x00, ## Lazy resolver.
0xFF, 0xFF, 0xFF, 0xFF, ## Module pointer (GNU extension).
0x11, 0x11, 0x11, 0x11, ## Local entry 1.
0x22, 0x22, 0x22, 0x22, ## Local entry 2.
0xAA, 0xAA, 0xAA, 0xAA, ## Global entry 1.
0xBB, 0xBB, 0xBB, 0xBB, ## Global entry 2.
0x00, 0x00, 0x00, 0x00 ] ## Other entry.
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 4
- Tag: DT_MIPS_GOTSYM
Value: 1
- Tag: DT_PLTGOT
Value: 0x1122
DynamicSymbols:
- Name: foo
- Name: bar
Type: STT_FUNC
# RUN: llvm-readobj -A %p/Inputs/got-empty.exe.mipsel | \
# RUN: FileCheck %s -check-prefix GOT-EMPTY
# RUN: llvm-readobj -A %p/Inputs/got-static.exe.mips | \
# RUN: FileCheck %s -check-prefix GOT-STATIC
# RUN: llvm-readelf -A %p/Inputs/got-empty.exe.mipsel | \
# RUN: FileCheck %s --strict-whitespace -check-prefix GNU-GOT-EMPTY
# RUN: llvm-readelf -A %p/Inputs/got-static.exe.mips | \
# RUN: FileCheck %s --strict-whitespace -check-prefix GNU-GOT-STATIC
# GOT-EMPTY: Primary GOT {
# GOT-EMPTY-NEXT: Canonical gp value: 0x409FF0
# GOT-EMPTY-NEXT: Reserved entries [
# GOT-EMPTY-NEXT: Entry {
# GOT-EMPTY-NEXT: Address: 0x402000
# GOT-EMPTY-NEXT: Access: -32752
# GOT-EMPTY-NEXT: Initial: 0x0
# GOT-EMPTY-NEXT: Purpose: Lazy resolver
# GOT-EMPTY-NEXT: }
# GOT-EMPTY-NEXT: Entry {
# GOT-EMPTY-NEXT: Address: 0x402004
# GOT-EMPTY-NEXT: Access: -32748
# GOT-EMPTY-NEXT: Initial: 0x80000000
# GOT-EMPTY-NEXT: Purpose: Module pointer (GNU extension)
# GOT-EMPTY-NEXT: }
# GOT-EMPTY-NEXT: ]
# GOT-EMPTY-NEXT: Local entries [
# GOT-EMPTY-NEXT: ]
# GOT-EMPTY-NEXT: Global entries [
# GOT-EMPTY-NEXT: ]
# GOT-EMPTY-NEXT: Number of TLS and multi-GOT entries: 2
# GOT-EMPTY-NEXT: }
# GOT-STATIC: Static GOT {
# GOT-STATIC-NEXT: Canonical gp value: 0x418100
# GOT-STATIC-NEXT: Reserved entries [
# GOT-STATIC-NEXT: Entry {
# GOT-STATIC-NEXT: Address: 0x410110
# GOT-STATIC-NEXT: Access: -32752
# GOT-STATIC-NEXT: Initial: 0x0
# GOT-STATIC-NEXT: Purpose: Lazy resolver
# GOT-STATIC-NEXT: }
# GOT-STATIC-NEXT: Entry {
# GOT-STATIC-NEXT: Address: 0x410114
# GOT-STATIC-NEXT: Access: -32748
# GOT-STATIC-NEXT: Initial: 0x80000000
# GOT-STATIC-NEXT: Purpose: Module pointer (GNU extension)
# GOT-STATIC-NEXT: }
# GOT-STATIC-NEXT: ]
# GOT-STATIC-NEXT: Local entries [
# GOT-STATIC-NEXT: Entry {
# GOT-STATIC-NEXT: Address: 0x410118
# GOT-STATIC-NEXT: Access: -32744
# GOT-STATIC-NEXT: Initial: 0x400000
# GOT-STATIC-NEXT: }
# GOT-STATIC-NEXT: Entry {
# GOT-STATIC-NEXT: Address: 0x41011C
# GOT-STATIC-NEXT: Access: -32740
# GOT-STATIC-NEXT: Initial: 0x400100
# GOT-STATIC-NEXT: }
# GOT-STATIC-NEXT: Entry {
# GOT-STATIC-NEXT: Address: 0x410120
# GOT-STATIC-NEXT: Access: -32736
# GOT-STATIC-NEXT: Initial: 0x400104
# GOT-STATIC-NEXT: }
# GOT-STATIC-NEXT: ]
# GOT-STATIC-NEXT: }
# GNU-GOTY : Primary GOT:
# GNU-GOT-EMPTY: Canonical gp value: 00409ff0
# GNU-GOTY : Reserved entries:
# GNU-GOT-EMPTY: Address Access Initial Purpose
# GNU-GOT-EMPTY: 00402000 -32752(gp) 00000000 Lazy resolver
# GNU-GOT-EMPTY: 00402004 -32748(gp) 80000000 Module pointer (GNU extension)
# GNU-GOT-STATIC: Static GOT:
# GNU-GOT-STATIC-NEXT: Canonical gp value: 00418100
# GNU-GOT-STATIC: Reserved entries:
# GNU-GOT-STATIC-NEXT: Address Access Initial Purpose
# GNU-GOT-STATIC-NEXT: 00410110 -32752(gp) 00000000 Lazy resolver
# GNU-GOT-STATIC-NEXT: 00410114 -32748(gp) 80000000 Module pointer (GNU extension)
# GNU-GOT-STATIC: Local entries:
# GNU-GOT-STATIC-NEXT: Address Access Initial
# GNU-GOT-STATIC-NEXT: 00410118 -32744(gp) 00400000
# GNU-GOT-STATIC-NEXT: 0041011c -32740(gp) 00400100
# GNU-GOT-STATIC-NEXT: 00410120 -32736(gp) 00400104
## Check we report errors when dynamic tags, needed for dumping GOT, are missing.
# RUN: yaml2obj --docnum=3 -DTAG1=DT_MIPS_LOCAL_GOTNO -DTAG2=DT_MIPS_GOTSYM %s -o %t.err1.o
# RUN: not llvm-readobj -A %t.err1.o 2>&1 | FileCheck %s -DFILE=%t.err1.o -check-prefix ERR1
# ERR1: error: '[[FILE]]': cannot find PLTGOT dynamic tag
# RUN: yaml2obj --docnum=3 -DTAG1=DT_PLTGOT -DTAG2=DT_MIPS_GOTSYM %s -o %t.err2.o
# RUN: not llvm-readobj -A %t.err2.o 2>&1 | FileCheck %s -DFILE=%t.err2.o -check-prefix ERR2
# ERR2: error: '[[FILE]]': cannot find MIPS_LOCAL_GOTNO dynamic tag
# RUN: yaml2obj --docnum=3 -DTAG1=DT_PLTGOT -DTAG2=DT_MIPS_LOCAL_GOTNO %s -o %t.err3.o
# RUN: not llvm-readobj -A %t.err3.o 2>&1 | FileCheck %s -DFILE=%t.err3.o -check-prefix ERR3
# ERR3: error: '[[FILE]]': cannot find MIPS_GOTSYM dynamic tag
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_MIPS
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: [[TAG1]]
Value: 0
- Tag: [[TAG2]]
Value: 0
- Tag: DT_NULL
Value: 0
DynamicSymbols: []
# RUN: yaml2obj --docnum=4 -DVAL1=0xffff %s -o %t.err4.o
# RUN: not llvm-readobj -A %t.err4.o 2>&1 | FileCheck %s -DFILE=%t.err4.o -check-prefix=ERR4
# ERR4: error: '[[FILE]]': DT_MIPS_GOTSYM value (65535) exceeds the number of dynamic symbols (1)
# RUN: yaml2obj --docnum=4 -DVAL2=0xffff %s -o %t.err5.o
# RUN: not llvm-readobj -A %t.err5.o 2>&1 | FileCheck %s -DFILE=%t.err5.o -check-prefix=ERR5
# ERR5: error: '[[FILE]]': there is no non-empty GOT section at 0xffff
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_MIPS
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 0
- Tag: DT_MIPS_GOTSYM
Value: [[VAL1=0]]
- Tag: DT_PLTGOT
Value: [[VAL2=0]]
DynamicSymbols: []
## Check that we do not report a warning about the .got section when we are able to locate it by name.
# RUN: yaml2obj --docnum=5 -DNAME=0xffff %s -o %t.err6.o
# RUN: llvm-readobj -A %t.err6.o 2>&1 | \
# RUN: FileCheck %s -DFILE=%t.err6.o -check-prefix=NAME-ERR-FOUND --implicit-check-not=warning:
# RUN: llvm-readelf -A %t.err6.o 2>&1 | \
# RUN: FileCheck %s -DFILE=%t.err6.o -check-prefix=NAME-ERR-FOUND --implicit-check-not=warning:
# NAME-ERR-FOUND: warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 1: a section [index 1] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
# NAME-ERR-FOUND-NEXT: warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 3: a section [index 3] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Sections:
- Type: SHT_PROGBITS
ShName: [[NAME=<none>]]
- Name: .got
Type: SHT_PROGBITS
ShName: [[GOTNAME=<none>]]
- Type: SHT_PROGBITS
ShName: [[NAME=<none>]]
## Check we report a warning when we are unable to find the .got section due to an error.
# RUN: yaml2obj --docnum=5 -DGOTNAME=0xffff %s -o %t.err7.o
# RUN: llvm-readelf -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning:
# RUN: llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning:
# NAME-ERR-NOTFOUND: warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 2: a section [index 2] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
## Check that we correctly show .got section content when there are some other zero-sized
## sections with the same address as the .got section.
## In this test the empty .data section has the same address as the .got section.
# RUN: yaml2obj --docnum=6 %s -o %t.err7.o
# RUN: llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=SAME-ADDR-LLVM
# RUN: llvm-readelf -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=SAME-ADDR-GNU
# SAME-ADDR-LLVM: Primary GOT {
# SAME-ADDR-LLVM-NEXT: Canonical gp value: 0x9112
# SAME-ADDR-LLVM-NEXT: Reserved entries [
# SAME-ADDR-LLVM-NEXT: Entry {
# SAME-ADDR-LLVM-NEXT: Address: 0x1122
# SAME-ADDR-LLVM-NEXT: Access: -32752
# SAME-ADDR-LLVM-NEXT: Initial: 0x0
# SAME-ADDR-LLVM-NEXT: Purpose: Lazy resolver
# SAME-ADDR-LLVM-NEXT: }
# SAME-ADDR-LLVM-NEXT: ]
# SAME-ADDR-LLVM-NEXT: Local entries [
# SAME-ADDR-LLVM-NEXT: ]
# SAME-ADDR-LLVM-NEXT: Global entries [
# SAME-ADDR-LLVM-NEXT: Entry {
# SAME-ADDR-LLVM-NEXT: Address: 0x112A
# SAME-ADDR-LLVM-NEXT: Access: -32744
# SAME-ADDR-LLVM-NEXT: Initial: 0x0
# SAME-ADDR-LLVM-NEXT: Value: 0x0
# SAME-ADDR-LLVM-NEXT: Type: None (0x0)
# SAME-ADDR-LLVM-NEXT: Section: Undefined (0x0)
# SAME-ADDR-LLVM-NEXT: Name: foo (1)
# SAME-ADDR-LLVM-NEXT: }
# SAME-ADDR-LLVM-NEXT: ]
# SAME-ADDR-LLVM-NEXT: Number of TLS and multi-GOT entries: 0
# SAME-ADDR-LLVM-NEXT: }
# SAME-ADDR-GNU: Primary GOT:
# SAME-ADDR-GNU-NEXT: Canonical gp value: 0000000000009112
# SAME-ADDR-GNU-EMPTY:
# SAME-ADDR-GNU-NEXT: Reserved entries:
# SAME-ADDR-GNU-NEXT: Address Access Initial Purpose
# SAME-ADDR-GNU-NEXT: 0000000000001122 -32752(gp) 0000000000000000 Lazy resolver
# SAME-ADDR-GNU-EMPTY:
# SAME-ADDR-GNU-NEXT: Global entries:
# SAME-ADDR-GNU-NEXT: Address Access Initial Sym.Val. Type Ndx Name
# SAME-ADDR-GNU-NEXT: 000000000000112a -32744(gp) 0000000000000000 0000000000000000 NOTYPE UND foo
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Sections:
- Name: .data
Type: SHT_PROGBITS
Address: 0x1122
Size: 0
- Name: .got
Type: SHT_PROGBITS
Address: 0x1122
Size: 16
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 1
- Tag: DT_MIPS_GOTSYM
Value: 1
- Tag: DT_PLTGOT
Value: 0x1122
DynamicSymbols:
- Name: foo
## Check how we print global GOT entries when they are unnamed section symbols.
# RUN: yaml2obj --docnum=7 %s -o %t.err8.o
# RUN: llvm-readobj -A %t.err8.o 2>&1 | FileCheck %s -DFILE=%t.err8.o --check-prefix=SEC-SYMS-LLVM
# RUN: llvm-readelf -A %t.err8.o 2>&1 | FileCheck %s -DFILE=%t.err8.o --check-prefix=SEC-SYMS-GNU
# SEC-SYMS-LLVM: Global entries [
# SEC-SYMS-LLVM-NEXT: Entry {
# SEC-SYMS-LLVM: Section: Absolute (0xFFF1)
# SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff1 (SHN_ABS)
# SEC-SYMS-LLVM-NEXT: Name: <?> (0)
# SEC-SYMS-LLVM-NEXT: }
# SEC-SYMS-LLVM-NEXT: Entry {
# SEC-SYMS-LLVM: Section: .got (0x1)
# SEC-SYMS-LLVM-NEXT: Name: .got (0)
# SEC-SYMS-LLVM-NEXT: }
# SEC-SYMS-LLVM-NEXT: Entry {
# SEC-SYMS-LLVM: Section: Common (0xFFF2)
# SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff2 (SHN_COMMON)
# SEC-SYMS-LLVM-NEXT: Name: <?> (0)
# SEC-SYMS-LLVM-NEXT: }
# SEC-SYMS-LLVM-NEXT: Entry {
# SEC-SYMS-LLVM: Type: Section (0x3)
# SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': extended symbol index (4) is past the end of the SHT_SYMTAB_SHNDX section of size 0
# SEC-SYMS-LLVM-NEXT: Section: Reserved (0xFFFF)
# SEC-SYMS-LLVM-NEXT: Name: <?> (0)
# SEC-SYMS-LLVM-NEXT: }
# SEC-SYMS-LLVM-NEXT: ]
# SEC-SYMS-GNU: Global entries:
# SEC-SYMS-GNU-NEXT: {{.*}} Ndx Name
# SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff1 (SHN_ABS)
# SEC-SYMS-GNU-NEXT: {{.*}} ABS <?>
# SEC-SYMS-GNU-NEXT: {{.*}} 1 .got
# SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff2 (SHN_COMMON)
# SEC-SYMS-GNU-NEXT: {{.*}} COM <?>
# SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': extended symbol index (4) is past the end of the SHT_SYMTAB_SHNDX section of size 0
# SEC-SYMS-GNU-NEXT: {{.*}} RSV[0xffff] <?>
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Sections:
- Name: .got
Type: SHT_PROGBITS
Address: 0x1122
Size: 48
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 1
- Tag: DT_MIPS_GOTSYM
Value: 1
- Tag: DT_PLTGOT
Value: 0x1122
DynamicSymbols:
- Type: STT_SECTION
Index: SHN_ABS
- Type: STT_SECTION
Section: .got
- Type: STT_SECTION
Index: SHN_COMMON
- Type: STT_SECTION
Index: SHN_XINDEX