about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWeihang Lo <me@weihanglo.tw>2023-11-27 12:35:27 -0500
committerWeihang Lo <me@weihanglo.tw>2023-12-11 14:58:01 -0500
commita2d328fa12ca66edb47398c4a620523d252ff727 (patch)
treef789614bfa93fb38decaafffd3c106d2d8b4c94d
parent57010939ed1d00076b4af0ed06a81ec69ea5e4a8 (diff)
downloadrust-a2d328fa12ca66edb47398c4a620523d252ff727.tar.gz
rust-a2d328fa12ca66edb47398c4a620523d252ff727.zip
test: demonstrate that dwarf debug names sections are emitted
-rw-r--r--tests/assembly/dwarf4.rs24
-rw-r--r--tests/assembly/dwarf5.rs1
2 files changed, 25 insertions, 0 deletions
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