[llvm] r199990 - Use DW_AT_high_pc and DW_AT_low_pc for the high and low pc for a
David Blaikie
dblaikie at gmail.com
Fri Jan 24 09:54:21 PST 2014
On Fri, Jan 24, 2014 at 3:40 AM, Eric Christopher <echristo at gmail.com>wrote:
> Author: echristo
> Date: Fri Jan 24 05:40:29 2014
> New Revision: 199990
>
> URL: http://llvm.org/viewvc/llvm-project?rev=199990&view=rev
> Log:
> Use DW_AT_high_pc and DW_AT_low_pc for the high and low pc for a
> compile unit. Make these relocations on the platforms that need
> relocations and add a routine to ensure that we don't put the
> addresses in an offset table for split dwarf.
>
> Modified:
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
> llvm/trunk/test/DebugInfo/X86/concrete_out_of_line.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=199990&r1=199989&r2=199990&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jan 24 05:40:29
> 2014
> @@ -187,6 +187,7 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
> DwarfAddrSectionSym = 0;
> DwarfAbbrevDWOSectionSym = DwarfStrDWOSectionSym = 0;
> FunctionBeginSym = FunctionEndSym = 0;
> + TextSectionBeginSym = TextSectionEndSym = 0;
>
Rather than keeping track of two new symbols - can we just form this from
the ranges data we already have? (the begin label of the first range and
the end label of the last)
> CurFn = 0;
> CurMI = 0;
>
> @@ -1061,9 +1062,12 @@ void DwarfDebug::finalizeModuleInfo() {
> addSectionLabel(Asm, U, U->getUnitDie(), dwarf::DW_AT_ranges,
> Asm->GetTempSymbol("cu_ranges", U->getUniqueID()),
> DwarfDebugRangeSectionSym);
> - else
> - U->addUInt(U->getUnitDie(), dwarf::DW_AT_low_pc,
> dwarf::DW_FORM_addr,
> - 0);
> + else {
> + U->addLocalLabelAddress(U->getUnitDie(), dwarf::DW_AT_low_pc,
> + TextSectionBeginSym);
> + U->addLocalLabelAddress(U->getUnitDie(), dwarf::DW_AT_high_pc,
> + TextSectionEndSym);
>
Be sort of nice if this came out in the wash & we didn't have to know at
the call-site that we were adding something to the non-dwo unit. But yeah,
short of having more derived classes in the DwarfUnit hierarchy (and it's
sort of orthogonal to that - since it applies to type and compile units
equally... ) I'm not sure how to make that happen.
Well, something to mull over/keep in mind.
> + }
> }
> }
>
> @@ -1117,6 +1121,10 @@ void DwarfDebug::endSections() {
> Sym = Asm->GetTempSymbol("debug_end", ID);
> Asm->OutStreamer.SwitchSection(Section);
> Asm->OutStreamer.EmitLabel(Sym);
> + // If this is the end of the text section keep track of where the
> end of
> + // the section is so that we can use it later.
> + if (Section == Asm->getObjFileLowering().getTextSection())
> + TextSectionEndSym = Sym;
> }
>
> // Insert a final terminator.
> @@ -2012,6 +2020,8 @@ void DwarfDebug::emitSectionLabels() {
>
> DwarfDebugLocSectionSym =
> emitSectionSym(Asm, TLOF.getDwarfLocSection(), "section_debug_loc");
> +
> + TextSectionBeginSym = emitSectionSym(Asm, TLOF.getTextSection(),
> "text_begin");
> }
>
> // Recursively emits a debug information entry.
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=199990&r1=199989&r2=199990&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Jan 24 05:40:29 2014
> @@ -432,6 +432,7 @@ class DwarfDebug : public AsmPrinterHand
> MCSymbol *DwarfInfoDWOSectionSym, *DwarfAbbrevDWOSectionSym;
> MCSymbol *DwarfStrDWOSectionSym;
> MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym;
> + MCSymbol *TextSectionBeginSym, *TextSectionEndSym;
>
> // As an optimization, there is no need to emit an entry in the
> directory
> // table for the same directory as DW_AT_comp_dir.
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=199990&r1=199989&r2=199990&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Fri Jan 24 05:40:29
> 2014
> @@ -266,21 +266,32 @@ void DwarfUnit::addSectionOffset(DIE *Di
> ///
> void DwarfCompileUnit::addLabelAddress(DIE *Die, dwarf::Attribute
> Attribute,
> MCSymbol *Label) {
> + if (!DD->useSplitDwarf())
> + return addLocalLabelAddress(Die, Attribute, Label);
> +
> + if (Label)
> + DD->addArangeLabel(SymbolCU(this, Label));
> +
> + unsigned idx = DU->getAddrPoolIndex(Label);
> + DIEValue *Value = new (DIEValueAllocator) DIEInteger(idx);
> + Die->addValue(Attribute, dwarf::DW_FORM_GNU_addr_index, Value);
> +}
> +
> +/// addLocalLabelAddress - Add a dwarf label attribute data and value
> using
> +/// DW_FORM_addr only.
> +///
> +void DwarfCompileUnit::addLocalLabelAddress(DIE *Die,
> + dwarf::Attribute Attribute,
> + MCSymbol *Label) {
> if (Label)
> DD->addArangeLabel(SymbolCU(this, Label));
>
> - if (!DD->useSplitDwarf()) {
> - if (Label) {
> - DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
> - Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
> - } else {
> - DIEValue *Value = new (DIEValueAllocator) DIEInteger(0);
> - Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
> - }
> + if (Label) {
> + DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
> + Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
> } else {
> - unsigned idx = DU->getAddrPoolIndex(Label);
> - DIEValue *Value = new (DIEValueAllocator) DIEInteger(idx);
> - Die->addValue(Attribute, dwarf::DW_FORM_GNU_addr_index, Value);
> + DIEValue *Value = new (DIEValueAllocator) DIEInteger(0);
> + Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
> }
> }
>
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=199990&r1=199989&r2=199990&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Fri Jan 24 05:40:29 2014
> @@ -545,6 +545,11 @@ public:
> /// addLabelAddress - Add a dwarf label attribute data and value using
> /// either DW_FORM_addr or DW_FORM_GNU_addr_index.
> void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol
> *Label);
> +
> + /// addLocalLabelAddress - Add a dwarf label attribute data and value
> using
> + /// DW_FORM_addr only.
> + void addLocalLabelAddress(DIE *Die, dwarf::Attribute Attribute,
> + MCSymbol *Label);
> };
>
> class DwarfTypeUnit : public DwarfUnit {
>
> Modified: llvm/trunk/test/DebugInfo/X86/concrete_out_of_line.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/concrete_out_of_line.ll?rev=199990&r1=199989&r2=199990&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/X86/concrete_out_of_line.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/concrete_out_of_line.ll Fri Jan 24
> 05:40:29 2014
> @@ -7,15 +7,15 @@
> ; first check that we have a TAG_subprogram at a given offset and it has
> ; AT_inline.
>
> -; CHECK: 0x0000011c: DW_TAG_subprogram [17]
> +; CHECK: 0x00000124: DW_TAG_subprogram [17]
> ; CHECK-NEXT: DW_AT_specification
> ; CHECK-NEXT: DW_AT_inline
>
>
> ; and then that a TAG_subprogram refers to it with AT_abstract_origin.
>
> -; CHECK: 0x0000015d: DW_TAG_subprogram [19]
> -; CHECK-NEXT: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x011c =>
> {0x0000011c})
> +; CHECK: 0x00000165: DW_TAG_subprogram [19]
> +; CHECK-NEXT: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x0124 =>
> {0x00000124})
>
> define i32 @_ZN17nsAutoRefCnt7ReleaseEv() {
> entry:
>
> 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=199990&r1=199989&r2=199990&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/X86/fission-cu.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/fission-cu.ll Fri Jan 24 05:40:29 2014
> @@ -109,6 +109,8 @@
> ; 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_64 .text 0x0
> +; OBJ-NEXT: R_X86_64_64 .text 0x0
> ; OBJ-NEXT: }
> ; OBJ: .debug_aranges
> ; OBJ-NEXT: R_X86_64_32 .debug_info 0x0
>
>
> _______________________________________________
> 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/20140124/d88fcc61/attachment.html>
More information about the llvm-commits
mailing list