public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Align libgloss/arm and libc/sys/arm sources: Lite exit support
@ 2019-08-05 12:02 Richard Earnshaw
  0 siblings, 0 replies; only message in thread
From: Richard Earnshaw @ 2019-08-05 12:02 UTC (permalink / raw)
  To: newlib-cvs

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

commit bd5596f4fdd8d08966f03057316c1baea754ae4c
Author: Alexander Fedotov <alfedotov@gmail.com>
Date:   Fri Aug 2 07:33:45 2019 -0500

    Align libgloss/arm and libc/sys/arm sources: Lite exit support
    
    Applied changes from commit 2404223:
    
    	* arm/crt0.S (_mainCRTStartup): Weak reference to atexit and _fini
    		when lite exit is enabled.

Diff:
---
 newlib/libc/sys/arm/crt0.S | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/newlib/libc/sys/arm/crt0.S b/newlib/libc/sys/arm/crt0.S
index a55aa36..5e677a2 100644
--- a/newlib/libc/sys/arm/crt0.S
+++ b/newlib/libc/sys/arm/crt0.S
@@ -518,8 +518,17 @@ __change_mode:
 	   for _fini to be called at program exit.  */
 	movs	r4, r0
 	movs	r5, r1
+#ifdef _LITE_EXIT
+	/* Make reference to atexit weak to avoid unconditionally pulling in
+	   support code.  Refer to comments in __atexit.c for more details.  */
+	.weak	FUNCTION(atexit)
+	ldr	r0, .Latexit
+	cmp	r0, #0
+	beq	.Lweak_atexit
+#endif
 	ldr	r0, .Lfini
 	bl	FUNCTION (atexit)
+.Lweak_atexit:
 	bl	FUNCTION (_init)
 	movs	r0, r4
 	movs	r1, r5
@@ -589,6 +598,13 @@ change_back:
 .LC2:
 	.word	__bss_end__
 #ifdef __USES_INITFINI__
+#ifdef _LITE_EXIT
+.Latexit:
+	.word	FUNCTION(atexit)
+
+	/* Weak reference _fini in case of lite exit.  */
+	.weak	FUNCTION(_fini)
+#endif
 .Lfini:
 	.word	FUNCTION(_fini)
 #endif


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

only message in thread, other threads:[~2019-08-05 12:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05 12:02 [newlib-cygwin] Align libgloss/arm and libc/sys/arm sources: Lite exit support Richard Earnshaw

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