Don't test mangled names on thumb
We are both the "real compiler-rt" and the "to be tested one".
This commit is contained in:
parent
5c74fb13d9
commit
c193113721
@ -18,6 +18,7 @@ compiler-builtins = []
|
|||||||
default = ["compiler-builtins"]
|
default = ["compiler-builtins"]
|
||||||
mem = []
|
mem = []
|
||||||
rustbuild = ["compiler-builtins"]
|
rustbuild = ["compiler-builtins"]
|
||||||
|
mangled-names = []
|
||||||
|
|
||||||
# generate tests
|
# generate tests
|
||||||
#
|
#
|
||||||
|
@ -51,10 +51,11 @@ case $1 in
|
|||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
cargo test --no-default-features --features gen-tests --target $1
|
run="cargo test --no-default-features --target $1"
|
||||||
cargo test --no-default-features --features 'gen-tests c' --target $1
|
$run --features 'gen-tests mangled-names'
|
||||||
cargo test --no-default-features --features gen-tests --target $1 --release
|
$run --features 'gen-tests mangled-names' --release
|
||||||
cargo test --no-default-features --features 'gen-tests c' --target $1 --release
|
$run --features 'gen-tests mangled-names c'
|
||||||
|
$run --features 'gen-tests mangled-names c' --release
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
37
src/arm.rs
37
src/arm.rs
@ -1,4 +1,3 @@
|
|||||||
#[cfg(not(feature = "gen-tests"))]
|
|
||||||
use core::intrinsics;
|
use core::intrinsics;
|
||||||
|
|
||||||
#[cfg(feature = "mem")]
|
#[cfg(feature = "mem")]
|
||||||
@ -7,8 +6,7 @@ use mem::{memcpy, memmove, memset};
|
|||||||
// NOTE This function and the ones below are implemented using assembly because they using a custom
|
// NOTE This function and the ones below are implemented using assembly because they using a custom
|
||||||
// calling convention which can't be implemented using a normal Rust function
|
// calling convention which can't be implemented using a normal Rust function
|
||||||
#[naked]
|
#[naked]
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
#[cfg(not(feature = "gen-tests"))]
|
|
||||||
pub unsafe fn __aeabi_uidivmod() {
|
pub unsafe fn __aeabi_uidivmod() {
|
||||||
asm!("push {lr}
|
asm!("push {lr}
|
||||||
sub sp, sp, #4
|
sub sp, sp, #4
|
||||||
@ -21,8 +19,7 @@ pub unsafe fn __aeabi_uidivmod() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[naked]
|
#[naked]
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
#[cfg(not(feature = "gen-tests"))]
|
|
||||||
pub unsafe fn __aeabi_uldivmod() {
|
pub unsafe fn __aeabi_uldivmod() {
|
||||||
asm!("push {r4, lr}
|
asm!("push {r4, lr}
|
||||||
sub sp, sp, #16
|
sub sp, sp, #16
|
||||||
@ -37,8 +34,7 @@ pub unsafe fn __aeabi_uldivmod() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[naked]
|
#[naked]
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
#[cfg(not(feature = "gen-tests"))]
|
|
||||||
pub unsafe fn __aeabi_idivmod() {
|
pub unsafe fn __aeabi_idivmod() {
|
||||||
asm!("push {r0, r1, r4, lr}
|
asm!("push {r0, r1, r4, lr}
|
||||||
bl __divsi3
|
bl __divsi3
|
||||||
@ -50,8 +46,7 @@ pub unsafe fn __aeabi_idivmod() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[naked]
|
#[naked]
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
#[cfg(not(feature = "gen-tests"))]
|
|
||||||
pub unsafe fn __aeabi_ldivmod() {
|
pub unsafe fn __aeabi_ldivmod() {
|
||||||
asm!("push {r4, lr}
|
asm!("push {r4, lr}
|
||||||
sub sp, sp, #16
|
sub sp, sp, #16
|
||||||
@ -75,55 +70,55 @@ extern "C" {
|
|||||||
|
|
||||||
// FIXME: The `*4` and `*8` variants should be defined as aliases.
|
// FIXME: The `*4` and `*8` variants should be defined as aliases.
|
||||||
|
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memcpy(dest: *mut u8, src: *const u8, n: usize) {
|
pub unsafe extern "aapcs" fn __aeabi_memcpy(dest: *mut u8, src: *const u8, n: usize) {
|
||||||
memcpy(dest, src, n);
|
memcpy(dest, src, n);
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memcpy4(dest: *mut u8, src: *const u8, n: usize) {
|
pub unsafe extern "aapcs" fn __aeabi_memcpy4(dest: *mut u8, src: *const u8, n: usize) {
|
||||||
memcpy(dest, src, n);
|
memcpy(dest, src, n);
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memcpy8(dest: *mut u8, src: *const u8, n: usize) {
|
pub unsafe extern "aapcs" fn __aeabi_memcpy8(dest: *mut u8, src: *const u8, n: usize) {
|
||||||
memcpy(dest, src, n);
|
memcpy(dest, src, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memmove(dest: *mut u8, src: *const u8, n: usize) {
|
pub unsafe extern "aapcs" fn __aeabi_memmove(dest: *mut u8, src: *const u8, n: usize) {
|
||||||
memmove(dest, src, n);
|
memmove(dest, src, n);
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memmove4(dest: *mut u8, src: *const u8, n: usize) {
|
pub unsafe extern "aapcs" fn __aeabi_memmove4(dest: *mut u8, src: *const u8, n: usize) {
|
||||||
memmove(dest, src, n);
|
memmove(dest, src, n);
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memmove8(dest: *mut u8, src: *const u8, n: usize) {
|
pub unsafe extern "aapcs" fn __aeabi_memmove8(dest: *mut u8, src: *const u8, n: usize) {
|
||||||
memmove(dest, src, n);
|
memmove(dest, src, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note the different argument order
|
// Note the different argument order
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memset(dest: *mut u8, n: usize, c: i32) {
|
pub unsafe extern "aapcs" fn __aeabi_memset(dest: *mut u8, n: usize, c: i32) {
|
||||||
memset(dest, c, n);
|
memset(dest, c, n);
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memset4(dest: *mut u8, n: usize, c: i32) {
|
pub unsafe extern "aapcs" fn __aeabi_memset4(dest: *mut u8, n: usize, c: i32) {
|
||||||
memset(dest, c, n);
|
memset(dest, c, n);
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memset8(dest: *mut u8, n: usize, c: i32) {
|
pub unsafe extern "aapcs" fn __aeabi_memset8(dest: *mut u8, n: usize, c: i32) {
|
||||||
memset(dest, c, n);
|
memset(dest, c, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memclr(dest: *mut u8, n: usize) {
|
pub unsafe extern "aapcs" fn __aeabi_memclr(dest: *mut u8, n: usize) {
|
||||||
memset(dest, 0, n);
|
memset(dest, 0, n);
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memclr4(dest: *mut u8, n: usize) {
|
pub unsafe extern "aapcs" fn __aeabi_memclr4(dest: *mut u8, n: usize) {
|
||||||
memset(dest, 0, n);
|
memset(dest, 0, n);
|
||||||
}
|
}
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "aapcs" fn __aeabi_memclr8(dest: *mut u8, n: usize) {
|
pub unsafe extern "aapcs" fn __aeabi_memclr8(dest: *mut u8, n: usize) {
|
||||||
memset(dest, 0, n);
|
memset(dest, 0, n);
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ macro_rules! intrinsics {
|
|||||||
$($rest:tt)*
|
$($rest:tt)*
|
||||||
) => (
|
) => (
|
||||||
$(#[$($attr)*])*
|
$(#[$($attr)*])*
|
||||||
#[cfg_attr(not(feature = "gen-tests"), no_mangle)]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub extern $abi fn $name( $($argname: $ty),* ) -> $ret {
|
pub extern $abi fn $name( $($argname: $ty),* ) -> $ret {
|
||||||
$($body)*
|
$($body)*
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ type c_int = i16;
|
|||||||
#[cfg(not(target_pointer_width = "16"))]
|
#[cfg(not(target_pointer_width = "16"))]
|
||||||
type c_int = i32;
|
type c_int = i32;
|
||||||
|
|
||||||
#[no_mangle]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "C" fn memcpy(dest: *mut u8,
|
pub unsafe extern "C" fn memcpy(dest: *mut u8,
|
||||||
src: *const u8,
|
src: *const u8,
|
||||||
n: usize)
|
n: usize)
|
||||||
@ -18,7 +18,7 @@ pub unsafe extern "C" fn memcpy(dest: *mut u8,
|
|||||||
dest
|
dest
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "C" fn memmove(dest: *mut u8,
|
pub unsafe extern "C" fn memmove(dest: *mut u8,
|
||||||
src: *const u8,
|
src: *const u8,
|
||||||
n: usize)
|
n: usize)
|
||||||
@ -41,7 +41,7 @@ pub unsafe extern "C" fn memmove(dest: *mut u8,
|
|||||||
dest
|
dest
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "C" fn memset(s: *mut u8, c: c_int, n: usize) -> *mut u8 {
|
pub unsafe extern "C" fn memset(s: *mut u8, c: c_int, n: usize) -> *mut u8 {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < n {
|
while i < n {
|
||||||
@ -51,7 +51,7 @@ pub unsafe extern "C" fn memset(s: *mut u8, c: c_int, n: usize) -> *mut u8 {
|
|||||||
s
|
s
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
|
||||||
pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 {
|
pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < n {
|
while i < n {
|
||||||
|
Loading…
Reference in New Issue
Block a user