diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 745f00c4f5276..e9f5e24f31281 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -56,13 +56,11 @@ run-make/libtest-junit/Makefile run-make/libtest-thread-limit/Makefile run-make/link-cfg/Makefile run-make/link-framework/Makefile -run-make/link-path-order/Makefile run-make/linkage-attr-on-static/Makefile run-make/long-linker-command-lines-cmd-exe/Makefile run-make/long-linker-command-lines/Makefile run-make/lto-linkage-used-attr/Makefile run-make/lto-no-link-whole-rlib/Makefile -run-make/lto-smoke-c/Makefile run-make/macos-deployment-target/Makefile run-make/macos-fat-archive/Makefile run-make/manual-link/Makefile diff --git a/tests/run-make/link-path-order/Makefile b/tests/run-make/link-path-order/Makefile deleted file mode 100644 index a3831a63ac7e5..0000000000000 --- a/tests/run-make/link-path-order/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -# Verifies that the -L arguments given to the linker is in the same order -# as the -L arguments on the rustc command line. - -CORRECT_DIR=$(TMPDIR)/correct -WRONG_DIR=$(TMPDIR)/wrong - -F := $(call NATIVE_STATICLIB_FILE,foo) - -all: $(call NATIVE_STATICLIB,correct) $(call NATIVE_STATICLIB,wrong) - mkdir -p $(CORRECT_DIR) $(WRONG_DIR) - mv $(call NATIVE_STATICLIB,correct) $(CORRECT_DIR)/$(F) - mv $(call NATIVE_STATICLIB,wrong) $(WRONG_DIR)/$(F) - $(RUSTC) main.rs -o $(TMPDIR)/should_succeed -L $(CORRECT_DIR) -L $(WRONG_DIR) - $(call RUN,should_succeed) - $(RUSTC) main.rs -o $(TMPDIR)/should_fail -L $(WRONG_DIR) -L $(CORRECT_DIR) - $(call FAIL,should_fail) diff --git a/tests/run-make/link-path-order/rmake.rs b/tests/run-make/link-path-order/rmake.rs new file mode 100644 index 0000000000000..c8e41b2bcf8ac --- /dev/null +++ b/tests/run-make/link-path-order/rmake.rs @@ -0,0 +1,33 @@ +// The order in which "library search path" `-L` arguments are given to the command line rustc +// is important. These arguments must match the order of the linker's arguments. In this test, +// fetching the Wrong library before the Correct one causes a function to return 0 instead of the +// expected 1, causing a runtime panic, as expected. +// See https://github.com/rust-lang/rust/pull/16904 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, path, rfs, run, run_fail, rustc, static_lib_name}; + +fn main() { + build_native_static_lib("correct"); + build_native_static_lib("wrong"); + rfs::create_dir("correct"); + rfs::create_dir("wrong"); + rfs::rename(static_lib_name("correct"), path("correct").join(static_lib_name("foo"))); + rfs::rename(static_lib_name("wrong"), path("wrong").join(static_lib_name("foo"))); + rustc() + .input("main.rs") + .output("should_succeed") + .library_search_path("correct") + .library_search_path("wrong") + .run(); + run("should_succeed"); + rustc() + .input("main.rs") + .output("should_fail") + .library_search_path("wrong") + .library_search_path("correct") + .run(); + run_fail("should_fail"); +} diff --git a/tests/run-make/lto-smoke-c/Makefile b/tests/run-make/lto-smoke-c/Makefile deleted file mode 100644 index f1ba3d95da292..0000000000000 --- a/tests/run-make/lto-smoke-c/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -# Apparently older versions of GCC segfault if -g is passed... -CC := $(CC:-g=) - -all: - $(RUSTC) foo.rs -C lto - $(CC) bar.c $(call STATICLIB,foo) \ - $(call OUT_EXE,bar) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,bar) diff --git a/tests/run-make/lto-smoke-c/rmake.rs b/tests/run-make/lto-smoke-c/rmake.rs new file mode 100644 index 0000000000000..70760f730c05f --- /dev/null +++ b/tests/run-make/lto-smoke-c/rmake.rs @@ -0,0 +1,20 @@ +// LLVM's link-time-optimization (LTO) is a useful feature added to Rust in response +// to #10741. This test uses this feature with `-C lto` alongside a native C library, +// and checks that compilation and execution is successful. +// See https://github.com/rust-lang/rust/issues/10741 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name}; + +fn main() { + rustc().input("foo.rs").arg("-Clto").run(); + cc().input("bar.c") + .arg(static_lib_name("foo")) + .out_exe("bar") + .args(extra_c_flags()) + .args(extra_cxx_flags()) + .run(); + run("bar"); +}