[llvm] [DWARFLinker] Add assembly-label range handling to parallel linker (PR #195366)
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Mon May 4 09:33:17 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);
----------------
JDevlieghere wrote:
By skipping, the label's DW_AT_low_pc is emitted unrelocated, which matches the classic linker does today (which class either addFunctionRange or addLabelLowPc but not both). In theory we totally could emit relocated label addresses, but given I'm trying to qualify the parallel linker, I'd rather match the existing behavior. Happy to revisit this in the future of course.
https://github.com/llvm/llvm-project/pull/195366
More information about the llvm-commits
mailing list