diff --git a/lib/csu/arm/crt1.c b/lib/csu/arm/crt1.c index bcee2cacf7dd..02af3c290470 100644 --- a/lib/csu/arm/crt1.c +++ b/lib/csu/arm/crt1.c @@ -96,9 +96,8 @@ __asm(" .text \n" " b __start "); /* ARGSUSED */ void -__start(int argc, char **argv, char **env, - const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void), - struct ps_strings *ps_strings) +__start(int argc, char **argv, char **env, struct ps_strings *ps_strings, + const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void)) { const char *s; @@ -118,7 +117,6 @@ __start(int argc, char **argv, char **env, atexit(cleanup); else _init_tls(); - #ifdef GCRT atexit(_mcleanup); #endif diff --git a/lib/csu/arm/crti.S b/lib/csu/arm/crti.S index 2261c37ef5d2..40e83bbf2f11 100644 --- a/lib/csu/arm/crti.S +++ b/lib/csu/arm/crti.S @@ -1,5 +1,21 @@ #include __FBSDID("$FreeBSD$"); -ENTRY(_init) -ENTRY(_fini) + .section .init,"ax",%progbits + .align 4 + .globl _init + .type _init,%function +_init: + mov ip, sp + stmdb sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + + .section .fini,"ax",%progbits + .align 4 + .globl _fini + .type _fini,%function +_fini: + mov ip, sp + stmdb sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + diff --git a/lib/csu/arm/crtn.S b/lib/csu/arm/crtn.S index 2785e42de122..d148b1eb0965 100644 --- a/lib/csu/arm/crtn.S +++ b/lib/csu/arm/crtn.S @@ -1,4 +1,9 @@ #include __FBSDID("$FreeBSD$"); -.section init -.section fini + .section .init,"ax",%progbits + ldmea fp, {fp, sp, pc} + mov pc, lr + + .section .fini,"ax",%progbits + ldmea fp, {fp, sp, pc} + mov pc, lr