From cb15a39d90a43a058228168dfdec8b01c0e46543 Mon Sep 17 00:00:00 2001 From: cognet Date: Thu, 23 Sep 2004 23:00:51 +0000 Subject: Implement .init and .fini. --- lib/csu/arm/crt1.c | 6 ++---- lib/csu/arm/crti.S | 20 ++++++++++++++++++-- lib/csu/arm/crtn.S | 9 +++++++-- 3 files changed, 27 insertions(+), 8 deletions(-) (limited to 'lib/csu/arm') diff --git a/lib/csu/arm/crt1.c b/lib/csu/arm/crt1.c index bcee2ca..02af3c2 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 2261c37..40e83bb 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 2785e42..d148b1e 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 -- cgit v1.1