From 6310b74d854eb354b344afbde6ea62be7fead78d Mon Sep 17 00:00:00 2001 From: Jordan Rhee Date: Thu, 5 Jul 2018 11:20:34 -0700 Subject: [PATCH 1/3] Support windows/arm target --- library/compiler-builtins/build.rs | 4 ++-- library/compiler-builtins/src/arm.rs | 2 +- library/compiler-builtins/src/int/sdiv.rs | 5 +++-- library/compiler-builtins/src/int/udiv.rs | 2 ++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/library/compiler-builtins/build.rs b/library/compiler-builtins/build.rs index fba4091124a9..111a38b5e6bf 100644 --- a/library/compiler-builtins/build.rs +++ b/library/compiler-builtins/build.rs @@ -297,7 +297,7 @@ mod c { } } - if target_arch == "arm" && target_os != "ios" { + if target_arch == "arm" && target_os != "ios" && target_env != "msvc" { sources.extend( &[ "arm/aeabi_div0.c", @@ -348,7 +348,7 @@ mod c { } } - if llvm_target[0] == "armv7" { + if llvm_target[0] == "armv7" && target_env != "msvc" { sources.extend( &[ "arm/sync_fetch_and_add_4.S", diff --git a/library/compiler-builtins/src/arm.rs b/library/compiler-builtins/src/arm.rs index dbd6f87ca522..9e43aec7d345 100644 --- a/library/compiler-builtins/src/arm.rs +++ b/library/compiler-builtins/src/arm.rs @@ -4,7 +4,7 @@ use core::intrinsics; // calling convention which can't be implemented using a normal Rust function. // NOTE The only difference between the iOS and non-iOS versions of those functions is that the iOS // versions use 3 leading underscores in the names of called functions instead of 2. -#[cfg(not(target_os = "ios"))] +#[cfg(not(any(target_os = "ios", target_env = "msvc")))] #[naked] #[cfg_attr(not(feature = "mangled-names"), no_mangle)] pub unsafe fn __aeabi_uidivmod() { diff --git a/library/compiler-builtins/src/int/sdiv.rs b/library/compiler-builtins/src/int/sdiv.rs index 2de73b0eab7c..89bb51a47b34 100644 --- a/library/compiler-builtins/src/int/sdiv.rs +++ b/library/compiler-builtins/src/int/sdiv.rs @@ -73,7 +73,8 @@ intrinsics! { } #[use_c_shim_if(all(target_arch = "arm", - not(target_os = "ios")), + not(target_os = "ios"), + not(target_env = "msvc")), not(thumbv6m))] pub extern "C" fn __modsi3(a: i32, b: i32) -> i32 { a.mod_(b) @@ -89,7 +90,7 @@ intrinsics! { a.mod_(b) } - #[use_c_shim_if(all(target_arch = "arm", + #[use_c_shim_if(all(target_arch = "arm", not(target_env = "msvc"), not(target_os = "ios"), not(thumbv6m)))] pub extern "C" fn __divmodsi4(a: i32, b: i32, rem: &mut i32) -> i32 { a.divmod(b, rem, |a, b| __divsi3(a, b)) diff --git a/library/compiler-builtins/src/int/udiv.rs b/library/compiler-builtins/src/int/udiv.rs index 4382460e7828..a2572227f970 100644 --- a/library/compiler-builtins/src/int/udiv.rs +++ b/library/compiler-builtins/src/int/udiv.rs @@ -211,6 +211,7 @@ intrinsics! { #[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios"), + not(target_env = "msvc"), not(thumbv6m)))] /// Returns `n % d` pub extern "C" fn __umodsi3(n: u32, d: u32) -> u32 { @@ -220,6 +221,7 @@ intrinsics! { #[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios"), + not(target_env = "msvc"), not(thumbv6m)))] /// Returns `n / d` and sets `*rem = n % d` pub extern "C" fn __udivmodsi4(n: u32, d: u32, rem: Option<&mut u32>) -> u32 { From 19a7eedbf3143f77a67e177ff9e2c7670f3e9bf5 Mon Sep 17 00:00:00 2001 From: Jordan Rhee Date: Thu, 6 Sep 2018 09:24:52 -0700 Subject: [PATCH 2/3] Try undoing unnecessary change --- library/compiler-builtins/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/compiler-builtins/build.rs b/library/compiler-builtins/build.rs index 111a38b5e6bf..45060a4e6e34 100644 --- a/library/compiler-builtins/build.rs +++ b/library/compiler-builtins/build.rs @@ -348,7 +348,7 @@ mod c { } } - if llvm_target[0] == "armv7" && target_env != "msvc" { + if llvm_target[0] == "armv7" /* XXX && target_env != "msvc" */ { sources.extend( &[ "arm/sync_fetch_and_add_4.S", From 71c5701c58f8744699690b450ca62ad53f1fc8ad Mon Sep 17 00:00:00 2001 From: Jordan Rhee Date: Fri, 7 Sep 2018 08:27:38 -0700 Subject: [PATCH 3/3] Remove unnecessary check --- library/compiler-builtins/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/compiler-builtins/build.rs b/library/compiler-builtins/build.rs index 45060a4e6e34..87b5e049063f 100644 --- a/library/compiler-builtins/build.rs +++ b/library/compiler-builtins/build.rs @@ -348,7 +348,7 @@ mod c { } } - if llvm_target[0] == "armv7" /* XXX && target_env != "msvc" */ { + if llvm_target[0] == "armv7" { sources.extend( &[ "arm/sync_fetch_and_add_4.S",