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