xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/compress-debug-sections-zlib-header.test (revision e29e30b1397f3e50f3487491f8a77ae08e4e3471)
1ade3c705SGeorge Rimar# REQUIRES: zlib
2ade3c705SGeorge Rimar
3ade3c705SGeorge Rimar# RUN: yaml2obj %s -o %t1.o
4ade3c705SGeorge Rimar# RUN: llvm-objcopy --compress-debug-sections %t1.o %t2.o
5*e29e30b1SFangrui Song# RUN: llvm-readobj -S %t2.o | FileCheck %s
6ade3c705SGeorge Rimar
7ade3c705SGeorge Rimar# Non-.zdebug* sections whose data does start with "ZLIB" should
8ade3c705SGeorge Rimar# not be considered as zlib-gnu compressed sections.
9ade3c705SGeorge Rimar
10ade3c705SGeorge Rimar# In this test we have 2 normal sections, one of them starts with "ZLIB",
11ade3c705SGeorge Rimar# another starts with "ZZZZ". Check we compress both as expected.
12ade3c705SGeorge Rimar
13ade3c705SGeorge Rimar# CHECK:        Name: .debug_foo
14ade3c705SGeorge Rimar# CHECK-NEXT:   Type: SHT_PROGBITS
15ade3c705SGeorge Rimar# CHECK-NEXT:   Flags [
16ade3c705SGeorge Rimar# CHECK-NEXT:     SHF_COMPRESSED
17ade3c705SGeorge Rimar# CHECK-NEXT:   ]
18ade3c705SGeorge Rimar
19ade3c705SGeorge Rimar# CHECK:        Name: .debug_bar
20ade3c705SGeorge Rimar# CHECK-NEXT:   Type: SHT_PROGBITS
21ade3c705SGeorge Rimar# CHECK-NEXT:   Flags [
22ade3c705SGeorge Rimar# CHECK-NEXT:     SHF_COMPRESSED
23ade3c705SGeorge Rimar# CHECK-NEXT:   ]
24ade3c705SGeorge Rimar
25ade3c705SGeorge Rimar--- !ELF
26ade3c705SGeorge RimarFileHeader:
27ade3c705SGeorge Rimar  Class:           ELFCLASS64
28ade3c705SGeorge Rimar  Data:            ELFDATA2LSB
29ade3c705SGeorge Rimar  Type:            ET_REL
30ade3c705SGeorge Rimar  Machine:         EM_X86_64
31ade3c705SGeorge RimarSections:
32ade3c705SGeorge Rimar  - Name:            .debug_foo
33ade3c705SGeorge Rimar    Type:            SHT_PROGBITS
34ade3c705SGeorge Rimar    AddressAlign:    0x0000000000000001
35ade3c705SGeorge Rimar    # "ZLIB"
36ade3c705SGeorge Rimar    Content:         5A4C49420000000000000000
37ade3c705SGeorge Rimar  - Name:            .debug_bar
38ade3c705SGeorge Rimar    Type:            SHT_PROGBITS
39ade3c705SGeorge Rimar    AddressAlign:    0x0000000000000001
40ade3c705SGeorge Rimar    # "ZZZZ"
41ade3c705SGeorge Rimar    Content:         5A5A5A5A0000000000000000
42