Skip to content

Commit

Permalink
rewrite native-link-modifier-linker to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jun 14, 2024
1 parent 5f2b47f commit e6fc319
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ run-make/missing-crate-dependency/Makefile
run-make/mixing-libs/Makefile
run-make/msvc-opt-minsize/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/no-alloc-shim/Makefile
run-make/no-builtins-attribute/Makefile
Expand Down
15 changes: 0 additions & 15 deletions tests/run-make/native-link-modifier-verbatim-linker/Makefile

This file was deleted.

36 changes: 36 additions & 0 deletions tests/run-make/native-link-modifier-verbatim-linker/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// `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

use run_make_support::rustc;

fn main() {
// Verbatim allows for the specification of a precise name - in this case, the unconventional ".ext" extension.

Check failure on line 9 in tests/run-make/native-link-modifier-verbatim-linker/rmake.rs

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

line longer than 100 chars
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

Check failure on line 18 in tests/run-make/native-link-modifier-verbatim-linker/rmake.rs

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

line longer than 100 chars
// 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");
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// `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-linker, but with rlibs.
// See https://github.com/rust-lang/rust/issues/99425

use run_make_support::rustc;
Expand Down

0 comments on commit e6fc319

Please sign in to comment.