diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp --- a/llvm/lib/DWARFLinker/DWARFLinker.cpp +++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp @@ -1423,6 +1423,11 @@ Flags |= TF_InFunctionScope; if (!Info.InDebugMap && LLVM_LIKELY(!Update)) Flags |= TF_SkipPC; + } else if (Abbrev->getTag() == dwarf::DW_TAG_variable) { + // Function-local globals could be in the debug map even when the function + // is not, e.g., inlined functions. + if ((Flags & TF_InFunctionScope) && Info.InDebugMap) + Flags &= ~TF_SkipPC; } for (const auto &AttrSpec : Abbrev->attributes()) { diff --git a/llvm/test/tools/dsymutil/Inputs/inlined-static-variable/4.o b/llvm/test/tools/dsymutil/Inputs/inlined-static-variable/4.o new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@