1 # REQUIRES: system-linux
3 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o
4 # RUN: %clang %cflags %t1.o -o %t.exe -Wl,-q
5 # RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
6 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
7 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=POSTCHECK %s
9 # PRECHECK: DW_AT_high_pc [DW_FORM_udata] (15)
10 # PRECHECK-NEXT: DW_AT_name [DW_FORM_strp]
11 # PRECHECK-SAME: "main.cpp"
13 # POSTCHECK: DW_AT_ranges [DW_FORM_sec_offset]
15 # POSTCHECK-NEXT: DW_AT_name [DW_FORM_strp]
16 # POSTCHECK-SAME: "main.cpp"
18 # Testing that BOLT transforms DW_AT_high_pc of form DW_FORM_udata correctly into DW_AT_ranges.
19 # Manually changed so that DW_AT_high_pc is DW_FORM_udata, and that DW_AT_name is after it.
25 .globl main # -- Begin function main
31 .loc 1 1 0 # main.cpp:1:0
35 .cfi_def_cfa_offset 16
38 .cfi_def_cfa_register %rbp
41 .loc 1 2 1 prologue_end # main.cpp:2:1
48 .size main, .Lfunc_end0-main
51 .section .debug_abbrev,"",@progbits
52 .byte 1 # Abbreviation Code
53 .byte 17 # DW_TAG_compile_unit
54 .byte 1 # DW_CHILDREN_yes
55 .byte 37 # DW_AT_producer
56 .byte 14 # DW_FORM_strp
57 .byte 19 # DW_AT_language
58 .byte 5 # DW_FORM_data2
59 .byte 16 # DW_AT_stmt_list
60 .byte 23 # DW_FORM_sec_offset
61 .byte 27 # DW_AT_comp_dir
62 .byte 14 # DW_FORM_strp
63 .byte 17 # DW_AT_low_pc
64 .byte 1 # DW_FORM_addr
65 .byte 18 # DW_AT_high_pc
66 .byte 15 # DW_FORM_udata
68 .byte 14 # DW_FORM_strp
71 .byte 2 # Abbreviation Code
72 .byte 46 # DW_TAG_subprogram
73 .byte 0 # DW_CHILDREN_no
74 .byte 17 # DW_AT_low_pc
75 .byte 1 # DW_FORM_addr
76 .byte 18 # DW_AT_high_pc
77 .byte 6 # DW_FORM_data4
78 .byte 64 # DW_AT_frame_base
79 .byte 24 # DW_FORM_exprloc
81 .byte 14 # DW_FORM_strp
82 .byte 58 # DW_AT_decl_file
83 .byte 11 # DW_FORM_data1
84 .byte 59 # DW_AT_decl_line
85 .byte 11 # DW_FORM_data1
87 .byte 19 # DW_FORM_ref4
88 .byte 63 # DW_AT_external
89 .byte 25 # DW_FORM_flag_present
92 .byte 3 # Abbreviation Code
93 .byte 36 # DW_TAG_base_type
94 .byte 0 # DW_CHILDREN_no
96 .byte 14 # DW_FORM_strp
97 .byte 62 # DW_AT_encoding
98 .byte 11 # DW_FORM_data1
99 .byte 11 # DW_AT_byte_size
100 .byte 11 # DW_FORM_data1
104 .section .debug_info,"",@progbits
106 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
108 .short 4 # DWARF version number
109 .long .debug_abbrev # Offset Into Abbrev. Section
110 .byte 8 # Address Size (in bytes)
111 .byte 1 # Abbrev [1] 0xb:0x40 DW_TAG_compile_unit
112 .long .Linfo_string0 # DW_AT_producer
113 .short 33 # DW_AT_language
114 .long .Lline_table_start0 # DW_AT_stmt_list
115 .long .Linfo_string2 # DW_AT_comp_dir
116 .quad .Lfunc_begin0 # DW_AT_low_pc
117 .byte .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
118 .long .Linfo_string1 # DW_AT_name
119 .byte 2 # Abbrev [2] 0x2a:0x19 DW_TAG_subprogram
120 .quad .Lfunc_begin0 # DW_AT_low_pc
121 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
122 .byte 1 # DW_AT_frame_base
124 .long .Linfo_string3 # DW_AT_name
125 .byte 1 # DW_AT_decl_file
126 .byte 1 # DW_AT_decl_line
127 .long 64 # DW_AT_type
129 .byte 3 # Abbrev [3] 0x43:0x7 DW_TAG_base_type
130 .long .Linfo_string4 # DW_AT_name
131 .byte 5 # DW_AT_encoding
132 .byte 4 # DW_AT_byte_size
133 .byte 0 # End Of Children Mark
135 .section .debug_str,"MS",@progbits,1
137 .asciz "clang" # string offset=0
139 .asciz "main.cpp" # string offset=134
141 .asciz "test" # string offset=143
143 .asciz "main" # string offset=186
145 .asciz "int" # string offset=191
147 .section ".note.GNU-stack","",@progbits
149 .section .debug_line,"",@progbits