rewrite c-static-dylib to rmake

This commit is contained in:
Oneirical 2024-07-12 15:14:12 -04:00
parent 5e55f07cc0
commit 1ae1ab8215
3 changed files with 20 additions and 14 deletions

View File

@ -1,7 +1,6 @@
run-make/branch-protection-check-IBT/Makefile
run-make/c-dynamic-dylib/Makefile
run-make/c-dynamic-rlib/Makefile
run-make/c-static-dylib/Makefile
run-make/c-static-rlib/Makefile
run-make/c-unwind-abi-catch-lib-panic/Makefile
run-make/c-unwind-abi-catch-panic/Makefile

View File

@ -1,13 +0,0 @@
# This test checks that static Rust linking with C does not encounter any errors, with dynamic dependencies given preference over static.
# See https://github.com/rust-lang/rust/issues/10434
# ignore-cross-compile
include ../tools.mk
all: $(call NATIVE_STATICLIB,cfoo)
$(RUSTC) foo.rs -C prefer-dynamic
$(RUSTC) bar.rs
rm $(call NATIVE_STATICLIB,cfoo)
$(call RUN,bar)
$(call REMOVE_DYLIBS,foo)
$(call FAIL,bar)

View File

@ -0,0 +1,20 @@
// This test checks that static Rust linking with C does not encounter any errors,
// with dynamic dependencies given preference over static.
// See https://github.com/rust-lang/rust/issues/10434
//@ ignore-cross-compile
// Reason: the compiled binary is executed
use run_make_support::{
build_native_static_lib, dynamic_lib_name, fs_wrapper, run, run_fail, rustc, static_lib_name,
};
fn main() {
build_native_static_lib("cfoo");
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
rustc().input("bar.rs").run();
fs_wrapper::remove_file(static_lib_name("cfoo"));
run("bar");
fs_wrapper::remove_file(dynamic_lib_name("foo"));
run_fail("bar");
}