DebugInfo: Omit DW_AT_addr_base from skeletal type units.
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 21 Mar 2014 20:27:21 +0000 (20:27 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 21 Mar 2014 20:27:21 +0000 (20:27 +0000)
Type units have no addresses, so there's no need for DW_AT_addr_base.
This removes another relocation from every skeletal type unit and brings
LLVM's skeletal type units in line with GCC's (containing only
GNU_dwo_name (strp), comp_dir (strp), and GNU_pubnames (flag_present)).

Cary's got some ideas about using str_index in the .o file to reduce
those last two relocations (well, replace two relocations with one
relocation (pointing to the string index) and two indicies)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204506 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
test/DebugInfo/X86/fission-cu.ll
test/DebugInfo/X86/generate-odr-hash.ll

index 22512e83d7f21f41ffb528dcfc1663275d067785..027f0b89a51e25f59ea156dfcdd2c1d62f28a2f7 100644 (file)
@@ -2637,13 +2637,6 @@ void DwarfDebug::initSkeletonUnit(const DwarfUnit *U, DIE *Die,
   NewU->addLocalString(Die, dwarf::DW_AT_GNU_dwo_name,
                        U->getCUNode().getSplitDebugFilename());
 
-  // Relocate to the beginning of the addr_base section, else 0 for the
-  // beginning of the one for this compile unit.
-  if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
-    NewU->addSectionLabel(Die, dwarf::DW_AT_GNU_addr_base, DwarfAddrSectionSym);
-  else
-    NewU->addSectionOffset(Die, dwarf::DW_AT_GNU_addr_base, 0);
-
   if (!CompilationDir.empty())
     NewU->addLocalString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
 
@@ -2668,6 +2661,13 @@ DwarfCompileUnit *DwarfDebug::constructSkeletonCU(const DwarfCompileUnit *CU) {
 
   initSkeletonUnit(CU, Die, NewCU);
 
+  // Relocate to the beginning of the addr_base section, else 0 for the
+  // beginning of the one for this compile unit.
+  if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
+    NewCU->addSectionLabel(Die, dwarf::DW_AT_GNU_addr_base, DwarfAddrSectionSym);
+  else
+    NewCU->addSectionOffset(Die, dwarf::DW_AT_GNU_addr_base, 0);
+
   return NewCU;
 }
 
index f6ea6445f83e154cd48fadc63aa6645c02b9f64d..1591deee5ee18ac43d0f0cd1094ad4c6d55381dd 100644 (file)
@@ -26,7 +26,6 @@
 ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_no
 ; CHECK: DW_AT_stmt_list DW_FORM_sec_offset
 ; CHECK: DW_AT_GNU_dwo_name      DW_FORM_strp
-; CHECK: DW_AT_GNU_addr_base     DW_FORM_sec_offset
 ; CHECK: DW_AT_comp_dir  DW_FORM_strp
 ; CHECK: DW_AT_GNU_dwo_id        DW_FORM_data8
 
@@ -59,8 +58,8 @@
 ; CHECK: DW_TAG_compile_unit
 ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x00000000)
 ; CHECK: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo")
-; CHECK: DW_AT_GNU_addr_base [DW_FORM_sec_offset]                   (0x00000000)
 ; CHECK: DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x00000008] = "/usr/local/google/home/echristo/tmp")
+; CHECK: DW_AT_GNU_addr_base [DW_FORM_sec_offset]                   (0x00000000)
 ; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8]  (0x1f1f859683d49324)
 
 ; Check that the rest of the compile units have information.
 ; OBJ-NEXT: R_X86_64_32 .debug_abbrev
 ; OBJ-NEXT: R_X86_64_32 .debug_line
 ; OBJ-NEXT: R_X86_64_32 .debug_str
-; OBJ-NEXT: R_X86_64_32 .debug_addr
 ; OBJ-NEXT: R_X86_64_32 .debug_str
+; OBJ-NEXT: R_X86_64_32 .debug_addr
 ; OBJ-NEXT: }
 
 ; HDR-NOT: .debug_aranges
index add1e74fde8d67be5a4d7127ffe4b71395f49010..e713f14c4f5bee5c3feb769d03fcda3510300ea9 100644 (file)
@@ -77,7 +77,6 @@
 ; FISSION-LABEL: type_signature = 0x1d02f3be30cc5688
 ; FISSION: DW_TAG_type_unit
 ; FISSION-NEXT: DW_AT_GNU_dwo_name{{.*}}"bar.dwo"
-; FISSION-NEXT: DW_AT_GNU_addr_base
 ; FISSION-NEXT: DW_AT_comp_dir{{.*}}"/tmp/dbginfo"
 ; FISSION-NOT: type_signature
 ; FISSION-LABEL: type_signature = 0xb04af47397402e77