rewrite native-link-modifier-linker to rmake
This commit is contained in:
parent
5f2b47fcb6
commit
6fffe848e3
@ -142,7 +142,6 @@ run-make/missing-crate-dependency/Makefile
|
|||||||
run-make/mixing-libs/Makefile
|
run-make/mixing-libs/Makefile
|
||||||
run-make/msvc-opt-minsize/Makefile
|
run-make/msvc-opt-minsize/Makefile
|
||||||
run-make/native-link-modifier-bundle/Makefile
|
run-make/native-link-modifier-bundle/Makefile
|
||||||
run-make/native-link-modifier-verbatim-linker/Makefile
|
|
||||||
run-make/native-link-modifier-whole-archive/Makefile
|
run-make/native-link-modifier-whole-archive/Makefile
|
||||||
run-make/no-alloc-shim/Makefile
|
run-make/no-alloc-shim/Makefile
|
||||||
run-make/no-builtins-attribute/Makefile
|
run-make/no-builtins-attribute/Makefile
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
# ignore-cross-compile
|
|
||||||
# ignore-apple
|
|
||||||
|
|
||||||
include ../tools.mk
|
|
||||||
|
|
||||||
all:
|
|
||||||
# Verbatim allows specify precise name.
|
|
||||||
$(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_some_strange_name.ext
|
|
||||||
$(RUSTC) main.rs -l static:+verbatim=local_some_strange_name.ext
|
|
||||||
|
|
||||||
# With verbatim any other name cannot be used (local).
|
|
||||||
$(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/liblocal_native_dep.a
|
|
||||||
$(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_native_dep.a
|
|
||||||
$(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_native_dep.lib
|
|
||||||
$(RUSTC) main.rs -l static:+verbatim=local_native_dep 2>&1 | $(CGREP) "local_native_dep"
|
|
41
tests/run-make/native-link-modifier-verbatim-linker/rmake.rs
Normal file
41
tests/run-make/native-link-modifier-verbatim-linker/rmake.rs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// `verbatim` is a native link modifier that forces rustc to only accept libraries with
|
||||||
|
// a specified name. This test checks that this modifier works as intended.
|
||||||
|
// This test is the same as native-link-modifier-rustc, but without rlibs.
|
||||||
|
// See https://github.com/rust-lang/rust/issues/99425
|
||||||
|
|
||||||
|
//@ ignore-apple
|
||||||
|
// Reason: linking fails due to the unusual ".ext" staticlib name.
|
||||||
|
|
||||||
|
use run_make_support::rustc;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Verbatim allows for the specification of a precise name
|
||||||
|
// - in this case, the unconventional ".ext" extension.
|
||||||
|
rustc()
|
||||||
|
.input("local_native_dep.rs")
|
||||||
|
.crate_type("staticlib")
|
||||||
|
.output("local_some_strange_name.ext")
|
||||||
|
.run();
|
||||||
|
rustc().input("main.rs").arg("-lstatic:+verbatim=local_some_strange_name.ext").run();
|
||||||
|
|
||||||
|
// This section voluntarily avoids using static_lib_name helpers to be verbatim.
|
||||||
|
// With verbatim, even these common library names are refused
|
||||||
|
// - it wants local_native_dep without
|
||||||
|
// any file extensions.
|
||||||
|
rustc()
|
||||||
|
.input("local_native_dep.rs")
|
||||||
|
.crate_type("staticlib")
|
||||||
|
.output("liblocal_native_dep.a")
|
||||||
|
.run();
|
||||||
|
rustc().input("local_native_dep.rs").crate_type("staticlib").output("local_native_dep.a").run();
|
||||||
|
rustc()
|
||||||
|
.input("local_native_dep.rs")
|
||||||
|
.crate_type("staticlib")
|
||||||
|
.output("local_native_dep.lib")
|
||||||
|
.run();
|
||||||
|
rustc()
|
||||||
|
.input("main.rs")
|
||||||
|
.arg("-lstatic:+verbatim=local_native_dep")
|
||||||
|
.run_fail()
|
||||||
|
.assert_stderr_contains("local_native_dep");
|
||||||
|
}
|
@ -1,11 +1,13 @@
|
|||||||
// `verbatim` is a native link modifier that forces rustc to only accept libraries with
|
// `verbatim` is a native link modifier that forces rustc to only accept libraries with
|
||||||
// a specified name. This test checks that this modifier works as intended.
|
// a specified name. This test checks that this modifier works as intended.
|
||||||
|
// This test is the same as native-link-modifier-linker, but with rlibs.
|
||||||
// See https://github.com/rust-lang/rust/issues/99425
|
// See https://github.com/rust-lang/rust/issues/99425
|
||||||
|
|
||||||
use run_make_support::rustc;
|
use run_make_support::rustc;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Verbatim allows for the specification of a precise name - in this case, the unconventional ".ext" extension.
|
// Verbatim allows for the specification of a precise name
|
||||||
|
// - in this case, the unconventional ".ext" extension.
|
||||||
rustc()
|
rustc()
|
||||||
.input("upstream_native_dep.rs")
|
.input("upstream_native_dep.rs")
|
||||||
.crate_type("staticlib")
|
.crate_type("staticlib")
|
||||||
@ -18,7 +20,8 @@ fn main() {
|
|||||||
.run();
|
.run();
|
||||||
|
|
||||||
// This section voluntarily avoids using static_lib_name helpers to be verbatim.
|
// This section voluntarily avoids using static_lib_name helpers to be verbatim.
|
||||||
// With verbatim, even these common library names are refused - it wants upstream_native_dep without
|
// With verbatim, even these common library names are refused
|
||||||
|
// - it wants upstream_native_dep without
|
||||||
// any file extensions.
|
// any file extensions.
|
||||||
rustc()
|
rustc()
|
||||||
.input("upstream_native_dep.rs")
|
.input("upstream_native_dep.rs")
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// ignore-tidy-linelength
|
||||||
// When the compiled executable would conflict with a directory, a
|
// When the compiled executable would conflict with a directory, a
|
||||||
// rustc error should be displayed instead of a verbose and
|
// rustc error should be displayed instead of a verbose and
|
||||||
// potentially-confusing linker error.
|
// potentially-confusing linker error.
|
||||||
@ -7,5 +8,7 @@
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
fs_wrapper::create_dir("foo");
|
fs_wrapper::create_dir("foo");
|
||||||
rustc().input("foo.rs").output("foo").run_fail().assert_stderr_contains(r#"the generated executable for the input file "foo.rs" conflicts with the existing directory "foo""#);
|
rustc().input("foo.rs").output("foo").run_fail().assert_stderr_contains(
|
||||||
|
r#"the generated executable for the input file "foo.rs" conflicts with the existing directory "foo""#,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user