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