# clang++ main.cpp -O1 -g2 -gdwarf-4 -emit-llvm -c -o mainLL.o
# clang++ helper1.cpp -O1 -g2 -gdwarf-4 -emit-llvm -c -o helper1LL.o
# llvm-link mainLL.o helper1LL.o -S -o linked.ll
# clang++ -O1 linked.ll -g2 -gdwarf-4 -S -o combinedTest.s
# main.cpp
# struct Foo {
# int x;
# int y;
# };
# inline __attribute__((always_inline))
# static int helper(Foo &f) {
# return f.x + 3;
# }
# int main(int argc, char *argv[]) {
# Foo foo;
# foo.x = argc;
# foo.y = 3;
# return helper(foo) + foo.x + foo.y;
# }
# helper1.cpp
# struct Foo2 {
# int x;
# int y;
# };
# inline __attribute__((always_inline))
# static int helper(Foo2 &f) {
# return f.x + 3;
# }
# int foo2(int i) {
# Foo2 foo;
# foo.x = i;
# foo.y = 3;
# return helper(foo);
# }
.text
.file "llvm-link"
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.Lfunc_begin0:
.cfi_startproc
# %bb.0: # %entry
#DEBUG_VALUE: main:argc <- $edi
#DEBUG_VALUE: main:argv <- $rsi
#DEBUG_VALUE: main:foo <- [DW_OP_LLVM_fragment 0 32] $edi
# kill: def $edi killed $edi def $rdi
#DEBUG_VALUE: main:foo <- [DW_OP_LLVM_fragment 32 32] 3
.file 1 "/dwarf4CrossCULocList" "main.cpp"
.loc 1 13 30 prologue_end # main.cpp:13:30
leal 6(,%rdi,2), %eax
.loc 1 13 3 is_stmt 0 # main.cpp:13:3
retq
.Ltmp0:
.Lfunc_end0:
.size main, .Lfunc_end0-main
.cfi_endproc
# -- End function
.globl _Z4foo2i # -- Begin function _Z4foo2i
.p2align 4, 0x90
.type _Z4foo2i,@function
_Z4foo2i: # @_Z4foo2i
.Lfunc_begin1:
.cfi_startproc
# %bb.0: # %entry
#DEBUG_VALUE: foo2:i <- $edi
#DEBUG_VALUE: foo2:foo <- [DW_OP_LLVM_fragment 0 32] $edi
# kill: def $edi killed $edi def $rdi
#DEBUG_VALUE: foo2:foo <- [DW_OP_LLVM_fragment 32 32] 3
.file 2 "/dwarf4CrossCULocList" "helper1.cpp"
.loc 2 7 14 prologue_end is_stmt 1 # helper1.cpp:7:14
leal 3(%rdi), %eax
.Ltmp1:
.loc 2 13 3 # helper1.cpp:13:3
retq
.Ltmp2:
.Lfunc_end1:
.size _Z4foo2i, .Lfunc_end1-_Z4foo2i
.cfi_endproc
# -- End function
.section .debug_loc,"",@progbits
.Ldebug_loc0:
.quad .Lfunc_begin0-.Lfunc_begin0
.quad .Lfunc_end0-.Lfunc_begin0
.short 7 # Loc expr size
.byte 85 # super-register DW_OP_reg5
.byte 147 # DW_OP_piece
.byte 4 # 4
.byte 51 # DW_OP_lit3
.byte 159 # DW_OP_stack_value
.byte 147 # DW_OP_piece
.byte 4 # 4
.quad 0
.quad 0
.Ldebug_loc1:
.quad .Lfunc_begin1-.Lfunc_begin1
.quad .Lfunc_end1-.Lfunc_begin1
.short 7 # Loc expr size
.byte 85 # super-register DW_OP_reg5
.byte 147 # DW_OP_piece
.byte 4 # 4
.byte 51 # DW_OP_lit3
.byte 159 # DW_OP_stack_value
.byte 147 # DW_OP_piece
.byte 4 # 4
.quad 0
.quad 0
.section .debug_abbrev,"",@progbits
.byte 1 # Abbreviation Code
.byte 17 # DW_TAG_compile_unit
.byte 1 # DW_CHILDREN_yes
.byte 37 # DW_AT_producer
.byte 14 # DW_FORM_strp
.byte 19 # DW_AT_language
.byte 5 # DW_FORM_data2
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 16 # DW_AT_stmt_list
.byte 23 # DW_FORM_sec_offset
.byte 27 # DW_AT_comp_dir
.byte 14 # DW_FORM_strp
.byte 17 # DW_AT_low_pc
.byte 1 # DW_FORM_addr
.byte 18 # DW_AT_high_pc
.byte 6 # DW_FORM_data4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 2 # Abbreviation Code
.byte 46 # DW_TAG_subprogram
.byte 1 # DW_CHILDREN_yes
.byte 17 # DW_AT_low_pc
.byte 1 # DW_FORM_addr
.byte 18 # DW_AT_high_pc
.byte 6 # DW_FORM_data4
.byte 64 # DW_AT_frame_base
.byte 24 # DW_FORM_exprloc
.ascii "\227B" # DW_AT_GNU_all_call_sites
.byte 25 # DW_FORM_flag_present
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 73 # DW_AT_type
.byte 16 # DW_FORM_ref_addr
.byte 63 # DW_AT_external
.byte 25 # DW_FORM_flag_present
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 3 # Abbreviation Code
.byte 5 # DW_TAG_formal_parameter
.byte 0 # DW_CHILDREN_no
.byte 2 # DW_AT_location
.byte 24 # DW_FORM_exprloc
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 73 # DW_AT_type
.byte 16 # DW_FORM_ref_addr
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 4 # Abbreviation Code
.byte 5 # DW_TAG_formal_parameter
.byte 0 # DW_CHILDREN_no
.byte 2 # DW_AT_location
.byte 24 # DW_FORM_exprloc
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 5 # Abbreviation Code
.byte 52 # DW_TAG_variable
.byte 0 # DW_CHILDREN_no
.byte 2 # DW_AT_location
.byte 23 # DW_FORM_sec_offset
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 6 # Abbreviation Code
.byte 15 # DW_TAG_pointer_type
.byte 0 # DW_CHILDREN_no
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 7 # Abbreviation Code
.byte 36 # DW_TAG_base_type
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 62 # DW_AT_encoding
.byte 11 # DW_FORM_data1
.byte 11 # DW_AT_byte_size
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 8 # Abbreviation Code
.byte 19 # DW_TAG_structure_type
.byte 1 # DW_CHILDREN_yes
.byte 54 # DW_AT_calling_convention
.byte 11 # DW_FORM_data1
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 11 # DW_AT_byte_size
.byte 11 # DW_FORM_data1
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 9 # Abbreviation Code
.byte 13 # DW_TAG_member
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 73 # DW_AT_type
.byte 16 # DW_FORM_ref_addr
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 56 # DW_AT_data_member_location
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 10 # Abbreviation Code
.byte 46 # DW_TAG_subprogram
.byte 1 # DW_CHILDREN_yes
.byte 110 # DW_AT_linkage_name
.byte 14 # DW_FORM_strp
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 32 # DW_AT_inline
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 11 # Abbreviation Code
.byte 5 # DW_TAG_formal_parameter
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 12 # Abbreviation Code
.byte 16 # DW_TAG_reference_type
.byte 0 # DW_CHILDREN_no
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 13 # Abbreviation Code
.byte 13 # DW_TAG_member
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 56 # DW_AT_data_member_location
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 14 # Abbreviation Code
.byte 46 # DW_TAG_subprogram
.byte 1 # DW_CHILDREN_yes
.byte 17 # DW_AT_low_pc
.byte 1 # DW_FORM_addr
.byte 18 # DW_AT_high_pc
.byte 6 # DW_FORM_data4
.byte 64 # DW_AT_frame_base
.byte 24 # DW_FORM_exprloc
.ascii "\227B" # DW_AT_GNU_all_call_sites
.byte 25 # DW_FORM_flag_present
.byte 110 # DW_AT_linkage_name
.byte 14 # DW_FORM_strp
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 63 # DW_AT_external
.byte 25 # DW_FORM_flag_present
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 15 # Abbreviation Code
.byte 29 # DW_TAG_inlined_subroutine
.byte 0 # DW_CHILDREN_no
.byte 49 # DW_AT_abstract_origin
.byte 19 # DW_FORM_ref4
.byte 17 # DW_AT_low_pc
.byte 1 # DW_FORM_addr
.byte 18 # DW_AT_high_pc
.byte 6 # DW_FORM_data4
.byte 88 # DW_AT_call_file
.byte 11 # DW_FORM_data1
.byte 89 # DW_AT_call_line
.byte 11 # DW_FORM_data1
.byte 87 # DW_AT_call_column
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 0 # EOM(3)
.section .debug_info,"",@progbits
.Lcu_begin0:
.long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
.Ldebug_info_start0:
.short 4 # DWARF version number
.long .debug_abbrev # Offset Into Abbrev. Section
.byte 8 # Address Size (in bytes)
.byte 1 # Abbrev [1] 0xb:0x96 DW_TAG_compile_unit
.long .Linfo_string0 # DW_AT_producer
.short 33 # DW_AT_language
.long .Linfo_string1 # DW_AT_name
.long .Lline_table_start0 # DW_AT_stmt_list
.long .Linfo_string2 # DW_AT_comp_dir
.quad .Lfunc_begin0 # DW_AT_low_pc
.long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
.byte 2 # Abbrev [2] 0x2a:0x43 DW_TAG_subprogram
.quad .Lfunc_begin0 # DW_AT_low_pc
.long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
.byte 1 # DW_AT_frame_base
.byte 87
# DW_AT_GNU_all_call_sites
.long .Linfo_string11 # DW_AT_name
.byte 1 # DW_AT_decl_file
.byte 9 # DW_AT_decl_line
.long .debug_info+231 # DW_AT_type
# DW_AT_external
.byte 3 # Abbrev [3] 0x43:0xd DW_TAG_formal_parameter
.byte 1 # DW_AT_location
.byte 85
.long .Linfo_string14 # DW_AT_name
.byte 1 # DW_AT_decl_file
.byte 9 # DW_AT_decl_line
.long .debug_info+231 # DW_AT_type
.byte 4 # Abbrev [4] 0x50:0xd DW_TAG_formal_parameter
.byte 1 # DW_AT_location
.byte 84
.long .Linfo_string15 # DW_AT_name
.byte 1 # DW_AT_decl_file
.byte 9 # DW_AT_decl_line
.long 109 # DW_AT_type
.byte 5 # Abbrev [5] 0x5d:0xf DW_TAG_variable
.long .Ldebug_loc0 # DW_AT_location
.long .Linfo_string17 # DW_AT_name
.byte 1 # DW_AT_decl_file
.byte 10 # DW_AT_decl_line
.long 126 # DW_AT_type
.byte 0 # End Of Children Mark
.byte 6 # Abbrev [6] 0x6d:0x5 DW_TAG_pointer_type
.long 114 # DW_AT_type
.byte 6 # Abbrev [6] 0x72:0x5 DW_TAG_pointer_type
.long 119 # DW_AT_type
.byte 7 # Abbrev [7] 0x77:0x7 DW_TAG_base_type
.long .Linfo_string16 # DW_AT_name
.byte 6 # DW_AT_encoding
.byte 1 # DW_AT_byte_size
.byte 8 # Abbrev [8] 0x7e:0x22 DW_TAG_structure_type
.byte 5 # DW_AT_calling_convention
.long .Linfo_string18 # DW_AT_name
.byte 8 # DW_AT_byte_size
.byte 1 # DW_AT_decl_file
.byte 1 # DW_AT_decl_line
.byte 9 # Abbrev [9] 0x87:0xc DW_TAG_member
.long .Linfo_string8 # DW_AT_name
.long .debug_info+231 # DW_AT_type
.byte 1 # DW_AT_decl_file
.byte 2 # DW_AT_decl_line
.byte 0 # DW_AT_data_member_location
.byte 9 # Abbrev [9] 0x93:0xc DW_TAG_member
.long .Linfo_string9 # DW_AT_name
.long .debug_info+231 # DW_AT_type
.byte 1 # DW_AT_decl_file
.byte 3 # DW_AT_decl_line
.byte 4 # DW_AT_data_member_location
.byte 0 # End Of Children Mark
.byte 0 # End Of Children Mark
.Ldebug_info_end0:
.Lcu_begin1:
.long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
.Ldebug_info_start1:
.short 4 # DWARF version number
.long .debug_abbrev # Offset Into Abbrev. Section
.byte 8 # Address Size (in bytes)
.byte 1 # Abbrev [1] 0xb:0xb8 DW_TAG_compile_unit
.long .Linfo_string0 # DW_AT_producer
.short 33 # DW_AT_language
.long .Linfo_string3 # DW_AT_name
.long .Lline_table_start0 # DW_AT_stmt_list
.long .Linfo_string2 # DW_AT_comp_dir
.quad .Lfunc_begin1 # DW_AT_low_pc
.long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
.byte 10 # Abbrev [10] 0x2a:0x1c DW_TAG_subprogram
.long .Linfo_string4 # DW_AT_linkage_name
.long .Linfo_string5 # DW_AT_name
.byte 2 # DW_AT_decl_file
.byte 6 # DW_AT_decl_line
.long 70 # DW_AT_type
.byte 1 # DW_AT_inline
.byte 11 # Abbrev [11] 0x3a:0xb DW_TAG_formal_parameter
.long .Linfo_string7 # DW_AT_name
.byte 2 # DW_AT_decl_file
.byte 6 # DW_AT_decl_line
.long 77 # DW_AT_type
.byte 0 # End Of Children Mark
.byte 7 # Abbrev [7] 0x46:0x7 DW_TAG_base_type
.long .Linfo_string6 # DW_AT_name
.byte 5 # DW_AT_encoding
.byte 4 # DW_AT_byte_size
.byte 12 # Abbrev [12] 0x4d:0x5 DW_TAG_reference_type
.long 82 # DW_AT_type
.byte 8 # Abbrev [8] 0x52:0x22 DW_TAG_structure_type
.byte 5 # DW_AT_calling_convention
.long .Linfo_string10 # DW_AT_name
.byte 8 # DW_AT_byte_size
.byte 2 # DW_AT_decl_file
.byte 1 # DW_AT_decl_line
.byte 13 # Abbrev [13] 0x5b:0xc DW_TAG_member
.long .Linfo_string8 # DW_AT_name
.long 70 # DW_AT_type
.byte 2 # DW_AT_decl_file
.byte 2 # DW_AT_decl_line
.byte 0 # DW_AT_data_member_location
.byte 13 # Abbrev [13] 0x67:0xc DW_TAG_member
.long .Linfo_string9 # DW_AT_name
.long 70 # DW_AT_type
.byte 2 # DW_AT_decl_file
.byte 3 # DW_AT_decl_line
.byte 4 # DW_AT_data_member_location
.byte 0 # End Of Children Mark
.byte 14 # Abbrev [14] 0x74:0x4e DW_TAG_subprogram
.quad .Lfunc_begin1 # DW_AT_low_pc
.long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
.byte 1 # DW_AT_frame_base
.byte 87
# DW_AT_GNU_all_call_sites
.long .Linfo_string12 # DW_AT_linkage_name
.long .Linfo_string13 # DW_AT_name
.byte 2 # DW_AT_decl_file
.byte 9 # DW_AT_decl_line
.long 70 # DW_AT_type
# DW_AT_external
.byte 4 # Abbrev [4] 0x91:0xd DW_TAG_formal_parameter
.byte 1 # DW_AT_location
.byte 85
.long .Linfo_string19 # DW_AT_name
.byte 2 # DW_AT_decl_file
.byte 9 # DW_AT_decl_line
.long 70 # DW_AT_type
.byte 5 # Abbrev [5] 0x9e:0xf DW_TAG_variable
.long .Ldebug_loc1 # DW_AT_location
.long .Linfo_string17 # DW_AT_name
.byte 2 # DW_AT_decl_file
.byte 10 # DW_AT_decl_line
.long 82 # DW_AT_type
.byte 15 # Abbrev [15] 0xad:0x14 DW_TAG_inlined_subroutine
.long 42 # DW_AT_abstract_origin
.quad .Lfunc_begin1 # DW_AT_low_pc
.long .Ltmp1-.Lfunc_begin1 # DW_AT_high_pc
.byte 2 # DW_AT_call_file
.byte 13 # DW_AT_call_line
.byte 10 # DW_AT_call_column
.byte 0 # End Of Children Mark
.byte 0 # End Of Children Mark
.Ldebug_info_end1:
.section .debug_str,"MS",@progbits,1
.Linfo_string0:
.asciz "clang version 18.0.0 ([email protected]:llvm/llvm-project.git 37d6c1cc7d4dd3a8a47ba62254bc88521bd50d66)" # string offset=0
.Linfo_string1:
.asciz "main.cpp" # string offset=101
.Linfo_string2:
.asciz "/dwarf4CrossCULocList" # string offset=110
.Linfo_string3:
.asciz "helper1.cpp" # string offset=169
.Linfo_string4:
.asciz "_ZL6helperR4Foo2" # string offset=181
.Linfo_string5:
.asciz "helper" # string offset=198
.Linfo_string6:
.asciz "int" # string offset=205
.Linfo_string7:
.asciz "f" # string offset=209
.Linfo_string8:
.asciz "x" # string offset=211
.Linfo_string9:
.asciz "y" # string offset=213
.Linfo_string10:
.asciz "Foo2" # string offset=215
.Linfo_string11:
.asciz "main" # string offset=220
.Linfo_string12:
.asciz "_Z4foo2i" # string offset=225
.Linfo_string13:
.asciz "foo2" # string offset=234
.Linfo_string14:
.asciz "argc" # string offset=239
.Linfo_string15:
.asciz "argv" # string offset=244
.Linfo_string16:
.asciz "char" # string offset=249
.Linfo_string17:
.asciz "foo" # string offset=254
.Linfo_string18:
.asciz "Foo" # string offset=258
.Linfo_string19:
.asciz "i" # string offset=262
.ident "clang version 18.0.0 ([email protected]:llvm/llvm-project.git 37d6c1cc7d4dd3a8a47ba62254bc88521bd50d66)"
.ident "clang version 18.0.0 ([email protected]:llvm/llvm-project.git 37d6c1cc7d4dd3a8a47ba62254bc88521bd50d66)"
.section ".note.GNU-stack","",@progbits
.addrsig
.section .debug_line,"",@progbits
.Lline_table_start0: