1; RUN: rm -rf %t 2; RUN: mkdir %t 3; RUN: cd %t 4; RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-df-dualcu-main.s \ 5; RUN: -split-dwarf-file=main.dwo -o main.o 6; RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-df-dualcu-helper.s \ 7; RUN: -split-dwarf-file=helper.dwo -o helper.o 8; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe -fno-pic -no-pie 9; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --always-convert-to-ranges 10; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe | FileCheck -check-prefix=PRE-BOLT %s 11; RUN: llvm-dwarfdump --show-form --verbose --debug-ranges main.exe.bolt &> %t/foo.txt 12; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe.bolt >> %t/foo.txt 13; RUN: cat %t/foo.txt | FileCheck -check-prefix=BOLT %s 14; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.dwo &> maindwo.txt 15; RUN: cat maindwo.txt | FileCheck -check-prefix=PRE-BOLT-DWO-MAIN %s 16; RUN: not llvm-dwarfdump --show-form --verbose --debug-info main.dwo.dwo &> mainddwodwo.txt 17; RUN: cat mainddwodwo.txt | FileCheck -check-prefix=BOLT-DWO-MAIN %s 18; RUN: llvm-dwarfdump --show-form --verbose --debug-info helper.dwo &> helperdwo.txt 19; RUN: cat helperdwo.txt | FileCheck -check-prefix=PRE-BOLT-DWO-HELPER %s 20; RUN: not llvm-dwarfdump --show-form --verbose --debug-info helper.dwo.dwo &> helperdwodwo.txt 21; RUN: cat helperdwodwo.txt | FileCheck -check-prefix=BOLT-DWO-HELPER %s 22 23;; Testing dwarf5 split dwarf for two CUs. Making sure DW_AT_low_pc/DW_AT_high_pc are converted correctly in the binary and in dwo. 24;; Checking that DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx ##) are updated correctly. 25 26; PRE-BOLT: version = 0x0004 27; PRE-BOLT: DW_TAG_compile_unit 28; PRE-BOLT: DW_AT_low_pc [DW_FORM_addr] 29; PRE-BOLT-NEXT: DW_AT_high_pc [DW_FORM_data4] 30; PRE-BOLT-NEXT: DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000000) 31; PRE-BOLT-NEXT: Compile 32; PRE-BOLT: version = 0x0004 33; PRE-BOLT: DW_TAG_compile_unit 34; PRE-BOLT: DW_AT_low_pc [DW_FORM_addr] 35; PRE-BOLT-NEXT: DW_AT_high_pc [DW_FORM_data4] 36; PRE-BOLT: DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000020) 37 38; BOLT: .debug_ranges 39; BOLT-NEXT: 00000000 <End of list> 40; BOLT-NEXT: 00000010 [[#%.16x,ADDR1:]] [[#%.16x,ADDRB1:]] 41; BOLT-NEXT: 00000010 [[#%.16x,ADDR2:]] [[#%.16x,ADDRB2:]] 42; BOLT-NEXT: 00000010 <End of list> 43; BOLT-NEXT: 00000040 [[#%.16x,ADDR1:]] [[#%.16x,ADDRB1:]] 44; BOLT-NEXT: 00000040 <End of list> 45; BOLT-NEXT: 00000060 [[#%.16x,ADDR2:]] [[#%.16x,ADDRB2:]] 46; BOLT-NEXT: 00000060 <End of list> 47; BOLT-NEXT: 00000080 [[#%.16x,ADDR3:]] [[#%.16x,ADDRB3:]] 48; BOLT-NEXT: 00000080 <End of list> 49; BOLT-NEXT: 000000a0 [[#%.16x,ADDR3:]] [[#%.16x,ADDRB3:]] 50; BOLT-NEXT: 000000a0 <End of list> 51 52; BOLT: DW_TAG_compile_unit 53; BOLT: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000016] = "main.dwo.dwo") 54; BOLT-NEXT: DW_AT_GNU_dwo_id 55; BOLT-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) 56; BOLT-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000010 57; BOLT-NEXT: [0x[[#ADDR1]], 0x[[#ADDRB1]]) 58; BOLT-NEXT: [0x[[#ADDR2]], 0x[[#ADDRB2]])) 59; BOLT-NEXT: DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000000) 60; BOLT-NEXT: DW_AT_GNU_ranges_base [DW_FORM_sec_offset] (0x00000040) 61; BOLT-NEXT: Compile 62; BOLT: DW_TAG_compile_unit 63; BOLT: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000023] = "helper.dwo.dwo") 64; BOLT-NEXT: DW_AT_GNU_dwo_id 65; BOLT-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) 66; BOLT-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000080 67; BOLT-NEXT: [0x[[#ADDR3]], 0x[[#ADDRB3]]) 68; BOLT-NEXT: DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000010) 69; BOLT-NEXT: DW_AT_GNU_ranges_base [DW_FORM_sec_offset] (0x000000a0) 70 71; PRE-BOLT-DWO-MAIN: version = 0x0004 72; PRE-BOLT-DWO-MAIN: DW_TAG_compile_unit 73; PRE-BOLT-DWO-MAIN: DW_TAG_variable [2] 74; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000000) string = "x") 75; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_type 76; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_external 77; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_file 78; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_line 79; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x0) 80; PRE-BOLT-DWO-MAIN: DW_TAG_variable [2] 81; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000002) string = "y") 82; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_type 83; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_external 84; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_file 85; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_line 86; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x1) 87; PRE-BOLT-DWO-MAIN: DW_TAG_subprogram 88; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000002) 89; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x00000024) 90; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_frame_base 91; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_linkage_name [DW_FORM_GNU_str_index] (indexed (00000003) string = "_Z3usePiS_") 92; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000004) string = "use") 93; PRE-BOLT-DWO-MAIN: DW_TAG_subprogram 94; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000003) 95; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x0000005f) 96; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_frame_base 97; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000005) string = "main") 98 99; BOLT-DWO-MAIN: version = 0x0004 100; BOLT-DWO-MAIN: DW_TAG_compile_unit 101; BOLT-DWO-MAIN: DW_TAG_variable [2] 102; BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000000) string = "x") 103; BOLT-DWO-MAIN-NEXT: DW_AT_type 104; BOLT-DWO-MAIN-NEXT: DW_AT_external 105; BOLT-DWO-MAIN-NEXT: DW_AT_decl_file 106; BOLT-DWO-MAIN-NEXT: DW_AT_decl_line 107; BOLT-DWO-MAIN-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x0) 108; BOLT-DWO-MAIN: DW_TAG_variable [2] 109; BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000002) string = "y") 110; BOLT-DWO-MAIN-NEXT: DW_AT_type 111; BOLT-DWO-MAIN-NEXT: DW_AT_external 112; BOLT-DWO-MAIN-NEXT: DW_AT_decl_file 113; BOLT-DWO-MAIN-NEXT: DW_AT_decl_line 114; BOLT-DWO-MAIN-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x1) 115; BOLT-DWO-MAIN: DW_TAG_subprogram [4] 116; BOLT-DWO-MAIN-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000 117; BOLT-DWO-MAIN-NEXT: ) 118; BOLT-DWO-MAIN-NEXT: DW_AT_frame_base 119; BOLT-DWO-MAIN-NEXT: DW_AT_linkage_name [DW_FORM_GNU_str_index] (indexed (00000003) string = "_Z3usePiS_") 120; BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000004) string = "use") 121; BOLT-DWO-MAIN: DW_TAG_subprogram [6] 122; BOLT-DWO-MAIN-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000020 123; BOLT-DWO-MAIN-NEXT: ) 124; BOLT-DWO-MAIN-NEXT: DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_reg6 RBP) 125; BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000005) string = "main") 126 127 128; PRE-BOLT-DWO-HELPER: version = 0x0004 129; PRE-BOLT-DWO-HELPER: DW_TAG_variable [2] 130; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000000) string = "z") 131; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_type 132; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_external 133; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_file 134; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_line 135; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x0) 136; PRE-BOLT-DWO-HELPER: DW_TAG_variable [2] 137; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000002) string = "d") 138; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_type 139; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_external 140; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_file 141; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_line 142; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x1) 143; PRE-BOLT-DWO-HELPER: DW_TAG_subprogram [4] 144; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000002) 145; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x0000003d) 146 147; BOLT-DWO-HELPER: version = 0x0004 148; BOLT-DWO-HELPER: DW_TAG_variable [2] 149; BOLT-DWO-HELPER-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000000) string = "z") 150; BOLT-DWO-HELPER-NEXT: DW_AT_type 151; BOLT-DWO-HELPER-NEXT: DW_AT_external 152; BOLT-DWO-HELPER-NEXT: DW_AT_decl_file 153; BOLT-DWO-HELPER-NEXT: DW_AT_decl_line 154; BOLT-DWO-HELPER-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x0) 155; BOLT-DWO-HELPER: DW_TAG_variable [2] 156; BOLT-DWO-HELPER-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000002) string = "d") 157; BOLT-DWO-HELPER-NEXT: DW_AT_type 158; BOLT-DWO-HELPER-NEXT: DW_AT_external 159; BOLT-DWO-HELPER-NEXT: DW_AT_decl_file 160; BOLT-DWO-HELPER-NEXT: DW_AT_decl_line 161; BOLT-DWO-HELPER-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x1) 162; BOLT-DWO-HELPER: DW_TAG_subprogram [4] 163; BOLT-DWO-HELPER-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000 164