<p dir="ltr">Thanks, I'll take a look. </p>
<div class="gmail_quote">On Dec 30, 2013 1:35 AM, "NAKAMURA Takumi" <<a href="mailto:geek4civic@gmail.com">geek4civic@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Eric, excuse me, I reverted it (and r198202) in r198208.<br>
<br>
Targeting i686-pc-cygwin would show you failures.<br>
<a href="http://bb.pgr.jp/builders/clang-i686-cygwin-RA-centos6/builds/1644" target="_blank">http://bb.pgr.jp/builders/clang-i686-cygwin-RA-centos6/builds/1644</a><br>
<br>
2013/12/30 Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>>:<br>
> Author: echristo<br>
> Date: Sun Dec 29 21:40:32 2013<br>
> New Revision: 198199<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=198199&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=198199&view=rev</a><br>
> Log:<br>
> Reapply r198196 with a fix to zero initialize the skeleton pointer.<br>
><br>
> Modified:<br>
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
>     llvm/trunk/test/DebugInfo/X86/fission-cu.ll<br>
>     llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=198199&r1=198198&r2=198199&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=198199&r1=198198&r2=198199&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sun Dec 29 21:40:32 2013<br>
> @@ -773,12 +773,6 @@ DwarfCompileUnit *DwarfDebug::constructD<br>
>                   DIUnit.getLanguage());<br>
>    NewCU->addString(Die, dwarf::DW_AT_name, FN);<br>
><br>
> -  // 2.17.1 requires that we use DW_AT_low_pc for a single entry point<br>
> -  // into an entity. We're using 0 (or a NULL label) for this. For<br>
> -  // split dwarf it's in the skeleton CU so omit it here.<br>
> -  if (!useSplitDwarf())<br>
> -    NewCU->addLabelAddress(Die, dwarf::DW_AT_low_pc, NULL);<br>
> -<br>
>    // Define start line table label for each Compile Unit.<br>
>    MCSymbol *LineTableStartSym =<br>
>        Asm->GetTempSymbol("line_table_start", NewCU->getUniqueID());<br>
> @@ -837,6 +831,10 @@ DwarfCompileUnit *DwarfDebug::constructD<br>
>        // skeleton units, not full units, if it's going to reference skeletons<br>
>        DwarfInfoSectionSym);<br>
><br>
> +  // If we're splitting the dwarf then construct the skeleton CU now.<br>
> +  if (useSplitDwarf())<br>
> +    NewCU->setSkeleton(constructSkeletonCU(NewCU));<br>
> +<br>
>    CUMap.insert(std::make_pair(DIUnit, NewCU));<br>
>    CUDieMap.insert(std::make_pair(Die, NewCU));<br>
>    return NewCU;<br>
> @@ -1082,7 +1080,9 @@ void DwarfDebug::finalizeModuleInfo() {<br>
>      // Add CU specific attributes if we need to add any.<br>
>      if (TheU->getUnitDie()->getTag() == dwarf::DW_TAG_compile_unit) {<br>
>        // If we're splitting the dwarf out now that we've got the entire<br>
> -      // CU then construct a skeleton CU based upon it.<br>
> +      // CU then add the dwo id to it.<br>
> +      DwarfCompileUnit *SkCU =<br>
> +          static_cast<DwarfCompileUnit *>(TheU->getSkeleton());<br>
>        if (useSplitDwarf()) {<br>
>          // This should be a unique identifier when we want to build .dwp files.<br>
>          uint64_t ID = 0;<br>
> @@ -1092,19 +1092,22 @@ void DwarfDebug::finalizeModuleInfo() {<br>
>          }<br>
>          TheU->addUInt(TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,<br>
>                        dwarf::DW_FORM_data8, ID);<br>
> -        // Now construct the skeleton CU associated.<br>
> -        DwarfCompileUnit *SkCU =<br>
> -            constructSkeletonCU(static_cast<DwarfCompileUnit *>(TheU));<br>
>          SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,<br>
>                        dwarf::DW_FORM_data8, ID);<br>
> -      } else {<br>
> -        // Attribute if we've emitted a range list for the compile unit, this<br>
> -        // will get constructed for the skeleton CU separately if we have one.<br>
> -        if (DwarfCURanges && TheU->getRanges().size())<br>
> -          addSectionLabel(Asm, TheU, TheU->getUnitDie(), dwarf::DW_AT_ranges,<br>
> -                          Asm->GetTempSymbol("cu_ranges", TheU->getUniqueID()),<br>
> -                          DwarfDebugRangeSectionSym);<br>
>        }<br>
> +<br>
> +      // If we've requested ranges and have them emit a DW_AT_ranges attribute<br>
> +      // on the unit that will remain in the .o file, otherwise add a DW_AT_low_pc.<br>
> +      // FIXME: Also add a high pc if we can.<br>
> +      // FIXME: We should use ranges if we have multiple compile units.<br>
> +      DwarfCompileUnit *U = SkCU ? SkCU : static_cast<DwarfCompileUnit *>(TheU);<br>
> +      if (DwarfCURanges && TheU->getRanges().size())<br>
> +        addSectionLabel(Asm, U, U->getUnitDie(), dwarf::DW_AT_ranges,<br>
> +                        Asm->GetTempSymbol("cu_ranges", U->getUniqueID()),<br>
> +                        DwarfDebugRangeSectionSym);<br>
> +      else<br>
> +        U->addLocalLabelAddress(U->getUnitDie(), dwarf::DW_AT_low_pc,<br>
> +                                TextSectionSym);<br>
>      }<br>
>    }<br>
><br>
> @@ -2997,15 +3000,6 @@ DwarfCompileUnit *DwarfDebug::constructS<br>
>    else<br>
>      NewCU->addSectionOffset(Die, dwarf::DW_AT_GNU_addr_base, 0);<br>
><br>
> -  // Attribute if we've emitted a range list for the compile unit, this<br>
> -  // will get constructed for the skeleton CU separately if we have one.<br>
> -  if (DwarfCURanges && CU->getRanges().size())<br>
> -    addSectionLabel(Asm, NewCU, Die, dwarf::DW_AT_ranges,<br>
> -                    Asm->GetTempSymbol("cu_ranges", CU->getUniqueID()),<br>
> -                    DwarfDebugRangeSectionSym);<br>
> -  else<br>
> -    NewCU->addUInt(Die, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, 0);<br>
> -<br>
>    // DW_AT_stmt_list is a offset of line number information for this<br>
>    // compile unit in debug_line section.<br>
>    // FIXME: Should handle multiple compile units.<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=198199&r1=198198&r2=198199&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=198199&r1=198198&r2=198199&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Sun Dec 29 21:40:32 2013<br>
> @@ -43,7 +43,7 @@ GenerateDwarfTypeUnits("generate-type-un<br>
>  DwarfUnit::DwarfUnit(unsigned UID, DIE *D, DICompileUnit Node, AsmPrinter *A,<br>
>                       DwarfDebug *DW, DwarfFile *DWU)<br>
>      : UniqueID(UID), Node(Node), UnitDie(D), DebugInfoOffset(0), Asm(A), DD(DW),<br>
> -      DU(DWU), IndexTyDie(0), Section(0) {<br>
> +      DU(DWU), IndexTyDie(0), Section(0), Skeleton(0) {<br>
>    DIEIntegerOne = new (DIEValueAllocator) DIEInteger(1);<br>
>  }<br>
><br>
> @@ -293,6 +293,23 @@ void DwarfCompileUnit::addLabelAddress(D<br>
>    }<br>
>  }<br>
><br>
> +/// addLocalLabelAddress - Add a dwarf label attribute data and value using<br>
> +/// DW_FORM_addr.<br>
> +void DwarfCompileUnit::addLocalLabelAddress(DIE *Die,<br>
> +                                            dwarf::Attribute Attribute,<br>
> +                                            MCSymbol *Label) {<br>
> +  if (Label)<br>
> +    DD->addArangeLabel(SymbolCU(this, Label));<br>
> +<br>
> +  if (Label != NULL) {<br>
> +    DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);<br>
> +    Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);<br>
> +  } else {<br>
> +    DIEValue *Value = new (DIEValueAllocator) DIEInteger(0);<br>
> +    Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);<br>
> +  }<br>
> +}<br>
> +<br>
>  /// addOpAddress - Add a dwarf op address data and value using the<br>
>  /// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.<br>
>  ///<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=198199&r1=198198&r2=198199&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=198199&r1=198198&r2=198199&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Sun Dec 29 21:40:32 2013<br>
> @@ -146,12 +146,21 @@ protected:<br>
>    /// The label for the start of the range sets for the elements of this unit.<br>
>    MCSymbol *LabelRange;<br>
><br>
> +  /// Skeleton unit associated with this unit.<br>
> +  DwarfUnit *Skeleton;<br>
> +<br>
>    DwarfUnit(unsigned UID, DIE *D, DICompileUnit CU, AsmPrinter *A,<br>
>              DwarfDebug *DW, DwarfFile *DWU);<br>
><br>
>  public:<br>
>    virtual ~DwarfUnit();<br>
><br>
> +  /// Set the skeleton unit associated with this unit.<br>
> +  void setSkeleton(DwarfUnit *Skel) { Skeleton = Skel; }<br>
> +<br>
> +  /// Get the skeleton unit associated with this unit.<br>
> +  DwarfUnit *getSkeleton() const { return Skeleton; }<br>
> +<br>
>    /// Pass in the SectionSym even though we could recreate it in every compile<br>
>    /// unit (type units will have actually distinct symbols once they're in<br>
>    /// comdat sections).<br>
> @@ -521,6 +530,11 @@ public:<br>
>    /// either DW_FORM_addr or DW_FORM_GNU_addr_index.<br>
>    void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label);<br>
><br>
> +  /// addLocalLabelAddress - Add a dwarf label attribute data and value using<br>
> +  /// DW_FORM_addr.<br>
> +  void addLocalLabelAddress(DIE *Die, dwarf::Attribute Attribute,<br>
> +                            MCSymbol *Label);<br>
> +<br>
>    uint16_t getLanguage() const LLVM_OVERRIDE { return getNode().getLanguage(); }<br>
>  };<br>
><br>
><br>
> Modified: llvm/trunk/test/DebugInfo/X86/fission-cu.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-cu.ll?rev=198199&r1=198198&r2=198199&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-cu.ll?rev=198199&r1=198198&r2=198199&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/test/DebugInfo/X86/fission-cu.ll (original)<br>
> +++ llvm/trunk/test/DebugInfo/X86/fission-cu.ll Sun Dec 29 21:40:32 2013<br>
> @@ -25,19 +25,19 @@<br>
>  ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_no<br>
>  ; CHECK: DW_AT_GNU_dwo_name      DW_FORM_strp<br>
>  ; CHECK: DW_AT_GNU_addr_base     DW_FORM_sec_offset<br>
> -; CHECK: DW_AT_low_pc    DW_FORM_addr<br>
>  ; CHECK: DW_AT_stmt_list DW_FORM_sec_offset<br>
>  ; CHECK: DW_AT_comp_dir  DW_FORM_strp<br>
>  ; CHECK: DW_AT_GNU_dwo_id        DW_FORM_data8<br>
> +; CHECK: DW_AT_low_pc    DW_FORM_addr<br>
><br>
>  ; CHECK: .debug_info contents:<br>
>  ; CHECK: DW_TAG_compile_unit<br>
>  ; CHECK: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo")<br>
>  ; CHECK: DW_AT_GNU_addr_base [DW_FORM_sec_offset]                   (0x00000000)<br>
> -; CHECK: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
>  ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x00000000)<br>
>  ; CHECK: DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x00000008] = "/usr/local/google/home/echristo/tmp")<br>
>  ; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8]  (0x0000000000000000)<br>
> +; CHECK: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
><br>
>  ; CHECK: .debug_str contents:<br>
>  ; CHECK: 0x00000000: "baz.dwo"<br>
> @@ -110,5 +110,6 @@<br>
>  ; OBJ-NEXT: R_X86_64_32 .debug_addr<br>
>  ; OBJ-NEXT: R_X86_64_32 .debug_line<br>
>  ; OBJ-NEXT: R_X86_64_32 .debug_str<br>
> +; OBJ-NEXT: R_X86_64_64 .text 0x0<br>
>  ; OBJ-NEXT: }<br>
>  !9 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}<br>
><br>
> Modified: llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll?rev=198199&r1=198198&r2=198199&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll?rev=198199&r1=198198&r2=198199&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll (original)<br>
> +++ llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll Sun Dec 29 21:40:32 2013<br>
> @@ -7,12 +7,12 @@<br>
>  ; rdar://13067005<br>
>  ; CHECK: .debug_info contents:<br>
>  ; CHECK: DW_TAG_compile_unit<br>
> -; CHECK: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
>  ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x00000000)<br>
> +; CHECK: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
><br>
>  ; CHECK: DW_TAG_compile_unit<br>
> -; CHECK: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
>  ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x0000003c)<br>
> +; CHECK: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
><br>
>  ; CHECK: .debug_line contents:<br>
>  ; CHECK-NEXT: Line table prologue:<br>
> @@ -25,12 +25,12 @@<br>
><br>
>  ; DWARF3: .debug_info contents:<br>
>  ; DWARF3: DW_TAG_compile_unit<br>
> -; DWARF3: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
>  ; DWARF3: DW_AT_stmt_list [DW_FORM_data4]   (0x00000000)<br>
> +; DWARF3: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
><br>
>  ; DWARF3: DW_TAG_compile_unit<br>
> -; DWARF3: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
>  ; DWARF3: DW_AT_stmt_list [DW_FORM_data4]   (0x0000003c)<br>
> +; DWARF3: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
><br>
>  ; DWARF3: .debug_line contents:<br>
>  ; DWARF3-NEXT: Line table prologue:<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>