dyn-symbols.test
18.8 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
## In this test we test that dynamic symbols are dumped as expected.
## Case 1: Dynamic symbol table found via the DT_SYMTAB dynamic tag.
# RUN: yaml2obj --docnum=1 %s -o %t1.so
# RUN: llvm-readobj --dyn-symbols %t1.so 2>&1 \
# RUN: | FileCheck %s --implicit-check-not="warning:" --check-prefix=DYNSYMS-LLVM
# RUN: llvm-readelf --dyn-symbols %t1.so 2>&1 \
# RUN: | FileCheck %s --implicit-check-not="warning:" --check-prefix=DYNSYMS-GNU
# DYNSYMS-LLVM: DynamicSymbols [
# DYNSYMS-LLVM-NEXT: Symbol {
# DYNSYMS-LLVM-NEXT: Name: (0)
# DYNSYMS-LLVM-NEXT: Value: 0x0
# DYNSYMS-LLVM-NEXT: Size: 0
# DYNSYMS-LLVM-NEXT: Binding: Local (0x0)
# DYNSYMS-LLVM-NEXT: Type: None (0x0)
# DYNSYMS-LLVM-NEXT: Other: 0
# DYNSYMS-LLVM-NEXT: Section: Undefined (0x0)
# DYNSYMS-LLVM-NEXT: }
# DYNSYMS-LLVM-NEXT: Symbol {
# DYNSYMS-LLVM-NEXT: Name: foo (5)
# DYNSYMS-LLVM-NEXT: Value: 0x0
# DYNSYMS-LLVM-NEXT: Size: 0
# DYNSYMS-LLVM-NEXT: Binding: Local (0x0)
# DYNSYMS-LLVM-NEXT: Type: None (0x0)
# DYNSYMS-LLVM-NEXT: Other: 0
# DYNSYMS-LLVM-NEXT: Section: Undefined (0x0)
# DYNSYMS-LLVM-NEXT: }
# DYNSYMS-LLVM-NEXT: Symbol {
# DYNSYMS-LLVM-NEXT: Name: bar (1)
# DYNSYMS-LLVM-NEXT: Value: 0x0
# DYNSYMS-LLVM-NEXT: Size: 0
# DYNSYMS-LLVM-NEXT: Binding: Local (0x0)
# DYNSYMS-LLVM-NEXT: Type: None (0x0)
# DYNSYMS-LLVM-NEXT: Other: 0
# DYNSYMS-LLVM-NEXT: Section: Undefined (0x0)
# DYNSYMS-LLVM-NEXT: }
# DYNSYMS-LLVM-NEXT: ]
# DYNSYMS-GNU: Symbol table '.dynsym' contains 3 entries:
# DYNSYMS-GNU-NEXT: Num: Value Size Type Bind Vis Ndx Name
# DYNSYMS-GNU-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
# DYNSYMS-GNU-NEXT: 1: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND foo
# DYNSYMS-GNU-NEXT: 2: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND bar
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_SYMTAB
Value: 0x100
- Tag: DT_NULL
Value: 0
- Name: .dynsym
Type: SHT_DYNSYM
Address: 0x100
DynamicSymbols:
- Name: foo
- Name: bar
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x100
Sections:
- Section: .dynsym
## Case 2: Check the output for aliases.
## a) Check the two-letter alias --dt is equivalent to the --dyn-symbols
## full flag name.
# RUN: llvm-readobj --dt %t1.so > %t.readobj-dt-alias
# RUN: llvm-readobj --dyn-symbols %t1.so > %t.readobj-dt-no-alias
# RUN: cmp %t.readobj-dt-alias %t.readobj-dt-no-alias
## b) Check --dyn-syms equals --dyn-symbols, --dt for llvm-readobj.
# RUN: llvm-readobj --dyn-syms %t1.so > %t.readobj-dyn-syms
# RUN: cmp %t.readobj-dt-alias %t.readobj-dyn-syms
## c) Check --dyn-syms equals --dyn-symbols for llvm-readelf.
# RUN: llvm-readelf --dyn-syms %t1.so > %t.readelf-dyn-syms
# RUN: llvm-readelf --dyn-symbols %t1.so > %t.readelf-dyn-symbols
# RUN: cmp %t.readelf-dyn-symbols %t.readelf-dyn-syms
## Case 3: Check that we are able to dump the dynamic symbol table even when we have no program headers.
## In this case we find the table by it's type (SHT_DYNSYM) and ignore the DT_SYMTAB value.
# RUN: yaml2obj --docnum=2 %s -o %t2.so
# RUN: llvm-readobj %t2.so --dyn-symbols | FileCheck %s --check-prefix=NOPHDRS-LLVM
# RUN: llvm-readelf %t2.so --dyn-symbols | FileCheck %s --check-prefix=NOPHDRS-GNU
# NOPHDRS-LLVM: Name: foo
# NOPHDRS-GNU: 1: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND foo
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_SYMTAB
Value: 0xffff1234
- Tag: DT_NULL
Value: 0
DynamicSymbols:
- Name: foo
## Case 4: Check we report a warning when there is no SHT_DYNSYM section and we can't map the DT_SYMTAB value
## to an address because of the absence of a corresponding PT_LOAD program header.
# RUN: yaml2obj --docnum=3 %s -o %t3.so
# RUN: llvm-readobj %t3.so --dyn-symbols 2>&1 | FileCheck %s -DFILE=%t3.so --check-prefixes=NOSHT-DYNSYM,NOSHT-DYNSYM-LLVM
# RUN: llvm-readelf %t3.so --dyn-symbols 2>&1 | FileCheck %s -DFILE=%t3.so --check-prefix=NOSHT-DYNSYM
# NOSHT-DYNSYM: warning: '[[FILE]]': Unable to parse DT_SYMTAB: virtual address is not in any segment: 0x0
# NOSHT-DYNSYM-LLVM: DynamicSymbols [
# NOSHT-DYNSYM-LLVM-NEXT: ]
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynsym
Type: SHT_PROGBITS
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_SYMTAB
Value: 0
- Tag: DT_NULL
Value: 0
DynamicSymbols:
- Name: foo
## Case 5: Check that when we can't map the value of the DT_SYMTAB tag to an address, we report a warning and
## use the information in the section header table to locate the dynamic symbol table.
# RUN: yaml2obj --docnum=4 %s -o %t4.so
# RUN: llvm-readobj %t4.so --dyn-symbols 2>&1 | FileCheck -DFILE=%t4.so %s --check-prefixes=BROKEN-DTSYMTAB,BROKEN-DTSYMTAB-LLVM
# RUN: llvm-readelf %t4.so --dyn-symbols 2>&1 | FileCheck -DFILE=%t4.so %s --check-prefixes=BROKEN-DTSYMTAB,BROKEN-DTSYMTAB-GNU
# BROKEN-DTSYMTAB: warning: '[[FILE]]': Unable to parse DT_SYMTAB: virtual address is not in any segment: 0xffff1234
# BROKEN-DTSYMTAB-LLVM: Name: foo
# BROKEN-DTSYMTAB-GNU: 1: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND foo
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_SYMTAB
Value: 0xffff1234
- Tag: DT_NULL
Value: 0
DynamicSymbols:
- Name: foo
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x0000
Sections:
- Section: .dynsym
## Case 6: Check that if we can get the location of the dynamic symbol table using both the DT_SYMTAB value
## and the section headers table then we prefer the former and report a warning.
# RUN: yaml2obj --docnum=5 %s -o %t5.so
# RUN: llvm-readobj %t5.so --dyn-symbols 2>&1 | FileCheck -DFILE=%t5.so %s --check-prefixes=PREFER-DTSYMTAB,PREFER-DTSYMTAB-LLVM
# RUN: llvm-readelf %t5.so --dyn-symbols 2>&1 | FileCheck -DFILE=%t5.so %s --check-prefixes=PREFER-DTSYMTAB,PREFER-DTSYMTAB-GNU
# PREFER-DTSYMTAB: warning: '[[FILE]]': SHT_DYNSYM section header and DT_SYMTAB disagree about the location of the dynamic symbol table
# PREFER-DTSYMTAB-LLVM: Name: o
# PREFER-DTSYMTAB-GNU: 1: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND o
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_SYMTAB
Value: 0x0
- Tag: DT_NULL
Value: 0
- Name: .dynsym
Type: SHT_DYNSYM
- Name: .mydynsym
Type: SHT_DYNSYM
## The Content describes 2 symbols: zero symbol and symbol with st_name == 3.
Content: "000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000"
DynamicSymbols:
- Name: foo
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x0000
Sections:
- Section: .mydynsym
## Case 7: Check how we dump versioned symbols. Use both -V and --dyn-symbols
## to check that printed version is consistent.
# RUN: yaml2obj %s --docnum=6 -o %t6
# RUN: llvm-readobj -V --dyn-symbols %t6 | FileCheck %s --check-prefix=VERSIONED-LLVM
# RUN: llvm-readelf -V --dyn-symbols %t6 | FileCheck %s --check-prefix=VERSIONED-GNU
# VERSIONED-LLVM: Symbol {
# VERSIONED-LLVM: Name: foo (16)
# VERSIONED-LLVM-NEXT: Value: 0x0
# VERSIONED-LLVM-NEXT: Size: 0
# VERSIONED-LLVM-NEXT: Binding: Local (0x0)
# VERSIONED-LLVM-NEXT: Type: None (0x0)
# VERSIONED-LLVM-NEXT: Other: 0
# VERSIONED-LLVM-NEXT: Section: Undefined (0x0)
# VERSIONED-LLVM-NEXT: }
# VERSIONED-LLVM-NEXT: Symbol {
# VERSIONED-LLVM-NEXT: Name: bar@@Default (12)
# VERSIONED-LLVM-NEXT: Value: 0x0
# VERSIONED-LLVM-NEXT: Size: 0
# VERSIONED-LLVM-NEXT: Binding: Local (0x0)
# VERSIONED-LLVM-NEXT: Type: None (0x0)
# VERSIONED-LLVM-NEXT: Other: 0
# VERSIONED-LLVM-NEXT: Section: Undefined (0x0)
# VERSIONED-LLVM-NEXT: }
# VERSIONED-LLVM-NEXT: Symbol {
# VERSIONED-LLVM-NEXT: Name: zed@NonDefault (20)
# VERSIONED-LLVM-NEXT: Value: 0x0
# VERSIONED-LLVM-NEXT: Size: 0
# VERSIONED-LLVM-NEXT: Binding: Local (0x0)
# VERSIONED-LLVM-NEXT: Type: None (0x0)
# VERSIONED-LLVM-NEXT: Other: 0
# VERSIONED-LLVM-NEXT: Section: Undefined (0x0)
# VERSIONED-LLVM-NEXT: }
# VERSIONED-LLVM: VersionSymbols [
# VERSIONED-LLVM: Name: foo
# VERSIONED-LLVM: Name: bar@@Default
# VERSIONED-LLVM: Name: zed@NonDefault
# VERSIONED-GNU: Num: Value Size Type Bind Vis Ndx Name
# VERSIONED-GNU: 1: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND foo
# VERSIONED-GNU-NEXT: 2: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND bar@@Default
# VERSIONED-GNU-NEXT: 3: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND zed@NonDefault
# VERSIONED-GNU: 000: 0 (*local*) 1 (*global*) 2 (Default) 3h(NonDefault)
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .gnu.version
Type: SHT_GNU_versym
Flags: [ SHF_ALLOC ]
Link: .dynsym
AddressAlign: 0x2
EntSize: 0x2
## 0x8000 is a special VERSYM_HIDDEN bit.
Entries: [ 0, 1, 2, 0x8003 ]
- Name: .gnu.version_d
Type: SHT_GNU_verdef
Flags: [ SHF_ALLOC ]
Link: .dynstr
AddressAlign: 0x4
Info: 0x2
Entries:
- Version: 1
Flags: 0
VersionNdx: 2
Hash: 0
Names:
- Default
- Version: 1
Flags: 0
VersionNdx: 3
Hash: 0
Names:
- NonDefault
DynamicSymbols:
- Name: foo
- Name: bar
- Name: zed
## Case 8: Check what we print when:
## a) The dynamic symbol table does not exist.
# RUN: yaml2obj %s --docnum=7 -o %t7
# RUN: llvm-readobj --dyn-symbols %t7 | FileCheck %s --check-prefix=NO-DYNSYM-LLVM
# RUN: llvm-readelf --dyn-symbols %t7 | count 0
## b) The dynamic symbol table has a size of 0.
# RUN: yaml2obj %s --docnum=8 -o %t8
# RUN: llvm-readobj --dyn-symbols %t8 | FileCheck %s --check-prefix=NO-DYNSYM-LLVM
# RUN: llvm-readelf --dyn-symbols %t8 | count 0
## c) The dynamic symbol table only contains the null symbol.
# RUN: yaml2obj %s --docnum=9 -o %t9
# RUN: llvm-readobj --dyn-symbols %t9 | FileCheck %s --check-prefix=DYNSYM-EMPTY-LLVM
# RUN: llvm-readelf --dyn-symbols %t9 | FileCheck %s --check-prefix=DYNSYM-EMPTY-GNU
# NO-DYNSYM-LLVM: DynamicSymbols [
# NO-DYNSYM-LLVM-NEXT: ]
# DYNSYM-EMPTY-LLVM: DynamicSymbols [
# DYNSYM-EMPTY-LLVM-NEXT: Symbol {
# DYNSYM-EMPTY-LLVM-NEXT: Name: (0)
# DYNSYM-EMPTY-LLVM-NEXT: Value: 0x0
# DYNSYM-EMPTY-LLVM-NEXT: Size: 0
# DYNSYM-EMPTY-LLVM-NEXT: Binding: Local (0x0)
# DYNSYM-EMPTY-LLVM-NEXT: Type: None (0x0)
# DYNSYM-EMPTY-LLVM-NEXT: Other: 0
# DYNSYM-EMPTY-LLVM-NEXT: Section: Undefined (0x0)
# DYNSYM-EMPTY-LLVM-NEXT: }
# DYNSYM-EMPTY-LLVM-NEXT: ]
# DYNSYM-EMPTY-GNU: Symbol table '.dynsym' contains 1 entries:
# DYNSYM-EMPTY-GNU-NEXT: Num: Value Size Type Bind Vis Ndx Name
# DYNSYM-EMPTY-GNU-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_386
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_386
Sections:
- Name: .dynsym
Type: SHT_DYNSYM
Size: 0
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_386
DynamicSymbols: []
## Case 9: Check what we print when:
## a) The size of the dynamic symbol table is not a multiple of its entry size.
# RUN: yaml2obj %s --docnum=10 -o %t10
# RUN: llvm-readobj --dyn-symbols %t10 2>&1 | FileCheck %s -DFILE=%t10 --check-prefix=DYNSYM-SIZE-INVALID1
# RUN: llvm-readelf --dyn-symbols %t10 2>&1 | FileCheck %s -DFILE=%t10 --check-prefix=DYNSYM-SIZE-INVALID1
# DYNSYM-SIZE-INVALID1: warning: '[[FILE]]': section with index 1 has invalid size (0x1) or entry size (0x10)
## b) The same, but the DT_SYMTAB tag is present. In this case the dynamic tag has priority over the
## information about a location and an entity size of the dynamic symbol table from the section header.
## The code uses sizeof(Elf_Sym) for an entity size, so it can't be incorrect and
## the message printed is a bit shorter.
# RUN: yaml2obj %s --docnum=11 -o %t11
# RUN: llvm-readobj --dyn-symbols %t11 2>&1 | FileCheck %s -DFILE=%t11 --check-prefix=DYNSYM-SIZE-INVALID2
# RUN: llvm-readelf --dyn-symbols %t11 2>&1 | FileCheck %s -DFILE=%t11 --check-prefix=DYNSYM-SIZE-INVALID2
# DYNSYM-SIZE-INVALID2: warning: '[[FILE]]': section with index 2 has invalid size (0x1){{$}}
## c) In the case when the DT_SYMENT tag is present, we report when it's value does not match the
# value of the symbol size for the platform.
# RUN: yaml2obj %s -D BITS=32 --docnum=12 -o %t12
# RUN: llvm-readobj --dyn-symbols %t12 2>&1 | FileCheck %s -DFILE=%t12 --check-prefix=DYNSYM-SIZE-INVALID3
# RUN: llvm-readelf --dyn-symbols %t12 2>&1 | FileCheck %s -DFILE=%t12 --check-prefix=DYNSYM-SIZE-INVALID3
# RUN: yaml2obj %s -D BITS=64 --docnum=12 -o %t13
# RUN: llvm-readobj --dyn-symbols %t13 2>&1 | FileCheck %s -DFILE=%t13 --check-prefix=DYNSYM-SIZE-INVALID4
# RUN: llvm-readelf --dyn-symbols %t13 2>&1 | FileCheck %s -DFILE=%t13 --check-prefix=DYNSYM-SIZE-INVALID4
# DYNSYM-SIZE-INVALID3: warning: '[[FILE]]': DT_SYMENT value of 0x123 is not the size of a symbol (0x10){{$}}
# DYNSYM-SIZE-INVALID4: warning: '[[FILE]]': DT_SYMENT value of 0x123 is not the size of a symbol (0x18){{$}}
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_386
Sections:
- Name: .dynsym
Type: SHT_DYNSYM
Size: 0x1
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_SYMTAB
Value: 0x100
- Tag: DT_NULL
Value: 0
- Name: .dynsym
Type: SHT_DYNSYM
Address: 0x100
Size: 0x1
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x100
Sections:
- Section: .dynsym
--- !ELF
FileHeader:
Class: ELFCLASS[[BITS]]
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_SYMENT
Value: 0x123
- Tag: DT_NULL
Value: 0
## Check we report a warning when the DT_STRSZ value is broken so that the dynamic string
## table goes past the end of the file. Document we stop dumping symbols and report an error.
# RUN: yaml2obj %s --docnum=13 -o %t14
# RUN: llvm-readobj --dyn-symbols %t14 2>&1 | \
# RUN: FileCheck %s -DFILE=%t14 --check-prefix=DYNSTR-INVALID-LLVM
# RUN: llvm-readelf --dyn-symbols %t14 2>&1 | \
# RUN: FileCheck %s -DFILE=%t14 --check-prefix=DYNSTR-INVALID-GNU
# DYNSTR-INVALID-LLVM: warning: '[[FILE]]': the dynamic string table at 0x78 goes past the end of the file (0x2a8) with DT_STRSZ = 0xffffffff
# DYNSTR-INVALID-LLVM: DynamicSymbols [
# DYNSTR-INVALID-LLVM-NEXT: Symbol {
# DYNSTR-INVALID-LLVM-NEXT: Name: (0)
# DYNSTR-INVALID-LLVM-NEXT: Value: 0x0
# DYNSTR-INVALID-LLVM-NEXT: Size: 0
# DYNSTR-INVALID-LLVM-NEXT: Binding: Local (0x0)
# DYNSTR-INVALID-LLVM-NEXT: Type: None (0x0)
# DYNSTR-INVALID-LLVM-NEXT: Other: 0
# DYNSTR-INVALID-LLVM-NEXT: Section: Undefined (0x0)
# DYNSTR-INVALID-LLVM-NEXT: }
# DYNSTR-INVALID-LLVM-NEXT: warning: '[[FILE]]': st_name (0xffffff00) is past the end of the string table of size 0x6
# DYNSTR-INVALID-LLVM-NEXT: Symbol {
# DYNSTR-INVALID-LLVM-NEXT: Name: <?> (4294967040)
# DYNSTR-INVALID-LLVM-NEXT: Value: 0x0
# DYNSTR-INVALID-LLVM-NEXT: Size: 0
# DYNSTR-INVALID-LLVM-NEXT: Binding: Local (0x0)
# DYNSTR-INVALID-LLVM-NEXT: Type: None (0x0)
# DYNSTR-INVALID-LLVM-NEXT: Other: 0
# DYNSTR-INVALID-LLVM-NEXT: Section: Undefined (0x0)
# DYNSTR-INVALID-LLVM-NEXT: }
# DYNSTR-INVALID-LLVM-NEXT: Symbol {
# DYNSTR-INVALID-LLVM-NEXT: Name: test (1)
# DYNSTR-INVALID-LLVM-NEXT: Value: 0x0
# DYNSTR-INVALID-LLVM-NEXT: Size: 0
# DYNSTR-INVALID-LLVM-NEXT: Binding: Local (0x0)
# DYNSTR-INVALID-LLVM-NEXT: Type: None (0x0)
# DYNSTR-INVALID-LLVM-NEXT: Other: 0
# DYNSTR-INVALID-LLVM-NEXT: Section: Undefined (0x0)
# DYNSTR-INVALID-LLVM-NEXT: }
# DYNSTR-INVALID-LLVM-NEXT: ]
# DYNSTR-INVALID-GNU: warning: '[[FILE]]': the dynamic string table at 0x78 goes past the end of the file (0x2a8) with DT_STRSZ = 0xffffffff
# DYNSTR-INVALID-GNU: Symbol table '.dynsym' contains 3 entries:
# DYNSTR-INVALID-GNU-NEXT: Num: Value Size Type Bind Vis Ndx Name
# DYNSTR-INVALID-GNU-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
# DYNSTR-INVALID-GNU-NEXT: warning: '[[FILE]]': st_name (0xffffff00) is past the end of the string table of size 0x6
# DYNSTR-INVALID-GNU-NEXT: 1: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND <?>
# DYNSTR-INVALID-GNU-NEXT: 2: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND test
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: .dynstr
Type: SHT_STRTAB
Flags: [ SHF_ALLOC ]
Content: '007465737400' ## '\0', 'test', '\0'
- Name: .dynamic
Type: SHT_DYNAMIC
Flags: [ SHF_ALLOC ]
Link: .dynstr
Entries:
- Tag: DT_STRTAB
Value: 0x0
- Tag: DT_STRSZ
Value: 0xffffffff
- Tag: DT_NULL
Value: 0x0
DynamicSymbols:
- StName: 0xffffff00
## An arbitrary valid symbol to document we report an error before dumping it.
- StName: 0x1
ProgramHeaders:
- Type: PT_LOAD
Flags: [ PF_R ]
Sections:
- Section: .dynstr
- Section: .dynamic
## Check we report a warning when the entry size of the dynamic symbol table is zero.
# RUN: yaml2obj %s --docnum=14 -o %t15
# RUN: llvm-readobj --dyn-symbols %t15 2>&1 | FileCheck %s -DFILE=%t15 --check-prefix=DYNSYM-ZERO-ENTSIZE-LLVM
# RUN: llvm-readelf --dyn-symbols %t15 2>&1 | \
# RUN: FileCheck %s -DFILE=%t15 --check-prefix=DYNSYM-ZERO-ENTSIZE-GNU --implicit-check-not="Symbol table"
# DYNSYM-ZERO-ENTSIZE-LLVM: DynamicSymbols [
# DYNSYM-ZERO-ENTSIZE-LLVM-NEXT: warning: '[[FILE]]': section with index 1 has invalid size (0x10) or entry size (0x0)
# DYNSYM-ZERO-ENTSIZE-LLVM-NEXT: ]
# DYNSYM-ZERO-ENTSIZE-GNU: warning: '[[FILE]]': section with index 1 has invalid size (0x10) or entry size (0x0)
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_386
Sections:
- Name: .dynsym
Type: SHT_DYNSYM
EntSize: 0x0