1# REQUIRES: zlib
2
3# RUN: yaml2obj %p/Inputs/compress-debug-sections.yaml -o %t.o
4# RUN: llvm-objcopy --compress-debug-sections=zlib-gnu %t.o %t-compressed.o
5# RUN: llvm-objcopy --decompress-debug-sections %t-compressed.o %t-decompressed.o
6
7# RUN: llvm-objdump -s %t.o --section=.debug_foo | FileCheck %s
8# RUN: llvm-objdump -s %t-compressed.o | FileCheck %s --check-prefix=CHECK-COMPRESSED
9# RUN: llvm-readobj --relocations -S %t-compressed.o | FileCheck %s --check-prefix=CHECK-FLAGS
10# RUN: llvm-readobj --relocations -S %t-decompressed.o | FileCheck %s --check-prefix=CHECK-HEADER
11# RUN: llvm-readobj --relocations -S %t.o | FileCheck %s --check-prefix=CHECK-HEADER
12# RUN: llvm-objdump -s %t-decompressed.o --section=.debug_foo | FileCheck %s
13
14# CHECK: .debug_foo:
15# CHECK-NEXT: 0000 00000000 00000000
16
17# CHECK-HEADER:      Name: .debug_foo
18# CHECK-HEADER-NEXT: Type: SHT_PROGBITS
19# CHECK-HEADER-NEXT: Flags [
20# CHECK-HEADER-NEXT: ]
21# CHECK-HEADER-NEXT: Address:
22# CHECK-HEADER-NEXT: Offset:
23# CHECK-HEADER-NEXT: Size: 8
24
25# CHECK-COMPRESSED: .zdebug_foo:
26# CHECK-COMPRESSED: ZLIB
27# CHECK-COMPRESSED: .notdebug_foo:
28
29# CHECK-FLAGS-NOT:  Name: .debug_foo
30# CHECK-FLAGS:      Name: .zdebug_foo
31# CHECK-FLAGS-NEXT: Type: SHT_PROGBITS
32# CHECK-FLAGS-NEXT: Flags [
33# CHECK-FLAGS-NEXT: ]
34# CHECK-FLAGS-NEXT: Address:
35# CHECK-FLAGS-NEXT: Offset:
36# CHECK-FLAGS-NEXT: Size: 23
37
38# CHECK-FLAGS: Name: .notdebug_foo
39# CHECK-FLAGS-NEXT: Type: SHT_PROGBITS
40# CHECK-FLAGS-NEXT: Flags [
41# CHECK-FLAGS-NEXT: ]
42# CHECK-FLAGS-NEXT: Address:
43# CHECK-FLAGS-NEXT: Offset:
44# CHECK-FLAGS-NEXT: Size: 8
45
46# CHECK-FLAGS: Name: .rela.debug_foo
47# CHECK-FLAGS-NEXT: Type: SHT_RELA
48# CHECK-FLAGS-NEXT: Flags [
49# CHECK-FLAGS-NEXT: ]
50
51# CHECK-FLAGS: Relocations [
52# CHECK-FLAGS-NEXT:   .rela.debug_foo {
53# CHECK-FLAGS-NEXT:     0x1 R_X86_64_32 .zdebug_foo 0x0
54# CHECK-FLAGS-NEXT:     0x2 R_X86_64_32 .notdebug_foo 0x0
55# CHECK-FLAGS-NEXT:   }
56# CHECK-FLAGS-NEXT: ]
57
58