[newlib-cygwin/main] or1k: Fix compilation for __OR1K_MULTICORE__ builds
Corinna Vinschen
corinna@sourceware.org
Mon Mar 31 09:00:53 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3955b88056995bcaf9abe96eed6eaae12435c650
commit 3955b88056995bcaf9abe96eed6eaae12435c650
Author: Stafford Horne <shorne@gmail.com>
AuthorDate: Fri Mar 28 10:09:27 2025 +0000
Commit: Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Mar 31 10:59:53 2025 +0200
or1k: Fix compilation for __OR1K_MULTICORE__ builds
When building newlib for multicore environments we specify __OR1K_MULTICORE__
which switches the build to allocate one struct _or1k_reent per CPU
dynamiocally.
This was using a strange definition of (*_or1k_reent)[], and causing
the following compiler error:
./gnu-toolchain/newlib/libgloss/or1k/impure.c: In function ‘_or1k_reent_init’:
./gnu-toolchain/newlib/libgloss/or1k/impure.c:121:21: error: assignment to ‘struct ..
121 | _or1k_reent = (struct _or1k_reent*) _sbrk_r(0, memsize);
|
Fix this compiler error by changing the or1k_reent definition to a pointer
to structs.
Signed-off-by: Stafford Horne <shorne@gmail.com>
Diff:
---
libgloss/or1k/impure.c | 2 +-
libgloss/or1k/or1k-internals.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libgloss/or1k/impure.c b/libgloss/or1k/impure.c
index e94fd637c3e8..7780c9170242 100644
--- a/libgloss/or1k/impure.c
+++ b/libgloss/or1k/impure.c
@@ -108,7 +108,7 @@ _or1k_libc_getreent(void) {
}
#ifdef __OR1K_MULTICORE__
-struct _or1k_reent (*_or1k_reent)[];
+struct _or1k_reent *_or1k_reent;
#else
struct _or1k_reent _or1k_reent;
#endif
diff --git a/libgloss/or1k/or1k-internals.h b/libgloss/or1k/or1k-internals.h
index 3aabdb05d4c1..d92c166994b4 100644
--- a/libgloss/or1k/or1k-internals.h
+++ b/libgloss/or1k/or1k-internals.h
@@ -55,8 +55,8 @@ struct _or1k_reent {
#ifdef __OR1K_MULTICORE__
-extern struct _or1k_reent (*_or1k_reent)[];
-#define OR1K_REENT (*_or1k_reent)[or1k_coreid()]
+extern struct _or1k_reent *_or1k_reent;
+#define OR1K_REENT _or1k_reent[or1k_coreid()]
#else
extern struct _or1k_reent _or1k_reent;
#define OR1K_REENT _or1k_reent
More information about the Newlib-cvs
mailing list