Some changes necessary for Windows support

cc #977
This commit is contained in:
bjorn3 2020-06-16 11:36:39 +02:00
parent b6144483ef
commit daad966be7
3 changed files with 17 additions and 8 deletions

View File

@ -12,6 +12,7 @@ fi
HOST_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
TARGET_TRIPLE=$HOST_TRIPLE
#TARGET_TRIPLE="x86_64-pc-windows-gnu"
#TARGET_TRIPLE="aarch64-unknown-linux-gnu"
linker=''
@ -21,6 +22,9 @@ if [[ "$HOST_TRIPLE" != "$TARGET_TRIPLE" ]]; then
# We are cross-compiling for aarch64. Use the correct linker and run tests in qemu.
linker='-Clinker=aarch64-linux-gnu-gcc'
RUN_WRAPPER='qemu-aarch64 -L /usr/aarch64-linux-gnu'
elif [[ "$TARGET_TRIPLE" == "x86_64-pc-windows-gnu" ]]; then
# We are cross-compiling for Windows. Run tests in wine.
RUN_WRAPPER='wine'
else
echo "Unknown non-native platform"
fi

View File

@ -85,18 +85,12 @@ fn clif_sig_from_fn_sig<'tcx>(
requires_caller_location: bool,
) -> Signature {
let abi = match sig.abi {
Abi::System => {
if tcx.sess.target.target.options.is_like_windows {
unimplemented!()
} else {
Abi::C
}
}
Abi::System => Abi::C,
abi => abi,
};
let (call_conv, inputs, output): (CallConv, Vec<Ty<'tcx>>, Ty<'tcx>) = match abi {
Abi::Rust => (CallConv::triple_default(triple), sig.inputs().to_vec(), sig.output()),
Abi::C => (CallConv::triple_default(triple), sig.inputs().to_vec(), sig.output()),
Abi::C | Abi::Unadjusted => (CallConv::triple_default(triple), sig.inputs().to_vec(), sig.output()),
Abi::RustCall => {
assert_eq!(sig.inputs().len(), 2);
let extra_args = match sig.inputs().last().unwrap().kind {

View File

@ -679,6 +679,17 @@ fn is_fat_ptr<'tcx>(
crate::trap::trap_unimplemented(fx, "_xgetbv arch intrinsic is not supported");
}
// ___chkstk, ___chkstk_ms and __alloca are only used on Windows
_ if fx.tcx.symbol_name(fx.instance).name.as_str().starts_with("___chkstk") => {
crate::trap::trap_unimplemented(fx, "Stack probes are not supported");
}
_ if fx.tcx.symbol_name(fx.instance).name.as_str() == "__alloca" => {
crate::trap::trap_unimplemented(fx, "Alloca is not supported");
}
// Used in sys::windows::abort_internal
"int $$0x29" => {
crate::trap::trap_unimplemented(fx, "Windows abort");
}
_ => unimpl_fatal!(fx.tcx, stmt.source_info.span, "Inline assembly is not supported"),
}
}