diff --git a/arch/arm/v7a/reboot.c b/arch/arm/v7a/reboot.c index 50be41a3..19399272 100644 --- a/arch/arm/v7a/reboot.c +++ b/arch/arm/v7a/reboot.c @@ -52,3 +52,28 @@ int reboot_reason(uint32_t *val) *val = pctl.reboot.reason; return 0; } + + +#include + +#ifdef __IEEE754_SQRT +double __ieee754_sqrt(double x) +{ + /* clang-format off */ + __asm__ volatile ("vsqrt.f64 %P0, %P1" : "=w"(x) : "w"(x)); + /* clang-format on */ + + return x; +} +#endif + +#ifdef __IEEE754_SQRTF +float __ieee754_sqrtf(float x) +{ + /* clang-format off */ + __asm__ volatile ("vsqrt.f32 %0, %1" : "=t"(x) : "t"(x)); + /* clang-format on */ + + return x; +} +#endif diff --git a/include/arch/armv7a/arch.h b/include/arch/armv7a/arch.h index 8a0f5ba2..5eb8d760 100644 --- a/include/arch/armv7a/arch.h +++ b/include/arch/armv7a/arch.h @@ -35,31 +35,21 @@ #if __ARM_FP & 8 #define __IEEE754_SQRT -static inline double __ieee754_sqrt(double x) -{ - /* clang-format off */ - __asm__ volatile ("vsqrt.f64 %P0, %P1" : "=w"(x) : "w"(x)); - /* clang-format on */ +double __ieee754_sqrt(double x); - return x; -} #endif #define __IEEE754_SQRTF -static inline float __ieee754_sqrtf(float x) -{ - /* clang-format off */ - __asm__ volatile ("vsqrt.f32 %0, %1" : "=t"(x) : "t"(x)); - /* clang-format on */ +float __ieee754_sqrtf(float x); + - return x; -} #endif #define _PAGE_SIZE 0x1000 #define SIZE_PAGE _Pragma("GCC warning \"'SIZE_PAGE' is deprecated. Use _PAGE_SIZE from arch.h or PAGE_SIZE from limits.h (POSIX only)\"") _PAGE_SIZE #define __LIBPHOENIX_ARCH_TLS_SUPPORTED +#define __LIBPHOENIX_ARCH_HAVE__TLS_GET_ADDR #endif diff --git a/rtld/stubs.c b/rtld/stubs.c index d8249045..54bd4296 100644 --- a/rtld/stubs.c +++ b/rtld/stubs.c @@ -57,9 +57,10 @@ __attribute__((weak)) void __rtld_atfork(int pre) { } -/* Stub __tls_get_addr implementations. - * They can be overriden on platforms requiring __tls_get_addr in PIC compiled platforms(eg. RISC-V, ARM). - * The override work due to linking order. */ +/* Allow override on platforms requiring __tls_get_addr in PIC compiled libraries(eg. RISC-V, ARM). */ +#ifndef __LIBPHOENIX_ARCH_HAVE__TLS_GET_ADDR + +/* Stub __tls_get_addr implementations. */ __attribute__((weak)) void *__tls_get_addr(void *d) { abort(); @@ -70,3 +71,5 @@ __attribute__((weak)) void *___tls_get_addr(void *d) { abort(); } + +#endif