mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-29 08:11:08 +00:00
* sysdeps/m68k/elf/start.S: Let __libc_start_main do most of the
init stuff.
This commit is contained in:
parent
2d4c61a667
commit
69235f764b
@ -1,5 +1,5 @@
|
|||||||
/* Startup code compliant to the ELF m68k ABI.
|
/* Startup code compliant to the ELF m68k ABI.
|
||||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -43,43 +43,31 @@ _start:
|
|||||||
the outermost frame obviously. */
|
the outermost frame obviously. */
|
||||||
sub.l %fp, %fp
|
sub.l %fp, %fp
|
||||||
|
|
||||||
/* %a1 contains the address of the shared library termination
|
/* Extract the arguments as encoded on the stack and set up the
|
||||||
function, which we will register with `atexit' to be called by
|
arguments for `main': argc, argv. envp will be determined
|
||||||
`exit'. */
|
later in __libc_start_main. */
|
||||||
tstl %a1
|
|
||||||
jbeq 1f
|
|
||||||
move.l %a1, -(%sp)
|
|
||||||
jbsr atexit
|
|
||||||
addql #4, %sp
|
|
||||||
1:
|
|
||||||
|
|
||||||
/* Do essential libc initialization. In statically linked
|
|
||||||
programs under the GNU Hurd, this is what sets up the
|
|
||||||
arguments on the stack for the code below. */
|
|
||||||
jbsr __libc_init_first
|
|
||||||
|
|
||||||
/* Extract the arguments and environment as encoded on the stack
|
|
||||||
and set up the arguments for `main': argc, argv, envp. */
|
|
||||||
move.l (%sp)+, %d0 /* Pop the argument count. */
|
move.l (%sp)+, %d0 /* Pop the argument count. */
|
||||||
lea (4,%sp,%d0*4), %a0 /* envp = &argv[argc + 1] */
|
move.l %sp, %a0 /* The argument vector starts just at the
|
||||||
move.l %a0, _environ /* Store it in the global variable. */
|
current stack top. */
|
||||||
pea (%a0) /* Push third argument: envp. */
|
|
||||||
pea 4(%sp) /* Push second argument: argv. */
|
pea (%a1) /* Push address of the shared library
|
||||||
|
termination function. */
|
||||||
|
|
||||||
|
/* Push the address of our own entry points to `.fini' and
|
||||||
|
`.init'. */
|
||||||
|
pea _fini
|
||||||
|
pea _init
|
||||||
|
|
||||||
|
pea (%a0) /* Push second argument: argv. */
|
||||||
move.l %d0, -(%sp) /* Push first argument: argc. */
|
move.l %d0, -(%sp) /* Push first argument: argc. */
|
||||||
|
|
||||||
/* Call `_init', which is the entry point to our own `.init'
|
pea main
|
||||||
section; and register with `atexit' to have `exit' call
|
|
||||||
`_fini', which is the entry point to our own `.fini' section. */
|
|
||||||
jbsr _init
|
|
||||||
move.l #_fini, -(%sp)
|
|
||||||
jbsr atexit
|
|
||||||
addq.l #4, %sp
|
|
||||||
|
|
||||||
/* Call the user's main function, and exit with its value. */
|
/* Call the user's main function, and exit with its value. But
|
||||||
jbsr main
|
let the libc call main. */
|
||||||
move.l %d0, (%sp)
|
jbsr __libc_start_main
|
||||||
1: jbsr exit /* This should never return. */
|
|
||||||
jbra 1b /* Try again if somehow it does return. */
|
illegal /* Crash if somehow `exit' does return. */
|
||||||
|
|
||||||
/* Define a symbol for the first piece of initialized data. */
|
/* Define a symbol for the first piece of initialized data. */
|
||||||
.data
|
.data
|
||||||
|
Loading…
Reference in New Issue
Block a user