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

Shubham Sandeep Rastogi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 11:42:25 PDT 2023


rastogishubham added inline comments.


================
Comment at: llvm/lib/DWARFLinker/DWARFLinker.cpp:1372
+        !AddrAttribute->getUnit()->getAddrOffsetSectionBase())
+      return 0;
     Addr = 0;
----------------
avl wrote:
> 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;
> }
> ```
> 
> 
That is incorrect, if we just check for std::nullopt, we will fail llvm/test/tools/dsymutil/X86/verify.test

This is because, that test adds broken dwarf where a duplicate DW_AT_language has the form DW_FORM_addr, and if we don't add that form to the Die, then the verify pass doesn't catch the error.


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

https://reviews.llvm.org/D155666



More information about the llvm-commits mailing list