xref: /llvm-project/lld/test/ELF/compressed-debug-level.test (revision 7c220c4bd31b832167b9fceadc3d27e7989728b9)
1# REQUIRES: x86, zlib
2
3# RUN: yaml2obj %s -o %t.o
4
5## LLD uses zlib compression of level 1 by default. Unlike previous versions,
6## -O does not change the level.
7# RUN: ld.lld %t.o -o %t.default --compress-debug-sections=zlib
8# RUN: llvm-readelf --sections %t.default | FileCheck -check-prefixes=HEADER,LEVEL1 %s
9
10# RUN: ld.lld -O0 %t.o -o %t.O0 --compress-debug-sections=zlib
11# RUN: cmp %t.default %t.O0
12
13# RUN: ld.lld -O2 %t.o -o %t.O2 --compress-debug-sections=zlib
14# RUN: cmp %t.default %t.O2
15
16## --compression-level specifies the level.
17# RUN: ld.lld %t.o -o %t.6 --compress-sections=.debug_info=zlib:6
18# RUN: llvm-readelf --sections %t.6 | FileCheck -check-prefixes=HEADER,LEVEL6 %s
19
20# HEADER: [Nr] Name        Type     Address  Off    Size
21# LEVEL1: [ 1] .debug_info PROGBITS 00000000 000094 0000{{1[def]|21}}
22# LEVEL6: [ 1] .debug_info PROGBITS 00000000 000094 00001{{[abc]}}
23
24## A little arbitrary debug section which has a different size after
25## applying compression of level 1 and 6.
26
27--- !ELF
28FileHeader:
29  Class:   ELFCLASS32
30  Data:    ELFDATA2LSB
31  Type:    ET_REL
32  Machine: EM_386
33Sections:
34  - Name:    .debug_info
35    Type:    SHT_PROGBITS
36    Content: '010101010101010201010201010101010101010201010201010101010101010201010201'
37