[PATCH] D76085: [DWARFLinker][dsymutil][NFC] add section index into address range.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 19 18:40:01 PDT 2020


dblaikie added a comment.

In D76085#1931600 <https://reviews.llvm.org/D76085#1931600>, @avl wrote:

> > While these are understandably different situations, keeping them similar seems like there's some value - so I'd be inclined to encourage you to see if there's a way to make the lld situation more like the llvm-dsymutil situation (where the DWARF reduction also applies relocations, essentially) or potentially make the llvm-dsymutil situation more like lld (could be useful to reuse pieces of lld that make for efficient section rewriting, etc, to improve llvm-dsymutil/share more code there).
>
>
>
> > Certainly llvm-dwp would probably benefit from being rephrased in terms of lld functionality (as binutils dwp uses some of gold's infrastructure - though admittedly not a lot, in part because dwp doesn't need to apply relocations, for instance).
>
> Agreed. It would be good if DWARFLinker would use the same handling for both dsymutil and lld.
>
> > I think that'd be worthwhile to investigate/understand.
>
> I prototyped this scheme - DWARF reduction is done in lld after addresses assigned, but before output sections are generated; DWARF reduction also applies relocations; DebugMap information created from relocations:    It is equally cheap. It does not need additional time and memory for creating DebugMap.
>
> So from the point of required resources and performance : both schemes are equal.
>
> But this patch is still necessary. The problem is that in darwin case -ffunction-sections does nothing. And address ranges do not clash. Thus following code is working:
>
>   auto LowPc = dwarf::toAddress(DIE.find(dwarf::DW_AT_low_pc));
>  
>   Ranges[*LowPc] = ObjFileAddressRange(*HighPc, MyInfo.AddrAdjust);
>  
>
>
> But in linux case all address ranges start from 0(in -ffunction-sections case). So above code would not work. 
>  It is necessary to add SectionIndex to have possibility to differentiate address ranges.
>
> So, I am going to add unit tests to this patch...


Sounds good (& FWIW, even without function-sections, inline functions, and function template implicit specializations also end up in their own sections, etc (or you might've put functions in sections explicitly with __attribute__((section("..."))) attribute)) - thankss for all the due diligence and explanation!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76085





More information about the llvm-commits mailing list