Debian Codegraph @

llvm/test/tools/llvm-objcopy/ELF/decompress-sections.test

raw
1 # REQUIRES: zlib
2 ## Test decompression for different sections.
3
4 # RUN: yaml2obj %s -o %t
5 # RUN: llvm-objcopy --decompress-debug-sections %t %t.de
6 # RUN: llvm-readelf -S %t.de | FileCheck %s
7 # RUN: llvm-objcopy --compress-sections '*nonalloc=none' --compress-sections .debugx=none %t %t.1.de
8 # RUN: cmp %t.de %t.1.de
9
10 # CHECK: Name Type Address Off Size ES Flg Lk Inf Al
11 # CHECK: .debug_alloc PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00 AC 0 0 0
12 # CHECK-NEXT: .debug_nonalloc PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00 0 0 1
13 # CHECK-NEXT: .debugx PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00 0 0 1
14 # CHECK-NEXT: nodebug PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00 C 0 0 0
15
16 # RUN: llvm-objcopy --compress-sections '.debug*=none' %t %t2.de
17 # RUN: llvm-readelf -S -x .debug_alloc -x .debug_nonalloc -x .debugx %t2.de | FileCheck %s --check-prefix=CHECK2
18
19 # CHECK2: Name Type Address Off Size ES Flg Lk Inf Al
20 # CHECK2: .debug_alloc PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00 A 0 0 1
21 # CHECK2-NEXT: .debug_nonalloc PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00 0 0 1
22 # CHECK2-NEXT: .debugx PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00 0 0 1
23 # CHECK2-NEXT: nodebug PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00 C 0 0 0
24
25 # CHECK2: Hex dump of section '.debug_alloc':
26 # CHECK2-NEXT: 0x00000000 2a000000 00000000 2a000000 00000000 *.......*.......
27 # CHECK2-NEXT: 0x00000010 2a000000 00000000 2a000000 00000000 *.......*.......
28 # CHECK2-NEXT: 0x00000020 2a000000 00000000 2a000000 00000000 *.......*.......
29 # CHECK2-NEXT: 0x00000030 2a000000 00000000 2a000000 00000000 *.......*.......
30 # CHECK2-EMPTY:
31 # CHECK2: Hex dump of section '.debug_nonalloc':
32 # CHECK2-NEXT: 0x00000000 2a000000 00000000 2a000000 00000000 *.......*.......
33 # CHECK2-NEXT: 0x00000010 2a000000 00000000 2a000000 00000000 *.......*.......
34 # CHECK2-NEXT: 0x00000020 2a000000 00000000 2a000000 00000000 *.......*.......
35 # CHECK2-NEXT: 0x00000030 2a000000 00000000 2a000000 00000000 *.......*.......
36 # CHECK2-EMPTY:
37 # CHECK2-NEXT: Hex dump of section '.debugx':
38 # CHECK2-NEXT: 0x00000000 2a000000 00000000 2a000000 00000000 *.......*.......
39 # CHECK2-NEXT: 0x00000010 2a000000 00000000 2a000000 00000000 *.......*.......
40 # CHECK2-NEXT: 0x00000020 2a000000 00000000 2a000000 00000000 *.......*.......
41 # CHECK2-NEXT: 0x00000030 2a000000 00000000 2a000000 00000000 *.......*.......
42
43 --- !ELF
44 FileHeader:
45 Class: ELFCLASS64
46 Data: ELFDATA2LSB
47 Type: ET_REL
48 Machine: EM_X86_64
49 Sections:
50 - Name: .debug_alloc
51 Type: SHT_PROGBITS
52 Flags: [ SHF_ALLOC, SHF_COMPRESSED ]
53 Content: 010000000000000040000000000000000100000000000000789cd36280002d3269002f800151
54 - Name: .debug_nonalloc
55 Type: SHT_PROGBITS
56 Flags: [ SHF_COMPRESSED ]
57 Content: 010000000000000040000000000000000100000000000000789cd36280002d3269002f800151
58 - Name: .debugx
59 Type: SHT_PROGBITS
60 Flags: [ SHF_COMPRESSED ]
61 Content: 010000000000000040000000000000000100000000000000789cd36280002d3269002f800151
62 - Name: nodebug
63 Type: SHT_PROGBITS
64 Flags: [ SHF_COMPRESSED ]
65 Content: 010000000000000040000000000000000100000000000000789cd36280002d3269002f800151