[PATCH] D52168: [DWARF] - Emit the correct value for DW_AT_addr_base.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 17 19:37:24 PDT 2018


dblaikie added inline comments.


================
Comment at: lib/CodeGen/AsmPrinter/AddressPool.cpp:43-44
+  // It is referenced via DW_AT_addr_base.
+  if (AddrBase)
+    Asm.OutStreamer->EmitLabel(AddrBase);
 }
----------------
Is there any reason to support not labeling the address pool? It doesn't look like this should be conditional.


================
Comment at: lib/CodeGen/AsmPrinter/DwarfFile.h:59
+  /// address table.
+  MCSymbol *AddressTableBaseSym = nullptr;
+
----------------
Since the DWO file can't have an address table itself (so its AddressTableBaseSym would always be null) - perhaps this symbol should be tracked in either the AddressPool itself, or in DwarfDebug? I'd slightly favor the AddressPool handling this. Using something like "DD->getAddressPool().getLabel()" to retrieve it in the DWARFCompileUnit & no need to pass it in when the AddressPool is emitting its header - it already has it/can attach it there.


================
Comment at: lib/CodeGen/AsmPrinter/DwarfUnit.cpp:1655-1656
+  MCSymbol *Base = DU->getAddrTableBaseSym();
+  if (!Base)
+    Base = TLOF.getDwarfAddrSection()->getBeginSymbol();
+  addSectionLabel(getUnitDie(), dwarf::DW_AT_GNU_addr_base, Base,
----------------
Could you explain what this case is for? I would (naively) have thought this case wouldn't come up once the label was being appropriately managed/emitted at the end of the header? In what situations is there no computed addrTableBase, but this fallback is correct?


https://reviews.llvm.org/D52168





More information about the llvm-commits mailing list