aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/m68k
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>1998-03-11 01:32:12 +0000
committerAndreas Schwab <schwab@suse.de>1998-03-11 01:32:12 +0000
commitc637edea752d0662adb0d75838db8f7ff3420fa1 (patch)
tree4520311021b925079ba9302ef65dd25f1c191f2c /sysdeps/m68k
parent7559b94331de6615ae2a2312f3f7efa4cc46a4c3 (diff)
downloadglibc-c637edea752d0662adb0d75838db8f7ff3420fa1.tar
glibc-c637edea752d0662adb0d75838db8f7ff3420fa1.tar.gz
glibc-c637edea752d0662adb0d75838db8f7ff3420fa1.tar.bz2
glibc-c637edea752d0662adb0d75838db8f7ff3420fa1.zip
* sysdeps/m68k/elf/start.S: Let __libc_start_main do most of the
init stuff. Wed Mar 11 10:30:53 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/elf/start.S: Let __libc_start_main do most of the init stuff.
Diffstat (limited to 'sysdeps/m68k')
-rw-r--r--sysdeps/m68k/elf/start.S54
1 files changed, 21 insertions, 33 deletions
diff --git a/sysdeps/m68k/elf/start.S b/sysdeps/m68k/elf/start.S
index 6c7cd4b99d..c1a5c2e48f 100644
--- a/sysdeps/m68k/elf/start.S
+++ b/sysdeps/m68k/elf/start.S
@@ -1,5 +1,5 @@
/* 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.
The GNU C Library is free software; you can redistribute it and/or
@@ -43,43 +43,31 @@ _start:
the outermost frame obviously. */
sub.l %fp, %fp
- /* %a1 contains the address of the shared library termination
- function, which we will register with `atexit' to be called by
- `exit'. */
- tstl %a1
- jbeq 1f
- move.l %a1, -(%sp)
- jbsr atexit
- addql #4, %sp
-1:
+ /* Extract the arguments as encoded on the stack and set up the
+ arguments for `main': argc, argv. envp will be determined
+ later in __libc_start_main. */
+ move.l (%sp)+, %d0 /* Pop the argument count. */
+ move.l %sp, %a0 /* The argument vector starts just at the
+ current stack top. */
- /* 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
+ pea (%a1) /* Push address of the shared library
+ termination function. */
- /* 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. */
- lea (4,%sp,%d0*4), %a0 /* envp = &argv[argc + 1] */
- move.l %a0, _environ /* Store it in the global variable. */
- pea (%a0) /* Push third argument: envp. */
- pea 4(%sp) /* Push second argument: argv. */
+ /* 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. */
- /* Call `_init', which is the entry point to our own `.init'
- 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
+ pea main
+
+ /* Call the user's main function, and exit with its value. But
+ let the libc call main. */
+ jbsr __libc_start_main
- /* Call the user's main function, and exit with its value. */
- jbsr main
- move.l %d0, (%sp)
-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. */
.data