[PATCH] D155666: Do not emit a .debug_addr section if the DW_AT_addr_base is not set.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 06:36:12 PDT 2023


avl added a comment.

The test could be written using yaml2obj tool. I attached an example of such test. It contains two compile units one is good and another one is missing DW_AT_addr_base(the test passes on current llvm and should be adapted for D154638 <https://reviews.llvm.org/D154638>). F28321227: dwarf5-addrbase-broken.test <https://reviews.llvm.org/F28321227>



================
Comment at: llvm/lib/DWARFLinker/DWARFLinker.cpp:1372
+        !AddrAttribute->getUnit()->getAddrOffsetSectionBase())
+      return 0;
     Addr = 0;
----------------
No need to check for DW_AT_addr_base specifically here. Just checking for std::nullopt should be enough:


```
if (!Addr) {
  Linker.reportWarning("Cann't read address attribute value.", ObjFile);
  return 0;
}
```




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

https://reviews.llvm.org/D155666



More information about the llvm-commits mailing list