[PATCH] Use attachLowHighPC also for compile unit DIE

David Blaikie dblaikie at gmail.com
Thu Aug 28 08:08:06 PDT 2014


Could you add test coverage and attach the entire patch (covering all
source and test changes together) as a single file for review?
On Aug 28, 2014 6:28 AM, "Frédéric Riss" <friss at apple.com> wrote:

> I’d like to apply this little hunk to have the compile unit low/high_pc
> obey the dwarf version setting:
>
> --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> @@ -950,10 +950,7 @@ void DwarfDebug::finalizeModuleInfo() {
>                      0);
>          } else {
>            RangeSpan &Range = TheU->getRanges().back();
> -          U.addLocalLabelAddress(U.getUnitDie(), dwarf::DW_AT_low_pc,
> -                                 Range.getStart());
> -          U.addLabelDelta(U.getUnitDie(), dwarf::DW_AT_high_pc,
> Range.getEnd(),
> -                          Range.getStart());
> +          attachLowHighPC(U, U.getUnitDie(), Range.getStart(),
> Range.getEnd());
>          }
>        }
>      }
>
>
> And it needs this const correctness fix to compile correctly:
>
>
> --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> @@ -2610,7 +2607,7 @@ void
> DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
>  }
>
>  void DwarfDebug::attachLowHighPC(DwarfCompileUnit &Unit, DIE &D,
> -                                 MCSymbol *Begin, MCSymbol *End) {
> +                                 const MCSymbol *Begin, const MCSymbol
> *End) {
>    assert(Begin && "Begin label should not be null!");
>    assert(End && "End label should not be null!");
>    assert(Begin->isDefined() && "Invalid starting label");
> diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h
> b/lib/CodeGen/AsmPrinter/DwarfDebug.
> h
> index c0e7e43..3528b2b 100644
> --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
> +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h
> @@ -562,8 +562,8 @@ class DwarfDebug : public AsmPrinterHandler {
>
>    void attachRangesOrLowHighPC(DwarfCompileUnit &Unit, DIE &D,
>                                 const SmallVectorImpl<InsnRange> &Ranges);
> -  void attachLowHighPC(DwarfCompileUnit &Unit, DIE &D, MCSymbol *Begin,
> -                       MCSymbol *End);
> +  void attachLowHighPC(DwarfCompileUnit &Unit, DIE &D, const MCSymbol
> *Begin,
> +                       const MCSymbol *End);
>
>  public:
>
>  //===--------------------------------------------------------------------===//
>
>
> Are these 2 patches OK to go in?
>
> Fred
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140828/40cbbdbf/attachment.html>


More information about the llvm-commits mailing list