164 lines · plain
1; RUN: rm -rf %t2; RUN: mkdir %t3; RUN: cd %t4; 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.o6; 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.o8; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe -fno-pic -no-pie9; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --always-convert-to-ranges10; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe | FileCheck -check-prefix=PRE-BOLT %s11; RUN: llvm-dwarfdump --show-form --verbose --debug-ranges main.exe.bolt &> %t/foo.txt12; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe.bolt >> %t/foo.txt13; RUN: cat %t/foo.txt | FileCheck -check-prefix=BOLT %s14; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.dwo &> maindwo.txt15; RUN: cat maindwo.txt | FileCheck -check-prefix=PRE-BOLT-DWO-MAIN %s16; RUN: not llvm-dwarfdump --show-form --verbose --debug-info main.dwo.dwo &> mainddwodwo.txt17; RUN: cat mainddwodwo.txt | FileCheck -check-prefix=BOLT-DWO-MAIN %s18; RUN: llvm-dwarfdump --show-form --verbose --debug-info helper.dwo &> helperdwo.txt19; RUN: cat helperdwo.txt | FileCheck -check-prefix=PRE-BOLT-DWO-HELPER %s20; RUN: not llvm-dwarfdump --show-form --verbose --debug-info helper.dwo.dwo &> helperdwodwo.txt21; RUN: cat helperdwodwo.txt | FileCheck -check-prefix=BOLT-DWO-HELPER %s22 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 = 0x000427; PRE-BOLT: DW_TAG_compile_unit28; 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: Compile32; PRE-BOLT: version = 0x000433; PRE-BOLT: DW_TAG_compile_unit34; 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_ranges39; 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_unit53; BOLT: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000016] = "main.dwo.dwo")54; BOLT-NEXT: DW_AT_GNU_dwo_id55; BOLT-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)56; BOLT-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x0000001057; 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: Compile62; BOLT: DW_TAG_compile_unit63; BOLT: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000023] = "helper.dwo.dwo")64; BOLT-NEXT: DW_AT_GNU_dwo_id65; BOLT-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)66; BOLT-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x0000008067; 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 = 0x000472; PRE-BOLT-DWO-MAIN: DW_TAG_compile_unit73; 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_type76; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_external77; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_file78; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_line79; 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_type83; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_external84; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_file85; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_line86; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x1)87; PRE-BOLT-DWO-MAIN: DW_TAG_subprogram88; 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_base91; 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_subprogram94; 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_base97; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_GNU_str_index] (indexed (00000005) string = "main")98 99; BOLT-DWO-MAIN: version = 0x0004100; BOLT-DWO-MAIN: DW_TAG_compile_unit101; 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_type104; BOLT-DWO-MAIN-NEXT: DW_AT_external105; BOLT-DWO-MAIN-NEXT: DW_AT_decl_file106; BOLT-DWO-MAIN-NEXT: DW_AT_decl_line107; 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_type111; BOLT-DWO-MAIN-NEXT: DW_AT_external112; BOLT-DWO-MAIN-NEXT: DW_AT_decl_file113; BOLT-DWO-MAIN-NEXT: DW_AT_decl_line114; 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] (0x00000000117; BOLT-DWO-MAIN-NEXT: )118; BOLT-DWO-MAIN-NEXT: DW_AT_frame_base119; 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] (0x00000020123; 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 = 0x0004129; 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_type132; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_external133; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_file134; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_line135; 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_type139; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_external140; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_file141; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_line142; 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 = 0x0004148; 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_type151; BOLT-DWO-HELPER-NEXT: DW_AT_external152; BOLT-DWO-HELPER-NEXT: DW_AT_decl_file153; BOLT-DWO-HELPER-NEXT: DW_AT_decl_line154; 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_type158; BOLT-DWO-HELPER-NEXT: DW_AT_external159; BOLT-DWO-HELPER-NEXT: DW_AT_decl_file160; BOLT-DWO-HELPER-NEXT: DW_AT_decl_line161; 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] (0x00000000164