[llvm] [BOLT][DWARF] Skip processing DWARF CUs with a DWO ID but no DWO name. (PR #154749)

Jinjie Huang via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 05:26:05 PDT 2025


================
@@ -0,0 +1,737 @@
+## This test checks that broken DWARF—having 
+## a DWOId but missing a DWOName—is correctly detected.
+# RUN: rm -rf %t && mkdir -p %t
+# RUN: %clang -O3 -g -gdwarf-5 -gsplit-dwarf -Wl,-q %s -o %t/main.exe
+# RUN: llvm-bolt %t/main.exe -o %t/main.exe.bolt -update-debug-sections -comp-dir-override="%t" 2>&1 | FileCheck %s
+
+# CHECK: BOLT-ERROR: broken DWARF found in CU at offset 0x47 (DWOId=0x0, missing DW_AT_dwo_name / DW_AT_GNU_dwo_name).
+# CHECK: BOLT-ERROR: broken DWARF found in CU at offset 0x70 (DWOId=0x0, missing DW_AT_dwo_name / DW_AT_GNU_dwo_name).
+# CHECK-NOT: Assertion `RangeListsWritersByCU.count(*DWOId) == 0 && "RangeLists writer for DWO unit already exists."'
----------------
Jinjie-Huang wrote:

Is this acceptable? 

Case 1 (DWO_name missing): Exclude any DW_TAG_compile_unit or DW_TAG_skeleton_unit from the post-BOLT binary that is missing the DW_AT_dwo_name attribute.
Case 2 (Duplicate DWO IDs): Handle only the first dwo CU , and ensure BOLT doesn't crash.

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


More information about the llvm-commits mailing list