diff options
-rw-r--r-- | lib/csu/boot.h | 5 | ||||
-rw-r--r-- | lib/csu/sparc/md_init.h | 62 |
2 files changed, 63 insertions, 4 deletions
diff --git a/lib/csu/boot.h b/lib/csu/boot.h index a76481b6946..fec41e3971b 100644 --- a/lib/csu/boot.h +++ b/lib/csu/boot.h @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.h,v 1.10 2015/01/16 06:47:03 deraadt Exp $ */ +/* $OpenBSD: boot.h,v 1.11 2015/07/03 11:17:25 miod Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -282,7 +282,8 @@ _dl_boot_bind(const long sp, long *dl_data, Elf_Dyn *dynamicp) else pagesize = 4096; -#if defined(__alpha__) || defined(__powerpc__) || defined(__sparc64__) +#if defined(__alpha__) || defined(__powerpc__) || defined(__sparc__) || \ + defined(__sparc64__) start = ELF_TRUNC((Elf_Addr)__plt_start, pagesize); size = ELF_ROUND((Elf_Addr)__plt_end - start, pagesize); mprotect((void *)start, size, PROT_READ); diff --git a/lib/csu/sparc/md_init.h b/lib/csu/sparc/md_init.h index cf102f4dd64..4eda521741e 100644 --- a/lib/csu/sparc/md_init.h +++ b/lib/csu/sparc/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.2 2013/12/03 06:21:41 guenther Exp $ */ +/* $OpenBSD: md_init.h,v 1.3 2015/07/03 11:17:25 miod Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -47,7 +47,6 @@ #entry_pt": \n" \ " save %sp, -96, %sp \n" \ " .align 4 \n" \ - " /* fall thru */ \n" \ " .previous") @@ -78,3 +77,62 @@ " call ___start \n" \ " mov %g1, %o3 \n" \ " .previous") + + +#define MD_RCRT0_START \ + __asm( \ + ".text \n" \ + " .align 4 \n" \ + " .global __start \n" \ + " .global _start \n" \ + "__start: \n" \ + "_start: \n" \ + " mov 0, %fp \n" \ + \ + " sub %sp, 96, %sp \n" \ + " add %sp, 96, %l3 \n" \ + " add %l3, 64, %o0 \n" \ + " mov %o0, %l0 \n" \ + " call 0f \n" \ + " nop \n" \ + " call _DYNAMIC + 8 \n" \ + "0: ld [%o7 + 8], %o2 \n" \ + " sll %o2, 2, %o2 \n" \ + " sra %o2, 0, %o2 \n" \ + " add %o2, %o7, %o2 \n" \ + " call _dl_boot_bind \n" \ + " mov %l3, %o1 \n" \ + " add %sp, 96, %sp \n" \ + \ + " ld [%sp + 64], %o0 ! get argc \n" \ + " add %sp, 68, %o1 ! get argv \n" \ + " sll %o0, 2, %o2 \n" \ + " add %o2, 4, %o2 ! envp = argv + (argc << 2) + 4 \n" \ + " add %o1, %o2, %o2 \n" \ + " andn %sp, 7, %sp ! align \n" \ + " sub %sp, 24, %sp ! expand to standard frame size \n" \ + " call ___start \n" \ + " clr %o3 \n" \ + \ + " .global _dl_mul_fixup \n" \ + " .type _dl_mul_fixup,@function \n" \ + "_dl_mul_fixup: \n" \ + " retl \n" \ + " nop \n" \ + \ + " .global _dl_printf \n" \ + " .type _dl_printf,@function \n" \ + "_dl_printf: \n" \ + " retl \n" \ + " nop \n" \ + \ + " .global _dl_exit \n" \ + " .type _dl_exit,@function \n" \ + "_dl_exit: \n" \ + " mov 0x401, %g1 \n" \ + " add %o7, 8, %g2 \n" \ + " ta 0 \n" \ + " retl \n" \ + " neg %o0 \n" \ + \ + " .previous") |