1# REQUIRES: zstd 2 3# RUN: llvm-mc -filetype=obj -triple=x86_64 -compress-debug-sections=zstd %s -o %t 4# RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SEC 5# RUN: llvm-objdump -s %t | FileCheck %s 6 7## Check that the large debug sections .debug_line and .debug_frame are compressed 8## and have the SHF_COMPRESSED flag. 9# SEC: .nonalloc PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 1 10# SEC: .debug_line PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 8 11# SEC: .debug_abbrev PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 1 12# SEC: .debug_info PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 0 0 1 13## .debug_str is uncompressed becuase sizeof(Elf64_Chdr)+len(compressed) >= len(uncompressed). 14# SEC: .debug_str PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 01 MS 0 0 1 15# SEC: .debug_frame PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 00 C 0 0 8 16 17# CHECK: Contents of section .debug_line 18## ch_type == ELFCOMPRESS_ZSTD (2) 19# CHECK-NEXT: 0000 02000000 00000000 55010000 00000000 20# 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.uncom 24# RUN: llvm-objcopy --decompress-debug-sections %t %t.decom 25# RUN: cmp %t.uncom %t.decom 26 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 %t1 29# RUN: llvm-readelf -S %t1 | FileCheck %s --check-prefix=SEC1 30 31# SEC1: .debug_str PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 01 MSC 0 0 4 32 33## Don't compress a section not named .debug_*. 34 .section .nonalloc,"",@progbits 35.rept 50 36.asciz "aaaaaaaaaa" 37.endr 38 39 .section .debug_line,"",@progbits 40 41 .section .debug_abbrev,"",@progbits 42.Lsection_abbrev: 43 .byte 1 # Abbreviation Code 44 .byte 17 # DW_TAG_compile_unit 45 .byte 0 # DW_CHILDREN_no 46 .byte 27 # DW_AT_comp_dir 47 .byte 14 # DW_FORM_strp 48 .byte 0 # EOM(1) 49 .byte 0 # EOM(2) 50 51 .section .debug_info,"",@progbits 52 .long 12 # Length of Unit 53 .short 4 # DWARF version number 54 .long .Lsection_abbrev # Offset Into Abbrev. Section 55 .byte 8 # Address Size (in bytes) 56 .byte 1 # Abbrev [1] DW_TAG_compile_unit 57 .long .Linfo_string0 # DW_AT_comp_dir 58 59 .text 60foo: 61 .cfi_startproc 62 .file 1 "Driver.ii" 63 64.rept 3 65.ifdef I386 66 pushl %ebp 67 .cfi_def_cfa_offset 8 68 .cfi_offset %ebp, -8 69 movl %esp, %ebp 70 .cfi_def_cfa_register %ebp 71 pushl %ebx 72 pushl %edi 73 pushl %esi 74 .cfi_offset %esi, -20 75 .cfi_offset %edi, -16 76 .cfi_offset %ebx, -12 77 .loc 1 1 1 prologue_end 78 popl %esi 79 popl %edi 80 popl %ebx 81 popl %ebp 82 .cfi_def_cfa %esp, 4 83.else 84 pushq %rbp 85 .cfi_def_cfa_offset 16 86 .cfi_offset %rbp, -16 87 movq %rsp, %rbp 88 .cfi_def_cfa_register %rbp 89 pushq %r15 90 pushq %r14 91 pushq %r13 92 pushq %r12 93 pushq %rbx 94 .cfi_offset %rbx, -56 95 .cfi_offset %r12, -48 96 .cfi_offset %r13, -40 97 .cfi_offset %r14, -32 98 .cfi_offset %r15, -24 99 .loc 1 1 1 prologue_end 100 popq %rbx 101 popq %r12 102 popq %r13 103 popq %r14 104 popq %r15 105 popq %rbp 106 .cfi_def_cfa %rsp, 8 107.endif 108.endr 109 110# pad out the line table to make sure it's big enough to warrant compression 111 .irpc i, 123456789 112 .irpc j, 0123456789 113 .loc 1 \i\j \j 114 nop 115 .endr 116 .endr 117 .cfi_endproc 118 .cfi_sections .debug_frame 119 120 .section .debug_str,"MS",@progbits,1 121.Linfo_string0: 122 .asciz "perfectly compressable data sample *****************************************" 123