2 ## Test --decompress/-z.
4 # RUN: yaml2obj %s -o %t
6 # RUN: llvm-readelf -z -x .strings -x .not_null_terminated %t | FileCheck %s --check-prefix=HEX
7 # RUN: llvm-readobj --decompress -p .strings -p .not_null_terminated %t | FileCheck %s --check-prefix=STR
9 # HEX: Hex dump of section '.strings':
10 # HEX-NEXT: 0x00000000 68657265 00617265 00736f6d 65007374 here.are.some.st
11 # HEX-NEXT: 0x00000010 72696e67 7300 rings.
12 # HEX: Hex dump of section '.not_null_terminated':
13 # HEX-NEXT: 0x00000000 6e6f006e 756c6c no.null
15 # STR: String dump of section '.strings':
19 # STR-NEXT: [ e] strings
21 # STR-NEXT: String dump of section '.not_null_terminated':
23 # STR-NEXT: [ 3] null{{$}}
26 # RUN: llvm-readobj -x .strings -p .not_null_terminated %t | FileCheck %s --check-prefix=COMPRESSED
28 # COMPRESSED: String dump of section '.not_null_terminated':
29 # COMPRESSED-NEXT: [ 0] no
30 # COMPRESSED-NEXT: [ 3] null
32 # COMPRESSED-NEXT: Hex dump of section '.strings':
33 # COMPRESSED-NEXT: 0x00000000 01000000 00000000 16000000 00000000 ................
34 # COMPRESSED-NEXT: 0x00000010 00000000 00000000 789ccb48 2d4a6548 ........x..H-JeH
35 # COMPRESSED-NEXT: 0x00000020 04e2e2fc 5c205152 9499975e cc000058 ....\ QR...^...X
36 # COMPRESSED-NEXT: 0x00000030 2e079b ...
38 # RUN: llvm-readelf -z -p .invalid1 -x .invalid2 -x .invalid3 %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=INVALID
40 # INVALID: String dump of section '.invalid1':
41 # INVALID-NEXT: warning: '[[FILE]]': corrupted compressed section header
42 # INVALID-NEXT: [ 0] .
44 # INVALID-NEXT: Hex dump of section '.invalid2':
45 # INVALID-NEXT: warning: '[[FILE]]': zlib error: Z_DATA_ERROR
46 # INVALID-NEXT: 0x00000000 01000000 00000000 16000000 00000000 ................
47 # INVALID-NEXT: 0x00000010 00000000 00000000 78 ........x
49 # INVALID-NEXT: Hex dump of section '.invalid3':
50 # INVALID-NEXT: warning: '[[FILE]]': unsupported compression type (3)
51 # INVALID-NEXT: 0x00000000 03000000 00000000 04000000 00000000 ................
52 # INVALID-NEXT: 0x00000010 00000000 00000000 789c6360 ........x.c`
62 Flags: [SHF_COMPRESSED]
63 Content: 010000000000000016000000000000000000000000000000789ccb482d4a654804e2e2fc5c2051529499975ecc0000582e079b
64 - Name: .not_null_terminated
66 Content: 6e6f006e756c6c
69 Flags: [SHF_COMPRESSED]
73 Flags: [SHF_COMPRESSED]
74 Content: 01000000000000001600000000000000000000000000000078
77 Flags: [SHF_COMPRESSED]
78 Content: 030000000000000004000000000000000000000000000000789c6360