1// REQUIRES: zlib 2 3// Check zlib style 4// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib -triple x86_64-pc-linux-gnu < %s -o %t 5// RUN: llvm-objdump -s %t | FileCheck %s 6// RUN: llvm-dwarfdump -debug-str %t | FileCheck --check-prefix=STR %s 7// RUN: llvm-readelf --sections %t | FileCheck --check-prefixes=FLAGS,FLAGS64 %s 8 9// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib -triple i386-pc-linux-gnu --defsym I386=1 %s -o %t 10// RUN: llvm-readelf -S -s %t | FileCheck --check-prefixes=386-SYMBOLS,FLAGS,FLAGS32 %s 11 12// Decompress one valid dwarf section just to check that this roundtrips, 13// we use .debug_str section for that 14// STR: perfectly compressable data sample ***************************************** 15 16 17// Now check the zlib style output: 18 19// Don't compress small sections, such as this simple debug_abbrev example 20// CHECK: Contents of section .debug_abbrev: 21// CHECK-NOT: ZLIB 22// CHECK-NOT: Contents of 23// CHECK: Contents of section .debug_info: 24// FIXME: Handle compressing alignment fragments to support compressing debug_frame 25// CHECK: Contents of section .debug_frame: 26// CHECK-NOT: ZLIB 27// CHECK: Contents of 28 29# FLAGS: .text PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 AX 0 0 4 30# FLAGS: .nonalloc PROGBITS [[#%x,]] [[#%x,]] 000226 00 0 0 1 31 32## Check that the large .debug_line and .debug_frame have the SHF_COMPRESSED 33## flag. 34# FLAGS32: .debug_line PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 4 35# FLAGS32: .debug_abbrev PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 1 36# FLAGS32: .debug_info PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 1 37# FLAGS32: .debug_frame PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 4 38 39# FLAGS64: .debug_line PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 8 40# FLAGS64: .debug_abbrev PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 1 41# FLAGS64: .debug_info PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 1 42# FLAGS64: .debug_frame PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 8 43 44# 386-SYMBOLS: Symbol table '.symtab' 45# 386-SYMBOLS: .debug_str 46 47## Don't compress a section not named .debug_*. 48 .section .nonalloc,"",@progbits 49.rept 50 50.asciz "aaaaaaaaaa" 51.endr 52 53 .section .debug_line,"",@progbits 54 55 .section .debug_abbrev,"",@progbits 56.Lsection_abbrev: 57 .byte 1 # Abbreviation Code 58 .byte 17 # DW_TAG_compile_unit 59 .byte 0 # DW_CHILDREN_no 60 .byte 27 # DW_AT_comp_dir 61 .byte 14 # DW_FORM_strp 62 .byte 0 # EOM(1) 63 .byte 0 # EOM(2) 64 65 .section .debug_info,"",@progbits 66 .long 12 # Length of Unit 67 .short 4 # DWARF version number 68 .long .Lsection_abbrev # Offset Into Abbrev. Section 69 .byte 8 # Address Size (in bytes) 70 .byte 1 # Abbrev [1] DW_TAG_compile_unit 71 .long .Linfo_string0 # DW_AT_comp_dir 72 73 .text 74foo: 75 .cfi_startproc 76 .file 1 "Driver.ii" 77 78.rept 3 79.ifdef I386 80 pushl %ebp 81 .cfi_def_cfa_offset 8 82 .cfi_offset %ebp, -8 83 movl %esp, %ebp 84 .cfi_def_cfa_register %ebp 85 pushl %ebx 86 pushl %edi 87 pushl %esi 88 .cfi_offset %esi, -20 89 .cfi_offset %edi, -16 90 .cfi_offset %ebx, -12 91 .loc 1 1 1 prologue_end 92 popl %esi 93 popl %edi 94 popl %ebx 95 popl %ebp 96 .cfi_def_cfa %esp, 4 97.else 98 pushq %rbp 99 .cfi_def_cfa_offset 16 100 .cfi_offset %rbp, -16 101 movq %rsp, %rbp 102 .cfi_def_cfa_register %rbp 103 pushq %r15 104 pushq %r14 105 pushq %r13 106 pushq %r12 107 pushq %rbx 108 .cfi_offset %rbx, -56 109 .cfi_offset %r12, -48 110 .cfi_offset %r13, -40 111 .cfi_offset %r14, -32 112 .cfi_offset %r15, -24 113 .loc 1 1 1 prologue_end 114 popq %rbx 115 popq %r12 116 popq %r13 117 popq %r14 118 popq %r15 119 popq %rbp 120 .cfi_def_cfa %rsp, 8 121.endif 122.endr 123 124# pad out the line table to make sure it's big enough to warrant compression 125 .irpc i, 123456789 126 .irpc j, 0123456789 127 .loc 1 \i\j \j 128 nop 129 .endr 130 .endr 131 .cfi_endproc 132 .cfi_sections .debug_frame 133 134# Below is the section we will use to check that after compression with llvm-mc, 135# llvm-dwarfdump tool will be able to decompress data back and dump it. Data sample 136# should be compressable enough, so it is filled with some amount of equal symbols at the end 137 .section .debug_str,"MS",@progbits,1 138.Linfo_string0: 139 .asciz "perfectly compressable data sample *****************************************" 140