[PATCH] D74169: [WIP][LLD][ELF][DebugInfo] Skeleton implementation of removing obsolete debug info.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 19 10:52:27 PDT 2020


MaskRay added a comment.

In D74169#1930688 <https://reviews.llvm.org/D74169#1930688>, @grimar wrote:

> In D74169#1928711 <https://reviews.llvm.org/D74169#1928711>, @avl wrote:
>
> > @ruiu, @grimar, @MaskRay
> >
> > While working on "remove obsolete debug info in lld" patch 
> >  I need to generate the DWARF section contents. dsymutil 
> >  uses AsmPrinter to create DWARF. Thus to create things 
> >  in the same way, I need to  add AsmPrinter library and targets libraries:
> >
> >   --- a/lld/ELF/CMakeLists.txt
> >   +++ b/lld/ELF/CMakeLists.txt
> >   @@ -59,6 +59,10 @@ add_lld_library(lldELF
> >      Option
> >      Passes
> >      Support
> >   +  AllTargetsCodeGens
> >   +  AllTargetsDescs
> >   +  AllTargetsInfos
> >   +  AsmPrinter
> >  
> >
> >
> > Would it be OK to add these libraries to lld code ?
> >
> > If that is not OK, then alternative solution would be to refactor 
> >  DWARF generation code to remove dependence on AsmPrinter and friends.
>
>
> Honestly I just do not know the answer, but it sounds to me that we can add them, and do
>  the refactoring you are proposing after whole functionality is done. (i.e. remove them later if it will be possible/reasonable).


Honestly I don't know, either. I echo most of comments on https://reviews.llvm.org/D74169#1880922 For -gsplit-dwarf or -gsplit-dwarf=single users, garbage collection of debug info can provide hardly any benefit. For non -gsplit-dwarf use cases, I am concerned whether the pros (avoid an intermediate file/avoid a post-processing step) overweight cons (time/memory/lld size). The link time/memory may increase significantly. I wonder whether the peak memory usage can increase to 2x given our experience https://reviews.llvm.org/D74773#1920751

I am also curious to learn how much `+ AllTargetsCodeGens + AllTargetsDescs + AllTargetsInfos + AsmPrinter` can increase the size of lld executable in a -DBUILD_SHARED_LIBS=off build.

Doing a full DWARF rewriting can save intermediate files. But if the memory/time trade-off is not that appealing, a standalone tool (which can have more configuration options) may be more suitable. That said, we may need some prototype to verify these theories.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74169/new/

https://reviews.llvm.org/D74169





More information about the llvm-commits mailing list