Skip to content

Commit 557fcbe

Browse files
committed
Reduce tests more
1 parent f1fdc0f commit 557fcbe

File tree

2 files changed

+36
-193
lines changed

2 files changed

+36
-193
lines changed

llvm/test/tools/llvm-objcopy/COFF/strip-invalid-symidx-section.test

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
## Bail out if a section consisting of symidx is invalid.
2-
## It includes both: an unexpected format for patching section data and
3-
## updating the checksum, as well as data validity.
4-
## Essentially, the expected format is a definitive symbol with a zero offset
5-
## linked to the section. Valid data consists of a sequence of symbol indices
6-
## that remain in the symbol table even after stripping.
1+
## Test that we bail out if a section consisting of symidx is invalid.
72

83
## In this case, the symbol .gfids$y is not present at all.
9-
104
# RUN: yaml2obj %s --docnum=1 -o %t1.in.o
115
# RUN: not llvm-objcopy --strip-debug %t1.in.o %t1.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-NOSYM -DFILE=%t1.out.o
126

@@ -19,13 +13,6 @@ header:
1913
sections:
2014
- Name: .text
2115
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
22-
Alignment: 4
23-
SectionData: 488D0500000000488D0D00000000488D0500000000488D0500000000
24-
SizeOfRawData: 28
25-
Relocations:
26-
- VirtualAddress: 3
27-
SymbolName: foo
28-
Type: IMAGE_REL_AMD64_REL32
2916
- Name: '.gfids$y'
3017
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
3118
Alignment: 4
@@ -39,10 +26,10 @@ symbols:
3926
ComplexType: IMAGE_SYM_DTYPE_NULL
4027
StorageClass: IMAGE_SYM_CLASS_STATIC
4128
SectionDefinition:
42-
Length: 28
29+
Length: 0
4330
NumberOfRelocations: 4
4431
NumberOfLinenumbers: 0
45-
CheckSum: 3583480811
32+
CheckSum: 0
4633
Number: 1
4734
- Name: foo
4835
Value: 0
@@ -53,7 +40,6 @@ symbols:
5340
...
5441

5542
## In this case, the symbol .giats$y has a non-zero offset.
56-
5743
# RUN: yaml2obj %s --docnum=2 -o %t2.in.o
5844
# RUN: not llvm-objcopy --strip-debug %t2.in.o %t2.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-OFFSET -DFILE=%t2.out.o
5945

@@ -66,13 +52,6 @@ header:
6652
sections:
6753
- Name: .text
6854
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
69-
Alignment: 4
70-
SectionData: 488D0500000000488D0D00000000488D0500000000488D0500000000
71-
SizeOfRawData: 28
72-
Relocations:
73-
- VirtualAddress: 3
74-
SymbolName: foo
75-
Type: IMAGE_REL_AMD64_REL32
7655
- Name: '.giats$y'
7756
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
7857
Alignment: 4
@@ -86,10 +65,10 @@ symbols:
8665
ComplexType: IMAGE_SYM_DTYPE_NULL
8766
StorageClass: IMAGE_SYM_CLASS_STATIC
8867
SectionDefinition:
89-
Length: 28
90-
NumberOfRelocations: 4
68+
Length: 0
69+
NumberOfRelocations: 0
9170
NumberOfLinenumbers: 0
92-
CheckSum: 3583480811
71+
CheckSum: 0
9372
Number: 1
9473
- Name: '.giats$y'
9574
Value: 42
@@ -112,7 +91,6 @@ symbols:
11291
...
11392

11493
## In this case, the symbol .gljmp$y has a non-static storage class.
115-
11694
# RUN: yaml2obj %s --docnum=3 -o %t3.in.o
11795
# RUN: not llvm-objcopy --strip-debug %t3.in.o %t3.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-EXTERNAL -DFILE=%t3.out.o
11896

@@ -125,13 +103,6 @@ header:
125103
sections:
126104
- Name: .text
127105
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
128-
Alignment: 4
129-
SectionData: 488D0500000000488D0D00000000488D0500000000488D0500000000
130-
SizeOfRawData: 28
131-
Relocations:
132-
- VirtualAddress: 3
133-
SymbolName: foo
134-
Type: IMAGE_REL_AMD64_REL32
135106
- Name: '.gljmp$y'
136107
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
137108
Alignment: 4
@@ -145,10 +116,10 @@ symbols:
145116
ComplexType: IMAGE_SYM_DTYPE_NULL
146117
StorageClass: IMAGE_SYM_CLASS_STATIC
147118
SectionDefinition:
148-
Length: 28
149-
NumberOfRelocations: 4
119+
Length: 0
120+
NumberOfRelocations: 0
150121
NumberOfLinenumbers: 0
151-
CheckSum: 3583480811
122+
CheckSum: 0
152123
Number: 1
153124
- Name: '.gljmp$y'
154125
Value: 0
@@ -167,7 +138,6 @@ symbols:
167138
## In this case, .gfids$y contains a symbol index that is not present in the
168139
## symbol table. Generally the behavior should be the same for every section consisting
169140
## of .symidx directives, e.g .giats$y, .gljmp$y and .gehcont$y.
170-
171141
# RUN: yaml2obj %s --docnum=4 -o %t4.in.o
172142
# RUN: not llvm-objcopy --strip-debug %t4.in.o %t4.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-SYMIDX -DFILE=%t4.out.o
173143

@@ -179,13 +149,6 @@ header:
179149
sections:
180150
- Name: .text
181151
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
182-
Alignment: 4
183-
SectionData: 488D0500000000488D0D00000000488D0500000000488D0500000000
184-
SizeOfRawData: 28
185-
Relocations:
186-
- VirtualAddress: 3
187-
SymbolName: foo
188-
Type: IMAGE_REL_AMD64_REL32
189152
- Name: '.gfids$y'
190153
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
191154
Alignment: 4
@@ -199,10 +162,10 @@ symbols:
199162
ComplexType: IMAGE_SYM_DTYPE_NULL
200163
StorageClass: IMAGE_SYM_CLASS_STATIC
201164
SectionDefinition:
202-
Length: 28
203-
NumberOfRelocations: 4
165+
Length: 0
166+
NumberOfRelocations: 0
204167
NumberOfLinenumbers: 0
205-
CheckSum: 3583480811
168+
CheckSum: 0
206169
Number: 1
207170
- Name: '.gfids$y'
208171
Value: 0

0 commit comments

Comments
 (0)