linux-openrisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: Newlib <newlib@sourceware.org>
Cc: Linux OpenRISC <linux-openrisc@vger.kernel.org>,
	Stafford Horne <shorne@gmail.com>
Subject: [PATCH] or1k: Fix compilation for __OR1K_MULTICORE__ builds
Date: Fri, 28 Mar 2025 10:09:27 +0000	[thread overview]
Message-ID: <20250328100927.2184243-1-shorne@gmail.com> (raw)

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>
---
 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 e94fd637c..7780c9170 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 3aabdb05d..d92c16699 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
-- 
2.47.0


                 reply	other threads:[~2025-03-28 10:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250328100927.2184243-1-shorne@gmail.com \
    --to=shorne@gmail.com \
    --cc=linux-openrisc@vger.kernel.org \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).