Seems reasonable, thanks. Fixed in r198351.<div><br></div><div>-eric<br><br><div>On Thu Jan 02 2014 at 11:55:12 AM, Robinson, Paul <<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank">Paul_Robinson@playstation.sony.com</a>> wrote:</div>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
> -----Original Message-----<br>
> From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.<u></u>e<u></u>du</a> [mailto:<a href="mailto:llvm-commits-" target="_blank">llvm-commits-</a><br>
> <a href="mailto:bounces@cs.uiuc.edu" target="_blank">bounces@cs.uiuc.edu</a>] On Behalf Of Eric Christopher<br>
> Sent: Sunday, December 29, 2013 9:26 PM<br>
> To: <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
> Subject: [llvm] r198202 - Fix aranges and split dwarf by ensuring that<br>
> the symbol and relocation<br>
><br>
> Author: echristo<br>
> Date: Sun Dec 29 23:25:49 2013<br>
> New Revision: 198202<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=198202&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>pr<u></u>oject?rev=198202&view=rev</a><br>
> Log:<br>
> Fix aranges and split dwarf by ensuring that the symbol and relocation<br>
> back to the compile unit from the aranges section is to the skeleton<br>
> unit and not the one in the dwo.<br>
><br>
> Do this by adding a method to grab a forwarded on local sym and local<br>
> section by querying the skeleton if one exists and using that. Add<br>
> a few tests to verify the relocations are back to the correct section.<br>
><br>
> Modified:<br>
>     llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfDebug.cpp<br>
>     llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfDebug.h<br>
>     llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfUnit.h<br>
>     llvm/trunk/test/DebugInfo/X86/<u></u><u></u>arange.ll<br>
>     llvm/trunk/test/DebugInfo/X86/<u></u><u></u>fission-cu.ll<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfDebug.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/lib/<u></u>CodeGen<u></u>/AsmPrinter/DwarfDebug.<u></u>cpp?<u></u>rev=198202&r1=1<br>
> 98201&r2=198202&view=diff<br>
> ==============================<u></u><u></u>==============================<u></u><u></u>============<br>
> ======<br>
> --- llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfDebug.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfDebug.cpp Sun Dec 29 23:25:49<br>
> 2013<br>
> @@ -825,11 +825,7 @@ DwarfCompileUnit *DwarfDebug::constructD<br>
>    NewCU->initSection(<br>
>        useSplitDwarf() ? Asm->getObjFileLowering().<u></u>getD<u></u>warfInfoDWOSection()<br>
>                        : Asm->getObjFileLowering().<u></u>getD<u></u>warfInfoSection(),<br>
> -      // FIXME: This is subtle (using the info section even when<br>
> -      // this CU is in the dwo section) and necessary for the<br>
> -      // current arange code - ideally it should iterate<br>
> -      // skeleton units, not full units, if it's going to reference skeletons<br>
> -      DwarfInfoSectionSym);<br>
> +      useSplitDwarf() ? DwarfInfoDWOSectionSym : DwarfInfoSectionSym);<br>
<br>
Two parameters with ?: using the same condition? Might be easier to read<br>
refactored into an actual 'if'.<br>
<br>
><br>
>    // If we're splitting the dwarf then construct the skeleton CU now.<br>
>    if (useSplitDwarf())<br>
> @@ -2010,6 +2006,9 @@ void DwarfDebug::emitSectionLabels(<u></u><u></u>) {<br>
>    // Dwarf sections base addresses.<br>
>    DwarfInfoSectionSym =<br>
>        emitSectionSym(Asm, TLOF.getDwarfInfoSection(), "section_info");<br>
> +  if (useSplitDwarf())<br>
> +    DwarfInfoDWOSectionSym =<br>
> +        emitSectionSym(Asm, TLOF.getDwarfInfoDWOSection(),<br>
> "section_info_dwo");<br>
>    DwarfAbbrevSectionSym =<br>
>        emitSectionSym(Asm, TLOF.getDwarfAbbrevSection(),<br>
> "section_abbrev");<br>
>    if (useSplitDwarf())<br>
> @@ -2875,7 +2874,7 @@ void DwarfDebug::emitDebugARanges() {<br>
>      Asm->OutStreamer.AddComment("<u></u><u></u>DWARF Arange version number");<br>
>      Asm->EmitInt16(dwarf::DW_<u></u>ARAN<u></u>GES_VERSION);<br>
>      Asm->OutStreamer.AddComment("<u></u><u></u>Offset Into Debug Info Section");<br>
> -    Asm->EmitSectionOffset(CU-><u></u>ge<u></u>tLabelBegin(), CU->getSectionSym());<br>
> +    Asm->EmitSectionOffset(CU-><u></u>ge<u></u>tLocalLabelBegin(), CU-<br>
> >getLocalSectionSym());<br>
>      Asm->OutStreamer.AddComment("<u></u><u></u>Address Size (in bytes)");<br>
>      Asm->EmitInt8(PtrSize);<br>
>      Asm->OutStreamer.AddComment("<u></u><u></u>Segment Size (in bytes)");<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfDebug.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/lib/<u></u>CodeGen<u></u>/AsmPrinter/DwarfDebug.<u></u>h?rev=<u></u>198202&r1=198<br>
> 201&r2=198202&view=diff<br>
> ==============================<u></u><u></u>==============================<u></u><u></u>============<br>
> ======<br>
> --- llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfDebug.h (original)<br>
> +++ llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfDebug.h Sun Dec 29 23:25:49<br>
> 2013<br>
> @@ -429,7 +429,8 @@ class DwarfDebug : public AsmPrinterHand<br>
>    MCSymbol *DwarfStrSectionSym, *TextSectionSym,<br>
> *DwarfDebugRangeSectionSym;<br>
>    MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym,<br>
> *DwarfAddrSectionSym;<br>
>    MCSymbol *FunctionBeginSym, *FunctionEndSym;<br>
> -  MCSymbol *DwarfAbbrevDWOSectionSym, *DwarfStrDWOSectionSym;<br>
> +  MCSymbol *DwarfInfoDWOSectionSym, *DwarfAbbrevDWOSectionSym;<br>
> +  MCSymbol *DwarfStrDWOSectionSym;<br>
>    MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym;<br>
><br>
>    // As an optimization, there is no need to emit an entry in the<br>
> directory<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfUnit.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/lib/<u></u>CodeGen<u></u>/AsmPrinter/DwarfUnit.<u></u>h?rev=<u></u>198202&r1=1982<br>
> 01&r2=198202&view=diff<br>
> ==============================<u></u><u></u>==============================<u></u><u></u>============<br>
> ======<br>
> --- llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfUnit.h (original)<br>
> +++ llvm/trunk/lib/CodeGen/<u></u>AsmPrin<u></u>ter/DwarfUnit.h Sun Dec 29 23:25:49<br>
> 2013<br>
> @@ -180,11 +180,27 @@ public:<br>
>      return Section;<br>
>    }<br>
><br>
> +  /// If there's a skeleton then return the section symbol for the<br>
> skeleton<br>
> +  /// unit, otherwise return the section symbol for this unit.<br>
> +  MCSymbol *getLocalSectionSym() const {<br>
> +    if (Skeleton)<br>
> +      return Skeleton->getSectionSym();<br>
> +    return SectionSym;<br>
<br>
return getSectionSym(); instead?  Marginally safer.<br>
<br>
> +  }<br>
> +<br>
>    MCSymbol *getSectionSym() const {<br>
>      assert(Section);<br>
>      return SectionSym;<br>
>    }<br>
><br>
> +  /// If there's a skeleton then return the begin label for the<br>
> skeleton unit,<br>
> +  /// otherwise return the local label for this unit.<br>
> +  MCSymbol *getLocalLabelBegin() const {<br>
> +    if (Skeleton)<br>
> +      return Skeleton->getLabelBegin();<br>
> +    return LabelBegin;<br>
<br>
return getLabelBegin() here, ditto.<br>
<br>
> +  }<br>
> +<br>
>    MCSymbol *getLabelBegin() const {<br>
>      assert(Section);<br>
>      return LabelBegin;<br>
><br>
> Modified: llvm/trunk/test/DebugInfo/X86/<u></u><u></u>arange.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/test/<u></u>DebugI<u></u>nfo/X86/arange.ll?rev=<u></u>198202&<u></u>r1=198201&r2=<br>
> 198202&view=diff<br>
> ==============================<u></u><u></u>==============================<u></u><u></u>============<br>
> ======<br>
> --- llvm/trunk/test/DebugInfo/X86/<u></u><u></u>arange.ll (original)<br>
> +++ llvm/trunk/test/DebugInfo/X86/<u></u><u></u>arange.ll Sun Dec 29 23:25:49 2013<br>
> @@ -1,6 +1,7 @@<br>
>  ; REQUIRES: object-emission<br>
><br>
>  ; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s | llvm-<br>
> dwarfdump -debug-dump=aranges - | FileCheck %s<br>
> +; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s | llvm-readobj<br>
> --relocations - | FileCheck --check-prefix=OBJ %s<br>
><br>
>  ; extern int i;<br>
>  ; template<int *x><br>
> @@ -15,6 +16,10 @@<br>
>  ; CHECK-NEXT: [0x<br>
>  ; CHECK-NOT: [0x<br>
><br>
> +; Check that we have a relocation back to the debug_info section from<br>
> the debug_aranges section<br>
> +; OBJ: debug_aranges<br>
> +; OBJ-NEXT: R_X86_64_32 .debug_info 0x0<br>
> +<br>
>  %struct.foo = type { i8 }<br>
><br>
>  @f = global %struct.foo zeroinitializer, align 1<br>
><br>
> Modified: llvm/trunk/test/DebugInfo/X86/<u></u><u></u>fission-cu.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/test/<u></u>DebugI<u></u>nfo/X86/fission-<br>
> cu.ll?rev=198202&r1=198201&r2=<u></u><u></u>198202&view=diff<br>
> ==============================<u></u><u></u>==============================<u></u><u></u>============<br>
> ======<br>
> --- llvm/trunk/test/DebugInfo/X86/<u></u><u></u>fission-cu.ll (original)<br>
> +++ llvm/trunk/test/DebugInfo/X86/<u></u><u></u>fission-cu.ll Sun Dec 29 23:25:49 2013<br>
> @@ -112,4 +112,7 @@<br>
>  ; OBJ-NEXT: R_X86_64_32 .debug_str<br>
>  ; OBJ-NEXT: R_X86_64_64 .text 0x0<br>
>  ; OBJ-NEXT: }<br>
> +; OBJ: .debug_aranges<br>
> +; OBJ-NEXT: R_X86_64_32 .debug_info 0x0<br>
> +<br>
>  !9 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}<br>
><br>
><br>
> ______________________________<u></u><u></u>_________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">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/<u></u>mailm<u></u>an/listinfo/llvm-commits</a><br>
<br>
<br>
</blockquote></div>