[llvm] [dsymutil] Fix linker's ODR uniquing for typedefs with different underlying types (PR #195749)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 15:52:07 PDT 2026


================
@@ -116,6 +116,28 @@ DeclContextTree::getChildDeclContext(DeclContext &Context, const DWARFDie &DIE,
     NameForUniquing = StringPool.internString(FullName ? *FullName : Name);
   }
 
+  // For typedefs, include the referenced type's tag and name in the uniquing
+  // key. Two typedefs with the same name (e.g. from preferred_name) but
+  // different DW_AT_type targets must get different DeclContexts, otherwise
+  // ODR deduplication can create self-referencing typedef cycles in the output
+  // DWARF. This mirrors the parallel linker fix in the parallel linker:
----------------
alx32 wrote:

Not sure “mirrors” is the right word here. The parallel path looks recursive, while this only uses the immediate referenced tag/name: [SyntheticTypeNameBuilder.cpp](https://github.com/llvm/llvm-project/blob/940b276a541ae3da94e683ba40a080893bbdc917/llvm/lib/DWARFLinker/Parallel/SyntheticTypeNameBuilder.cpp#L276-L305). Did we actually want a mirror impl ? 


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


More information about the llvm-commits mailing list