[llvm] r198202 - Fix aranges and split dwarf by ensuring that the symbol and relocation

Eric Christopher echristo at gmail.com
Thu Jan 2 13:10:10 PST 2014


Seems reasonable, thanks. Fixed in r198351.

-eric

On Thu Jan 02 2014 at 11:55:12 AM, Robinson, Paul <
Paul_Robinson at playstation.sony.com> wrote:



> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
> bounces at cs.uiuc.edu] On Behalf Of Eric Christopher
> Sent: Sunday, December 29, 2013 9:26 PM
> To: llvm-commits at cs.uiuc.edu
> Subject: [llvm] r198202 - Fix aranges and split dwarf by ensuring that
> the symbol and relocation
>
> Author: echristo
> Date: Sun Dec 29 23:25:49 2013
> New Revision: 198202
>
> URL: http://llvm.org/viewvc/llvm-project?rev=198202&view=rev
> Log:
> Fix aranges and split dwarf by ensuring that the symbol and relocation
> back to the compile unit from the aranges section is to the skeleton
> unit and not the one in the dwo.
>
> Do this by adding a method to grab a forwarded on local sym and local
> section by querying the skeleton if one exists and using that. Add
> a few tests to verify the relocations are back to the correct section.
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
>     llvm/trunk/test/DebugInfo/X86/arange.ll
>     llvm/trunk/test/DebugInfo/X86/fission-cu.ll
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=198202&r1=1
> 98201&r2=198202&view=diff
> ========================================================================
> ======
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sun Dec 29 23:25:49
> 2013
> @@ -825,11 +825,7 @@ DwarfCompileUnit *DwarfDebug::constructD
>    NewCU->initSection(
>        useSplitDwarf() ? Asm->getObjFileLowering().getD
warfInfoDWOSection()
>                        : Asm->getObjFileLowering().getDwarfInfoSection(),
> -      // FIXME: This is subtle (using the info section even when
> -      // this CU is in the dwo section) and necessary for the
> -      // current arange code - ideally it should iterate
> -      // skeleton units, not full units, if it's going to reference
skeletons
> -      DwarfInfoSectionSym);
> +      useSplitDwarf() ? DwarfInfoDWOSectionSym : DwarfInfoSectionSym);

Two parameters with ?: using the same condition? Might be easier to read
refactored into an actual 'if'.

>
>    // If we're splitting the dwarf then construct the skeleton CU now.
>    if (useSplitDwarf())
> @@ -2010,6 +2006,9 @@ void DwarfDebug::emitSectionLabels() {
>    // Dwarf sections base addresses.
>    DwarfInfoSectionSym =
>        emitSectionSym(Asm, TLOF.getDwarfInfoSection(), "section_info");
> +  if (useSplitDwarf())
> +    DwarfInfoDWOSectionSym =
> +        emitSectionSym(Asm, TLOF.getDwarfInfoDWOSection(),
> "section_info_dwo");
>    DwarfAbbrevSectionSym =
>        emitSectionSym(Asm, TLOF.getDwarfAbbrevSection(),
> "section_abbrev");
>    if (useSplitDwarf())
> @@ -2875,7 +2874,7 @@ void DwarfDebug::emitDebugARanges() {
>      Asm->OutStreamer.AddComment("DWARF Arange version number");
>      Asm->EmitInt16(dwarf::DW_ARANGES_VERSION);
>      Asm->OutStreamer.AddComment("Offset Into Debug Info Section");
> -    Asm->EmitSectionOffset(CU->getLabelBegin(), CU->getSectionSym());
> +    Asm->EmitSectionOffset(CU->getLocalLabelBegin(), CU-
> >getLocalSectionSym());
>      Asm->OutStreamer.AddComment("Address Size (in bytes)");
>      Asm->EmitInt8(PtrSize);
>      Asm->OutStreamer.AddComment("Segment Size (in bytes)");
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=198202&r1=198
> 201&r2=198202&view=diff
> ========================================================================
> ======
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Sun Dec 29 23:25:49
> 2013
> @@ -429,7 +429,8 @@ class DwarfDebug : public AsmPrinterHand
>    MCSymbol *DwarfStrSectionSym, *TextSectionSym,
> *DwarfDebugRangeSectionSym;
>    MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym,
> *DwarfAddrSectionSym;
>    MCSymbol *FunctionBeginSym, *FunctionEndSym;
> -  MCSymbol *DwarfAbbrevDWOSectionSym, *DwarfStrDWOSectionSym;
> +  MCSymbol *DwarfInfoDWOSectionSym, *DwarfAbbrevDWOSectionSym;
> +  MCSymbol *DwarfStrDWOSectionSym;
>    MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym;
>
>    // As an optimization, there is no need to emit an entry in the
> directory
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=198202&r1=1982
> 01&r2=198202&view=diff
> ========================================================================
> ======
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Sun Dec 29 23:25:49
> 2013
> @@ -180,11 +180,27 @@ public:
>      return Section;
>    }
>
> +  /// If there's a skeleton then return the section symbol for the
> skeleton
> +  /// unit, otherwise return the section symbol for this unit.
> +  MCSymbol *getLocalSectionSym() const {
> +    if (Skeleton)
> +      return Skeleton->getSectionSym();
> +    return SectionSym;

return getSectionSym(); instead?  Marginally safer.

> +  }
> +
>    MCSymbol *getSectionSym() const {
>      assert(Section);
>      return SectionSym;
>    }
>
> +  /// If there's a skeleton then return the begin label for the
> skeleton unit,
> +  /// otherwise return the local label for this unit.
> +  MCSymbol *getLocalLabelBegin() const {
> +    if (Skeleton)
> +      return Skeleton->getLabelBegin();
> +    return LabelBegin;

return getLabelBegin() here, ditto.

> +  }
> +
>    MCSymbol *getLabelBegin() const {
>      assert(Section);
>      return LabelBegin;
>
> Modified: llvm/trunk/test/DebugInfo/X86/arange.ll
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/test/DebugInfo/X86/arange.ll?rev=198202&r1=198201&r2=
> 198202&view=diff
> ========================================================================
> ======
> --- llvm/trunk/test/DebugInfo/X86/arange.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/arange.ll Sun Dec 29 23:25:49 2013
> @@ -1,6 +1,7 @@
>  ; REQUIRES: object-emission
>
>  ; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s | llvm-
> dwarfdump -debug-dump=aranges - | FileCheck %s
> +; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s | llvm-readobj
> --relocations - | FileCheck --check-prefix=OBJ %s
>
>  ; extern int i;
>  ; template<int *x>
> @@ -15,6 +16,10 @@
>  ; CHECK-NEXT: [0x
>  ; CHECK-NOT: [0x
>
> +; Check that we have a relocation back to the debug_info section from
> the debug_aranges section
> +; OBJ: debug_aranges
> +; OBJ-NEXT: R_X86_64_32 .debug_info 0x0
> +
>  %struct.foo = type { i8 }
>
>  @f = global %struct.foo zeroinitializer, align 1
>
> Modified: llvm/trunk/test/DebugInfo/X86/fission-cu.ll
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/test/DebugInfo/X86/fission-
> cu.ll?rev=198202&r1=198201&r2=198202&view=diff
> ========================================================================
> ======
> --- llvm/trunk/test/DebugInfo/X86/fission-cu.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/fission-cu.ll Sun Dec 29 23:25:49 2013
> @@ -112,4 +112,7 @@
>  ; OBJ-NEXT: R_X86_64_32 .debug_str
>  ; OBJ-NEXT: R_X86_64_64 .text 0x0
>  ; OBJ-NEXT: }
> +; OBJ: .debug_aranges
> +; OBJ-NEXT: R_X86_64_32 .debug_info 0x0
> +
>  !9 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140102/9629a05c/attachment.html>


More information about the llvm-commits mailing list