Skip to content

Commit daad966

Browse files
committed
Some changes necessary for Windows support
cc rust-lang#977
1 parent b614448 commit daad966

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

config.sh

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ fi
1212

1313
HOST_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
1414
TARGET_TRIPLE=$HOST_TRIPLE
15+
#TARGET_TRIPLE="x86_64-pc-windows-gnu"
1516
#TARGET_TRIPLE="aarch64-unknown-linux-gnu"
1617

1718
linker=''
@@ -21,6 +22,9 @@ if [[ "$HOST_TRIPLE" != "$TARGET_TRIPLE" ]]; then
2122
# We are cross-compiling for aarch64. Use the correct linker and run tests in qemu.
2223
linker='-Clinker=aarch64-linux-gnu-gcc'
2324
RUN_WRAPPER='qemu-aarch64 -L /usr/aarch64-linux-gnu'
25+
elif [[ "$TARGET_TRIPLE" == "x86_64-pc-windows-gnu" ]]; then
26+
# We are cross-compiling for Windows. Run tests in wine.
27+
RUN_WRAPPER='wine'
2428
else
2529
echo "Unknown non-native platform"
2630
fi

src/abi/mod.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,12 @@ fn clif_sig_from_fn_sig<'tcx>(
8585
requires_caller_location: bool,
8686
) -> Signature {
8787
let abi = match sig.abi {
88-
Abi::System => {
89-
if tcx.sess.target.target.options.is_like_windows {
90-
unimplemented!()
91-
} else {
92-
Abi::C
93-
}
94-
}
88+
Abi::System => Abi::C,
9589
abi => abi,
9690
};
9791
let (call_conv, inputs, output): (CallConv, Vec<Ty<'tcx>>, Ty<'tcx>) = match abi {
9892
Abi::Rust => (CallConv::triple_default(triple), sig.inputs().to_vec(), sig.output()),
99-
Abi::C => (CallConv::triple_default(triple), sig.inputs().to_vec(), sig.output()),
93+
Abi::C | Abi::Unadjusted => (CallConv::triple_default(triple), sig.inputs().to_vec(), sig.output()),
10094
Abi::RustCall => {
10195
assert_eq!(sig.inputs().len(), 2);
10296
let extra_args = match sig.inputs().last().unwrap().kind {

src/base.rs

+11
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,17 @@ fn trans_stmt<'tcx>(
679679

680680
crate::trap::trap_unimplemented(fx, "_xgetbv arch intrinsic is not supported");
681681
}
682+
// ___chkstk, ___chkstk_ms and __alloca are only used on Windows
683+
_ if fx.tcx.symbol_name(fx.instance).name.as_str().starts_with("___chkstk") => {
684+
crate::trap::trap_unimplemented(fx, "Stack probes are not supported");
685+
}
686+
_ if fx.tcx.symbol_name(fx.instance).name.as_str() == "__alloca" => {
687+
crate::trap::trap_unimplemented(fx, "Alloca is not supported");
688+
}
689+
// Used in sys::windows::abort_internal
690+
"int $$0x29" => {
691+
crate::trap::trap_unimplemented(fx, "Windows abort");
692+
}
682693
_ => unimpl_fatal!(fx.tcx, stmt.source_info.span, "Inline assembly is not supported"),
683694
}
684695
}

0 commit comments

Comments
 (0)