diff options
author | 2018-06-16 16:06:03 +0000 | |
---|---|---|
committer | 2018-06-16 16:06:03 +0000 | |
commit | acd0de91b74efe8567f819ca555a304fb1ae700d (patch) | |
tree | e091d82582e2745f1c961b04bada89bb5090e65f /lib | |
parent | Zap whitespaces (diff) | |
download | wireguard-openbsd-acd0de91b74efe8567f819ca555a304fb1ae700d.tar.xz wireguard-openbsd-acd0de91b74efe8567f819ca555a304fb1ae700d.zip |
Add add PIE support for m88k (requires gcc4 toolchain)
Convert __cerror to hidden visibility.
from miod@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/csu/m88k/md_init.h | 42 | ||||
-rw-r--r-- | lib/libc/arch/m88k/SYS.h | 8 | ||||
-rw-r--r-- | lib/libc/arch/m88k/sys/cerror.S | 4 |
3 files changed, 44 insertions, 10 deletions
diff --git a/lib/csu/m88k/md_init.h b/lib/csu/m88k/md_init.h index f55018a474d..e5ec20705aa 100644 --- a/lib/csu/m88k/md_init.h +++ b/lib/csu/m88k/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.5 2016/03/24 05:27:19 guenther Exp $ */ +/* $OpenBSD: md_init.h,v 1.6 2018/06/16 16:06:03 guenther Exp $ */ /* * Copyright (c) 2012 Miodrag Vallat. @@ -46,12 +46,8 @@ * * Our start code starts with two nops because execution may skip up to * two instructions; see setregs() in the kernel for details. - * - * The definitions of environ and __progname prevent the creation - * of COPY relocations for WEAK symbols. */ #define MD_CRT0_START \ - char **environ, *__progname; \ __asm( \ " .text \n" \ " .align 3 \n" \ @@ -68,3 +64,39 @@ " addu %r4, %r4, 4 \n" \ " /* envp = argv + argc + 1 */ \n" \ " .previous"); + +#define MD_RCRT0_START \ + __asm( \ + " .text \n" \ + " .align 3 \n" \ + " .globl __start \n" \ + " .globl _start \n" \ + "__start: \n" \ + "_start: \n" \ + " or %r0, %r0, %r0 \n" \ + " or %r0, %r0, %r0 \n" \ + \ + " or %r2, %r31, 0 \n" \ + " subu %r31, %r31, 4*16 \n" \ + " or %r3, %r31, 0 \n" \ + " bsr 1f \n" \ + " bsr _DYNAMIC#plt \n" \ + "1: ld %r6, %r1, 0 \n" \ + " mak %r5, %r6, 26<2> \n" \ + " addu %r4, %r5, %r1 \n" \ + " bsr _dl_boot_bind#plt \n" \ + " addu %r31, %r31, 4*16 \n" \ + \ + " ld %r2, %r31, 0 /* argc */ \n" \ + " addu %r3, %r31, 4 /* argv */ \n" \ + " lda %r4, %r3[%r2] \n" \ + " or %r5, %r0, %r0 /* cleanup */ \n" \ + " br.n ___start \n" \ + " addu %r4, %r4, 4 \n" \ + " /* envp = argv + argc + 1 */ \n" \ + \ + "_dl_exit: \n" \ + " or %r13, %r0, 1 \n" \ + " tb0 0, %r0, 450 \n" \ + " or %r0, %r0, %r0 \n" \ + " .previous"); diff --git a/lib/libc/arch/m88k/SYS.h b/lib/libc/arch/m88k/SYS.h index 636b5e7ea82..feb08d91253 100644 --- a/lib/libc/arch/m88k/SYS.h +++ b/lib/libc/arch/m88k/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.24 2016/09/22 18:19:59 guenther Exp $*/ +/* $OpenBSD: SYS.h,v 1.25 2018/06/16 16:06:03 guenther Exp $*/ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -73,8 +73,10 @@ ld %r11, %r25, __CONCAT(sym,#got_rel); \ st reg, %r11, %r0 #endif -#endif +#define CERROR __cerror#plt +#else /* __PIC__ */ #define CERROR __cerror +#endif /* __PIC__ */ #define __DO_SYSCALL(x) \ or %r13, %r0, __SYSCALLNAME(SYS_,x); \ @@ -127,5 +129,3 @@ #define SYSCALL_END(x) SYSCALL_END_HIDDEN(x); END(x) #define ASMSTR .asciz - - .globl __cerror diff --git a/lib/libc/arch/m88k/sys/cerror.S b/lib/libc/arch/m88k/sys/cerror.S index 20b2d43581a..7297885dc0e 100644 --- a/lib/libc/arch/m88k/sys/cerror.S +++ b/lib/libc/arch/m88k/sys/cerror.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cerror.S,v 1.14 2016/09/22 18:19:59 guenther Exp $ */ +/* $OpenBSD: cerror.S,v 1.15 2018/06/16 16:06:03 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -51,6 +51,8 @@ ASENTRY(__cerror) or %r2, %r0, %r3 END(__cerror) + .hidden __cerror + #if 0 /* ahh, if only */ ASENTRY(__errno) |