From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/run-make-fulldeps/c-dynamic-dylib/Makefile | 12 ++++++++++++ tests/run-make-fulldeps/c-dynamic-dylib/bar.rs | 5 +++++ tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c | 4 ++++ tests/run-make-fulldeps/c-dynamic-dylib/foo.rs | 10 ++++++++++ 4 files changed, 31 insertions(+) create mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/Makefile create mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/bar.rs create mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c create mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/foo.rs (limited to 'tests/run-make-fulldeps/c-dynamic-dylib') diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/Makefile b/tests/run-make-fulldeps/c-dynamic-dylib/Makefile new file mode 100644 index 000000000..ac6877892 --- /dev/null +++ b/tests/run-make-fulldeps/c-dynamic-dylib/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +# ignore-macos +# +# This hits an assertion in the linker on older versions of osx apparently + +all: $(call DYLIB,cfoo) + $(RUSTC) foo.rs -C prefer-dynamic + $(RUSTC) bar.rs + $(call RUN,bar) + $(call REMOVE_DYLIBS,cfoo) + $(call FAIL,bar) diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/bar.rs b/tests/run-make-fulldeps/c-dynamic-dylib/bar.rs new file mode 100644 index 000000000..b8c798ffd --- /dev/null +++ b/tests/run-make-fulldeps/c-dynamic-dylib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::rsfoo(); +} diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c b/tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c new file mode 100644 index 000000000..fea490cf9 --- /dev/null +++ b/tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int foo() { return 0; } diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/foo.rs b/tests/run-make-fulldeps/c-dynamic-dylib/foo.rs new file mode 100644 index 000000000..9f7a9e221 --- /dev/null +++ b/tests/run-make-fulldeps/c-dynamic-dylib/foo.rs @@ -0,0 +1,10 @@ +#![crate_type = "dylib"] + +#[link(name = "cfoo")] +extern "C" { + fn foo(); +} + +pub fn rsfoo() { + unsafe { foo() } +} -- cgit v1.2.3