1# REQUIRES: zlib
2# RUN: yaml2obj --docnum=1 %s -o %t1.o
3# RUN: not ld.lld %t1.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=TOO-SHORT
4# TOO-SHORT: error: {{.*}}.o:(.debug_info): corrupted compressed section
5
6# RUN: yaml2obj --docnum=2 %s -o %t2.o
7# RUN: not ld.lld %t2.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=UNKNOWN
8# UNKNOWN: error: {{.*}}.o:(.debug_info): unsupported compression type (3)
9
10# RUN: yaml2obj --docnum=3 %s -o %t3.o
11# RUN: not ld.lld %t3.o -o /dev/null -shared 2>&1 | FileCheck %s
12
13## Check we are able to report zlib uncompress errors.
14# CHECK: error: {{.*}}.o:(.debug_info): uncompress failed: zlib error: Z_DATA_ERROR
15
16--- !ELF
17FileHeader:
18  Class:   ELFCLASS64
19  Data:    ELFDATA2LSB
20  Type:    ET_REL
21  Machine: EM_X86_64
22Sections:
23  - Type:         SHT_PROGBITS
24    Name:         .debug_info
25    Flags:        [ SHF_COMPRESSED ]
26    AddressAlign: 8
27    Content:      "0100000000000000040000000000000001000000000000"
28
29--- !ELF
30FileHeader:
31  Class:   ELFCLASS64
32  Data:    ELFDATA2LSB
33  Type:    ET_REL
34  Machine: EM_X86_64
35Sections:
36  - Type:         SHT_PROGBITS
37    Name:         .debug_info
38    Flags:        [ SHF_COMPRESSED ]
39    AddressAlign: 8
40    Content:      "030000000000000000000000000000000100000000000000789c030000000001"
41
42--- !ELF
43FileHeader:
44  Class:   ELFCLASS64
45  Data:    ELFDATA2LSB
46  Type:    ET_REL
47  Machine: EM_X86_64
48Sections:
49  - Type:         SHT_PROGBITS
50    Name:         .debug_info
51    Flags:        [ SHF_COMPRESSED ]
52    AddressAlign: 8
53    Content:      "010000000000000004000000000000000100000000000000ffff"
54