Skip to content

Commit

Permalink
DBG
Browse files Browse the repository at this point in the history
  • Loading branch information
badochov committed Sep 5, 2024
1 parent 34f5196 commit 1fbfbc1
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 22 deletions.
25 changes: 25 additions & 0 deletions arch/arm/v7a/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,28 @@ int reboot_reason(uint32_t *val)
*val = pctl.reboot.reason;
return 0;
}


#include <arch.h>

#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
18 changes: 4 additions & 14 deletions include/arch/armv7a/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 6 additions & 3 deletions rtld/stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ __attribute__((weak)) void *dlsym(void *restrict a, const char *restrict b)
}


/* 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();
Expand All @@ -65,3 +66,5 @@ __attribute__((weak)) void *___tls_get_addr(void *d)
{
abort();
}

#endif
10 changes: 5 additions & 5 deletions shared.mk
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ ifneq ($(TOOLCHAIN_BUILD),y)

install-shared: rootfs-install-shared-toolchain-libs install-shared-toolchain-libs

GLOBAL_SYSROOT := $$($(CC) --print-sysroot)
TOOLCHAIN_LIBS_PATH := $(shell $(CC) --print-sysroot)/lib/$(MULTILIB_DIR)

rootfs-install-shared-toolchain-libs install-shared-toolchain-libs: TOOLCHAIN_LIBS_PATH := $(TOOLCHAIN_LIBS_PATH)


# TODO: do not hardcode versions of libs
rootfs-install-shared-toolchain-libs: $(PREFIX_ROOTFS)$(LOCAL_INSTALL_PATH)/$(REALNAME)
$(SIL)cp $(GLOBAL_SYSROOT)/lib/libstdc++.so.6.28 $(PREFIX_ROOTFS)$(LOCAL_INSTALL_PATH)
$(SIL)cp $(GLOBAL_SYSROOT)/lib/libgcc_s.so.1 $(PREFIX_ROOTFS)$(LOCAL_INSTALL_PATH)
$(SIL)cp $(TOOLCHAIN_LIBS_PATH)/libstdc++.so.6.28 $(PREFIX_ROOTFS)$(LOCAL_INSTALL_PATH)
$(SIL)cp $(TOOLCHAIN_LIBS_PATH)/libgcc_s.so.1 $(PREFIX_ROOTFS)$(LOCAL_INSTALL_PATH)


install-shared-toolchain-libs: install-shared-libs
$(SIL)ln -sf $(GLOBAL_SYSROOT)/lib/libstdc++.so.6.28 $(LIBC_INSTALL_DIR)
$(SIL)ln -sf $(GLOBAL_SYSROOT)/lib/libgcc_s.so.1 $(LIBC_INSTALL_DIR)
$(SIL)ln -sf $(TOOLCHAIN_LIBS_PATH)/libstdc++.so.6.28 $(LIBC_INSTALL_DIR)
$(SIL)ln -sf $(TOOLCHAIN_LIBS_PATH)/libgcc_s.so.1 $(LIBC_INSTALL_DIR)
$(SIL)(cd $(LIBC_INSTALL_DIR) && \
ln -sf libstdc++.so.6.28 libstdc++.so.6 && ln -sf libstdc++.so.6.28 libstdc++.so && \
ln -sf libgcc_s.so.1 libgcc_s.so \
Expand Down

0 comments on commit 1fbfbc1

Please sign in to comment.