From ee70ac6d85ad5c8eafb0a4630acfe22119788f5b Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 19 Jan 2013 05:33:55 +0000 Subject: Add the required __aeabi_* functions to libc. The floating point functions are here rather than compiler-rt because the libc softfloat code allows us to set the rounding mode. --- lib/libc/arm/Makefile.inc | 2 + lib/libc/arm/aeabi/Makefile.inc | 11 ++++ lib/libc/arm/aeabi/Symbol.map | 47 ++++++++++++++++ lib/libc/arm/aeabi/aeabi_atexit.c | 38 +++++++++++++ lib/libc/arm/aeabi/aeabi_double.c | 101 ++++++++++++++++++++++++++++++++++ lib/libc/arm/aeabi/aeabi_float.c | 101 ++++++++++++++++++++++++++++++++++ lib/libc/arm/aeabi/aeabi_unwind_cpp.c | 61 ++++++++++++++++++++ 7 files changed, 361 insertions(+) create mode 100644 lib/libc/arm/aeabi/Makefile.inc create mode 100644 lib/libc/arm/aeabi/Symbol.map create mode 100644 lib/libc/arm/aeabi/aeabi_atexit.c create mode 100644 lib/libc/arm/aeabi/aeabi_double.c create mode 100644 lib/libc/arm/aeabi/aeabi_float.c create mode 100644 lib/libc/arm/aeabi/aeabi_unwind_cpp.c (limited to 'lib/libc/arm') diff --git a/lib/libc/arm/Makefile.inc b/lib/libc/arm/Makefile.inc index dafc8d6..1ae1298 100644 --- a/lib/libc/arm/Makefile.inc +++ b/lib/libc/arm/Makefile.inc @@ -12,5 +12,7 @@ SYM_MAPS+=${.CURDIR}/arm/Symbol.map .if ${MK_ARM_EABI} == "no" # This contains the symbols that were removed when moving to the ARM EABI SYM_MAPS+=${.CURDIR}/arm/Symbol_oabi.map +.else +.include "${.CURDIR}/arm/aeabi/Makefile.inc" .endif diff --git a/lib/libc/arm/aeabi/Makefile.inc b/lib/libc/arm/aeabi/Makefile.inc new file mode 100644 index 0000000..ac147c0 --- /dev/null +++ b/lib/libc/arm/aeabi/Makefile.inc @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/arm/aeabi + +SRCS+= aeabi_atexit.c \ + aeabi_double.c \ + aeabi_float.c \ + aeabi_unwind_cpp.c + +SYM_MAPS+=${.CURDIR}/arm/aeabi/Symbol.map + diff --git a/lib/libc/arm/aeabi/Symbol.map b/lib/libc/arm/aeabi/Symbol.map new file mode 100644 index 0000000..9493427 --- /dev/null +++ b/lib/libc/arm/aeabi/Symbol.map @@ -0,0 +1,47 @@ +/* + * $FreeBSD$ + */ + +/* + * This only needs to contain AEABI symbols that are not listed in + * symbol maps from other parts of libc (i.e., not found in + * stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...). + */ +FBSDprivate_1.0 { + __aeabi_atexit; + + __aeabi_dcmpeq; + __aeabi_dcmplt; + __aeabi_dcmple; + __aeabi_dcmpge; + __aeabi_dcmpgt; + __aeabi_dcmpun; + + __aeabi_d2iz; + __aeabi_d2f; + + __aeabi_dadd; + __aeabi_ddiv; + __aeabi_dmul; + __aeabi_dsub; + + + __aeabi_fcmpeq; + __aeabi_fcmplt; + __aeabi_fcmple; + __aeabi_fcmpge; + __aeabi_fcmpgt; + __aeabi_fcmpun; + + __aeabi_f2iz; + __aeabi_f2d; + + __aeabi_fadd; + __aeabi_fdiv; + __aeabi_fmul; + __aeabi_fsub; + + + __aeabi_i2d; + __aeabi_i2f; +}; diff --git a/lib/libc/arm/aeabi/aeabi_atexit.c b/lib/libc/arm/aeabi/aeabi_atexit.c new file mode 100644 index 0000000..8502595 --- /dev/null +++ b/lib/libc/arm/aeabi/aeabi_atexit.c @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2012 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +int __cxa_atexit(void (*)(void *), void *, void *); + +int +__aeabi_atexit(void *object, void (*func)(void*), void *dso) +{ + return __cxa_atexit(func, object, dso); +} + diff --git a/lib/libc/arm/aeabi/aeabi_double.c b/lib/libc/arm/aeabi/aeabi_double.c new file mode 100644 index 0000000..5f9065c --- /dev/null +++ b/lib/libc/arm/aeabi/aeabi_double.c @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2012 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +flag __unorddf2(float64, float64); + +int __aeabi_dcmpeq(float64 a, float64 b) +{ + return float64_eq(a, b); +} + +int __aeabi_dcmplt(float64 a, float64 b) +{ + return float64_lt(a, b); +} + +int __aeabi_dcmple(float64 a, float64 b) +{ + return float64_le(a, b); +} + +int __aeabi_dcmpge(float64 a, float64 b) +{ + return float64_le(b, a); +} + +int __aeabi_dcmpgt(float64 a, float64 b) +{ + return float64_lt(b, a); +} + +int __aeabi_dcmpun(float64 a, float64 b) +{ + return __unorddf2(a, b); +} + +int __aeabi_d2iz(float64 a) +{ + return float64_to_int32_round_to_zero(a); +} + +float32 __aeabi_d2f(float64 a) +{ + return float64_to_float32(a); +} + +float64 __aeabi_i2d(int a) +{ + return int32_to_float64(a); +} + +float64 __aeabi_dadd(float64 a, float64 b) +{ + return float64_add(a, b); +} + +float64 __aeabi_ddiv(float64 a, float64 b) +{ + return float64_div(a, b); +} + +float64 __aeabi_dmul(float64 a, float64 b) +{ + return float64_mul(a, b); +} + +float64 __aeabi_dsub(float64 a, float64 b) +{ + return float64_sub(a, b); +} + diff --git a/lib/libc/arm/aeabi/aeabi_float.c b/lib/libc/arm/aeabi/aeabi_float.c new file mode 100644 index 0000000..97751ad --- /dev/null +++ b/lib/libc/arm/aeabi/aeabi_float.c @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2012 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +flag __unordsf2(float32, float32); + +int __aeabi_fcmpeq(float32 a, float32 b) +{ + return float32_eq(a, b); +} + +int __aeabi_fcmplt(float32 a, float32 b) +{ + return float32_lt(a, b); +} + +int __aeabi_fcmple(float32 a, float32 b) +{ + return float32_le(a, b); +} + +int __aeabi_fcmpge(float32 a, float32 b) +{ + return float32_le(b, a); +} + +int __aeabi_fcmpgt(float32 a, float32 b) +{ + return float32_lt(b, a); +} + +int __aeabi_fcmpun(float32 a, float32 b) +{ + return __unordsf2(a, b); +} + +int __aeabi_f2iz(float32 a) +{ + return float32_to_int32_round_to_zero(a); +} + +float32 __aeabi_f2d(float32 a) +{ + return float32_to_float64(a); +} + +float32 __aeabi_i2f(int a) +{ + return int32_to_float32(a); +} + +float32 __aeabi_fadd(float32 a, float32 b) +{ + return float32_add(a, b); +} + +float32 __aeabi_fdiv(float32 a, float32 b) +{ + return float32_div(a, b); +} + +float32 __aeabi_fmul(float32 a, float32 b) +{ + return float32_mul(a, b); +} + +float32 __aeabi_fsub(float32 a, float32 b) +{ + return float32_sub(a, b); +} + diff --git a/lib/libc/arm/aeabi/aeabi_unwind_cpp.c b/lib/libc/arm/aeabi/aeabi_unwind_cpp.c new file mode 100644 index 0000000..c07cbbd --- /dev/null +++ b/lib/libc/arm/aeabi/aeabi_unwind_cpp.c @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2011 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* + * Provide an implementation of __aeabi_unwind_cpp_pr{0,1,2}. These are + * required by libc but are implemented in libgcc_eh.a which we don't link + * against. The libgcc_eh.a version will be called so we call abort to + * check this. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +void __aeabi_unwind_cpp_pr0(void) __hidden; +void __aeabi_unwind_cpp_pr1(void) __hidden; +void __aeabi_unwind_cpp_pr2(void) __hidden; + +void +__aeabi_unwind_cpp_pr0(void) +{ + abort(); +} + +void +__aeabi_unwind_cpp_pr1(void) +{ + abort(); +} + +void +__aeabi_unwind_cpp_pr2(void) +{ + abort(); +} + -- cgit v1.1