diff --git a/lib/libc/arm/aeabi/Symbol.map b/lib/libc/arm/aeabi/Symbol.map index 175884c82881..515794004ba7 100644 --- a/lib/libc/arm/aeabi/Symbol.map +++ b/lib/libc/arm/aeabi/Symbol.map @@ -1,75 +1,31 @@ /* * 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_cdcmpeq; - __aeabi_cdcmple; - __aeabi_cdrcmple; - - __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_cfcmpeq; - __aeabi_cfcmple; - __aeabi_cfrcmple; - - __aeabi_f2iz; - __aeabi_f2d; - - __aeabi_fadd; - __aeabi_fdiv; - __aeabi_fmul; - __aeabi_fsub; - - - __aeabi_i2d; - __aeabi_i2f; - - __aeabi_memclr; __aeabi_memclr4; __aeabi_memclr8; __aeabi_memcmp; __aeabi_memcmp4; __aeabi_memcmp8; __aeabi_memcpy; __aeabi_memcpy4; __aeabi_memcpy8; __aeabi_memmove; __aeabi_memmove4; __aeabi_memmove8; __aeabi_memset; __aeabi_memset4; __aeabi_memset8; /* * A workaround for DEFINE_AEABI_FUNCTION_ALIAS() bug. * - see aeabi_int_div.S */ __aeabi_idiv; __aeabi_uidiv; }; diff --git a/lib/libc/arm/aeabi/aeabi_int_div.S b/lib/libc/arm/aeabi/aeabi_int_div.S index 708b478b3881..bb002c2716f7 100644 --- a/lib/libc/arm/aeabi/aeabi_int_div.S +++ b/lib/libc/arm/aeabi/aeabi_int_div.S @@ -1,49 +1,51 @@ /* * Copyright (C) 2017 Michal Meloun * 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 /* * Due to bug in libcompiler_rt, all symbols declared by * DEFINE_AEABI_FUNCTION_ALIAS() are not hidden. All these but * __aeabi_uidiv_compat and/or __aeabi_idiv_compat are explicitly * exported from libc and don't causes problems. * * As workaround, export these from libc as compatible symbols, * in global namespace */ ENTRY(__aeabi_uidiv_compat) + .hidden __aeabi_uidiv_compat .symver __aeabi_uidiv_compat, __aeabi_uidiv@ b __udivsi3 END(__aeabi_uidiv_compat) ENTRY(__aeabi_idiv_compat) + .hidden __aeabi_idiv_compat .symver __aeabi_idiv_compat, __aeabi_idiv@ b __divsi3 END(__aeabi_idiv_compat) .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/arm/aeabi/aeabi_vfp.h b/lib/libc/arm/aeabi/aeabi_vfp.h index 3b70fe06fab3..4f3bb2ef969b 100644 --- a/lib/libc/arm/aeabi/aeabi_vfp.h +++ b/lib/libc/arm/aeabi/aeabi_vfp.h @@ -1,129 +1,131 @@ /* * Copyright (C) 2013 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. * */ #ifndef AEABI_VFP_H #define AEABI_VFP_H #include /* * ASM helper macros. These allow the functions to be changed depending on * the endian-ness we are building for. */ /* Allow the name of the function to be changed depending on the ABI */ #ifndef __ARM_PCS_VFP #define AEABI_ENTRY(x) ENTRY(__aeabi_ ## x ## _vfp) #define AEABI_END(x) END(__aeabi_ ## x ## _vfp) #else -#define AEABI_ENTRY(x) ENTRY(__aeabi_ ## x) +#define AEABI_ENTRY(x) \ + ENTRY(__aeabi_ ## x) \ + .symver __aeabi_##x, __aeabi_##x##@FBSDprivate_1.0; #define AEABI_END(x) END(__aeabi_ ## x) #endif /* * These should be used when a function either takes, or returns a floating * point falue. They will load the data from an ARM to a VFP register(s), * or from a VFP to an ARM register */ #ifdef __ARM_BIG_ENDIAN #define LOAD_DREG(vreg, reg0, reg1) vmov vreg, reg1, reg0 #define UNLOAD_DREG(reg0, reg1, vreg) vmov reg1, reg0, vreg #else #define LOAD_DREG(vreg, reg0, reg1) vmov vreg, reg0, reg1 #define UNLOAD_DREG(reg0, reg1, vreg) vmov reg0, reg1, vreg #endif #define LOAD_SREGS(vreg0, vreg1, reg0, reg1) vmov vreg0, vreg1, reg0, reg1 #define LOAD_SREG(vreg, reg) vmov vreg, reg #define UNLOAD_SREG(reg, vreg) vmov reg, vreg /* * C Helper macros */ #if !defined(SOFTFLOAT_FOR_GCC) /* * Generate a function that will either call into the VFP implementation, * or the soft float version for a given __aeabi_* helper. The function * will take a single argument of the type given by in_type. */ #define AEABI_FUNC(name, in_type, soft_func) \ __aeabi_ ## name(in_type a) \ { \ if (_libc_arm_fpu_present) \ return __aeabi_ ## name ## _vfp(a); \ else \ return soft_func (a); \ } /* As above, but takes two arguments of the same type */ #define AEABI_FUNC2(name, in_type, soft_func) \ __aeabi_ ## name(in_type a, in_type b) \ { \ if (_libc_arm_fpu_present) \ return __aeabi_ ## name ## _vfp(a, b); \ else \ return soft_func (a, b); \ } /* As above, but with the soft float arguments reversed */ #define AEABI_FUNC2_REV(name, in_type, soft_func) \ __aeabi_ ## name(in_type a, in_type b) \ { \ if (_libc_arm_fpu_present) \ return __aeabi_ ## name ## _vfp(a, b); \ else \ return soft_func (b, a); \ } #else /* * Helper macros for when we are only able to use the softfloat * version of these functions, i.e. on arm before armv6. */ #define AEABI_FUNC(name, in_type, soft_func) \ __aeabi_ ## name(in_type a) \ { \ return soft_func (a); \ } /* As above, but takes two arguments of the same type */ #define AEABI_FUNC2(name, in_type, soft_func) \ __aeabi_ ## name(in_type a, in_type b) \ { \ return soft_func (a, b); \ } /* As above, but with the soft float arguments reversed */ #define AEABI_FUNC2_REV(name, in_type, soft_func) \ __aeabi_ ## name(in_type a, in_type b) \ { \ return soft_func (b, a); \ } #endif #endif diff --git a/lib/libcompiler_rt/Makefile.inc b/lib/libcompiler_rt/Makefile.inc index e2a2618232e1..57cfdee95541 100644 --- a/lib/libcompiler_rt/Makefile.inc +++ b/lib/libcompiler_rt/Makefile.inc @@ -1,302 +1,306 @@ .include CRTARCH= ${MACHINE_CPUARCH:C/amd64/x86_64/:C/powerpc/ppc/} CRTSRC= ${SRCTOP}/contrib/llvm-project/compiler-rt/lib/builtins .PATH: ${CRTSRC}/${CRTARCH} .PATH: ${CRTSRC} SRCF+= absvdi2 SRCF+= absvsi2 SRCF+= absvti2 SRCF+= addvdi3 SRCF+= addvsi3 SRCF+= addvti3 SRCF+= apple_versioning SRCF+= ashldi3 SRCF+= ashlti3 SRCF+= ashrdi3 SRCF+= ashrti3 SRCF+= bswapdi2 SRCF+= bswapsi2 SRCF+= clear_cache SRCF+= clzdi2 SRCF+= clzsi2 SRCF+= clzti2 SRCF+= cmpdi2 SRCF+= cmpti2 SRCF+= ctzdi2 SRCF+= ctzsi2 SRCF+= ctzti2 SRCF+= divdc3 SRCF+= divdi3 SRCF+= divmoddi4 SRCF+= divmodsi4 SRCF+= divmodti4 SRCF+= divsc3 SRCF+= divsi3 SRCF+= divti3 SRCF+= enable_execute_stack SRCF+= extendhfsf2 SRCF+= ffsdi2 SRCF+= ffssi2 SRCF+= ffsti2 SRCF+= fixdfdi SRCF+= fixdfti SRCF+= fixsfdi SRCF+= fixsfti SRCF+= fixunsdfdi SRCF+= fixunsdfsi SRCF+= fixunsdfti SRCF+= fixunssfdi SRCF+= fixunssfsi SRCF+= fixunssfti SRCF+= floattidf SRCF+= floattisf SRCF+= floatunsidf SRCF+= floatunsisf SRCF+= floatuntidf SRCF+= floatuntisf SRCF+= int_util SRCF+= lshrdi3 SRCF+= lshrti3 SRCF+= moddi3 SRCF+= modsi3 SRCF+= modti3 SRCF+= muldc3 SRCF+= muldi3 SRCF+= mulodi4 SRCF+= mulosi4 SRCF+= muloti4 SRCF+= mulsc3 SRCF+= multi3 SRCF+= mulvdi3 SRCF+= mulvsi3 SRCF+= mulvti3 SRCF+= negdf2 SRCF+= negdi2 SRCF+= negsf2 SRCF+= negti2 SRCF+= negvdi2 SRCF+= negvsi2 SRCF+= negvti2 SRCF+= paritydi2 SRCF+= paritysi2 SRCF+= parityti2 SRCF+= popcountdi2 SRCF+= popcountsi2 SRCF+= popcountti2 SRCF+= powidf2 SRCF+= powisf2 SRCF+= subvdi3 SRCF+= subvsi3 SRCF+= subvti3 SRCF+= trampoline_setup SRCF+= truncdfhf2 SRCF+= truncsfhf2 SRCF+= ucmpdi2 SRCF+= ucmpti2 SRCF+= udivdi3 SRCF+= udivmoddi4 SRCF+= udivmodsi4 SRCF+= udivmodti4 SRCF+= udivsi3 SRCF+= udivti3 SRCF+= umoddi3 SRCF+= umodsi3 SRCF+= umodti3 # Enable compiler-rt's atomic implementation only for clang, as it uses clang # specific builtins, and gcc packages usually come with their own libatomic. # Exclude arm which has its own implementations of atomic functions, below. .if "${COMPILER_TYPE}" == "clang" && ${MACHINE_CPUARCH} != "arm" SRCF+= atomic .endif # Avoid using SSE2 instructions on i386, if unsupported. .if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2) SRCS+= floatdidf.c SRCS+= floatdisf.c SRCS+= floatundidf.c SRCS+= floatundisf.c .else SRCF+= floatdidf SRCF+= floatdisf SRCF+= floatundidf SRCF+= floatundisf .endif # # 80-bit long double functions, only used on x86. # .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" SRCF+= divxc3 SRCF+= fixxfdi SRCF+= fixxfti SRCF+= fixunsxfdi SRCF+= fixunsxfsi SRCF+= fixunsxfti SRCF+= floattixf SRCF+= floatuntixf SRCF+= mulxc3 SRCF+= powixf2 # Avoid using SSE2 instructions on i386, if unsupported. .if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2) SRCS+= floatdixf.c SRCS+= floatundixf.c .else SRCF+= floatdixf SRCF+= floatundixf .endif .endif # 128-bit float is an amd64 feature .if ${MACHINE_CPUARCH} == "amd64" SRCF+= extendxftf2 SRCF+= trunctfxf2 .endif # __cpu_model support, only used on aarch64 and x86 .if ${MACHINE_CPUARCH} == "aarch64" SRCS+= cpu_model/aarch64.c .elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" SRCS+= cpu_model/x86.c .endif # The fp_mode implementation for amd64 and i386 is shared, while other # architectures use the regular approach. .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" SRCS+= i386/fp_mode.c .else SRCF+= fp_mode .endif # # 128-bit quad precision long double support, # only used on some architectures. # .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_CPUARCH} == "riscv" SRCF+= addtf3 SRCF+= comparetf2 SRCF+= divtc3 SRCF+= divtf3 SRCF+= extenddftf2 SRCF+= extendhftf2 SRCF+= extendsftf2 SRCF+= fixtfdi SRCF+= fixtfsi SRCF+= fixtfti SRCF+= fixunstfdi SRCF+= fixunstfsi SRCF+= fixunstfti SRCF+= floatditf SRCF+= floatsitf SRCF+= floattitf SRCF+= floatunditf SRCF+= floatunsitf SRCF+= floatuntitf SRCF+= multc3 SRCF+= multf3 SRCF+= powitf2 SRCF+= subtf3 SRCF+= trunctfdf2 SRCF+= trunctfhf2 SRCF+= trunctfsf2 .endif # These are already shipped by libc.a on some architectures. -.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "riscv" +.if ${MACHINE_CPUARCH} != "riscv" SRCF+= adddf3 SRCF+= addsf3 SRCF+= divdf3 SRCF+= divsf3 SRCF+= extendsfdf2 SRCF+= fixdfsi SRCF+= fixsfsi SRCF+= floatsidf SRCF+= floatsisf SRCF+= muldf3 SRCF+= mulsf3 SRCF+= subdf3 SRCF+= subsf3 SRCF+= truncdfsf2 .endif -.if ${MACHINE_CPUARCH} != "arm" SRCF+= comparedf2 SRCF+= comparesf2 -.endif # Helper to reduce complexity of _Float16 and __bf16 statements below. .if ${MACHINE_CPUARCH} == "aarch64" || \ ${MACHINE_CPUARCH} == "amd64" || \ (${MACHINE_CPUARCH} == "i386" && !empty(MACHINE_CPU:Msse2)) CRT_COMMON_F16_ARCH=t .endif # # _Float16 support, only on some architectures, and with certain compiler # versions. # .if ((${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 150000) && \ (defined(CRT_COMMON_F16_ARCH) || \ ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "riscv")) || \ ((${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 120000) && \ (defined(CRT_COMMON_F16_ARCH))) CFLAGS+= -DCOMPILER_RT_HAS_FLOAT16 .endif # # __bf16 support, only on some architectures, and with certain compiler # versions. # .if ((${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 150000) && \ (defined(CRT_COMMON_F16_ARCH))) || \ ((${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 180000) && \ ${MACHINE_CPUARCH} == "riscv") || \ ((${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 130000) && \ (defined(CRT_COMMON_F16_ARCH))) CFLAGS+= -DCOMPILER_RT_HAS_BFLOAT16 SRCF+= extendbfsf2 SRCF+= truncdfbf2 SRCF+= truncsfbf2 .endif # FreeBSD-specific atomic intrinsics. .if ${MACHINE_CPUARCH} == "arm" .PATH: ${SRCTOP}/sys/arm/arm SRCF+= stdatomic CFLAGS+= -DEMIT_SYNC_ATOMICS .endif .for file in ${SRCF} -.if ${MACHINE_CPUARCH} == "arm" && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \ - && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S) -SRCS+= ${file}vfp.S -. elif exists(${CRTSRC}/${CRTARCH}/${file}.S) +. if exists(${CRTSRC}/${CRTARCH}/${file}.S) SRCS+= ${file}.S . else SRCS+= ${file}.c . endif .endfor .if ${MACHINE_CPUARCH} == "arm" +SRCS+= aeabi_cdcmp.S +SRCS+= aeabi_cdcmpeq_check_nan.c +SRCS+= aeabi_cfcmp.S +SRCS+= aeabi_cfcmpeq_check_nan.c +SRCS+= aeabi_dcmp.S SRCS+= aeabi_div0.c +SRCS+= aeabi_drsub.c +SRCS+= aeabi_fcmp.S +SRCS+= aeabi_frsub.c SRCS+= aeabi_idivmod.S SRCS+= aeabi_ldivmod.S SRCS+= aeabi_memcmp.S SRCS+= aeabi_memcpy.S SRCS+= aeabi_memmove.S SRCS+= aeabi_memset.S SRCS+= aeabi_uidivmod.S SRCS+= aeabi_uldivmod.S + SRCS+= switch16.S SRCS+= switch32.S SRCS+= switch8.S SRCS+= switchu8.S SRCS+= sync_synchronize.S .endif diff --git a/lib/libgcc_s/arm/Symbol.map b/lib/libgcc_s/arm/Symbol.map index 92b54761d810..ea0189eabaa0 100644 --- a/lib/libgcc_s/arm/Symbol.map +++ b/lib/libgcc_s/arm/Symbol.map @@ -1,17 +1,85 @@ /* */ GCC_3.5 { + __aeabi_cdcmple; + __aeabi_cdrcmple; + __aeabi_cfcmpeq; + __aeabi_cfcmple; + __aeabi_cfrcmple; + __aeabi_d2f; + __aeabi_d2h; +/* __aeabi_d2h_alt; */ + __aeabi_d2iz; + __aeabi_d2lz; + __aeabi_d2uiz; + __aeabi_d2ulz; + __aeabi_dadd; + __aeabi_dcmpeq; + __aeabi_dcmpge; + __aeabi_dcmpgt; + __aeabi_dcmple; + __aeabi_dcmplt; + __aeabi_dcmpun; + __aeabi_ddiv; + __aeabi_dmul; + __aeabi_dneg; + __aeabi_drsub; + __aeabi_dsub; + __aeabi_f2d; + __aeabi_f2h; +/* __aeabi_f2h_alt; */ + __aeabi_f2iz; + __aeabi_f2lz; + __aeabi_f2uiz; + __aeabi_f2ulz; + __aeabi_fadd; + __aeabi_fcmpeq; + __aeabi_fcmpge; + __aeabi_fcmpgt; + __aeabi_fcmple; + __aeabi_fcmplt; + __aeabi_fcmpun; + __aeabi_fdiv; + __aeabi_fmul; + __aeabi_fneg; + __aeabi_frsub; + __aeabi_fsub; + __aeabi_h2f; +/* __aeabi_h2f_alt; */ + __aeabi_i2d; + __aeabi_i2f; + __aeabi_idiv; + __aeabi_idiv0; + __aeabi_idivmod; + __aeabi_l2d; + __aeabi_l2f; + __aeabi_lasr; + __aeabi_lcmp; + __aeabi_ldiv0; + __aeabi_ldivmod; + __aeabi_llsl; + __aeabi_llsr; + __aeabi_lmul; + __aeabi_ui2d; + __aeabi_ui2f; + __aeabi_uidiv; + __aeabi_uidivmod; + __aeabi_ul2d; + __aeabi_ul2f; + __aeabi_ulcmp; + __aeabi_uldivmod; + _Unwind_Complete; _Unwind_VRS_Get; _Unwind_VRS_Set; _Unwind_VRS_Pop; __aeabi_unwind_cpp_pr0; __aeabi_unwind_cpp_pr1; __aeabi_unwind_cpp_pr2; __gnu_unwind_frame; }; GCC_4.3.0 { _Unwind_Backtrace; };