Index: llvm/lib/DWARFLinker/DWARFLinker.cpp =================================================================== --- llvm/lib/DWARFLinker/DWARFLinker.cpp +++ llvm/lib/DWARFLinker/DWARFLinker.cpp @@ -1365,6 +1365,11 @@ std::optional Addr = AddrAttribute->getAsAddress(); if (!Addr) { Linker.reportWarning("Cann't read address attribute value.", ObjFile); + // If the attribute is of form addrx* and the DW_AT_addr_base is not set, do + // not emit the .debug_addr section + if (AttrSpec.Form != dwarf::DW_FORM_addr && + !AddrAttribute->getUnit()->getAddrOffsetSectionBase()) + return 0; Addr = 0; }