aboutsummaryrefslogtreecommitdiff
path: root/libgloss/arm/crt0.S
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2013-07-02 21:34:35 +0000
committerJeff Johnston <jjohnstn@redhat.com>2013-07-02 21:34:35 +0000
commit2404223df651ceef42c6e2f2c9fa42fb7963db10 (patch)
treeb9ad79ba4a61ee371d7bf4b9df52244819bc4872 /libgloss/arm/crt0.S
parente2ac49d3d7c6445c07467e2a4d271d5664f83830 (diff)
downloadnewlib-2404223df651ceef42c6e2f2c9fa42fb7963db10.zip
newlib-2404223df651ceef42c6e2f2c9fa42fb7963db10.tar.gz
newlib-2404223df651ceef42c6e2f2c9fa42fb7963db10.tar.bz2
2013-07-02 Joey Ye <joey.ye@arm.com>
* arm/crt0.S (_mainCRTStartup): Weak reference to atexit and _fini when lite exit is enabled.
Diffstat (limited to 'libgloss/arm/crt0.S')
-rw-r--r--libgloss/arm/crt0.S18
1 files changed, 17 insertions, 1 deletions
diff --git a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
index 92e7648..f7ed5c5 100644
--- a/libgloss/arm/crt0.S
+++ b/libgloss/arm/crt0.S
@@ -390,12 +390,21 @@ __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
-#endif
+#endif
bl FUNCTION (main)
bl FUNCTION (exit) /* Should not return. */
@@ -465,6 +474,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