[llvm] [BOLT][DWARF] Skip processing DWO files with ID 0 (PR #154749)

Jinjie Huang via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 01:38:34 PDT 2025


================
@@ -583,6 +583,15 @@ DWARFDie DIEBuilder::resolveDIEReference(
   uint64_t TmpRefOffset = RefOffset;
   if ((RefCU =
            getUnitForOffset(*this, *DwarfContext, TmpRefOffset, AttrSpec))) {
+    std::optional<uint64_t> DWOId = RefCU->getDWOId();
----------------
Jinjie-Huang wrote:

@ayermolo This is intended to prevent the broken DWARF from being re-registered(constructFromUnit->constructDIEFast->cloneAttribute->cloneDieOffsetReferenceAttribute->resolveDIEReference->**registerUnit**), ensuring it's neither updated nor included in the final post-BOLT binary...

An alternative approach appears to be detecting and skipping this before "processMainBinaryCU()". However, the existing implementation happens to also resolves the issue I've encountered -- "duplicate, invalid DWARF DWO IDs." Do you have a preference for handling this within processMainBinaryCU?


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


More information about the llvm-commits mailing list