@@ -42,14 +42,18 @@ Sections:
42
42
Info : 0
43
43
Address : 0x0
44
44
45
- # # Check we can redefine fields of the first SHT_NULL section .
45
+ # # Check we are still able to describe other sections too .
46
46
47
47
# RUN: yaml2obj --docnum=3 %s -o %t3
48
- # RUN: llvm-readelf --sections %t3 | FileCheck %s --check-prefix=REDEFINE
48
+ # RUN: llvm-readelf --sections %t3 | FileCheck %s --check-prefix=OTHER-SECTION
49
49
50
- # REDEFINE: Section Headers:
51
- # REDEFINE-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
52
- # REDEFINE-NEXT: [ 0] .foo NULL 0000000000000006 000000 000002 03 A 4 5 1
50
+ # OTHER-SECTION: Section Headers:
51
+ # OTHER-SECTION-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
52
+ # OTHER-SECTION-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
53
+ # OTHER-SECTION-NEXT: [ 1] foo PROGBITS 0000000000000000 000180 000000 00 0 0 0
54
+ # OTHER-SECTION-NEXT: [ 2] .symtab SYMTAB 0000000000000000 000180 000018 18 3 1 8
55
+ # OTHER-SECTION-NEXT: [ 3] .strtab STRTAB 0000000000000000 000198 000001 00 0 0 1
56
+ # OTHER-SECTION-NEXT: [ 4] .shstrtab STRTAB 0000000000000000 000199 00001f 00 0 0 1
53
57
54
58
--- !ELF
55
59
FileHeader :
@@ -59,25 +63,23 @@ FileHeader:
59
63
Machine : EM_X86_64
60
64
Sections :
61
65
- Type : SHT_NULL
62
- Name : .foo
63
- Flags : [ SHF_ALLOC ]
64
- AddressAlign : 0x1
65
- Size : 0x2
66
- EntSize : 0x3
67
- Link : 4
68
- Info : 5
69
- Address : 0x6
70
-
71
- # # Check that file size does not change if we redefine the Size
72
- # # of the first SHT_NULL section.
66
+ Name : ' '
67
+ Flags : [ ]
68
+ AddressAlign : 0x0
69
+ Size : 0x0
70
+ EntSize : 0x0
71
+ Link : 0
72
+ - Type : SHT_PROGBITS
73
+ Name : ' foo'
74
+
75
+ # # Check we can redefine sh_size and sh_link fields of the SHT_NULL section.
73
76
74
77
# RUN: yaml2obj --docnum=4 %s -o %t4
75
- # RUN: stat %t3 > %t.txt
76
- # RUN: stat %t4 >> %t.txt
77
- # RUN: FileCheck %s --input-file=%t.txt --check-prefix=SIZE
78
+ # RUN: llvm-readelf --sections %t4 | FileCheck %s --check-prefix=REDEFINE
78
79
79
- # SIZE: Size: [[FILESIZE:.*]]
80
- # SIZE: Size: [[FILESIZE]]
80
+ # REDEFINE: Section Headers:
81
+ # REDEFINE-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
82
+ # REDEFINE-NEXT: [ 0] NULL 0000000000000000 000000 000123 00 1 0 0
81
83
82
84
--- !ELF
83
85
FileHeader :
@@ -86,28 +88,16 @@ FileHeader:
86
88
Type : ET_REL
87
89
Machine : EM_X86_64
88
90
Sections :
89
- - Type : SHT_NULL
90
- Name : .foo
91
- Flags : [ SHF_ALLOC ]
92
- AddressAlign : 0x1
93
- Size : 0xFFFF
94
- EntSize : 0x3
95
- Link : 4
96
- Info : 5
97
- Address : 0x6
91
+ - Type : SHT_NULL
92
+ Link : .foo
93
+ Size : 0x123
94
+ - Type : SHT_PROGBITS
95
+ Name : .foo
98
96
99
- # # Check we are still able to describe other sections too .
97
+ # # The same as above, but using a number as a Link value .
100
98
101
99
# RUN: yaml2obj --docnum=5 %s -o %t5
102
- # RUN: llvm-readelf --sections %t5 | FileCheck %s --check-prefix=OTHER-SECTION
103
-
104
- # OTHER-SECTION: Section Headers:
105
- # OTHER-SECTION-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
106
- # OTHER-SECTION-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
107
- # OTHER-SECTION-NEXT: [ 1] foo PROGBITS 0000000000000000 000180 000000 00 0 0 0
108
- # OTHER-SECTION-NEXT: [ 2] .symtab SYMTAB 0000000000000000 000180 000018 18 3 1 8
109
- # OTHER-SECTION-NEXT: [ 3] .strtab STRTAB 0000000000000000 000198 000001 00 0 0 1
110
- # OTHER-SECTION-NEXT: [ 4] .shstrtab STRTAB 0000000000000000 000199 00001f 00 0 0 1
100
+ # RUN: llvm-readelf --sections %t5 | FileCheck %s --check-prefix=REDEFINE
111
101
112
102
--- !ELF
113
103
FileHeader :
@@ -116,15 +106,11 @@ FileHeader:
116
106
Type : ET_REL
117
107
Machine : EM_X86_64
118
108
Sections :
119
- - Type : SHT_NULL
120
- Name : ' '
121
- Flags : [ ]
122
- AddressAlign : 0x0
123
- Size : 0x0
124
- EntSize : 0x0
125
- Link : 0
109
+ - Type : SHT_NULL
110
+ Link : 1
111
+ Size : 0x123
126
112
- Type : SHT_PROGBITS
127
- Name : ' foo'
113
+ Name : . foo
128
114
129
115
# # Check we report an error if null section sh_link field refers to an unknown section.
130
116
@@ -164,7 +150,7 @@ Sections:
164
150
# MULTIPLE: Section Headers:
165
151
# MULTIPLE-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
166
152
# MULTIPLE-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
167
- # MULTIPLE-NEXT: [ 1] .foo NULL 0000000000000123 000180 000020 10 A 1 2 0
153
+ # MULTIPLE-NEXT: [ 1] NULL 0000000000000123 000180 000020 10 A 1 2 0
168
154
169
155
--- !ELF
170
156
FileHeader :
@@ -175,31 +161,9 @@ FileHeader:
175
161
Sections :
176
162
- Type : SHT_NULL
177
163
- Type : SHT_NULL
178
- Name : .foo
179
164
Flags : [ SHF_ALLOC ]
180
165
Size : 0x20
181
166
EntSize : 0x10
182
167
Link : 1
183
168
Info : 2
184
169
Address : 0x123
185
-
186
- # # Check we can override the sh_offset/sh_size fields of the first SHT_NULL section if requested.
187
-
188
- # RUN: yaml2obj --docnum=9 %s -o %t9
189
- # RUN: llvm-readelf --sections %t9 | FileCheck %s --check-prefix=OVERRIDE
190
-
191
- # OVERRIDE: Section Headers:
192
- # OVERRIDE-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
193
- # OVERRIDE-NEXT: [ 0] NULL 0000000000000000 000007 000008 00 0 0 0
194
-
195
- --- !ELF
196
- FileHeader :
197
- Class : ELFCLASS64
198
- Data : ELFDATA2LSB
199
- Type : ET_REL
200
- Machine : EM_X86_64
201
- Sections :
202
- - Type : SHT_NULL
203
- Size : 0x2
204
- ShOffset : 0x7
205
- ShSize : 0x8
0 commit comments