[llvm] [AsmPrinter] Find a DIE's unit by its owner, not by its tag (PR #219660)

Arcadiy Ivanov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 10:00:20 PDT 2026


================
@@ -0,0 +1,303 @@
+## This test checks that a cross-unit DW_FORM_ref_addr reference into a
+## DW_TAG_partial_unit is rewritten to the section-absolute offset of the
+## referenced DIE, as it already is for a DW_TAG_compile_unit.
+##
+## The two documents differ only in the root tag and unit type of the unit
+## holding the referenced type, so the compile unit document is the control.
+##
+## Only the classic linker is exercised. The parallel linker asserts on a type
+## under a partial unit root, which is issue #219613, and --verify rejects the
+## output because a partial unit still ships under a DW_UT_compile header,
+## which is issue #219365.
----------------
arcivanov wrote:

The unit tests cover `getUnitDie()`/`getUnit()` in isolation. They do not cover the reported defect, which is a linker abort:

1. Without this change `llvm-dwarfutil` aborts on that input — `getDebugSectionOffset()` asserts on the null unit — in every one of the four runs the test performs. Remove it and #219650 has no coverage at the tool level at all.
2. The unit tests cannot catch a re-break coming from the DWARFLinker side, e.g. a change to how a cross-unit `DW_FORM_ref_addr` is emitted that stops routing through `getDebugSectionOffset()`. The lit test asserts the reference resolves; the unit tests assert only that the parent walk finds the owner.
3. The two linked issues limit which RUN lines the test can carry, not what it asserts. #219613 keeps the parallel linker out and #219365 keeps `--verify` out; the classic runs that remain still go from abort to a correctly resolved reference. I would add the parallel and `--verify` lines to this same test once those land, rather than defer the whole test until then.

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


More information about the llvm-commits mailing list