port no-cdylib-as-rdylib test
This commit is contained in:
parent
d25cf6fc14
commit
1f61cc3078
3 changed files with 16 additions and 17 deletions
|
@ -185,7 +185,6 @@ run-make/native-link-modifier-whole-archive/Makefile
|
|||
run-make/no-alloc-shim/Makefile
|
||||
run-make/no-builtins-attribute/Makefile
|
||||
run-make/no-builtins-lto/Makefile
|
||||
run-make/no-cdylib-as-rdylib/Makefile
|
||||
run-make/no-duplicate-libs/Makefile
|
||||
run-make/no-intermediate-extras/Makefile
|
||||
run-make/obey-crate-type-flag/Makefile
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
# ignore-cross-compile
|
||||
include ../tools.mk
|
||||
|
||||
# Test that rustc will not attempt to link against a cdylib as if
|
||||
# it is a rust dylib when an rlib for the same crate is available.
|
||||
# Previously rustc didn't actually check if any further formats of
|
||||
# a crate which has been loaded are of the same version and if
|
||||
# they are actually valid. This caused a cdylib to be interpreted
|
||||
# as rust dylib as soon as the corresponding rlib was loaded. As
|
||||
# cdylibs don't export any rust symbols, linking would fail if
|
||||
# rustc decides to link against the cdylib rather than the rlib.
|
||||
|
||||
all:
|
||||
$(RUSTC) bar.rs --crate-type=rlib --crate-type=cdylib
|
||||
$(RUSTC) foo.rs -C prefer-dynamic
|
||||
$(call RUN,foo)
|
16
tests/run-make/no-cdylib-as-rdylib/rmake.rs
Normal file
16
tests/run-make/no-cdylib-as-rdylib/rmake.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// This test produces an rlib and a cdylib from bar.rs.
|
||||
// Then, foo.rs attempts to link to the bar library.
|
||||
// If the test passes, that means rustc favored the rlib and ignored the cdylib.
|
||||
// If the test fails, that is because the cdylib was picked, which does not export
|
||||
// any Rust symbols.
|
||||
// See https://github.com/rust-lang/rust/pull/113695
|
||||
|
||||
//@ ignore-cross-compile
|
||||
|
||||
use run_make_support::{run, rustc};
|
||||
|
||||
fn main() {
|
||||
rustc().input("bar.rs").crate_type("rlib").crate_type("cdylib").run();
|
||||
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
|
||||
run("foo");
|
||||
}
|
Loading…
Add table
Reference in a new issue