summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2014-12-27 20:33:47 +0000
committerkettenis <kettenis@openbsd.org>2014-12-27 20:33:47 +0000
commita05b67b7159ccee69d91364137da3e35fc81f147 (patch)
treed160943bd521495ca8e253d3f74ebe9a95f03fd6
parentencrypt should easily fit onto the media now. this will be done step by step. (diff)
downloadwireguard-openbsd-a05b67b7159ccee69d91364137da3e35fc81f147.tar.xz
wireguard-openbsd-a05b67b7159ccee69d91364137da3e35fc81f147.zip
Static PIE for mips64. Still something not quite right as a full make build
fails. ok kurt@
-rw-r--r--lib/csu/mips64/md_init.h45
-rw-r--r--libexec/ld.so/mips64/archdep.h5
2 files changed, 47 insertions, 3 deletions
diff --git a/lib/csu/mips64/md_init.h b/lib/csu/mips64/md_init.h
index 2bc75ae7914..291654966a4 100644
--- a/lib/csu/mips64/md_init.h
+++ b/lib/csu/mips64/md_init.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: md_init.h,v 1.7 2014/12/23 16:27:18 deraadt Exp $ */
+/* $OpenBSD: md_init.h,v 1.8 2014/12/27 20:33:47 kettenis Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
@@ -105,6 +105,49 @@
" .end __start \n" \
" .previous")
+#define MD_RCRT0_START \
+ __asm( \
+ ".text \n" \
+ " .align 3 \n" \
+ " .globl __start \n" \
+ " .ent __start \n" \
+ " .type __start, @function \n" \
+ "__start: \n" \
+ " dsubu $sp, $sp, 160 \n" \
+ " .cpsetup $t9, 144, __start \n" \
+ " dla $s1, 1f \n" \
+ " bgezal $zero, 1f \n" \
+ "1: \n" \
+ " dsubu $s0, $ra, $s1 \n" \
+ " daddu $a0, $sp, 160 \n" \
+ " daddu $a1, $sp, 0 \n" \
+ " dla $t9, _dl_boot_bind \n" \
+ " daddu $t9, $s0 \n" \
+ " jalr $t9 \n" \
+ " daddu $sp, $sp, 160 \n" \
+ " move $a0, $sp \n" \
+ " dsrl $a1, $sp, 4 \n" /* align stack on a */ \
+ " dsll $sp, $a1, 4 \n" /* 16 byte boundary */ \
+ " move $a1, $zero \n" \
+ " dla $t9, ___start \n" \
+ " jr $t9 \n" \
+ " .end __start \n" \
+ " .globl _dl_exit \n" \
+ " .ent _dl_exit \n" \
+ " .type _dl_exit, @function \n" \
+ "_dl_exit: \n" \
+ " li $v0, 1 \n" \
+ " syscall \n" \
+ " j $ra \n" \
+ " .end _dl_exit \n" \
+ " .globl _dl_printf \n" \
+ " .ent _dl_printf \n" \
+ " .type _dl_printf, @function \n" \
+ "_dl_printf: \n" \
+ " j $ra \n" \
+ " .end _dl_printf \n" \
+ " .previous")
+
struct kframe {
long kargc;
char *kargv[1]; /* size depends on kargc */
diff --git a/libexec/ld.so/mips64/archdep.h b/libexec/ld.so/mips64/archdep.h
index b51bc169607..95631b08c3f 100644
--- a/libexec/ld.so/mips64/archdep.h
+++ b/libexec/ld.so/mips64/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.7 2014/07/04 18:07:54 miod Exp $ */
+/* $OpenBSD: archdep.h,v 1.8 2014/12/27 20:33:47 kettenis Exp $ */
/*
* Copyright (c) 1998-2002 Opsycon AB, Sweden.
@@ -84,7 +84,8 @@ do { \
while (n--) { \
if (sp->st_shndx == SHN_UNDEF || \
sp->st_shndx == SHN_COMMON) { \
- _dl_exit(6); \
+ if (ELF64_ST_BIND(sp->st_info) != STB_WEAK) \
+ _dl_exit(6); \
} else if (ELF64_ST_TYPE(sp->st_info) == STT_FUNC) { \
*gotp += __loff; \
} else { \