-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite native-link-modifier-linker to rmake
- Loading branch information
Showing
5 changed files
with
50 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
tests/run-make/native-link-modifier-verbatim-linker/Makefile
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
tests/run-make/native-link-modifier-verbatim-linker/rmake.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters