[clang] [llvm] [dwarf] make dwarf fission compatible with RISCV relaxations (PR #164128)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 09:54:47 PDT 2025


================
@@ -493,10 +493,12 @@ void DwarfCompileUnit::attachLowHighPC(DIE &D, const MCSymbol *Begin,
   assert(End->isDefined() && "Invalid end label");
 
   addLabelAddress(D, dwarf::DW_AT_low_pc, Begin);
-  if (DD->getDwarfVersion() < 4)
-    addLabelAddress(D, dwarf::DW_AT_high_pc, End);
-  else
+  if (DD->getDwarfVersion() >= 4 &&
+      (!isDwoUnit() || !llvm::isRangeRelaxable(Begin, End))) {
     addLabelDelta(D, dwarf::DW_AT_high_pc, End, Begin);
+    return;
+  }
+  addLabelAddress(D, dwarf::DW_AT_high_pc, End);
----------------
dwblaikie wrote:

This should probably be a separate patch too - you can do the uses of `isRangeRelaxable` in any order (& whichever's the first can have the `isRangeRelaxable` function, so it can be tested when it's added, etc), but should be separate with incremental test coverage being added, etc.

Though perhaps the Split DWARF test coverage (if we have an assert checking that relocations aren't used in .dwo files) can only be added at the end once all the functionality is in.

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


More information about the llvm-commits mailing list