public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: newlib@sourceware.org
Cc: openrisc@lists.librecores.org,	stefan.wallentowitz@posteo.de,
	Stafford Horne <shorne@gmail.com>
Subject: [PATCH 2/3] libgloss: or1k: If available call the init for init_array
Date: Mon, 06 Feb 2017 14:39:00 -0000	[thread overview]
Message-ID: <0c64720c78e17dc41fab6f2a80b6e101e78e459a.1486391219.git.shorne@gmail.com> (raw)
In-Reply-To: <cover.1486391219.git.shorne@gmail.com>
In-Reply-To: <cover.1486391219.git.shorne@gmail.com>

There was an issue revealed in gdb testing where C++ virtual tables
were not getting properly initialized.  This seems to be due to the
c++ global constructors moving from ctors to init_array.

This fix makes sure we call the proper method for initializing the
constructors in all places.
---
 libgloss/or1k/crt0.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libgloss/or1k/crt0.S b/libgloss/or1k/crt0.S
index 84adba1..03d7323 100644
--- a/libgloss/or1k/crt0.S
+++ b/libgloss/or1k/crt0.S
@@ -36,6 +36,7 @@
       the obvious things..                                                    */
 /* -------------------------------------------------------------------------- */
 
+#include "newlib.h"
 #include "include/or1k-asm.h"
 #include "include/or1k-sprs.h"
 
@@ -96,6 +97,11 @@ _or1k_exception_stack_size:	.word EXCEPTION_STACK_SIZE
                                                                               */
 /* -------------------------------------------------------------------------- */
 
+#ifdef HAVE_INITFINI_ARRAY
+#define _init	__libc_init_array
+#define _fini	__libc_fini_array
+#endif
+
 #define GPR_BUF_OFFSET(x) (x << 2)
 
 #ifndef __OR1K_MULTICORE__
-- 
2.9.3

  reply	other threads:[~2017-02-06 14:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 14:38 [PATCH 0/3] openrisc: various fixes Stafford Horne
2017-02-06 14:39 ` Stafford Horne [this message]
2017-02-06 14:39 ` [PATCH 1/3] or1k: Make open reentrant Stafford Horne
2017-02-06 14:39 ` [PATCH 3/3] libgloss: Remove duplicate definition of environ Stafford Horne
2017-02-13  8:20 ` [PATCH 0/3] openrisc: various fixes Corinna Vinschen
2017-03-15 11:44 ` Stafford Horne
2017-03-15 22:10   ` Stafford Horne

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=0c64720c78e17dc41fab6f2a80b6e101e78e459a.1486391219.git.shorne@gmail.com \
    --to=shorne@gmail.com \
    --cc=newlib@sourceware.org \
    --cc=openrisc@lists.librecores.org \
    --cc=stefan.wallentowitz@posteo.de \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).