summaryrefslogtreecommitdiffstats
path: root/src/test/run-make-fulldeps/static-dylib-by-default
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/run-make-fulldeps/static-dylib-by-default
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/run-make-fulldeps/static-dylib-by-default')
-rw-r--r--src/test/run-make-fulldeps/static-dylib-by-default/Makefile16
-rw-r--r--src/test/run-make-fulldeps/static-dylib-by-default/bar.rs8
-rw-r--r--src/test/run-make-fulldeps/static-dylib-by-default/foo.rs4
-rw-r--r--src/test/run-make-fulldeps/static-dylib-by-default/main.c6
4 files changed, 34 insertions, 0 deletions
diff --git a/src/test/run-make-fulldeps/static-dylib-by-default/Makefile b/src/test/run-make-fulldeps/static-dylib-by-default/Makefile
new file mode 100644
index 000000000..6409aa66a
--- /dev/null
+++ b/src/test/run-make-fulldeps/static-dylib-by-default/Makefile
@@ -0,0 +1,16 @@
+-include ../tools.mk
+
+TO_LINK := $(call DYLIB,bar)
+ifdef IS_MSVC
+LINK_ARG = $(TO_LINK:dll=dll.lib)
+else
+LINK_ARG = $(TO_LINK)
+endif
+
+all:
+ $(RUSTC) foo.rs
+ $(RUSTC) bar.rs
+ $(CC) main.c $(call OUT_EXE,main) $(LINK_ARG) $(EXTRACFLAGS)
+ rm $(TMPDIR)/*.rlib
+ rm $(call DYLIB,foo)
+ $(call RUN,main)
diff --git a/src/test/run-make-fulldeps/static-dylib-by-default/bar.rs b/src/test/run-make-fulldeps/static-dylib-by-default/bar.rs
new file mode 100644
index 000000000..14421165e
--- /dev/null
+++ b/src/test/run-make-fulldeps/static-dylib-by-default/bar.rs
@@ -0,0 +1,8 @@
+#![crate_type = "dylib"]
+
+extern crate foo;
+
+#[no_mangle]
+pub extern "C" fn bar() {
+ foo::foo();
+}
diff --git a/src/test/run-make-fulldeps/static-dylib-by-default/foo.rs b/src/test/run-make-fulldeps/static-dylib-by-default/foo.rs
new file mode 100644
index 000000000..7ebec8720
--- /dev/null
+++ b/src/test/run-make-fulldeps/static-dylib-by-default/foo.rs
@@ -0,0 +1,4 @@
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+
+pub fn foo() {}
diff --git a/src/test/run-make-fulldeps/static-dylib-by-default/main.c b/src/test/run-make-fulldeps/static-dylib-by-default/main.c
new file mode 100644
index 000000000..5f7f2c27c
--- /dev/null
+++ b/src/test/run-make-fulldeps/static-dylib-by-default/main.c
@@ -0,0 +1,6 @@
+extern void bar();
+
+int main() {
+ bar();
+ return 0;
+}