Skip to content

Commit 17a3c77

Browse files
committed
Extend the test
1 parent 5695096 commit 17a3c77

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

llvm/test/tools/llvm-objcopy/ELF/remove-note.test

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Check incompatible options
1+
## Check incompatible options.
22
# RUN: not llvm-objcopy --remove-note=1 --remove-section=.test - 2>&1 | FileCheck %s --check-prefix=ERR-REMSEC
33
# RUN: not llvm-objcopy --remove-note=1 --add-section=.test=%s - 2>&1 | FileCheck %s --check-prefix=ERR-ADDSEC
44
# RUN: not llvm-objcopy --remove-note=1 --update-section=.test=%s - 2>&1 | FileCheck %s --check-prefix=ERR-UPDSEC
@@ -7,7 +7,7 @@
77
# ERR-ADDSEC: error: cannot specify both --remove-note and --add-section
88
# ERR-UPDSEC: error: cannot specify both --remove-note and --update-section
99

10-
## Check invalid argument formats
10+
## Check invalid argument formats.
1111
# RUN: not llvm-objcopy --remove-note= - 2>&1 | FileCheck %s --check-prefix=ERR-NOTYPEID
1212
# RUN: not llvm-objcopy --remove-note=CORE/ - 2>&1 | FileCheck %s --check-prefix=ERR-NOTYPEID
1313
# RUN: not llvm-objcopy --remove-note=/1 - 2>&1 | FileCheck %s --check-prefix=ERR-EMPTYNAME
@@ -20,20 +20,24 @@
2020
# ERR-INVNUM1: error: bad note type_id for --remove-note: '1/2'
2121
# ERR-INVNUM2: error: bad note type_id for --remove-note: 'Notanumber'
2222

23+
## Check deleting notes:
24+
## * --remove-note=1 will remove note "CORE/1" and "LINUX/1",
25+
## * --remove-note=DUMMY/2 will not remove any notes because there are no notes with this owner,
26+
## * --remove-note=CORE/3 will remove "CORE/3" but preserve "LINUX/3".
2327
# RUN: yaml2obj -D ALIGN=8 -D ELFCLASS=64 -D ENDIANNESS=LSB %s -o %t8.64.lsb
2428
# RUN: llvm-objcopy --remove-note=0x01 --remove-note=DUMMY/2 --remove-note=CORE/0x03 %t8.64.lsb %t8.64.lsb.o
2529
# RUN: llvm-readobj --segments --sections --notes %t8.64.lsb.o | \
26-
# RUN: FileCheck %s -D#SIZE0=32 -D#SIZE1=32
30+
# RUN: FileCheck %s -D#SIZE0=32 -D#SIZE1=64
2731

2832
# RUN: yaml2obj -D ALIGN=4 -D ELFCLASS=64 -D ENDIANNESS=MSB %s -o %t4.64.msb
2933
# RUN: llvm-objcopy --remove-note=0x01 --remove-note=DUMMY/0x02 --remove-note=CORE/3 %t4.64.msb %t4.64.msb.o
3034
# RUN: llvm-readobj --segments --sections --notes %t4.64.msb.o | \
31-
# RUN: FileCheck %s -D#SIZE0=24 -D#SIZE1=24
35+
# RUN: FileCheck %s -D#SIZE0=24 -D#SIZE1=48
3236

3337
# RUN: yaml2obj -D ALIGN=4 -D ELFCLASS=32 -D ENDIANNESS=LSB %s -o %t4.32.lsb
3438
# RUN: llvm-objcopy --remove-note=1 --remove-note=DUMMY/0x02 --remove-note=CORE/3 %t4.32.lsb %t4.32.lsb.o
3539
# RUN: llvm-readobj --segments --sections --notes %t4.32.lsb.o | \
36-
# RUN: FileCheck %s -D#SIZE0=24 -D#SIZE1=24
40+
# RUN: FileCheck %s -D#SIZE0=24 -D#SIZE1=48
3741

3842
# CHECK: Sections [
3943
# CHECK: Section {
@@ -70,7 +74,7 @@
7074
# CHECK-NEXT: Data size: 0x2
7175
# CHECK-NEXT: Type: NT_ARCH
7276
# CHECK-NEXT: Description data (
73-
# CHECK-NEXT: 0000: 0202
77+
# CHECK-NEXT: 0000: 0201
7478
# CHECK-NEXT: )
7579
# CHECK-NEXT: }
7680
# CHECK-NEXT: ]
@@ -81,11 +85,19 @@
8185
# CHECK-NEXT: Size: 0x[[#%X,SIZE1]]
8286
# CHECK-NEXT: Notes [
8387
# CHECK-NEXT: {
88+
# CHECK-NEXT: Owner: LINUX
89+
# CHECK-NEXT: Data size: 0x2
90+
# CHECK-NEXT: Type: Unknown (0x00000003)
91+
# CHECK-NEXT: Description data (
92+
# CHECK-NEXT: 0000: 0301
93+
# CHECK-NEXT: )
94+
# CHECK-NEXT: }
95+
# CHECK-NEXT: {
8496
# CHECK-NEXT: Owner: CORE
8597
# CHECK-NEXT: Data size: 0x2
8698
# CHECK-NEXT: Type: Unknown (0x00000004)
8799
# CHECK-NEXT: Description data (
88-
# CHECK-NEXT: 0000: 0404
100+
# CHECK-NEXT: 0000: 0401
89101
# CHECK-NEXT: )
90102
# CHECK-NEXT: }
91103
# CHECK-NEXT: ]
@@ -114,22 +126,25 @@ Sections:
114126
Desc: 0101
115127
- Name: CORE
116128
Type: 0x02
117-
Desc: 0202
129+
Desc: 0201
118130
- Name: .note1
119131
Type: SHT_NOTE
120132
AddressAlign: [[ALIGN]]
121133
Notes:
134+
- Name: LINUX
135+
Type: 0x03
136+
Desc: 0301
122137
- Name: CORE
123138
Type: 0x03
124-
Desc: 0303
139+
Desc: 0302
125140
- Name: CORE
126141
Type: 0x04
127-
Desc: 0404
142+
Desc: 0401
128143
- Name: .note2
129144
Type: SHT_NOTE
130145
AddressAlign: [[ALIGN]]
131146
Notes:
132147
- Name: LINUX
133148
Type: 0x01
134-
Desc: 0505
149+
Desc: 0102
135150
...

0 commit comments

Comments
 (0)