[PATCH] D96827: [DWARF][WIP] Check for AddrOffsetSectionBase to work with DWO Units.

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 8 17:06:29 PST 2021


ayermolo added a subscriber: dblaikie.
ayermolo added a comment.

Per discussion with @dblaikie going to go with this approach. Need to add test + see if we can avoid redundant checks.

Looking at what various tools produce here are few cases.
**CASE 1**
llc output.
This file contains .debug_info, .debug_info.dwo, .debug_info.dwo, etc sections. 
IsDWO --> true.
hasSingleElement --> true
AddrOffsetSectionBase -> False, and True on recursive call. 
Return Address.

**CASE 2**
DWARF5 produced by llvm-mc. Important part here is DWARF5 and we need to dump .debug_rnglists on the .o file.
IsDWO --> False
hasSingleElement --> False
AddrOffsetSectionBase --> False
Return None
Here AddrOffsetSectionBase is false due to how the DWO CU is created. I think if we went through getNonSkeletonUnitDIE we would have that link.

**CASE 3**
DWP IsDWO --> True
hasSingleElement --> False
AddrOffsetSectionBase --> False
Return None
We are dumping dwo sections by feeding dwp file, so no link to binary with .debug_addr. Although I do want to add API to create that link. Similar to what happens under the hood in getNonSkeletonUnitDIE/parseDWO. This way tools, like BOLT, that deal with DWARF info on DIE level can transparently do it.

**CASE 4**
DWARF Fission Single Mode. When DWO CUs are created with getNonSkeletonUnitDIE, then processed.
IsDWO --> True
hasSingleElement --> True
AddrOffsetSectionBase --> True
Return None. This is the case we want to fix. If AddrOffsetSectionBase is true it should use it, and not go in to recursive call because hasSingleElement is True.

**CASE 5**
DWARF Fission Split Mode. Again if there is a link created by getNonSkeletonUnitDIE.
IsDWO --> True
hasSingleElement --> False Since we processing dwo file that only has dwo sections
AddrOffsetSectionBase --> True
Return Address

So TLDR.
If AddrOffsetSectionBase is true we should just use that.
If it's false and IsDWO is true we need to check hasSingleElement. If that is true do recursive call, otherwise return None.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96827



More information about the llvm-commits mailing list