[llvm] [DWARFLinker] Fix placement lost-update crash in parallel marking (PR #211009)
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 21 11:53:30 PDT 2026
================
@@ -0,0 +1,353 @@
+# RUN: rm -rf %t && mkdir -p %t
+# RUN: split-file %s %t
+# RUN: yaml2obj %t/foo.o.yaml -o %t/foo.o
+
+## The parallel linker computes each DIE's output placement (artificial type
+## unit vs plain DWARF) concurrently across compile units. A DIE's placement is
+## the join of every mark that reaches it, so it must not depend on thread
+## interleaving.
+##
+## The input (from odr-types-in-subprogram1) defines class "clas1" inside the
+## live subprogram "foo" and also references it as a template parameter of
+## "Container" in the type table, so the same nested type is reached by both a
+## plain-DWARF (live) mark and a type-table mark while the enclosing subprogram
+## stays in plain DWARF. The debug map links the object eight times so many such
+## compile units are marked concurrently. -oso-prepend-path resolves the
+## relative object filename against the temporary directory.
+##
+## Require the threaded output to match the single-threaded output byte-for-byte
+## on every run, which is the placement invariant the parallel linker must
+## preserve. Structural correctness of this input is covered by
+## odr-types-in-subprogram1.test.
+# RUN: dsymutil --linker=parallel -oso-prepend-path=%t -y %t/link.map -f -o %t/serial.out --num-threads 1
+# RUN: dsymutil --linker=parallel -oso-prepend-path=%t -y %t/link.map -f -o %t/par1.out --num-threads 4
+# RUN: dsymutil --linker=parallel -oso-prepend-path=%t -y %t/link.map -f -o %t/par2.out --num-threads 8
+# RUN: diff %t/serial.out %t/par1.out
+# RUN: diff %t/serial.out %t/par2.out
----------------
JDevlieghere wrote:
I unstaged the fix and after a 1000 runs it doesn't trigger the bug, so the test isn't adding the coverage I was hoping it would. The fix is still correct: I have a downstream reproducer (that I cannot share) where I can consistently reproduce the issue. I'll see if I can find a test that repros the issue.
https://github.com/llvm/llvm-project/pull/211009
More information about the llvm-commits
mailing list