Bring r240130 back.
[oota-llvm.git] / test / MC / ELF / compression.s
1 // RUN: llvm-mc -filetype=obj -compress-debug-sections -triple x86_64-pc-linux-gnu < %s -o %t
2 // RUN: llvm-objdump -s %t | FileCheck %s
3 // RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck --check-prefix=INFO %s
4 // RUN: llvm-mc -filetype=obj -compress-debug-sections -triple i386-pc-linux-gnu < %s \
5 // RUN:     | llvm-readobj -symbols - | FileCheck --check-prefix=386-SYMBOLS %s
6
7 // REQUIRES: zlib
8
9 // CHECK: Contents of section .zdebug_line:
10 // Check for the 'ZLIB' file magic at the start of the section only
11 // CHECK-NEXT: ZLIB
12 // CHECK-NOT: ZLIB
13
14 // Don't compress small sections, such as this simple debug_abbrev example
15 // CHECK: Contents of section .debug_abbrev:
16 // CHECK-NOT: ZLIB
17 // CHECK-NOT: Contents of
18
19 // CHECK: Contents of section .debug_info:
20
21 // FIXME: Handle compressing alignment fragments to support compressing debug_frame
22 // CHECK: Contents of section .debug_frame:
23 // CHECK-NOT: ZLIB
24 // CHECK: Contents of
25
26 // Decompress one valid dwarf section just to check that this roundtrips
27 // INFO: 0x00000000: Compile Unit: length = 0x0000000c version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000010)
28
29 // In x86 32 bit named symbols are used for temporary symbols in merge
30 // sections, so make sure we handle symbols inside compressed sections
31 // 386-SYMBOLS:        Symbol {
32 // 386-SYMBOLS-NEXT:    Name:  (0)
33 // 386-SYMBOLS-NEXT:    Value: 0x0
34 // 386-SYMBOLS-NEXT:    Size: 0
35 // 386-SYMBOLS-NEXT:    Binding: Local (0x0)
36 // 386-SYMBOLS-NEXT:    Type: None (0x0)
37 // 386-SYMBOLS-NEXT:    Other: 0
38 // 386-SYMBOLS-NEXT:    Section: Undefined (0x0)
39 // 386-SYMBOLS-NEXT:  }
40 // 386-SYMBOLS-NEXT:  Symbol {
41 // 386-SYMBOLS-NEXT:    Name:  (0)
42 // 386-SYMBOLS-NEXT:    Value: 0x0
43 // 386-SYMBOLS-NEXT:    Size: 0
44 // 386-SYMBOLS-NEXT:    Binding: Local (0x0)
45 // 386-SYMBOLS-NEXT:    Type: None (0x0)
46 // 386-SYMBOLS-NEXT:    Other: 0
47 // 386-SYMBOLS-NEXT:    Section: .zdebug_str (0xA)
48 // 386-SYMBOLS-NEXT:  }
49
50         .section        .debug_line,"",@progbits
51
52         .section        .debug_abbrev,"",@progbits
53 .Lsection_abbrev:
54         .byte   1                       # Abbreviation Code
55         .byte   17                      # DW_TAG_compile_unit
56         .byte   0                       # DW_CHILDREN_no
57         .byte   27                      # DW_AT_comp_dir
58         .byte   14                      # DW_FORM_strp
59         .byte   0                       # EOM(1)
60         .byte   0                       # EOM(2)
61
62         .section        .debug_info,"",@progbits
63         .long   12                      # Length of Unit
64         .short  4                       # DWARF version number
65         .long   .Lsection_abbrev        # Offset Into Abbrev. Section
66         .byte   8                       # Address Size (in bytes)
67         .byte   1                       # Abbrev [1] DW_TAG_compile_unit
68         .long   .Linfo_string0          # DW_AT_comp_dir
69
70         .text
71 foo:
72         .cfi_startproc
73         .file 1 "Driver.ii"
74 # pad out the line table to make sure it's big enough to warrant compression
75         .loc 1 2 0
76         nop
77         .loc 1 3 0
78         nop
79         .loc 1 4 0
80         nop
81         .loc 1 5 0
82         nop
83         .loc 1 6 0
84         nop
85         .loc 1 7 0
86         nop
87         .loc 1 8 0
88         nop
89         .cfi_endproc
90         .cfi_sections .debug_frame
91
92         .section        .debug_str,"MS",@progbits,1
93 .Linfo_string0:
94         .asciz  "compress this                                    "