about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-17 19:04:14 +0000
committerbors <bors@rust-lang.org>2025-03-17 19:04:14 +0000
commit43a2e9d2c72db101f5fedac8b3acb78981b06bf2 (patch)
treee8d860111ca96d9e2da9866d3bdbc5cf1a6a1c18 /tests/codegen
parent8279176ccdfd4eebd40a671f75b6d3024ae56b42 (diff)
parent1e58d512903836962af9633ec6ac03caad69cb32 (diff)
downloadrust-43a2e9d2c72db101f5fedac8b3acb78981b06bf2.tar.gz
rust-43a2e9d2c72db101f5fedac8b3acb78981b06bf2.zip
Auto merge of #138611 - matthiaskrgr:rollup-hmjbqva, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #133870 (Stabilize `asm_goto` feature gate)
 - #137449 (Denote `ControlFlow` as `#[must_use]`)
 - #137465 (mir_build: Avoid some useless work when visiting "primary" bindings)
 - #138349 (Emit function declarations for functions with `#[linkage="extern_weak"]`)
 - #138412 (Install licenses into `share/doc/rust/licenses`)
 - #138577 (rustdoc-json: Don't also include `#[deprecated]` in `Item::attrs`)
 - #138588 (Avoid double lowering of idents)

Failed merges:

 - #138321 ([bootstrap] Distribute split debuginfo if present)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/asm/goto.rs2
-rw-r--r--tests/codegen/sanitizer/cfi/external_weak_symbols.rs24
2 files changed, 25 insertions, 1 deletions
diff --git a/tests/codegen/asm/goto.rs b/tests/codegen/asm/goto.rs
index 7a87bb7983b..f68c399c920 100644
--- a/tests/codegen/asm/goto.rs
+++ b/tests/codegen/asm/goto.rs
@@ -2,7 +2,7 @@
 //@ only-x86_64
 
 #![crate_type = "rlib"]
-#![feature(asm_goto, asm_goto_with_outputs)]
+#![feature(asm_goto_with_outputs)]
 
 use std::arch::asm;
 
diff --git a/tests/codegen/sanitizer/cfi/external_weak_symbols.rs b/tests/codegen/sanitizer/cfi/external_weak_symbols.rs
new file mode 100644
index 00000000000..00e9b5029af
--- /dev/null
+++ b/tests/codegen/sanitizer/cfi/external_weak_symbols.rs
@@ -0,0 +1,24 @@
+// Verifies that type metadata identifiers for for weakly-linked symbols are
+// emitted correctly.
+//
+//@ needs-sanitizer-cfi
+//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
+#![crate_type = "bin"]
+#![feature(linkage)]
+
+unsafe extern "C" {
+    #[linkage = "extern_weak"]
+    static FOO: Option<unsafe extern "C" fn(f64) -> ()>;
+}
+// CHECK: @_rust_extern_with_linkage_FOO = internal global ptr @FOO
+
+fn main() {
+    unsafe {
+        if let Some(method) = FOO {
+            method(4.2);
+            // CHECK: call i1 @llvm.type.test(ptr {{%method|%0}}, metadata !"_ZTSFvdE")
+        }
+    }
+}
+
+// CHECK: declare !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} extern_weak void @FOO(double) unnamed_addr #{{[0-9]+}}