-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #132646 - jieyouxu:liberate-aarch64-gnu-debug, r=Kobzol
Liberate `aarch64-gnu-debug` from the shackles of `--test-args=clang` ### Changes - Drop `--test-args=clang` from `aarch64-gnu-debug` so run-make tests that are `//@ needs-force-clang-based-tests` no longer only run if their test name contains `clang` (which is a very cool footgun). - Reorganize run-make-suport library slightly to accommodate a raw gcc invocation. - Fix `tests/run-make/mte-ffi/rmake.rs` to use `gcc` instead of *a* c compiler. try-job: aarch64-gnu try-job: aarch64-gnu-debug
- Loading branch information
Showing
9 changed files
with
184 additions
and
111 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
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
97 changes: 97 additions & 0 deletions
97
src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.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,97 @@ | ||
use crate::{is_msvc, is_windows, uname}; | ||
|
||
/// `EXTRACFLAGS` | ||
pub fn extra_c_flags() -> Vec<&'static str> { | ||
// Adapted from tools.mk (trimmed): | ||
// | ||
// ```makefile | ||
// ifdef IS_WINDOWS | ||
// ifdef IS_MSVC | ||
// EXTRACFLAGS := ws2_32.lib userenv.lib advapi32.lib bcrypt.lib ntdll.lib synchronization.lib | ||
// else | ||
// EXTRACFLAGS := -lws2_32 -luserenv -lbcrypt -lntdll -lsynchronization | ||
// endif | ||
// else | ||
// ifeq ($(UNAME),Darwin) | ||
// EXTRACFLAGS := -lresolv | ||
// else | ||
// ifeq ($(UNAME),FreeBSD) | ||
// EXTRACFLAGS := -lm -lpthread -lgcc_s | ||
// else | ||
// ifeq ($(UNAME),SunOS) | ||
// EXTRACFLAGS := -lm -lpthread -lposix4 -lsocket -lresolv | ||
// else | ||
// ifeq ($(UNAME),OpenBSD) | ||
// EXTRACFLAGS := -lm -lpthread -lc++abi | ||
// else | ||
// EXTRACFLAGS := -lm -lrt -ldl -lpthread | ||
// endif | ||
// endif | ||
// endif | ||
// endif | ||
// endif | ||
// ``` | ||
|
||
if is_windows() { | ||
if is_msvc() { | ||
vec![ | ||
"ws2_32.lib", | ||
"userenv.lib", | ||
"advapi32.lib", | ||
"bcrypt.lib", | ||
"ntdll.lib", | ||
"synchronization.lib", | ||
] | ||
} else { | ||
vec!["-lws2_32", "-luserenv", "-lbcrypt", "-lntdll", "-lsynchronization"] | ||
} | ||
} else { | ||
match uname() { | ||
n if n.contains("Darwin") => vec!["-lresolv"], | ||
n if n.contains("FreeBSD") => vec!["-lm", "-lpthread", "-lgcc_s"], | ||
n if n.contains("SunOS") => { | ||
vec!["-lm", "-lpthread", "-lposix4", "-lsocket", "-lresolv"] | ||
} | ||
n if n.contains("OpenBSD") => vec!["-lm", "-lpthread", "-lc++abi"], | ||
_ => vec!["-lm", "-lrt", "-ldl", "-lpthread"], | ||
} | ||
} | ||
} | ||
|
||
/// `EXTRACXXFLAGS` | ||
pub fn extra_cxx_flags() -> Vec<&'static str> { | ||
// Adapted from tools.mk (trimmed): | ||
// | ||
// ```makefile | ||
// ifdef IS_WINDOWS | ||
// ifdef IS_MSVC | ||
// else | ||
// EXTRACXXFLAGS := -lstdc++ | ||
// endif | ||
// else | ||
// ifeq ($(UNAME),Darwin) | ||
// EXTRACXXFLAGS := -lc++ | ||
// else | ||
// ifeq ($(UNAME),FreeBSD) | ||
// else | ||
// ifeq ($(UNAME),SunOS) | ||
// else | ||
// ifeq ($(UNAME),OpenBSD) | ||
// else | ||
// EXTRACXXFLAGS := -lstdc++ | ||
// endif | ||
// endif | ||
// endif | ||
// endif | ||
// endif | ||
// ``` | ||
if is_windows() { | ||
if is_msvc() { vec![] } else { vec!["-lstdc++"] } | ||
} else { | ||
match &uname()[..] { | ||
"Darwin" => vec!["-lc++"], | ||
"FreeBSD" | "SunOS" | "OpenBSD" => vec![], | ||
_ => vec!["-lstdc++"], | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
src/tools/run-make-support/src/external_deps/c_cxx_compiler/gcc.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,66 @@ | ||
use std::path::Path; | ||
|
||
use crate::command::Command; | ||
|
||
/// Construct a gcc invocation. | ||
/// | ||
/// WARNING: This assumes *a* `gcc` exists in the environment and is suitable for use. | ||
#[track_caller] | ||
pub fn gcc() -> Gcc { | ||
Gcc::new() | ||
} | ||
|
||
/// A specific `gcc`. | ||
#[derive(Debug)] | ||
#[must_use] | ||
pub struct Gcc { | ||
cmd: Command, | ||
} | ||
|
||
crate::macros::impl_common_helpers!(Gcc); | ||
|
||
impl Gcc { | ||
/// Construct a `gcc` invocation. This assumes that *a* suitable `gcc` is available in the | ||
/// environment. | ||
/// | ||
/// Note that this does **not** prepopulate the `gcc` invocation with `CC_DEFAULT_FLAGS`. | ||
#[track_caller] | ||
pub fn new() -> Self { | ||
let cmd = Command::new("gcc"); | ||
Self { cmd } | ||
} | ||
|
||
/// Specify path of the input file. | ||
pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self { | ||
self.cmd.arg(path.as_ref()); | ||
self | ||
} | ||
|
||
/// Adds directories to the list that the linker searches for libraries. | ||
/// Equivalent to `-L`. | ||
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self { | ||
self.cmd.arg("-L"); | ||
self.cmd.arg(path.as_ref()); | ||
self | ||
} | ||
|
||
/// Specify `-o`. | ||
pub fn out_exe(&mut self, name: &str) -> &mut Self { | ||
self.cmd.arg("-o"); | ||
self.cmd.arg(name); | ||
self | ||
} | ||
|
||
/// Specify path of the output binary. | ||
pub fn output<P: AsRef<Path>>(&mut self, path: P) -> &mut Self { | ||
self.cmd.arg("-o"); | ||
self.cmd.arg(path.as_ref()); | ||
self | ||
} | ||
|
||
/// Optimize the output at `-O3`. | ||
pub fn optimize(&mut self) -> &mut Self { | ||
self.cmd.arg("-O3"); | ||
self | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/tools/run-make-support/src/external_deps/c_cxx_compiler/mod.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,7 @@ | ||
mod cc; | ||
mod extras; | ||
mod gcc; | ||
|
||
pub use cc::*; | ||
pub use extras::*; | ||
pub use gcc::*; |
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
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