summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/m68k/crt1.S
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/m68k/crt1.S')
-rw-r--r--libc/sysdeps/linux/m68k/crt1.S41
1 files changed, 35 insertions, 6 deletions
diff --git a/libc/sysdeps/linux/m68k/crt1.S b/libc/sysdeps/linux/m68k/crt1.S
index 9ce14e594..a5f973fe2 100644
--- a/libc/sysdeps/linux/m68k/crt1.S
+++ b/libc/sysdeps/linux/m68k/crt1.S
@@ -34,6 +34,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <features.h>
+#include "m68k_pic.S"
+
+#ifndef L_Scrt1
/* This is the canonical entry point, usually the first thing in the text
segment. The SVR4/m68k ABI says that when the entry point runs,
most registers' values are unspecified, except for:
@@ -60,8 +64,6 @@
8(%sp) envp
*/
-#include <features.h>
-
.text
.type _init,%function
.type _fini,%function
@@ -76,6 +78,17 @@ _start:
the outermost frame obviously. */
sub.l %fp, %fp
+#if !defined __ARCH_USE_MMU__ && defined __PIC__
+ /* Set up the global pointer. The GOT is at the beginning of the
+ data segment, whose address is in %d5. */
+ move.l %d5,%a5
+ .equ have_current_got, 1
+#endif
+
+#ifdef __HAVE_SHARED_FLAT__
+ CALL __shared_flat_add_library,%a1
+#endif
+
/* 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. */
@@ -100,19 +113,35 @@ _start:
/* Push the address of our own entry points to `.fini' and
`.init'. */
- pea _fini
- pea _init
+#if defined __HAVE_SHARED_FLAT__
+ PEA_TEXT __shared_flat_fini,%a1
+ PEA_TEXT __shared_flat_init,%a1
+#else
+ PEA_TEXT _fini,%a1
+ PEA_TEXT _init,%a1
+#endif
pea (%a0) /* Push second argument: argv. */
move.l %d0, -(%sp) /* Push first argument: argc. */
- pea main
+ PEA_TEXT main,%a1
/* Call the user's main function, and exit with its value. But
let the libc call main. */
- jbsr __uClibc_main
+ CALL __uClibc_main,%a1
illegal /* Crash if somehow `exit' does return. */
+#else
+ .text
+ .globl lib_main
+ .hidden lib_main
+ .type lib_main,@function
+lib_main:
+ move.l %d5,%a5
+ JUMP __shared_flat_add_library,%a0
+
+ .hidden _current_shared_library_a5_offset_
+#endif
/* Define a symbol for the first piece of initialized data. */
.data