From 4319248cf83f64231717936b3e01b6bd1f5d082a Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Mon, 1 May 2023 16:24:23 +0100 Subject: [PATCH] devkitARM: fix dynamic reent --- .../patches/newlib-4.3.0.20230120.patch | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/dkarm-eabi/patches/newlib-4.3.0.20230120.patch b/dkarm-eabi/patches/newlib-4.3.0.20230120.patch index b3b303e..727b64b 100644 --- a/dkarm-eabi/patches/newlib-4.3.0.20230120.patch +++ b/dkarm-eabi/patches/newlib-4.3.0.20230120.patch @@ -10419,7 +10419,7 @@ index bc967bd70..8a72f26f7 100644 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/machine/powerpc/libc_a-vfprintf.o -MD -MP -MF libc/machine/powerpc/$(DEPDIR)/libc_a-vfprintf.Tpo -c -o libc/machine/powerpc/libc_a-vfprintf.o `test -f 'libc/machine/powerpc/vfprintf.c' || echo '$(srcdir)/'`libc/machine/powerpc/vfprintf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/machine/powerpc/$(DEPDIR)/libc_a-vfprintf.Tpo libc/machine/powerpc/$(DEPDIR)/libc_a-vfprintf.Po diff --git a/newlib/configure.host b/newlib/configure.host -index 0a1ba282a..dfb96af4b 100644 +index 0a1ba282a..66ccbec57 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -620,13 +620,25 @@ newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVID @@ -10456,7 +10456,7 @@ index 0a1ba282a..dfb96af4b 100644 + powerpc*-*-eabi*) + default_newlib_io_c99_formats="yes" + default_newlib_io_long_long="yes" -+ newlib_cflags="${newlib_cflags} -DCUSTOM_MALLOC_LOCK -D__DYNAMIC_REENT__ -DREENTRANT_SYSCALLS_PROVIDED -D__DEFAULT_UTF8__" ++ newlib_cflags="${newlib_cflags} -DCUSTOM_MALLOC_LOCK -D__DYNAMIC_REENT__ -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -D__DEFAULT_UTF8__" + newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections" + syscall_dir=syscalls + ;; @@ -10840,21 +10840,30 @@ index f810b008f..ca7e11dc7 100644 + #endif /* !_SYS__TIMESPEC_H_ */ diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h -index 5dcc77a80..3a33705c0 100644 +index 5dcc77a80..6930a751d 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h -@@ -8,6 +8,11 @@ - #define MALLOC_ALIGNMENT 16 - #endif +@@ -4,8 +4,19 @@ + #include /* floating point macros */ + #include /* POSIX defs */ -+#ifdef _ARCH_PPC -+#define __BUFSIZ__ 32768 -+#define MALLOC_ALIGNMENT 64 +-#ifdef __aarch64__ ++#ifdef __DEVKITARM__ ++#define __DYNAMIC_REENT__ +#endif + - #ifdef __AMDGCN__ - #define __DYNAMIC_REENT__ ++#ifdef __DEVKITA64__ + #define MALLOC_ALIGNMENT 16 ++#define __DYNAMIC_REENT__ ++#endif ++ ++#ifdef __DEVKITPPC__ ++#define __BUFSIZ__ 32768 ++#define MALLOC_ALIGNMENT 64 ++#define __DYNAMIC_REENT__ #endif + + #ifdef __AMDGCN__ diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h index 45476ce4a..05efc0ab2 100644 --- a/newlib/libc/include/sys/features.h