Fix Armv8-M Baseline compilation
Armv8-M Baseline, ie thumbv8m.base-none-eabi, is a superset of the Armv6-M architecture profile. As it shares almost the same instruction set, this commit copies the configuration for thumbv6m-none-eabi to enable it.
This commit is contained in:
parent
fafaacecd1
commit
c924aed0b9
11
build.rs
11
build.rs
|
@ -49,10 +49,11 @@ fn main() {
|
||||||
println!("cargo:rustc-cfg=thumb")
|
println!("cargo:rustc-cfg=thumb")
|
||||||
}
|
}
|
||||||
|
|
||||||
// compiler-rt `cfg`s away some intrinsics for thumbv6m because that target doesn't have full
|
// compiler-rt `cfg`s away some intrinsics for thumbv6m and thumbv8m.base because
|
||||||
// THUMBv2 support. We have to cfg our code accordingly.
|
// these targets do not have full Thumb-2 support but only original Thumb-1.
|
||||||
if llvm_target[0] == "thumbv6m" {
|
// We have to cfg our code accordingly.
|
||||||
println!("cargo:rustc-cfg=thumbv6m")
|
if llvm_target[0] == "thumbv6m" || llvm_target[0] == "thumbv8m.base" {
|
||||||
|
println!("cargo:rustc-cfg=thumb_1")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only emit the ARM Linux atomic emulation on pre-ARMv6 architectures.
|
// Only emit the ARM Linux atomic emulation on pre-ARMv6 architectures.
|
||||||
|
@ -407,7 +408,7 @@ mod c {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the assembly implementations that won't compile for the target
|
// Remove the assembly implementations that won't compile for the target
|
||||||
if llvm_target[0] == "thumbv6m" {
|
if llvm_target[0] == "thumbv6m" || llvm_target[0] == "thumbv8m.base" {
|
||||||
sources.remove(
|
sources.remove(
|
||||||
&[
|
&[
|
||||||
"clzdi2",
|
"clzdi2",
|
||||||
|
|
|
@ -74,8 +74,8 @@ intrinsics! {
|
||||||
|
|
||||||
#[use_c_shim_if(all(target_arch = "arm",
|
#[use_c_shim_if(all(target_arch = "arm",
|
||||||
not(target_os = "ios"),
|
not(target_os = "ios"),
|
||||||
not(target_env = "msvc")),
|
not(target_env = "msvc"),
|
||||||
not(thumbv6m))]
|
not(thumb_1)))]
|
||||||
pub extern "C" fn __modsi3(a: i32, b: i32) -> i32 {
|
pub extern "C" fn __modsi3(a: i32, b: i32) -> i32 {
|
||||||
a.mod_(b)
|
a.mod_(b)
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ intrinsics! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[use_c_shim_if(all(target_arch = "arm", not(target_env = "msvc"),
|
#[use_c_shim_if(all(target_arch = "arm", not(target_env = "msvc"),
|
||||||
not(target_os = "ios"), not(thumbv6m)))]
|
not(target_os = "ios"), not(thumb_1)))]
|
||||||
pub extern "C" fn __divmodsi4(a: i32, b: i32, rem: &mut i32) -> i32 {
|
pub extern "C" fn __divmodsi4(a: i32, b: i32, rem: &mut i32) -> i32 {
|
||||||
a.divmod(b, rem, |a, b| __divsi3(a, b))
|
a.divmod(b, rem, |a, b| __divsi3(a, b))
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ intrinsics! {
|
||||||
#[use_c_shim_if(all(target_arch = "arm",
|
#[use_c_shim_if(all(target_arch = "arm",
|
||||||
not(target_os = "ios"),
|
not(target_os = "ios"),
|
||||||
not(target_env = "msvc"),
|
not(target_env = "msvc"),
|
||||||
not(thumbv6m)))]
|
not(thumb_1)))]
|
||||||
/// Returns `n % d`
|
/// Returns `n % d`
|
||||||
pub extern "C" fn __umodsi3(n: u32, d: u32) -> u32 {
|
pub extern "C" fn __umodsi3(n: u32, d: u32) -> u32 {
|
||||||
let q = __udivsi3(n, d);
|
let q = __udivsi3(n, d);
|
||||||
|
@ -222,7 +222,7 @@ intrinsics! {
|
||||||
#[use_c_shim_if(all(target_arch = "arm",
|
#[use_c_shim_if(all(target_arch = "arm",
|
||||||
not(target_os = "ios"),
|
not(target_os = "ios"),
|
||||||
not(target_env = "msvc"),
|
not(target_env = "msvc"),
|
||||||
not(thumbv6m)))]
|
not(thumb_1)))]
|
||||||
/// Returns `n / d` and sets `*rem = n % d`
|
/// Returns `n / d` and sets `*rem = n % d`
|
||||||
pub extern "C" fn __udivmodsi4(n: u32, d: u32, rem: Option<&mut u32>) -> u32 {
|
pub extern "C" fn __udivmodsi4(n: u32, d: u32, rem: Option<&mut u32>) -> u32 {
|
||||||
let q = __udivsi3(n, d);
|
let q = __udivsi3(n, d);
|
||||||
|
|
Loading…
Reference in New Issue