section-symbols.test
2.77 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
## ELF section symbols use the section names when printing. This test verifies
## this and also that appropriate things are printed if the section is somehow
## invalid.
# RUN: yaml2obj %s -o %t1
# RUN: llvm-readobj %t1 --symbols 2> %t.llvm.err1 | FileCheck %s --check-prefix=LLVM1
# RUN: FileCheck %s --input-file %t.llvm.err1 --check-prefix=WARN1 --implicit-check-not=warning
# RUN: llvm-readelf %t1 --symbols 2> %t.gnu.err1 | FileCheck %s --check-prefix=GNU1
# RUN: FileCheck %s --input-file %t.gnu.err1 --check-prefix=WARN1 --implicit-check-not=warning
# LLVM1: Name: (0)
# LLVM1: Name: .foo (0)
# LLVM1: Name: <section 67> (0)
# LLVM1: Name: .bar (0)
# LLVM1: Name: <section 66> (0)
# GNU1: Symbol table '.symtab' contains 5 entries:
# GNU1-NEXT: Num: {{.*}} Type {{.*}} Ndx Name
# GNU1-NEXT: 0: {{.*}} NOTYPE {{.*}} UND {{$}}
# GNU1-NEXT: 1: {{.*}} SECTION {{.*}} 1 .foo
# GNU1-NEXT: 2: {{.*}} SECTION {{.*}} 67 <section 67>
# GNU1-NEXT: 3: {{.*}} SECTION {{.*}} 2 .bar
# GNU1-NEXT: 4: {{.*}} SECTION {{.*}} 66 <section 66>
# WARN1: warning: '{{.*}}.tmp1': invalid section index: 67
# WARN1: warning: '{{.*}}.tmp1': invalid section index: 66
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Sections:
- Name: .foo
Type: SHT_PROGBITS
- Name: .bar
Type: SHT_PROGBITS
- Name: .symtab_shndx
Type: SHT_SYMTAB_SHNDX
Link: .symtab
Entries: [ 0, 0, 0, 2, 0x42 ]
Symbols:
- Name: ""
Section: .foo
Type: STT_SECTION
- Name: ""
Index: 0x43
Type: STT_SECTION
# Section symbol via SHT_SYMTAB_SHNDX.
- Name: ""
Index: SHN_XINDEX
Type: STT_SECTION
# Section symbol via SHT_SYMTAB_SHNDX with invalid index.
- Name: ""
Index: SHN_XINDEX
Type: STT_SECTION
# RUN: yaml2obj %s --docnum=2 -o %t2
# RUN: llvm-readobj %t2 --symbols 2> %t.llvm.err2 | FileCheck %s --check-prefix=LLVM2
# RUN: FileCheck %s --input-file %t.llvm.err2 --check-prefix=WARN2 --implicit-check-not=warning
# RUN: llvm-readelf %t2 --symbols 2> %t.gnu.err2 | FileCheck %s --check-prefix=GNU2
# RUN: FileCheck %s --input-file %t.gnu.err2 --check-prefix=WARN2 --implicit-check-not=warning
# LLVM2: Name: (0)
# LLVM2: Name: <?> (0)
# GNU2: Symbol table '.symtab' contains 2 entries:
# GNU2-NEXT: Num: {{.*}} Type {{.*}} Ndx Name
# GNU2-NEXT: 0: {{.*}} NOTYPE {{.*}} UND {{$}}
# GNU2-NEXT: 1: {{.*}} SECTION {{.*}} RSV[0xffff] <?>
# WARN2: warning: '{{.*}}.tmp2': extended symbol index (1) is past the end of the SHT_SYMTAB_SHNDX section of size 0
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Symbols:
# Section symbol via SHT_SYMTAB_SHNDX when SHT_SYMTAB_SHNDX is missing.
- Name: ""
Index: SHN_XINDEX
Type: STT_SECTION