Add cygwin support
Co-authored-by: Ookiineko <chiisaineko@protonmail.com>
This commit is contained in:
parent
890cd1e0f9
commit
f5f09d2f4b
5 changed files with 27 additions and 21 deletions
|
|
@ -575,7 +575,7 @@ mod c {
|
|||
("__fe_raise_inexact", "fp_mode.c"),
|
||||
]);
|
||||
|
||||
if target.os != "windows" {
|
||||
if target.os != "windows" && target.os != "cygwin" {
|
||||
sources.extend(&[("__multc3", "multc3.c")]);
|
||||
}
|
||||
}
|
||||
|
|
@ -608,13 +608,15 @@ mod c {
|
|||
sources.remove(&["__aeabi_cdcmp", "__aeabi_cfcmp"]);
|
||||
}
|
||||
|
||||
// Android uses emulated TLS so we need a runtime support function.
|
||||
if target.os == "android" {
|
||||
// Android and Cygwin uses emulated TLS so we need a runtime support function.
|
||||
if target.os == "android" || target.os == "cygwin" {
|
||||
sources.extend(&[("__emutls_get_address", "emutls.c")]);
|
||||
}
|
||||
|
||||
// Work around a bug in the NDK headers (fixed in
|
||||
// https://r.android.com/2038949 which will be released in a future
|
||||
// NDK version) by providing a definition of LONG_BIT.
|
||||
// Work around a bug in the NDK headers (fixed in
|
||||
// https://r.android.com/2038949 which will be released in a future
|
||||
// NDK version) by providing a definition of LONG_BIT.
|
||||
if target.os == "android" {
|
||||
cfg.define("LONG_BIT", "(8 * sizeof(long))");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -673,17 +673,17 @@ pub fn __aeabi_unwind_cpp_pr0() {}
|
|||
#[no_mangle]
|
||||
pub fn __aeabi_unwind_cpp_pr1() {}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[cfg(not(any(windows, target_os = "cygwin")))]
|
||||
#[allow(non_snake_case)]
|
||||
#[no_mangle]
|
||||
pub fn _Unwind_Resume() {}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[cfg(not(any(windows, target_os = "cygwin")))]
|
||||
#[lang = "eh_personality"]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn eh_personality() {}
|
||||
|
||||
#[cfg(all(windows, target_env = "gnu"))]
|
||||
#[cfg(any(all(windows, target_env = "gnu"), target_os = "cygwin"))]
|
||||
mod mingw_unwinding {
|
||||
#[no_mangle]
|
||||
pub fn rust_eh_personality() {}
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ macro_rules! intrinsics {
|
|||
|
||||
$($rest:tt)*
|
||||
) => (
|
||||
#[cfg(all(any(windows, all(target_os = "uefi", target_arch = "x86_64")), target_pointer_width = "64"))]
|
||||
#[cfg(all(any(windows, target_os = "cygwin", all(target_os = "uefi", target_arch = "x86_64")), target_pointer_width = "64"))]
|
||||
intrinsics! {
|
||||
$(#[$($attr)*])*
|
||||
pub extern "unadjusted" fn $name( $($argname: $ty),* ) $(-> $ret)? {
|
||||
|
|
@ -201,7 +201,7 @@ macro_rules! intrinsics {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(all(any(windows, all(target_os = "uefi", target_arch = "x86_64")), target_pointer_width = "64")))]
|
||||
#[cfg(not(all(any(windows, target_os = "cygwin", all(target_os = "uefi", target_arch = "x86_64")), target_pointer_width = "64")))]
|
||||
intrinsics! {
|
||||
$(#[$($attr)*])*
|
||||
pub extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
|
||||
|
|
@ -257,7 +257,7 @@ macro_rules! intrinsics {
|
|||
#[cfg(all(target_vendor = "apple", any(target_arch = "x86", target_arch = "x86_64"), not(feature = "mangled-names")))]
|
||||
mod $name {
|
||||
#[no_mangle]
|
||||
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
|
||||
#[cfg_attr(not(any(all(windows, target_env = "gnu"), target_os = "cygwin")), linkage = "weak")]
|
||||
$(#[$($attr)*])*
|
||||
extern $abi fn $name( $($argname: u16),* ) $(-> $ret)? {
|
||||
super::$name($(f16::from_bits($argname)),*)
|
||||
|
|
@ -293,7 +293,7 @@ macro_rules! intrinsics {
|
|||
#[cfg(all(target_vendor = "apple", any(target_arch = "x86", target_arch = "x86_64"), not(feature = "mangled-names")))]
|
||||
mod $name {
|
||||
#[no_mangle]
|
||||
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
|
||||
#[cfg_attr(not(any(all(windows, target_env = "gnu"), target_os = "cygwin")), linkage = "weak")]
|
||||
$(#[$($attr)*])*
|
||||
extern $abi fn $name( $($argname: $ty),* ) -> u16 {
|
||||
super::$name($($argname),*).to_bits()
|
||||
|
|
@ -334,7 +334,7 @@ macro_rules! intrinsics {
|
|||
#[cfg(all(target_arch = "arm", not(feature = "mangled-names")))]
|
||||
mod $name {
|
||||
#[no_mangle]
|
||||
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
|
||||
#[cfg_attr(not(any(all(windows, target_env = "gnu"), target_os = "cygwin")), linkage = "weak")]
|
||||
$(#[$($attr)*])*
|
||||
extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
|
||||
super::$name($($argname),*)
|
||||
|
|
@ -344,7 +344,7 @@ macro_rules! intrinsics {
|
|||
#[cfg(all(target_arch = "arm", not(feature = "mangled-names")))]
|
||||
mod $alias {
|
||||
#[no_mangle]
|
||||
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
|
||||
#[cfg_attr(not(any(all(windows, target_env = "gnu"), target_os = "cygwin")), linkage = "weak")]
|
||||
$(#[$($attr)*])*
|
||||
extern "aapcs" fn $alias( $($argname: $ty),* ) $(-> $ret)? {
|
||||
super::$name($($argname),*)
|
||||
|
|
@ -411,7 +411,7 @@ macro_rules! intrinsics {
|
|||
mod $name {
|
||||
$(#[$($attr)*])*
|
||||
#[no_mangle]
|
||||
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
|
||||
#[cfg_attr(not(any(all(windows, target_env = "gnu"), target_os = "cygwin")), linkage = "weak")]
|
||||
unsafe extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
|
||||
super::$name($($argname),*)
|
||||
}
|
||||
|
|
@ -436,7 +436,7 @@ macro_rules! intrinsics {
|
|||
#[naked]
|
||||
$(#[$($attr)*])*
|
||||
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
|
||||
#[cfg_attr(not(any(all(windows, target_env = "gnu"), target_os = "cygwin")), linkage = "weak")]
|
||||
pub unsafe extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
|
||||
$($body)*
|
||||
}
|
||||
|
|
@ -503,7 +503,7 @@ macro_rules! intrinsics {
|
|||
mod $name {
|
||||
$(#[$($attr)*])*
|
||||
#[no_mangle]
|
||||
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
|
||||
#[cfg_attr(not(any(all(windows, target_env = "gnu"), target_os = "cygwin")), linkage = "weak")]
|
||||
$(unsafe $($empty)?)? extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
|
||||
super::$name($($argname),*)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@
|
|||
//! be more than welcome to accept such a change!
|
||||
|
||||
#![cfg(not(feature = "mangled-names"))]
|
||||
// Windows already has builtins to do this.
|
||||
#![cfg(not(windows))]
|
||||
// Windows and Cygwin already has builtins to do this.
|
||||
#![cfg(not(any(windows, target_os = "cygwin")))]
|
||||
// All these builtins require assembly
|
||||
#![cfg(not(feature = "no-asm"))]
|
||||
// We only define stack probing for these architectures today.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@ use core::intrinsics;
|
|||
intrinsics! {
|
||||
#[naked]
|
||||
#[cfg(all(
|
||||
any(all(windows, target_env = "gnu"), target_os = "uefi"),
|
||||
any(
|
||||
all(windows, target_env = "gnu"),
|
||||
target_os = "cygwin",
|
||||
target_os = "uefi"
|
||||
),
|
||||
not(feature = "no-asm")
|
||||
))]
|
||||
pub unsafe extern "C" fn ___chkstk_ms() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue