Implement .init and .fini.

This commit is contained in:
Olivier Houchard 2004-09-23 23:00:51 +00:00
parent fba25c542c
commit eed605e0fe
3 changed files with 27 additions and 8 deletions

View File

@ -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

View File

@ -1,5 +1,21 @@
#include <machine/asm.h>
__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

View File

@ -1,4 +1,9 @@
#include <machine/asm.h>
__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