1; RUN: rm -rf %t 2; RUN: mkdir %t 3; RUN: cd %t 4; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-dualcu-main.s \ 5; RUN: -split-dwarf-file=main.dwo -o main.o 6; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-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 --create-debug-names-section=true 10; RUN: llvm-dwarfdump --debug-info --debug-names main.exe.bolt > %t/foo.txt 11; RUN: cat %t/foo.txt | FileCheck -check-prefix=BOLT %s 12 13;; Tests BOLT generates .debug_names with --create-debug-names-section. 14;; Also applicable when binary has split dwarf CUs that do not contribute to .debug_names pre-bolt. 15 16; BOLT: [[OFFSET1:0x[0-9a-f]*]]: Compile Unit 17; BOLT: [[OFFSET2:0x[0-9a-f]*]]: Compile Unit 18; BOLT: Name Index @ 0x0 { 19; BOLT-NEXT: Header { 20; BOLT-NEXT: Length: 0x14E 21; BOLT-NEXT: Format: DWARF32 22; BOLT-NEXT: Version: 5 23; BOLT-NEXT: CU count: 2 24; BOLT-NEXT: Local TU count: 0 25; BOLT-NEXT: Foreign TU count: 0 26; BOLT-NEXT: Bucket count: 11 27; BOLT-NEXT: Name count: 11 28; BOLT-NEXT: Abbreviations table size: 0x1F 29; BOLT-NEXT: Augmentation: 'BOLT' 30; BOLT-NEXT: } 31; BOLT-NEXT: Compilation Unit offsets [ 32; BOLT-NEXT: CU[0]: [[OFFSET1]] 33; BOLT-NEXT: CU[1]: [[OFFSET2]] 34; BOLT-NEXT: ] 35; BOLT-NEXT: Abbreviations [ 36; BOLT-NEXT: Abbreviation [[ABBREV1:0x[0-9a-f]*]] { 37; BOLT-NEXT: Tag: DW_TAG_variable 38; BOLT-NEXT: DW_IDX_compile_unit: DW_FORM_data1 39; BOLT-NEXT: DW_IDX_die_offset: DW_FORM_ref4 40; BOLT-NEXT: DW_IDX_parent: DW_FORM_flag_present 41; BOLT-NEXT: } 42; BOLT-NEXT: Abbreviation [[ABBREV2:0x[0-9a-f]*]] { 43; BOLT-NEXT: Tag: DW_TAG_base_type 44; BOLT-NEXT: DW_IDX_compile_unit: DW_FORM_data1 45; BOLT-NEXT: DW_IDX_die_offset: DW_FORM_ref4 46; BOLT-NEXT: DW_IDX_parent: DW_FORM_flag_present 47; BOLT-NEXT: } 48; BOLT-NEXT: Abbreviation [[ABBREV3:0x[0-9a-f]*]] { 49; BOLT-NEXT: Tag: DW_TAG_subprogram 50; BOLT-NEXT: DW_IDX_compile_unit: DW_FORM_data1 51; BOLT-NEXT: DW_IDX_die_offset: DW_FORM_ref4 52; BOLT-NEXT: DW_IDX_parent: DW_FORM_flag_present 53; BOLT-NEXT: } 54; BOLT-NEXT: ] 55; BOLT-NEXT: Bucket 0 [ 56; BOLT-NEXT: Name 1 { 57; BOLT-NEXT: Hash: 0x2B61E 58; BOLT-NEXT: String: {{.+}} "y" 59; BOLT-NEXT: Entry @ {{.+}} { 60; BOLT-NEXT: Abbrev: [[ABBREV1]] 61; BOLT-NEXT: Tag: DW_TAG_variable 62; BOLT-NEXT: DW_IDX_compile_unit: 0x00 63; BOLT-NEXT: DW_IDX_die_offset: 0x00000029 64; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 65; BOLT-NEXT: } 66; BOLT-NEXT: } 67; BOLT-NEXT: Name 2 { 68; BOLT-NEXT: Hash: 0x7C952063 69; BOLT-NEXT: String: {{.+}} "char" 70; BOLT-NEXT: Entry @ {{.+}} { 71; BOLT-NEXT: Abbrev: [[ABBREV2]] 72; BOLT-NEXT: Tag: DW_TAG_base_type 73; BOLT-NEXT: DW_IDX_compile_unit: 0x00 74; BOLT-NEXT: DW_IDX_die_offset: 0x0000008c 75; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 76; BOLT-NEXT: } 77; BOLT-NEXT: } 78; BOLT-NEXT: ] 79; BOLT-NEXT: Bucket 1 [ 80; BOLT-NEXT: Name 3 { 81; BOLT-NEXT: Hash: 0x2B609 82; BOLT-NEXT: String: {{.+}} "d" 83; BOLT-NEXT: Entry @ {{.+}} { 84; BOLT-NEXT: Abbrev: [[ABBREV1]] 85; BOLT-NEXT: Tag: DW_TAG_variable 86; BOLT-NEXT: DW_IDX_compile_unit: 0x01 87; BOLT-NEXT: DW_IDX_die_offset: 0x00000029 88; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 89; BOLT-NEXT: } 90; BOLT-NEXT: } 91; BOLT-NEXT: Name 4 { 92; BOLT-NEXT: Hash: 0x2B61F 93; BOLT-NEXT: String: {{.+}} "z" 94; BOLT-NEXT: Entry @ {{.+}} { 95; BOLT-NEXT: Abbrev: [[ABBREV1]] 96; BOLT-NEXT: Tag: DW_TAG_variable 97; BOLT-NEXT: DW_IDX_compile_unit: 0x01 98; BOLT-NEXT: DW_IDX_die_offset: 0x0000001a 99; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 100; BOLT-NEXT: } 101; BOLT-NEXT: } 102; BOLT-NEXT: ] 103; BOLT-NEXT: Bucket 2 [ 104; BOLT-NEXT: Name 5 { 105; BOLT-NEXT: Hash: 0xB88B3D2 106; BOLT-NEXT: String: {{.+}} "use" 107; BOLT-NEXT: Entry @ {{.+}} { 108; BOLT-NEXT: Abbrev: [[ABBREV3]] 109; BOLT-NEXT: Tag: DW_TAG_subprogram 110; BOLT-NEXT: DW_IDX_compile_unit: 0x00 111; BOLT-NEXT: DW_IDX_die_offset: 0x00000034 112; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 113; BOLT-NEXT: } 114; BOLT-NEXT: } 115; BOLT-NEXT: ] 116; BOLT-NEXT: Bucket 3 [ 117; BOLT-NEXT: Name 6 { 118; BOLT-NEXT: Hash: 0x45A3B006 119; BOLT-NEXT: String: {{.+}} "_Z6helperii" 120; BOLT-NEXT: Entry @ {{.+}} { 121; BOLT-NEXT: Abbrev: [[ABBREV3]] 122; BOLT-NEXT: Tag: DW_TAG_subprogram 123; BOLT-NEXT: DW_IDX_compile_unit: 0x01 124; BOLT-NEXT: DW_IDX_die_offset: 0x00000034 125; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 126; BOLT-NEXT: } 127; BOLT-NEXT: } 128; BOLT-NEXT: ] 129; BOLT-NEXT: Bucket 4 [ 130; BOLT-NEXT: EMPTY 131; BOLT-NEXT: ] 132; BOLT-NEXT: Bucket 5 [ 133; BOLT-NEXT: Name 7 { 134; BOLT-NEXT: Hash: 0x8C06E589 135; BOLT-NEXT: String: {{.+}} "_Z3usePiS_" 136; BOLT-NEXT: Entry @ {{.+}} { 137; BOLT-NEXT: Abbrev: [[ABBREV3]] 138; BOLT-NEXT: Tag: DW_TAG_subprogram 139; BOLT-NEXT: DW_IDX_compile_unit: 0x00 140; BOLT-NEXT: DW_IDX_die_offset: 0x00000034 141; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 142; BOLT-NEXT: } 143; BOLT-NEXT: } 144; BOLT-NEXT: ] 145; BOLT-NEXT: Bucket 6 [ 146; BOLT-NEXT: Name 8 { 147; BOLT-NEXT: Hash: 0xB888030 148; BOLT-NEXT: String: {{.+}} "int" 149; BOLT-NEXT: Entry @ {{.+}} { 150; BOLT-NEXT: Abbrev: [[ABBREV2]] 151; BOLT-NEXT: Tag: DW_TAG_base_type 152; BOLT-NEXT: DW_IDX_compile_unit: 0x00 153; BOLT-NEXT: DW_IDX_die_offset: 0x00000025 154; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 155; BOLT-NEXT: } 156; BOLT-NEXT: Entry @ {{.+}} { 157; BOLT-NEXT: Abbrev: [[ABBREV2]] 158; BOLT-NEXT: Tag: DW_TAG_base_type 159; BOLT-NEXT: DW_IDX_compile_unit: 0x01 160; BOLT-NEXT: DW_IDX_die_offset: 0x00000025 161; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 162; BOLT-NEXT: } 163; BOLT-NEXT: } 164; BOLT-NEXT: ] 165; BOLT-NEXT: Bucket 7 [ 166; BOLT-NEXT: Name 9 { 167; BOLT-NEXT: Hash: 0x1D853E5 168; BOLT-NEXT: String: {{.+}} "helper" 169; BOLT-NEXT: Entry @ {{.+}} { 170; BOLT-NEXT: Abbrev: [[ABBREV3]] 171; BOLT-NEXT: Tag: DW_TAG_subprogram 172; BOLT-NEXT: DW_IDX_compile_unit: 0x01 173; BOLT-NEXT: DW_IDX_die_offset: 0x00000034 174; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 175; BOLT-NEXT: } 176; BOLT-NEXT: } 177; BOLT-NEXT: Name 10 { 178; BOLT-NEXT: Hash: 0x7C9A7F6A 179; BOLT-NEXT: String: {{.+}} "main" 180; BOLT-NEXT: Entry @ {{.+}} { 181; BOLT-NEXT: Abbrev: [[ABBREV3]] 182; BOLT-NEXT: Tag: DW_TAG_subprogram 183; BOLT-NEXT: DW_IDX_compile_unit: 0x00 184; BOLT-NEXT: DW_IDX_die_offset: 0x00000057 185; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 186; BOLT-NEXT: } 187; BOLT-NEXT: } 188; BOLT-NEXT: ] 189; BOLT-NEXT: Bucket 8 [ 190; BOLT-NEXT: EMPTY 191; BOLT-NEXT: ] 192; BOLT-NEXT: Bucket 9 [ 193; BOLT-NEXT: EMPTY 194; BOLT-NEXT: ] 195; BOLT-NEXT: Bucket 10 [ 196; BOLT-NEXT: Name 11 { 197; BOLT-NEXT: Hash: 0x2B61D 198; BOLT-NEXT: String: {{.+}} "x" 199; BOLT-NEXT: Entry @ {{.+}} { 200; BOLT-NEXT: Abbrev: [[ABBREV1]] 201; BOLT-NEXT: Tag: DW_TAG_variable 202; BOLT-NEXT: DW_IDX_compile_unit: 0x00 203; BOLT-NEXT: DW_IDX_die_offset: 0x0000001a 204; BOLT-NEXT: DW_IDX_parent: <parent not indexed> 205; BOLT-NEXT: } 206; BOLT-NEXT: } 207; BOLT-NEXT: ] 208