Skip to content

Commit 975184f

Browse files
committed
Check file name in errors and return lost checksum checks
1 parent 71a638c commit 975184f

File tree

2 files changed

+42
-13
lines changed

2 files changed

+42
-13
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
## In this case, the symbol .gfids$y is not present at all.
99

1010
# RUN: yaml2obj %s --docnum=1 -o %t1.in.o
11-
# RUN: not llvm-objcopy --strip-debug %t1.in.o %t1.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-NOSYM
11+
# RUN: not llvm-objcopy --strip-debug %t1.in.o %t1.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-NOSYM -DFILE=%t1.out.o
1212

13-
# ERROR-NOSYM: section '.gfids$y' does not have the corresponding symbol or the symbol has unexpected format
13+
# ERROR-NOSYM: error: '[[FILE]]': section '.gfids$y' does not have the corresponding symbol or the symbol has unexpected format
1414

1515
--- !COFF
1616
header:
@@ -55,9 +55,9 @@ symbols:
5555
## In this case, the symbol .giats$y has a non-zero offset.
5656

5757
# RUN: yaml2obj %s --docnum=2 -o %t2.in.o
58-
# RUN: not llvm-objcopy --strip-debug %t2.in.o %t2.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-OFFSET
58+
# RUN: not llvm-objcopy --strip-debug %t2.in.o %t2.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-OFFSET -DFILE=%t2.out.o
5959

60-
# ERROR-OFFSET: section '.giats$y' does not have the corresponding symbol or the symbol has unexpected format
60+
# ERROR-OFFSET: error: '[[FILE]]': section '.giats$y' does not have the corresponding symbol or the symbol has unexpected format
6161

6262
--- !COFF
6363
header:
@@ -114,9 +114,9 @@ symbols:
114114
## In this case, the symbol .gljmp$y has a non-static storage class.
115115

116116
# RUN: yaml2obj %s --docnum=3 -o %t3.in.o
117-
# RUN: not llvm-objcopy --strip-debug %t3.in.o %t3.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-EXTERNAL
117+
# RUN: not llvm-objcopy --strip-debug %t3.in.o %t3.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-EXTERNAL -DFILE=%t3.out.o
118118

119-
# ERROR-EXTERNAL: section '.gljmp$y' does not have the corresponding symbol or the symbol has unexpected format
119+
# ERROR-EXTERNAL: error: '[[FILE]]': section '.gljmp$y' does not have the corresponding symbol or the symbol has unexpected format
120120

121121
--- !COFF
122122
header:
@@ -169,9 +169,9 @@ symbols:
169169
## of .symidx directives, e.g .giats$y, .gljmp$y and .gehcont$y.
170170

171171
# RUN: yaml2obj %s --docnum=4 -o %t4.in.o
172-
# RUN: not llvm-objcopy --strip-debug %t4.in.o %t4.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-SYMIDX
172+
# RUN: not llvm-objcopy --strip-debug %t4.in.o %t4.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-SYMIDX -DFILE=%t4.out.o
173173

174-
# ERROR-SYMIDX: section '.gfids$y' contains a .symidx (16) that is incorrect or was stripped
174+
# ERROR-SYMIDX: error: '[[FILE]]': section '.gfids$y' contains a .symidx (16) that is incorrect or was stripped
175175
--- !COFF
176176
header:
177177
Machine: IMAGE_FILE_MACHINE_AMD64

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

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,36 @@
55
# RUN: yaml2obj %s -o %t.in.o
66

77
# RUN: llvm-objcopy --strip-debug %t.in.o %t.out.o
8-
# RUN: llvm-readobj -x '.gehcont$y' -x '.gfids$y' -x '.giats$y' -x '.gljmp$y' %t.out.o | FileCheck %s
8+
# RUN: llvm-readobj -s -x '.gehcont$y' -x '.gfids$y' -x '.giats$y' -x '.gljmp$y' %t.out.o | FileCheck %s
9+
10+
# CHECK: Symbols [
11+
# CHECK: Name: .text
12+
# CHECK: Name: .data
13+
# CHECK: Name: .bss
14+
# CHECK: Name: .text
15+
# CHECK: Name: ?foo@@YAXXZ
16+
# CHECK: Name: .data
17+
# CHECK: Name: .drectve
18+
# CHECK: Name: .gehcont$y
19+
# CHECK: AuxSectionDef {
20+
# CHECK: Checksum: 0x20BA8B48
21+
# CHECK: }
22+
# CHECK: Name: ?foo2@@YAXXZ
23+
# CHECK: Name: $ehgcr_0_1
24+
# CHECK: Name: .gfids$y
25+
# CHECK: AuxSectionDef {
26+
# CHECK: Checksum: 0x5B6F2027
27+
# CHECK: }
28+
# CHECK: Name: .giats$y
29+
# CHECK: AuxSectionDef {
30+
# CHECK: Checksum: 0x95AD7F70
31+
# CHECK: }
32+
# CHECK: Name: .gljmp$y
33+
# CHECK: AuxSectionDef {
34+
# CHECK: Checksum: 0xFACF36F8
35+
# CHECK: }
36+
# CHECK: Name: foo
37+
# CHECK: ]
938

1039
# CHECK: Hex dump of section '.gehcont$y':
1140
# CHECK-NEXT: 0x00000000 10000000 10000000 10000000
@@ -193,7 +222,7 @@ symbols:
193222
Length: 12
194223
NumberOfRelocations: 0
195224
NumberOfLinenumbers: 0
196-
CheckSum: 820498156
225+
CheckSum: 0x30E7CEEC
197226
Number: 8
198227
- Name: '?foo2@@YAXXZ'
199228
Value: 0
@@ -217,7 +246,7 @@ symbols:
217246
Length: 8
218247
NumberOfRelocations: 0
219248
NumberOfLinenumbers: 0
220-
CheckSum: 1167279533
249+
CheckSum: 0x459345AD
221250
Number: 9
222251
- Name: '.giats$y'
223252
Value: 0
@@ -229,7 +258,7 @@ symbols:
229258
Length: 8
230259
NumberOfRelocations: 0
231260
NumberOfLinenumbers: 0
232-
CheckSum: 830808662
261+
CheckSum: 0x31852256
233262
Number: 10
234263
- Name: '.gljmp$y'
235264
Value: 0
@@ -241,7 +270,7 @@ symbols:
241270
Length: 16
242271
NumberOfRelocations: 0
243272
NumberOfLinenumbers: 0
244-
CheckSum: 3322439691
273+
CheckSum: 0xC608680B
245274
Number: 11
246275
- Name: foo
247276
Value: 0

0 commit comments

Comments
 (0)