Skip to content

Commit c424bc6

Browse files
committed
rewrite compiler-rt-works-on-mingw to rmake
1 parent 4dad2a3 commit c424bc6

File tree

5 files changed

+37
-11
lines changed

5 files changed

+37
-11
lines changed

src/tools/run-make-support/src/external_deps/cc.rs

+21
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ pub fn cc() -> Cc {
1515
Cc::new()
1616
}
1717

18+
/// Construct a new platform-specific CXX compiler invocation.
19+
#[track_caller]
20+
pub fn cxx() -> Cc {
21+
Cc::new_cxx()
22+
}
23+
1824
/// A platform-specific C compiler invocation builder. The specific C compiler used is
1925
/// passed down from compiletest.
2026
#[derive(Debug)]
@@ -44,6 +50,21 @@ impl Cc {
4450
Self { cmd }
4551
}
4652

53+
/// Construct a new platform-specific CXX compiler invocation.
54+
#[track_caller]
55+
pub fn new_cxx() -> Self {
56+
let compiler = env_var("CXX");
57+
58+
let mut cmd = Command::new(compiler);
59+
60+
let default_cflags = env_var("CXX_DEFAULT_FLAGS");
61+
for flag in default_cflags.split(char::is_whitespace) {
62+
cmd.arg(flag);
63+
}
64+
65+
Self { cmd }
66+
}
67+
4768
/// Specify path of the input file.
4869
pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
4970
self.cmd.arg(path.as_ref());

src/tools/run-make-support/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub use external_deps::{c_build, cc, clang, htmldocck, llvm, python, rustc, rust
4444

4545
// These rely on external dependencies.
4646
pub use c_build::{build_native_dynamic_lib, build_native_static_lib};
47-
pub use cc::{cc, extra_c_flags, extra_cxx_flags, Cc};
47+
pub use cc::{cc, cxx, extra_c_flags, extra_cxx_flags, Cc};
4848
pub use clang::{clang, Clang};
4949
pub use htmldocck::htmldocck;
5050
pub use llvm::{

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ run-make/branch-protection-check-IBT/Makefile
22
run-make/c-unwind-abi-catch-lib-panic/Makefile
33
run-make/cat-and-grep-sanity-check/Makefile
44
run-make/cdylib-dylib-linkage/Makefile
5-
run-make/compiler-rt-works-on-mingw/Makefile
65
run-make/cross-lang-lto-clang/Makefile
76
run-make/cross-lang-lto-pgo-smoketest/Makefile
87
run-make/cross-lang-lto-upstream-rlibs/Makefile

tests/run-make/compiler-rt-works-on-mingw/Makefile

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// `compiler-rt` ("runtime") is a suite of LLVM features compatible with rustc.
2+
// After building it was enabled on Windows-gnu in #29874, this test checks
3+
// that compilation and execution with it are successful.
4+
// See https://github.com./rust-lang/rust/pull/29478
5+
6+
//@ only-windows-gnu
7+
8+
use run_make_support::{cxx, is_msvc, llvm_ar, run, rustc, static_lib_name};
9+
10+
fn main() {
11+
cxx().input("foo.cpp").arg("-c").out_exe("foo.o").run();
12+
llvm_ar().obj_to_ar().output_input(static_lib_name("foo"), "foo.o").run();
13+
rustc().input("foo.rs").arg("-lfoo").arg("-lstdc++").run();
14+
run("foo");
15+
}

0 commit comments

Comments
 (0)