From 63b78c86d93484a3721c53faf9bd60311063b64f Mon Sep 17 00:00:00 2001 From: Paolo Teti Date: Fri, 16 Feb 2018 17:31:25 +0100 Subject: [PATCH] Fix thumbv6m build (feature=c) 1. Avoid undefined references as: undefined reference to `__modsi3' undefined reference to `__umodsi3' 2. We can't remove assembly implementations that are not in the list --- library/compiler-builtins/build.rs | 5 ----- library/compiler-builtins/src/int/sdiv.rs | 7 +++++-- library/compiler-builtins/src/int/udiv.rs | 4 +++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/library/compiler-builtins/build.rs b/library/compiler-builtins/build.rs index 594afbded81..9eca26c1dd9 100644 --- a/library/compiler-builtins/build.rs +++ b/library/compiler-builtins/build.rs @@ -423,13 +423,8 @@ mod c { if llvm_target[0] == "thumbv6m" { sources.remove( &[ - "aeabi_cdcmp", - "aeabi_cfcmp", - "aeabi_dcmp", - "aeabi_fcmp", "clzdi2", "clzsi2", - "comparesf2", "divmodsi4", "modsi3", "switch16", diff --git a/library/compiler-builtins/src/int/sdiv.rs b/library/compiler-builtins/src/int/sdiv.rs index 2f09bd51d91..2de73b0eab7 100644 --- a/library/compiler-builtins/src/int/sdiv.rs +++ b/library/compiler-builtins/src/int/sdiv.rs @@ -72,7 +72,9 @@ intrinsics! { a.div(b) } - #[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios")))] + #[use_c_shim_if(all(target_arch = "arm", + not(target_os = "ios")), + not(thumbv6m))] pub extern "C" fn __modsi3(a: i32, b: i32) -> i32 { a.mod_(b) } @@ -87,7 +89,8 @@ intrinsics! { a.mod_(b) } - #[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios")))] + #[use_c_shim_if(all(target_arch = "arm", + 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 1d93e177b5b..4382460e782 100644 --- a/library/compiler-builtins/src/int/udiv.rs +++ b/library/compiler-builtins/src/int/udiv.rs @@ -209,7 +209,9 @@ intrinsics! { (q << 1) | carry } - #[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios")))] + #[use_c_shim_if(all(target_arch = "arm", + not(target_os = "ios"), + not(thumbv6m)))] /// Returns `n % d` pub extern "C" fn __umodsi3(n: u32, d: u32) -> u32 { let q = __udivsi3(n, d);