140 lines · plain
1// REQUIRES: zlib2 3// Check zlib style4// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib -triple x86_64-pc-linux-gnu < %s -o %t5// RUN: llvm-objdump -s %t | FileCheck %s6// RUN: llvm-dwarfdump -debug-str %t | FileCheck --check-prefix=STR %s7// RUN: llvm-readelf --sections %t | FileCheck --check-prefixes=FLAGS,FLAGS64 %s8 9// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib -triple i386-pc-linux-gnu --defsym I386=1 %s -o %t10// RUN: llvm-readelf -S -s %t | FileCheck --check-prefixes=386-SYMBOLS,FLAGS,FLAGS32 %s11 12// Decompress one valid dwarf section just to check that this roundtrips,13// we use .debug_str section for that14// 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 example20// CHECK: Contents of section .debug_abbrev:21// CHECK-NOT: ZLIB22// CHECK-NOT: Contents of23// CHECK: Contents of section .debug_info:24// FIXME: Handle compressing alignment fragments to support compressing debug_frame25// CHECK: Contents of section .debug_frame:26// CHECK-NOT: ZLIB27// CHECK: Contents of28 29# FLAGS: .text PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 AX 0 0 430# FLAGS: .nonalloc PROGBITS [[#%x,]] [[#%x,]] 000226 00 0 0 131 32## Check that the large .debug_line and .debug_frame have the SHF_COMPRESSED33## flag.34# FLAGS32: .debug_line PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 435# FLAGS32: .debug_abbrev PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 136# FLAGS32: .debug_info PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 137# FLAGS32: .debug_frame PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 438 39# FLAGS64: .debug_line PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 840# FLAGS64: .debug_abbrev PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 141# FLAGS64: .debug_info PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 142# FLAGS64: .debug_frame PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 843 44# 386-SYMBOLS: Symbol table '.symtab'45# 386-SYMBOLS: .debug_str46 47## Don't compress a section not named .debug_*.48 .section .nonalloc,"",@progbits49.rept 5050.asciz "aaaaaaaaaa"51.endr52 53 .section .debug_line,"",@progbits54 55 .section .debug_abbrev,"",@progbits56.Lsection_abbrev:57 .byte 1 # Abbreviation Code58 .byte 17 # DW_TAG_compile_unit59 .byte 0 # DW_CHILDREN_no60 .byte 27 # DW_AT_comp_dir61 .byte 14 # DW_FORM_strp62 .byte 0 # EOM(1)63 .byte 0 # EOM(2)64 65 .section .debug_info,"",@progbits66 .long 12 # Length of Unit67 .short 4 # DWARF version number68 .long .Lsection_abbrev # Offset Into Abbrev. Section69 .byte 8 # Address Size (in bytes)70 .byte 1 # Abbrev [1] DW_TAG_compile_unit71 .long .Linfo_string0 # DW_AT_comp_dir72 73 .text74foo:75 .cfi_startproc76 .file 1 "Driver.ii"77 78.rept 379.ifdef I38680 pushl %ebp81 .cfi_def_cfa_offset 882 .cfi_offset %ebp, -883 movl %esp, %ebp84 .cfi_def_cfa_register %ebp85 pushl %ebx86 pushl %edi87 pushl %esi88 .cfi_offset %esi, -2089 .cfi_offset %edi, -1690 .cfi_offset %ebx, -1291 .loc 1 1 1 prologue_end92 popl %esi93 popl %edi94 popl %ebx95 popl %ebp96 .cfi_def_cfa %esp, 497.else98 pushq %rbp99 .cfi_def_cfa_offset 16100 .cfi_offset %rbp, -16101 movq %rsp, %rbp102 .cfi_def_cfa_register %rbp103 pushq %r15104 pushq %r14105 pushq %r13106 pushq %r12107 pushq %rbx108 .cfi_offset %rbx, -56109 .cfi_offset %r12, -48110 .cfi_offset %r13, -40111 .cfi_offset %r14, -32112 .cfi_offset %r15, -24113 .loc 1 1 1 prologue_end114 popq %rbx115 popq %r12116 popq %r13117 popq %r14118 popq %r15119 popq %rbp120 .cfi_def_cfa %rsp, 8121.endif122.endr123 124# pad out the line table to make sure it's big enough to warrant compression125 .irpc i, 123456789126 .irpc j, 0123456789127 .loc 1 \i\j \j128 nop129 .endr130 .endr131 .cfi_endproc132 .cfi_sections .debug_frame133 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 sample136# should be compressable enough, so it is filled with some amount of equal symbols at the end137 .section .debug_str,"MS",@progbits,1138.Linfo_string0:139 .asciz "perfectly compressable data sample *****************************************"140