summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorNathan Corbyn <me@nathancorbyn.com>2020-06-05 16:47:37 +0100
committerNathan Corbyn <me@nathancorbyn.com>2020-06-15 09:40:56 +0100
commitf62903b74a8630fa62e721f69e6621d1d441e7f1 (patch)
treea054cf5352766f8084835cc3f9326a316f83cd96 /src/test/codegen
parentce6d3a73b514e9649e57cee812ad129bb2112016 (diff)
downloadrust-f62903b74a8630fa62e721f69e6621d1d441e7f1.tar.gz
rust-f62903b74a8630fa62e721f69e6621d1d441e7f1.zip
Export `#[inline] #[no_mangle]` fns in cdylibs and staticlibs
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/cdylib-external-no-mangle-fns.rs13
-rw-r--r--src/test/codegen/staticlib-external-no-mangle-fns.rs13
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/codegen/cdylib-external-no-mangle-fns.rs b/src/test/codegen/cdylib-external-no-mangle-fns.rs
new file mode 100644
index 00000000000..827de7e5c11
--- /dev/null
+++ b/src/test/codegen/cdylib-external-no-mangle-fns.rs
@@ -0,0 +1,13 @@
+// compile-flags: -C no-prepopulate-passes
+
+#![crate_type = "cdylib"]
+
+// CHECK: define void @a()
+#[no_mangle]
+#[inline]
+pub extern "C" fn a() {
+    // side effect to keep `a` around
+    unsafe {
+        core::ptr::read_volatile(&42);
+    }
+}
diff --git a/src/test/codegen/staticlib-external-no-mangle-fns.rs b/src/test/codegen/staticlib-external-no-mangle-fns.rs
new file mode 100644
index 00000000000..0b4a37febb2
--- /dev/null
+++ b/src/test/codegen/staticlib-external-no-mangle-fns.rs
@@ -0,0 +1,13 @@
+// compile-flags: -C no-prepopulate-passes
+
+#![crate_type = "staticlib"]
+
+// CHECK: define void @a()
+#[no_mangle]
+#[inline]
+pub extern "C" fn a() {
+    // side effect to keep `a` around
+    unsafe {
+        core::ptr::read_volatile(&42);
+    }
+}