public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Committed, libgloss: hook up cris-elf to the initfini-array support.
@ 2017-01-29 20:23 Hans-Peter Nilsson
  0 siblings, 0 replies; only message in thread
From: Hans-Peter Nilsson @ 2017-01-29 20:23 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=cd5e7e2d8271d8d4b976eaa42c69770d94c67a74

commit cd5e7e2d8271d8d4b976eaa42c69770d94c67a74
Author: Hans-Peter Nilsson <hp@bitrange.com>
Date:   Sun Jan 29 21:23:32 2017 +0100

    Committed, libgloss: hook up cris-elf to the initfini-array support.
    
    After a binutils change "a while ago" (2015-12) to default to
    --enable-initfini-array, i.e. to merge .ctors and .dtors into
    .init_array and .fini_array, this is needed for cdtors to run at all.
    
    Based on what goes on in arm/ and aarch64/.  Tested for cris-elf by
    running the gcc testsuite.
    
    By the way, the configure test doesn't detect this change, so the
    HAVE_INITFINI_ARRAY ifdeffery is somewhat redundant.  Still, the
    change is tested to be safe with older binutils too.
    
    libgloss/
    	* cris/crt0.S, cris/lcrt0.c: Include newlib.h.
    	[HAVE_INITFINI_ARRAY] (_init): Define to __libc_init_array.
    	[HAVE_INITFINI_ARRAY] (_fini): Ditto __libc_fini_array.

Diff:
---
 libgloss/cris/crt0.S  | 9 ++++++++-
 libgloss/cris/lcrt0.c | 8 +++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libgloss/cris/crt0.S b/libgloss/cris/crt0.S
index 74c1594..3041988 100644
--- a/libgloss/cris/crt0.S
+++ b/libgloss/cris/crt0.S
@@ -1,5 +1,5 @@
 /* Generic simplistic start-up-stub for CRIS/CRISv32.
-   Copyright (C) 1993-2005, 2007 Axis Communications.
+   Copyright (C) 1993-2005, 2007, 2017 Axis Communications.
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
@@ -26,6 +26,8 @@
    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.  */
 
+#include "newlib.h"
+
 #undef cris
 #undef L
 #ifdef __NO_UNDERSCORES__
@@ -34,6 +36,11 @@
 #define L(x) _ ## x
 #endif
 
+#ifdef HAVE_INITFINI_ARRAY
+#define _init __libc_init_array
+#define _fini __libc_fini_array
+#endif
+
 ; Rudimentary v0..v32-compatible startup stub.
 
 #ifdef __ELF__
diff --git a/libgloss/cris/lcrt0.c b/libgloss/cris/lcrt0.c
index ee50746..8b8cc0b 100644
--- a/libgloss/cris/lcrt0.c
+++ b/libgloss/cris/lcrt0.c
@@ -1,5 +1,5 @@
 /* Support for cris*-axis-linux-gnu and src/sim/cris simulator.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Axis Communications.
+   Copyright (C) 2000-2005, 2017 Axis Communications.
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
@@ -27,6 +27,12 @@
    POSSIBILITY OF SUCH DAMAGE.  */
 
 #include "linunistd.h"
+#include "newlib.h"
+
+#ifdef HAVE_INITFINI_ARRAY
+#define _init __libc_init_array
+#define _fini __libc_fini_array
+#endif
 
 extern void exit (int) __attribute ((__noreturn__));


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-29 20:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-29 20:23 [newlib-cygwin] Committed, libgloss: hook up cris-elf to the initfini-array support Hans-Peter Nilsson

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).