[llvm] [DWARF] Disable generation of cross-CU references for DWARF V2 (PR #192516)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 11:38:39 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")
----------------
dwblaikie wrote:
I'd probably let the first `{{.*}}` consume all the way through the `(cu + ... => ` and end up with something like:
```
; CHECK-V3-NEXT: DW_AT_type [DW_FORM_ref4]{{.*}}{0x[[INT_ADDR:[0-9a-f]+]]}
```
https://github.com/llvm/llvm-project/pull/192516
More information about the llvm-commits
mailing list