1# REQUIRES: x86, zlib
2
3# RUN: yaml2obj %s -o %t.o
4
5# RUN: ld.lld %t.o -o %t.default --compress-debug-sections=zlib
6# RUN: llvm-readelf --sections %t.default | FileCheck -check-prefixes=HEADER,LEVEL1 %s
7
8# RUN: ld.lld -O0 %t.o -o %t.O0 --compress-debug-sections=zlib
9# RUN: llvm-readelf --sections %t.O0 | FileCheck -check-prefixes=HEADER,LEVEL1 %s
10# RUN: cmp %t.default %t.O0
11
12# RUN: ld.lld -O1 %t.o -o %t.O1 --compress-debug-sections=zlib
13# RUN: llvm-readelf --sections %t.O1 | FileCheck -check-prefixes=HEADER,LEVEL1 %s
14# RUN: cmp %t.default %t.O1
15
16# RUN: ld.lld -O2 %t.o -o %t.O2 --compress-debug-sections=zlib
17# RUN: llvm-readelf --sections %t.O2 | FileCheck -check-prefixes=HEADER,LEVEL6 %s
18
19## LLD uses zlib compression of level 1 when -O0, -O1 and level 6 when -O2.
20## Here we check how -O flag affects the size of compressed sections produced.
21
22# HEADER: [Nr] Name        Type     Address  Off    Size
23# LEVEL1: [ 1] .debug_info PROGBITS 00000000 000094 00001{{[bc]}}
24# LEVEL6: [ 1] .debug_info PROGBITS 00000000 000094 00001a
25
26## A little arbitrary debug section which has a different size after
27## applying compression of level 1 and 6.
28
29--- !ELF
30FileHeader:
31  Class:   ELFCLASS32
32  Data:    ELFDATA2LSB
33  Type:    ET_REL
34  Machine: EM_386
35Sections:
36  - Name:    .debug_info
37    Type:    SHT_PROGBITS
38    Content: '010101010101010201010201'
39