From a2d328fa12ca66edb47398c4a620523d252ff727 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Mon, 27 Nov 2023 12:35:27 -0500 Subject: [PATCH] test: demonstrate that dwarf debug names sections are emitted --- tests/assembly/dwarf4.rs | 24 ++++++++++++++++++++++++ tests/assembly/dwarf5.rs | 1 + 2 files changed, 25 insertions(+) create mode 100644 tests/assembly/dwarf4.rs diff --git a/tests/assembly/dwarf4.rs b/tests/assembly/dwarf4.rs new file mode 100644 index 00000000000..a5009021141 --- /dev/null +++ b/tests/assembly/dwarf4.rs @@ -0,0 +1,24 @@ +// Makes sure that `-Z dwarf-version=4` causes `rustc` to emit DWARF version 4. +// assembly-output: emit-asm +// compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=4 -Copt-level=0 +// needs-llvm-components: x86 + +#![feature(no_core, lang_items)] +#![crate_type = "rlib"] +#![no_core] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +pub fn wibble() {} + +pub struct X; + +// CHECK: .section .debug_info +// CHECK-NOT: .short 2 +// CHECK-NOT: .short 5 +// CHECK: .short 4 +// CHECK: .section .debug_pubnames +// CHECK: .section .debug_pubtypes diff --git a/tests/assembly/dwarf5.rs b/tests/assembly/dwarf5.rs index 253baafb887..46d4e84b41b 100644 --- a/tests/assembly/dwarf5.rs +++ b/tests/assembly/dwarf5.rs @@ -18,3 +18,4 @@ pub fn wibble() {} // CHECK-NOT: .short 2 // CHECK-NOT: .short 4 // CHECK: .short 5 +// CHECK: .section .debug_names