[all-commits] [llvm/llvm-project] 499b69: [DWARFLinker] Fix data race on the per-unit file-n...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Fri Jul 17 07:48:34 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 499b69cf07e03a23a420ee773261fcfcfc1c3df9
      https://github.com/llvm/llvm-project/commit/499b69cf07e03a23a420ee773261fcfcfc1c3df9
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp
    M llvm/lib/DWARFLinker/Parallel/DWARFLinkerUnit.h

  Log Message:
  -----------
  [DWARFLinker] Fix data race on the per-unit file-name cache (#208967)

CompileUnit::getDirAndFilenameFromLineTable reads and mutates the unit's
FileNames DenseMap without synchronization. During the parallel
type-name assignment phase a unit's cache is touched both by its own
worker and, through cross-unit type-name references
(addReferencedODRDies calling addDieNameFromDeclFileAndDeclLine) by
other units' workers.

The concurrent find/insert/grow corrupts the map and trips the
assertion:

```
Assertion failed: (TheBucket), function findBucketForInsertion, DenseMap.h
```

Guard the cache with a mutex. Store each entry in a heap-allocated pair
so the StringRefs handed back to callers stay valid across a concurrent
rehash. Otherwise a short (small-string-optimized) file name would move
when another insertion grows the map, dangling a StringRef already
returned.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list