[llvm] [DWARFLinker] Add assembly-label range handling to parallel linker (PR #195366)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 09:14:23 PDT 2026


================
@@ -816,6 +816,22 @@ bool DependencyTracker::isLiveSubprogramEntry(const UnitEntryPairTy &Entry) {
               .value_or(UINT64_MAX) <= LowPc)
         return false;
 
+      // For assembly-language CUs there are typically no DW_TAG_subprogram
+      // DIEs, so labels are the only addresses we see. Fall back to the
+      // assembly-range lookup to recover a function range for the line-table
+      // filter; otherwise the output line table would be empty.
+      uint16_t Language = dwarf::toUnsigned(
+          Entry.CU->getOrigUnit().getUnitDIE().find(dwarf::DW_AT_language), 0);
+      if (Language == dwarf::DW_LANG_Mips_Assembler ||
+          Language == dwarf::DW_LANG_Assembly) {
+        if (auto Range = Entry.CU->getContaingFile()
+                             .Addresses->getAssemblyRangeForAddress(*LowPc)) {
+          Entry.CU->addFunctionRange(Range->LowPC, Range->HighPC,
+                                     *RelocAdjustment);
+          return true;
+        }
+      }
+
       Entry.CU->addLabelLowPc(*LowPc, *RelocAdjustment);
----------------
alx32 wrote:

I think skipping this could also be an issue ? 
Via later on interacting with this: https://github.com/llvm/llvm-project/blob/1a264eee3989485a94e355d04139ee5b2d3a49b2/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp#L1389

https://github.com/llvm/llvm-project/pull/195366


More information about the llvm-commits mailing list