[PATCH] D76085: [DWARFLinker][dsymutil][NFC] add section index into address range.
Alexey Lapshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 19 10:18:03 PDT 2020
avl added a comment.
> 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...
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