From: Alexander Fedotov <alfedotov@gmail.com>
To: newlib@sourceware.org
Cc: Alexander Fedotov <alfedotov@gmail.com>
Subject: [PATCH v2 3/4] Align libgloss/arm and libc/sys/arm sources: Lite exit support
Date: Fri, 02 Aug 2019 12:34:00 -0000 [thread overview]
Message-ID: <20190802123346.5377-4-alfedotov@gmail.com> (raw)
In-Reply-To: <20190802123346.5377-1-alfedotov@gmail.com>
Applied changes from commit 2404223:
* arm/crt0.S (_mainCRTStartup): Weak reference to atexit and _fini
when lite exit is enabled.
---
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 a55aa365b..5e677a23c 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
--
2.17.1
next prev parent reply other threads:[~2019-08-02 12:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-02 12:33 [PATCH v2 0/4] Align libgloss/arm and libc/sys/arm sources Alexander Fedotov
2019-08-02 12:34 ` [PATCH v2 1/4] Align libgloss/arm and libc/sys/arm sources: Fix GetCmdLine semihosting directives Alexander Fedotov
2019-08-02 12:34 ` [PATCH v2 4/4] Align libgloss/arm and libc/sys/arm sources: miscellaneous fixes Alexander Fedotov
2019-08-02 12:34 ` [PATCH v2 2/4] Align libgloss/arm and libc/sys/arm sources: HeapInfo and __heap_limit Alexander Fedotov
2019-08-02 12:34 ` Alexander Fedotov [this message]
2019-08-05 11:17 ` [PATCH v2 0/4] Align libgloss/arm and libc/sys/arm sources Corinna Vinschen
2019-08-05 12:03 ` Richard Earnshaw (lists)
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=20190802123346.5377-4-alfedotov@gmail.com \
--to=alfedotov@gmail.com \
--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 read-only IMAP folder(s) and NNTP newsgroup(s).