[PATCH] D104341: API to get Address Offset Section

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 15 16:39:06 PDT 2021


ayermolo created this revision.
ayermolo added a reviewer: dblaikie.
Herald added subscribers: hoy, wenlei.
ayermolo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I am adding DWP support to BOLT. At the moment DWP as input, later see if parts of llvm-dwp can be re-used to output DWP directly from bolt. 
The Address information is in the main binary, so when DWO CU is created from DWP it is not available. I am exposing a set API so that from user code this can be set. 
Example of how I am creating CU from DWP file. https://github.com/facebookincubator/BOLT/blob/0c14e20238604a4c05e174e71676857d45c60a0f/bolt/src/BinaryContext.cpp#L1472 
Example of usage of the new API: 
Optional<uint64_t> addrOffBase = DwarfUnit->getAddrOffsetSectionBase();         
assert(addrOffBase && "Address Offset Section Base is not set.");         
DWOCU->setAddrOffsetSection(DwarfUnit->getAddrOffsetSection(), *addrOffBase); 
Test Plan:


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104341

Files:
  llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h


Index: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
===================================================================
--- llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
@@ -306,10 +306,16 @@
     AddrOffsetSectionBase = Base;
   }
 
+  /// Returns Address offset section base.
   Optional<uint64_t> getAddrOffsetSectionBase() const {
     return AddrOffsetSectionBase;
   }
 
+  /// Returns Address offset section.
+  const DWARFSection *getAddrOffsetSection() const {
+    return AddrOffsetSection;
+  }
+
   /// Recursively update address to Die map.
   void updateAddressDieMap(DWARFDie Die);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104341.352297.patch
Type: text/x-patch
Size: 650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210615/1162ad29/attachment.bin>


More information about the llvm-commits mailing list