duplicate-section-names.yaml
4.1 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
## Check that yaml2obj is able to produce an object from YAML
## containing sections with duplicate names (but different name suffixes).
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readobj -s %t1 | FileCheck %s --check-prefix=CASE1
# CASE1: Name: .foo1 (
# CASE1: Name: .foo (
# CASE1: Name: .foo (
# CASE1: Name: .foo2 (
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .foo1
Type: SHT_PROGBITS
- Name: .foo
Type: SHT_PROGBITS
- Name: '.foo [1]'
Type: SHT_PROGBITS
- Name: .foo2
Type: SHT_PROGBITS
## Check that yaml2obj reports an error in case we have
## sections with equal names and suffixes.
# RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=CASE2
# CASE2: error: repeated section/fill name: '.foo [1]' at YAML section/fill number 2
# CASE2: error: repeated section/fill name: '.foo [1]' at YAML section/fill number 3
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: '.foo [1]'
Type: SHT_PROGBITS
- Name: '.foo [1]'
Type: SHT_PROGBITS
- Name: '.foo [1]'
Type: SHT_PROGBITS
## Check that yaml2obj reports an error in case we have
## symbols without suffixes in the names and their
## names are equal.
# RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=CASE3
# CASE3: error: repeated section/fill name: '.foo' at YAML section/fill number 2
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .foo
Type: SHT_PROGBITS
- Name: .foo
Type: SHT_PROGBITS
## Check that yaml2obj can produce an object when symbols are defined
## relative to sections with duplicate names (but different name suffixes).
# RUN: yaml2obj --docnum=4 %s -o %t4
# RUN: llvm-readobj -s -t %t4 | FileCheck %s --check-prefix=CASE4
# CASE4: Section {
# CASE4: Index: 1
# CASE4-NEXT: Name: .foo
# CASE4: Index: 2
# CASE4-NEXT: Name: .foo
# CASE4: Symbol {
# CASE4: Name: foo
# CASE4-NEXT: Value:
# CASE4-NEXT: Size:
# CASE4-NEXT: Binding:
# CASE4-NEXT: Type:
# CASE4-NEXT: Other:
# CASE4-NEXT: Section: .foo (0x1)
# CASE4: Name: bar
# CASE4-NEXT: Value:
# CASE4-NEXT: Size:
# CASE4-NEXT: Binding:
# CASE4-NEXT: Type:
# CASE4-NEXT: Other:
# CASE4-NEXT: Section: .foo (0x2)
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .foo
Type: SHT_PROGBITS
- Name: '.foo [1]'
Type: SHT_PROGBITS
Symbols:
- Name: foo
Section: .foo
- Name: bar
Section: '.foo [1]'
## Check that yaml2obj can produce SHT_GROUP sections that
## reference sections and symbols with name suffixes.
# RUN: yaml2obj --docnum=5 %s -o %t5
# RUN: llvm-readobj --elf-section-groups %t5 | FileCheck %s --check-prefix=CASE5
# CASE5: Groups {
# CASE5-NEXT: Group {
# CASE5-NEXT: Name: .group (1)
# CASE5-NEXT: Index: 1
# CASE5-NEXT: Link: 5
# CASE5-NEXT: Info: 1
# CASE5-NEXT: Type: COMDAT (0x1)
# CASE5-NEXT: Signature: foo
# CASE5-NEXT: Section(s) in group [
# CASE5-NEXT: .text.foo (2)
# CASE5-NEXT: ]
# CASE5-NEXT: }
# CASE5-NEXT: Group {
# CASE5-NEXT: Name: .group (1)
# CASE5-NEXT: Index: 3
# CASE5-NEXT: Link: 5
# CASE5-NEXT: Info: 2
# CASE5-NEXT: Type: COMDAT (0x1)
# CASE5-NEXT: Signature: foo
# CASE5-NEXT: Section(s) in group [
# CASE5-NEXT: .text.foo (4)
# CASE5-NEXT: ]
# CASE5-NEXT: }
# CASE5-NEXT: }
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .group
Type: SHT_GROUP
Info: foo
Members:
- SectionOrType: GRP_COMDAT
- SectionOrType: .text.foo
- Name: .text.foo
Type: SHT_PROGBITS
- Name: '.group [1]'
Type: SHT_GROUP
Info: 'foo [1]'
Members:
- SectionOrType: GRP_COMDAT
- SectionOrType: '.text.foo [1]'
- Name: '.text.foo [1]'
Type: SHT_PROGBITS
Symbols:
- Name: foo
Section: .text.foo
- Name: 'foo [1]'
Section: '.text.foo [1]'