From: kettenis Date: Sat, 27 Dec 2014 20:33:47 +0000 (+0000) Subject: Static PIE for mips64. Still something not quite right as a full make build X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a05b67b7159ccee69d91364137da3e35fc81f147;p=openbsd Static PIE for mips64. Still something not quite right as a full make build fails. ok kurt@ --- 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 { \