123 lines · plain
1# REQUIRES: zstd2 3# RUN: llvm-mc -filetype=obj -triple=x86_64 -compress-debug-sections=zstd %s -o %t4# RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SEC5# RUN: llvm-objdump -s %t | FileCheck %s6 7## Check that the large debug sections .debug_line and .debug_frame are compressed8## and have the SHF_COMPRESSED flag.9# SEC: .nonalloc PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 110# SEC: .debug_line PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 811# SEC: .debug_abbrev PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 112# SEC: .debug_info PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 113## .debug_str is uncompressed becuase sizeof(Elf64_Chdr)+len(compressed) >= len(uncompressed).14# SEC: .debug_str PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 01 MS 0 0 115# SEC: .debug_frame PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 816 17# CHECK: Contents of section .debug_line18## ch_type == ELFCOMPRESS_ZSTD (2)19# CHECK-NEXT: 0000 02000000 00000000 55010000 0000000020# CHECK-NEXT: 0010 01000000 00000000 {{.*}}21 22## The compress/decompress round trip should be identical to the uncompressed output.23# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.uncom24# RUN: llvm-objcopy --decompress-debug-sections %t %t.decom25# RUN: cmp %t.uncom %t.decom26 27## .debug_str is compressed becuase sizeof(Elf32_Chdr)+len(compressed) < len(uncompressed).28# RUN: llvm-mc -filetype=obj -triple=i386 --defsym I386=1 -compress-debug-sections=zstd --defsym LONG=1 %s -o %t129# RUN: llvm-readelf -S %t1 | FileCheck %s --check-prefix=SEC130 31# SEC1: .debug_str PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 01 MSC 0 0 432 33## Don't compress a section not named .debug_*.34 .section .nonalloc,"",@progbits35.rept 5036.asciz "aaaaaaaaaa"37.endr38 39 .section .debug_line,"",@progbits40 41 .section .debug_abbrev,"",@progbits42.Lsection_abbrev:43 .byte 1 # Abbreviation Code44 .byte 17 # DW_TAG_compile_unit45 .byte 0 # DW_CHILDREN_no46 .byte 27 # DW_AT_comp_dir47 .byte 14 # DW_FORM_strp48 .byte 0 # EOM(1)49 .byte 0 # EOM(2)50 51 .section .debug_info,"",@progbits52 .long 12 # Length of Unit53 .short 4 # DWARF version number54 .long .Lsection_abbrev # Offset Into Abbrev. Section55 .byte 8 # Address Size (in bytes)56 .byte 1 # Abbrev [1] DW_TAG_compile_unit57 .long .Linfo_string0 # DW_AT_comp_dir58 59 .text60foo:61 .cfi_startproc62 .file 1 "Driver.ii"63 64.rept 365.ifdef I38666 pushl %ebp67 .cfi_def_cfa_offset 868 .cfi_offset %ebp, -869 movl %esp, %ebp70 .cfi_def_cfa_register %ebp71 pushl %ebx72 pushl %edi73 pushl %esi74 .cfi_offset %esi, -2075 .cfi_offset %edi, -1676 .cfi_offset %ebx, -1277 .loc 1 1 1 prologue_end78 popl %esi79 popl %edi80 popl %ebx81 popl %ebp82 .cfi_def_cfa %esp, 483.else84 pushq %rbp85 .cfi_def_cfa_offset 1686 .cfi_offset %rbp, -1687 movq %rsp, %rbp88 .cfi_def_cfa_register %rbp89 pushq %r1590 pushq %r1491 pushq %r1392 pushq %r1293 pushq %rbx94 .cfi_offset %rbx, -5695 .cfi_offset %r12, -4896 .cfi_offset %r13, -4097 .cfi_offset %r14, -3298 .cfi_offset %r15, -2499 .loc 1 1 1 prologue_end100 popq %rbx101 popq %r12102 popq %r13103 popq %r14104 popq %r15105 popq %rbp106 .cfi_def_cfa %rsp, 8107.endif108.endr109 110# pad out the line table to make sure it's big enough to warrant compression111 .irpc i, 123456789112 .irpc j, 0123456789113 .loc 1 \i\j \j114 nop115 .endr116 .endr117 .cfi_endproc118 .cfi_sections .debug_frame119 120 .section .debug_str,"MS",@progbits,1121.Linfo_string0:122 .asciz "perfectly compressable data sample *****************************************"123