fix arm crti/crtn code
authorRich Felker <dalias@aerifal.cx>
Mon, 25 Jun 2012 20:06:09 +0000 (16:06 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 25 Jun 2012 20:06:09 +0000 (16:06 -0400)
lr must be saved because init/fini-section code from the compiler
clobbers it. this was not a problem when i tested without gcc's
crtbegin/crtend files present, but with them, musl on arm fails to
work (infinite loop in _init).

crt/arm/crti.s
crt/arm/crtn.s

index 2eb23ed..0dd978a 100644 (file)
@@ -1,7 +1,9 @@
 .section .init
 .global _init
 _init:
+       push {lr}
 
 .section .fini
 .global _fini
 _fini:
+       push {lr}
index 9d7107d..5d5d645 100644 (file)
@@ -1,9 +1,11 @@
 .section .init
+       pop {lr}
        tst lr,#1
        moveq pc,lr
        bx lr
 
 .section .fini
+       pop {lr}
        tst lr,#1
        moveq pc,lr
        bx lr