• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// REQUIRES: zlib
2// Check zlib-gnu style
3// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib-gnu -triple x86_64-pc-linux-gnu < %s -o %t
4// RUN: llvm-objdump -s %t | FileCheck --check-prefix=CHECK-GNU-STYLE %s
5// RUN: llvm-dwarfdump -debug-str %t | FileCheck --check-prefix=STR %s
6// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib-gnu -triple i386-pc-linux-gnu < %s \
7// RUN:     | llvm-readobj -symbols - | FileCheck --check-prefix=386-SYMBOLS-GNU %s
8
9// Check zlib style
10// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib -triple x86_64-pc-linux-gnu < %s -o %t
11// RUN: llvm-objdump -s %t | FileCheck --check-prefix=CHECK-ZLIB-STYLE %s
12// RUN: llvm-dwarfdump -debug-str %t | FileCheck --check-prefix=STR %s
13// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib -triple i386-pc-linux-gnu < %s \
14// RUN:     | llvm-readobj -symbols - | FileCheck --check-prefix=386-SYMBOLS-ZLIB %s
15// RUN: llvm-readobj -sections %t | FileCheck --check-prefix=ZLIB-STYLE-FLAGS %s
16
17// Don't compress small sections, such as this simple debug_abbrev example
18// CHECK-GNU-STYLE: Contents of section .debug_abbrev:
19// CHECK-GNU-STYLE-NOT: ZLIB
20// CHECK-GNU-STYLE-NOT: Contents of
21
22// CHECK-GNU-STYLE: Contents of section .debug_info:
23
24// CHECK-GNU-STYLE: Contents of section .zdebug_str:
25// Check for the 'ZLIB' file magic at the start of the section only
26// CHECK-GNU-STYLE-NEXT: ZLIB
27// CHECK-GNU-STYLE-NOT: ZLIB
28// FIXME: Handle compressing alignment fragments to support compressing debug_frame
29// CHECK-GNU-STYLE: Contents of section .debug_frame:
30// CHECK-GNU-STYLE-NOT: ZLIB
31// CHECK-GNU-STYLE: Contents of
32
33// Decompress one valid dwarf section just to check that this roundtrips,
34// we use .zdebug_str section for that
35// STR: perfectly compressable data sample *****************************************
36
37// In x86 32 bit named symbols are used for temporary symbols in merge
38// sections, so make sure we handle symbols inside compressed sections
39// 386-SYMBOLS-GNU: Name: .Linfo_string0
40// 386-SYMBOLS-GNU-NOT: }
41// 386-SYMBOLS-GNU: Section: .zdebug_str
42
43// Now check the zlib style output:
44
45// Don't compress small sections, such as this simple debug_abbrev example
46// CHECK-ZLIB-STYLE: Contents of section .debug_abbrev:
47// CHECK-ZLIB-STYLE-NOT: ZLIB
48// CHECK-ZLIB-STYLE-NOT: Contents of
49// CHECK-ZLIB-STYLE: Contents of section .debug_info:
50// FIXME: Handle compressing alignment fragments to support compressing debug_frame
51// CHECK-ZLIB-STYLE: Contents of section .debug_frame:
52// CHECK-ZLIB-STYLE-NOT: ZLIB
53// CHECK-ZLIB-STYLE: Contents of
54
55// Check that debug_line section was not renamed, so it is
56// zlib-style, not zlib-gnu one. Check that SHF_COMPRESSED was set.
57// ZLIB-STYLE-FLAGS:      Section {
58// ZLIB-STYLE-FLAGS:        Index:
59// ZLIB-STYLE-FLAGS:        Name: .debug_str
60// ZLIB-STYLE-FLAGS-NEXT:   Type: SHT_PROGBITS
61// ZLIB-STYLE-FLAGS-NEXT:   Flags [
62// ZLIB-STYLE-FLAGS-NEXT:     SHF_COMPRESSED
63
64// 386-SYMBOLS-ZLIB: Name: .Linfo_string0
65// 386-SYMBOLS-ZLIB-NOT: }
66// 386-SYMBOLS-ZLIB: Section: .debug_str
67
68	.section	.debug_line,"",@progbits
69
70	.section	.debug_abbrev,"",@progbits
71.Lsection_abbrev:
72	.byte	1                       # Abbreviation Code
73	.byte	17                      # DW_TAG_compile_unit
74	.byte	0                       # DW_CHILDREN_no
75	.byte	27                      # DW_AT_comp_dir
76	.byte	14                      # DW_FORM_strp
77	.byte	0                       # EOM(1)
78	.byte	0                       # EOM(2)
79
80	.section	.debug_info,"",@progbits
81	.long	12                      # Length of Unit
82	.short	4                       # DWARF version number
83	.long	.Lsection_abbrev        # Offset Into Abbrev. Section
84	.byte	8                       # Address Size (in bytes)
85	.byte	1                       # Abbrev [1] DW_TAG_compile_unit
86	.long	.Linfo_string0          # DW_AT_comp_dir
87
88	.text
89foo:
90	.cfi_startproc
91	.file 1 "Driver.ii"
92# pad out the line table to make sure it's big enough to warrant compression
93	.loc 1 2 0
94        nop
95	.loc 1 3 0
96        nop
97	.loc 1 4 0
98        nop
99	.loc 1 5 0
100        nop
101	.loc 1 6 0
102        nop
103	.loc 1 7 0
104        nop
105	.loc 1 8 0
106        nop
107	.cfi_endproc
108	.cfi_sections .debug_frame
109
110# Below is the section we will use to check that after compression with llvm-mc,
111# llvm-dwarfdump tool will be able to decompress data back and dump it. Data sample
112# should be compressable enough, so it is filled with some amount of equal symbols at the end
113	.section        .debug_str,"MS",@progbits,1
114.Linfo_string0:
115        .asciz  "perfectly compressable data sample *****************************************"
116