|
| 1 | +# REQUIRES: system-linux |
| 2 | + |
| 3 | +## Check that BOLT correctly prints debug line comments for DWARF-5. |
| 4 | + |
| 5 | + |
| 6 | +# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o |
| 7 | +# RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q |
| 8 | +# RUN: llvm-bolt %t.exe --update-debug-sections --print-debug-info \ |
| 9 | +# RUN: --print-after-lowering -o %t.bolt | FileCheck %s |
| 10 | + |
| 11 | +# CHECK: xorq %rdi, %rdi # debug line main.c:2:5 |
| 12 | + |
| 13 | +# __attribute__((naked)) void _start() { |
| 14 | +# __asm__( |
| 15 | +# "xor %rdi, %rdi\n" // exit code 0 |
| 16 | +# "mov $60, %rax\n" // syscall number for exit |
| 17 | +# "syscall\n" |
| 18 | +# ); |
| 19 | +# } |
| 20 | + |
| 21 | + .file "main.c" |
| 22 | + .text |
| 23 | + .globl _start # -- Begin function _start |
| 24 | + .p2align 4 |
| 25 | + .type _start,@function |
| 26 | +_start: # @_start |
| 27 | +.Lfunc_begin0: |
| 28 | + .file 0 "/home/gpastukhov/tmp2" "main.c" md5 0x94c0e54a615c2a21415ddb904991abd8 |
| 29 | + .cfi_startproc |
| 30 | +# %bb.0: |
| 31 | + .loc 0 2 5 prologue_end # main.c:2:5 |
| 32 | + #APP |
| 33 | + xorq %rdi, %rdi |
| 34 | + movq $60, %rax |
| 35 | + syscall |
| 36 | + |
| 37 | + #NO_APP |
| 38 | +.Ltmp0: |
| 39 | +.Lfunc_end0: |
| 40 | + .size _start, .Lfunc_end0-_start |
| 41 | + .cfi_endproc |
| 42 | + # -- End function |
| 43 | + .section .debug_abbrev,"",@progbits |
| 44 | + .byte 1 # Abbreviation Code |
| 45 | + .byte 17 # DW_TAG_compile_unit |
| 46 | + .byte 1 # DW_CHILDREN_yes |
| 47 | + .byte 37 # DW_AT_producer |
| 48 | + .byte 37 # DW_FORM_strx1 |
| 49 | + .byte 19 # DW_AT_language |
| 50 | + .byte 5 # DW_FORM_data2 |
| 51 | + .byte 3 # DW_AT_name |
| 52 | + .byte 37 # DW_FORM_strx1 |
| 53 | + .byte 114 # DW_AT_str_offsets_base |
| 54 | + .byte 23 # DW_FORM_sec_offset |
| 55 | + .byte 16 # DW_AT_stmt_list |
| 56 | + .byte 23 # DW_FORM_sec_offset |
| 57 | + .byte 27 # DW_AT_comp_dir |
| 58 | + .byte 37 # DW_FORM_strx1 |
| 59 | + .byte 17 # DW_AT_low_pc |
| 60 | + .byte 27 # DW_FORM_addrx |
| 61 | + .byte 18 # DW_AT_high_pc |
| 62 | + .byte 6 # DW_FORM_data4 |
| 63 | + .byte 115 # DW_AT_addr_base |
| 64 | + .byte 23 # DW_FORM_sec_offset |
| 65 | + .byte 0 # EOM(1) |
| 66 | + .byte 0 # EOM(2) |
| 67 | + .byte 2 # Abbreviation Code |
| 68 | + .byte 46 # DW_TAG_subprogram |
| 69 | + .byte 0 # DW_CHILDREN_no |
| 70 | + .byte 17 # DW_AT_low_pc |
| 71 | + .byte 27 # DW_FORM_addrx |
| 72 | + .byte 18 # DW_AT_high_pc |
| 73 | + .byte 6 # DW_FORM_data4 |
| 74 | + .byte 64 # DW_AT_frame_base |
| 75 | + .byte 24 # DW_FORM_exprloc |
| 76 | + .byte 3 # DW_AT_name |
| 77 | + .byte 37 # DW_FORM_strx1 |
| 78 | + .byte 58 # DW_AT_decl_file |
| 79 | + .byte 11 # DW_FORM_data1 |
| 80 | + .byte 59 # DW_AT_decl_line |
| 81 | + .byte 11 # DW_FORM_data1 |
| 82 | + .byte 63 # DW_AT_external |
| 83 | + .byte 25 # DW_FORM_flag_present |
| 84 | + .byte 0 # EOM(1) |
| 85 | + .byte 0 # EOM(2) |
| 86 | + .byte 0 # EOM(3) |
| 87 | + .section .debug_info,"",@progbits |
| 88 | +.Lcu_begin0: |
| 89 | + .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit |
| 90 | +.Ldebug_info_start0: |
| 91 | + .short 5 # DWARF version number |
| 92 | + .byte 1 # DWARF Unit Type |
| 93 | + .byte 8 # Address Size (in bytes) |
| 94 | + .long .debug_abbrev # Offset Into Abbrev. Section |
| 95 | + .byte 1 # Abbrev [1] 0xc:0x23 DW_TAG_compile_unit |
| 96 | + .byte 0 # DW_AT_producer |
| 97 | + .short 29 # DW_AT_language |
| 98 | + .byte 1 # DW_AT_name |
| 99 | + .long .Lstr_offsets_base0 # DW_AT_str_offsets_base |
| 100 | + .long .Lline_table_start0 # DW_AT_stmt_list |
| 101 | + .byte 2 # DW_AT_comp_dir |
| 102 | + .byte 0 # DW_AT_low_pc |
| 103 | + .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc |
| 104 | + .long .Laddr_table_base0 # DW_AT_addr_base |
| 105 | + .byte 2 # Abbrev [2] 0x23:0xb DW_TAG_subprogram |
| 106 | + .byte 0 # DW_AT_low_pc |
| 107 | + .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc |
| 108 | + .byte 1 # DW_AT_frame_base |
| 109 | + .byte 87 |
| 110 | + .byte 3 # DW_AT_name |
| 111 | + .byte 0 # DW_AT_decl_file |
| 112 | + .byte 1 # DW_AT_decl_line |
| 113 | + # DW_AT_external |
| 114 | + .byte 0 # End Of Children Mark |
| 115 | +.Ldebug_info_end0: |
| 116 | + .section .debug_str_offsets,"",@progbits |
| 117 | + .long 20 # Length of String Offsets Set |
| 118 | + .short 5 |
| 119 | + .short 0 |
| 120 | +.Lstr_offsets_base0: |
| 121 | + .section .debug_str,"MS",@progbits,1 |
| 122 | +.Linfo_string0: |
| 123 | + .asciz "clang version 20.1.8 (CentOS 20.1.8-1.el9)" # string offset=0 |
| 124 | +.Linfo_string1: |
| 125 | + .asciz "main.c" # string offset=43 |
| 126 | +.Linfo_string2: |
| 127 | + .asciz "/home/gpastukhov/tmp2" # string offset=50 |
| 128 | +.Linfo_string3: |
| 129 | + .asciz "_start" # string offset=72 |
| 130 | + .section .debug_str_offsets,"",@progbits |
| 131 | + .long .Linfo_string0 |
| 132 | + .long .Linfo_string1 |
| 133 | + .long .Linfo_string2 |
| 134 | + .long .Linfo_string3 |
| 135 | + .section .debug_addr,"",@progbits |
| 136 | + .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution |
| 137 | +.Ldebug_addr_start0: |
| 138 | + .short 5 # DWARF version number |
| 139 | + .byte 8 # Address size |
| 140 | + .byte 0 # Segment selector size |
| 141 | +.Laddr_table_base0: |
| 142 | + .quad .Lfunc_begin0 |
| 143 | +.Ldebug_addr_end0: |
| 144 | + .ident "clang version 20.1.8 (CentOS 20.1.8-1.el9)" |
| 145 | + .section ".note.GNU-stack","",@progbits |
| 146 | + .addrsig |
| 147 | + .section .debug_line,"",@progbits |
| 148 | +.Lline_table_start0: |
0 commit comments