[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
Thu Jul 20 15:09:19 PDT 2023


avl added inline comments.


================
Comment at: llvm/lib/DWARFLinker/DWARFLinker.cpp:1372
+        !AddrAttribute->getUnit()->getAddrOffsetSectionBase())
+      return 0;
     Addr = 0;
----------------
rastogishubham wrote:
> 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.
This is exactly wanted behavior - dsymutil removed broken attribute and so verifier does not report the error.

We need to modify /tools/dsymutil/X86/verify.test so that it uses another kind of error. f.e. it might add DW_AT_language that has DW_FORM_ref_addr form or something like this.


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

https://reviews.llvm.org/D155666



More information about the llvm-commits mailing list