diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/dl-sysdep.c | 3 | ||||
-rw-r--r-- | sysdeps/generic/entry.h | 4 | ||||
-rw-r--r-- | sysdeps/ia64/elf/entry.h | 7 | ||||
-rw-r--r-- | sysdeps/ia64/elf/start.S | 45 | ||||
-rw-r--r-- | sysdeps/mach/hurd/dl-sysdep.c | 7 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/entry.h | 4 |
6 files changed, 50 insertions, 20 deletions
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index 3dc76257a7..d1acaeedca 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -46,7 +46,6 @@ extern unsigned long int _dl_hwcap; extern size_t _dl_platformlen; extern fpu_control_t _dl_fpu_control; extern void _end; -extern void ENTRY_POINT (void); /* Protect SUID program against misuse of file descriptors. */ extern void __libc_check_standard_fds (void); @@ -101,7 +100,7 @@ _dl_sysdep_start (void **start_argptr, DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, _dl_argv, _environ, _dl_auxv); - user_entry = (ElfW(Addr)) &ENTRY_POINT; + user_entry = (ElfW(Addr)) ENTRY_POINT; _dl_platform = NULL; /* Default to nothing known about the platform. */ for (av = _dl_auxv; av->a_type != AT_NULL; set_seen (av++)) diff --git a/sysdeps/generic/entry.h b/sysdeps/generic/entry.h index cc0e1d88ab..2f17ce8a4b 100644 --- a/sysdeps/generic/entry.h +++ b/sysdeps/generic/entry.h @@ -1 +1,5 @@ +#ifndef __ASSEMBLY__ +extern void _start (void); +#endif + #define ENTRY_POINT _start diff --git a/sysdeps/ia64/elf/entry.h b/sysdeps/ia64/elf/entry.h new file mode 100644 index 0000000000..53ea9a2297 --- /dev/null +++ b/sysdeps/ia64/elf/entry.h @@ -0,0 +1,7 @@ +#ifndef __ASSEMBLY__ +extern void _start (void); +#endif + +/* The function's entry point is stored in the first word of the + function descriptor (plabel) of _start(). */ +#define ENTRY_POINT (((long int *) _start)[0]) diff --git a/sysdeps/ia64/elf/start.S b/sysdeps/ia64/elf/start.S index 5ba6196e3c..cc8b798b37 100644 --- a/sysdeps/ia64/elf/start.S +++ b/sysdeps/ia64/elf/start.S @@ -17,6 +17,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <sysdep.h> + #include <asm/unistd.h> #include <asm/fpu.h> @@ -31,10 +33,12 @@ * out6: stack_end */ - .global _start - .proc _start + .align 32 + .global _start + .proc _start _start: + .prologue { .mlx alloc r2 = ar.pfs,0,0,7,0 movl r3 = FPSR_DEFAULT @@ -44,38 +48,46 @@ _start: movl gp = @gprel(0f) ;; } -0: { .mii +0: { .mmi ld8 out1 = [out2], 8 /* load argc and move out2 to become argv */ + mov.m r10 = ar.bsp /* fetch rbs base address */ mov r9 = ip ;; + } + { .mii + mov ar.fpsr = r3 sub gp = r9, gp /* back-compute gp value */ + adds out6 = 16, sp /* highest non-environment stack address */ ;; } - { .mfi - mov ar.fpsr = r3 + { + addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp addl out0 = @ltoff(@fptr(main)), gp - } - { .mfi - addl out4 = @ltoff(@fptr(_fini)), gp addl out3 = @ltoff(@fptr(_init)), gp ;; } { .mmi + ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */ ld8 out0 = [out0] /* pointer to `main' function descriptor */ + addl out4 = @ltoff(@fptr(_fini)), gp + ;; + } + { .mmi ld8 out3 = [out3] /* pointer to `init' function descriptor */ - adds out6 = 16, sp /* highest non-environment stack address */ + ld8 out4 = [out4] /* pointer to `fini' function descriptor */ + .save rp, r4 + mov r4 = r0 /* terminate unwind chain with a NULL return-pointer */ } + .body { .mib - ld8 out4 = [out4] /* pointer to `fini' function descriptor */ + st8 [r3] = r10 mov out5 = ret0 /* dynamic linker destructor */ br.call.sptk.few rp = __libc_start_main } { .mib - mov rp = r0 - br.ret.sptk.few rp /* break miserably if we ever return */ - ;; + break 0 /* break miserably if we ever return */ } - .endp _start + .endp _start /* Define a symbol for the first piece of initialized data. */ .data @@ -84,3 +96,8 @@ __data_start: .long 0 .weak data_start data_start = __data_start + + .global __libc_ia64_register_backing_store_base + .align 8 +__libc_ia64_register_backing_store_base: + .space 8 diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 25ae5bbc68..8bcce13588 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -47,7 +47,6 @@ extern void __mach_init (void); extern int _dl_argc; extern char **_dl_argv; extern char **_environ; -extern void ENTRY_POINT (void); int __libc_enable_secure; int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion @@ -119,7 +118,7 @@ _dl_sysdep_start (void **start_argptr, { static struct hurd_startup_data nodata; _dl_hurd_data = &nodata; - nodata.user_entry = (vm_address_t) &ENTRY_POINT; + nodata.user_entry = (vm_address_t) ENTRY_POINT; } else _dl_hurd_data = (void *) p; @@ -128,12 +127,12 @@ _dl_sysdep_start (void **start_argptr, if (_dl_hurd_data->flags & EXEC_STACK_ARGS && _dl_hurd_data->user_entry == 0) - _dl_hurd_data->user_entry = (vm_address_t) &ENTRY_POINT; + _dl_hurd_data->user_entry = (vm_address_t) ENTRY_POINT; unfmh(); /* XXX */ #if 0 /* XXX make this work for real someday... */ - if (_dl_hurd_data->user_entry == (vm_address_t) &ENTRY_POINT) + if (_dl_hurd_data->user_entry == (vm_address_t) ENTRY_POINT) /* We were invoked as a command, not as the program interpreter. The generic ld.so code supports this: it will parse the args as "ld.so PROGRAM [ARGS...]". For booting the Hurd, we diff --git a/sysdeps/unix/sysv/linux/mips/entry.h b/sysdeps/unix/sysv/linux/mips/entry.h index 3db6d93636..04d05d2b0a 100644 --- a/sysdeps/unix/sysv/linux/mips/entry.h +++ b/sysdeps/unix/sysv/linux/mips/entry.h @@ -1 +1,5 @@ +#ifndef __ASSEMBLY__ +extern void __start (void); +#endif + #define ENTRY_POINT __start |