[llvm] [DWARF] Disable generation of cross-CU references for DWARF V2 (PR #192516)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 12:15:17 PDT 2026


================
@@ -0,0 +1,59 @@
+; RUN: %llc_dwarf -dwarf-version=3 -O0 -filetype=obj < %s | llvm-dwarfdump -v -debug-info - | FileCheck --check-prefix=CHECK-V3 %s
+; RUN: %llc_dwarf -dwarf-version=2 -O0 -filetype=obj < %s | llvm-dwarfdump -v -debug-info - | FileCheck --check-prefix=CHECK-V2 --implicit-check-not=DW_FORM_ref_addr %s
+
+; DWARF v2 is incompatible with 64-bit XCOFF/AIX (requires DWARF64 format which needs DWARF v3+).
+; UNSUPPORTED: target=powerpc64{{.*}}-aix{{.*}}
+
+; DWARF V3: Expect cross-CU type deduplication resulting in only one "int"
+; definition and a DW_FORM_ref_addr.
+
+; CHECK-V3: Compile Unit{{.*}} version = 0x0003
+
+; CHECK-V3: DW_TAG_compile_unit
+; CHECK-V3: DW_AT_name{{.*}}"x"
+; CHECK-V3-NEXT: DW_AT_type [DW_FORM_ref4]{{.*}}(cu + {{.*}} => {0x[[INT_ADDR:[0-9a-f]+]]} "int")
----------------
Nadharm wrote:

Fair, yeah, I originally chose to keep the `(cu + ...` to explicitly check for the cu-relative offset, but I guess the `ref4` check makes it redundant. Updated. Thank you!

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


More information about the llvm-commits mailing list