diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2015-09-05 06:22:48 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2015-09-05 06:22:48 +0000 |
commit | 539de3a1188f5b1c228094e5dce66cb8d36373ca (patch) | |
tree | 5a75b37cc83751a64d7e1e1d239017cb5170e53d /lib | |
parent | 93ab453ac3fdb7231f0e8d9d4e94aa74d0333a88 (diff) |
Adds hidden _libc_FOO aliases for the system call stubs.
Stop generating _brk and _sbrk symbols: they've already been hidden.
Set the ELF symbol size on the syscall stubs.
Give the __{min,cur}brk symbols a size and type, and hide more jump labels.
ok deraadt@
Diffstat (limited to 'lib')
39 files changed, 198 insertions, 125 deletions
diff --git a/lib/libc/arch/amd64/SYS.h b/lib/libc/arch/amd64/SYS.h index d96101b77c4..0893037f13f 100644 --- a/lib/libc/arch/amd64/SYS.h +++ b/lib/libc/arch/amd64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.14 2015/08/31 02:53:56 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.15 2015/09/05 06:22:46 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -67,10 +67,12 @@ SYSENTRY_HIDDEN(x); \ WEAK_ALIAS(x, _thread_sys_##x) #define SYSENTRY_HIDDEN(x) \ - ENTRY(_thread_sys_ ## x); \ - _HIDDEN_FALIAS(x,_thread_sys_##x) + ENTRY(_thread_sys_ ## x) -#define SYSEXIT_HIDDEN(x) END(_thread_sys_ ## x) +#define SYSEXIT_HIDDEN(x) \ + END(_thread_sys_ ## x); \ + _HIDDEN_FALIAS(x,_thread_sys_##x); \ + END(_HIDDEN(x)) #define SYSEXIT(x) SYSEXIT_HIDDEN(x); END(x) #define CERROR _C_LABEL(__cerror) diff --git a/lib/libc/arch/amd64/sys/Ovfork.S b/lib/libc/arch/amd64/sys/Ovfork.S index 882edb0f448..fd2b7a45703 100644 --- a/lib/libc/arch/amd64/sys/Ovfork.S +++ b/lib/libc/arch/amd64/sys/Ovfork.S @@ -1,4 +1,4 @@ -/* $OpenBSD: Ovfork.S,v 1.5 2015/06/17 03:04:50 uebayasi Exp $ */ +/* $OpenBSD: Ovfork.S,v 1.6 2015/09/05 06:22:47 guenther Exp $ */ /* $NetBSD: Ovfork.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ /*- @@ -42,9 +42,9 @@ SYSENTRY(vfork) popq %r9 /* my rta into r9 */ SYSTRAP(vfork) - jc err + jc 1f jmp *%r9 -err: +1: pushq %r9 #ifdef __PIC__ movq PIC_GOT(CERROR), %rcx diff --git a/lib/libc/arch/amd64/sys/brk.S b/lib/libc/arch/amd64/sys/brk.S index 3f9f6d7a7be..c59f0036eb0 100644 --- a/lib/libc/arch/amd64/sys/brk.S +++ b/lib/libc/arch/amd64/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.6 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.7 2015/09/05 06:22:47 guenther Exp $ */ /* $NetBSD: brk.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ /*- @@ -42,14 +42,15 @@ .globl _end .globl __curbrk -WEAK_ALIAS(brk, _brk) - .data __minbrk: .quad _end + END(__minbrk) + .type __minbrk,@object .text -ENTRY(_brk) + .weak brk +ENTRY(brk) #ifdef __PIC__ movq PIC_GOT(__minbrk),%rdx cmpq %rdi,(%rdx) @@ -57,12 +58,12 @@ ENTRY(_brk) movq (%rdx),%rdi 1: SYSTRAP(break) - jc err + jc 1f movq PIC_GOT(__curbrk),%rdx # set up GOT addressing movq %rdi,(%rdx) xorl %eax,%eax ret -err: +1: movq PIC_GOT(CERROR),%rdx jmp *%rdx #else @@ -71,11 +72,11 @@ err: movq __minbrk(%rip),%rdi 1: SYSTRAP(break) - jc err + jc 1f movq %rdi,__curbrk(%rip) xorl %eax,%eax ret -err: +1: jmp CERROR #endif -END(_brk) +END(brk) diff --git a/lib/libc/arch/amd64/sys/sbrk.S b/lib/libc/arch/amd64/sys/sbrk.S index 848274f6f84..06ed6ba7cca 100644 --- a/lib/libc/arch/amd64/sys/sbrk.S +++ b/lib/libc/arch/amd64/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.6 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.7 2015/09/05 06:22:47 guenther Exp $ */ /* $NetBSD: sbrk.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ /*- @@ -47,25 +47,26 @@ .globl __curbrk .hidden __curbrk -WEAK_ALIAS(sbrk, _sbrk) - .data __curbrk: .quad _end + END(__curbrk) + .type __curbrk,@object .text -ENTRY(_sbrk) + .weak sbrk +ENTRY(sbrk) #ifdef __PIC__ movq PIC_GOT(__curbrk),%rdx movslq %edi, %rax movq (%rdx),%rdi addq %rax,%rdi SYSTRAP(break) - jc err + jc 1f movq PIC_GOT(__curbrk),%rdx movq (%rdx),%rax movq %rdi,(%rdx) ret -err: +1: mov PIC_GOT(CERROR),%rdx jmp *%rdx #else @@ -74,11 +75,11 @@ err: movq %rsi,%rdi addq %rax,%rdi SYSTRAP(break) - jc err + jc 1f movq __curbrk(%rip),%rax addq %rsi,__curbrk(%rip) ret -err: +1: jmp CERROR #endif -END(_sbrk) +END(sbrk) diff --git a/lib/libc/arch/amd64/sys/sigprocmask.S b/lib/libc/arch/amd64/sys/sigprocmask.S index 0b8eced0fdf..3b2c8b2394f 100644 --- a/lib/libc/arch/amd64/sys/sigprocmask.S +++ b/lib/libc/arch/amd64/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.5 2015/06/17 03:04:50 uebayasi Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.6 2015/09/05 06:22:47 guenther Exp $ */ /* $NetBSD: sigprocmask.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ /*- @@ -46,14 +46,14 @@ SYSENTRY(sigprocmask) jmp 2f 1: movl (%rsi),%esi # fetch indirect ... 2: SYSTRAP(sigprocmask) - jc err + jc 1f testq %rdx,%rdx # test if old mask requested jz out movl %eax,(%rdx) # store old mask out: xorl %eax,%eax ret -err: +1: #ifdef __PIC__ movq PIC_GOT(CERROR), %rcx jmp *%rcx diff --git a/lib/libc/arch/amd64/sys/sigsuspend.S b/lib/libc/arch/amd64/sys/sigsuspend.S index c07567fc34d..0c0c32b1609 100644 --- a/lib/libc/arch/amd64/sys/sigsuspend.S +++ b/lib/libc/arch/amd64/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.S,v 1.4 2015/06/17 03:04:50 uebayasi Exp $ */ +/* $OpenBSD: sigsuspend.S,v 1.5 2015/09/05 06:22:47 guenther Exp $ */ /* $NetBSD: sigsuspend.S,v 1.1 2001/06/19 00:25:07 fvdl Exp $ */ /*- @@ -42,10 +42,10 @@ SYSENTRY(sigsuspend) movl (%rdi),%edi # indirect to mask arg SYSTRAP(sigsuspend) - jc err + jc 1f xorl %eax,%eax # shouldn t happen ret -err: +1: #ifdef __PIC__ movq PIC_GOT(CERROR), %rcx jmp *%rcx diff --git a/lib/libc/arch/amd64/sys/syscall.S b/lib/libc/arch/amd64/sys/syscall.S index bdddd51205e..64a0d100f53 100644 --- a/lib/libc/arch/amd64/sys/syscall.S +++ b/lib/libc/arch/amd64/sys/syscall.S @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.S,v 1.5 2015/06/17 03:04:50 uebayasi Exp $ */ +/* $OpenBSD: syscall.S,v 1.6 2015/09/05 06:22:47 guenther Exp $ */ /* $NetBSD: syscall.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ /*- @@ -43,9 +43,9 @@ SYSENTRY(syscall) movq $0,%rax movq %rcx,%r10 syscall - jc err + jc 1f ret -err: +1: #ifdef __PIC__ movq PIC_GOT(CERROR), %rcx jmp *%rcx diff --git a/lib/libc/arch/i386/SYS.h b/lib/libc/arch/i386/SYS.h index 4e1a54f003e..2cb60bc11ac 100644 --- a/lib/libc/arch/i386/SYS.h +++ b/lib/libc/arch/i386/SYS.h @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: SYS.h,v 1.22 2015/08/31 02:53:56 guenther Exp $ + * $OpenBSD: SYS.h,v 1.23 2015/09/05 06:22:47 guenther Exp $ */ #include <machine/asm.h> @@ -75,6 +75,10 @@ _C_LABEL(x) = _C_LABEL(_thread_sys_ ## x) #define SYSENTRY_HIDDEN(x) \ ENTRY(_thread_sys_ ## x) +#define __END_HIDDEN(x) END(_thread_sys_ ## x); \ + _HIDDEN_FALIAS(x,_thread_sys_ ## x); \ + END(_HIDDEN(x)) +#define __END(x) __END_HIDDEN(x); END(x) #define __DO_SYSCALL(x) \ movl $(SYS_ ## x),%eax; \ @@ -137,20 +141,24 @@ /* perform a syscall, return */ #define PSEUDO_NOERROR(x,y) \ _SYSCALL_NOERROR(x,y); \ - ret + ret; \ + __END(x) /* perform a syscall, set errno, return */ #define PSEUDO(x,y) \ _SYSCALL(x,y); \ - ret + ret; \ + __END(x) #define PSEUDO_HIDDEN(x,y) \ _SYSCALL_HIDDEN(x,y); \ - ret + ret; \ + __END_HIDDEN(x) /* perform a syscall with the same name, set errno, return */ #define RSYSCALL(x) \ PSEUDO(x,x); #define RSYSCALL_HIDDEN(x) \ PSEUDO_HIDDEN(x,x) +#define SYSCALL_END(x) __END(x) .globl CERROR diff --git a/lib/libc/arch/i386/sys/Ovfork.S b/lib/libc/arch/i386/sys/Ovfork.S index aad09330695..7068e0bd144 100644 --- a/lib/libc/arch/i386/sys/Ovfork.S +++ b/lib/libc/arch/i386/sys/Ovfork.S @@ -1,4 +1,4 @@ -/* $OpenBSD: Ovfork.S,v 1.8 2015/03/31 04:32:01 guenther Exp $ */ +/* $OpenBSD: Ovfork.S,v 1.9 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -37,9 +37,9 @@ SYSENTRY(vfork) popl %ecx /* my rta into ecx */ movl $(SYS_vfork),%eax int $0x80 - jc err + jc 1f jmp *%ecx -err: +1: #ifdef __PIC__ PIC_PROLOGUE movl PIC_GOT(_C_LABEL(errno)),%edx @@ -50,3 +50,4 @@ err: #endif movl $-1,%eax jmp *%ecx +SYSCALL_END(vfork) diff --git a/lib/libc/arch/i386/sys/brk.S b/lib/libc/arch/i386/sys/brk.S index 4cafe3049cd..f918b4379e7 100644 --- a/lib/libc/arch/i386/sys/brk.S +++ b/lib/libc/arch/i386/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.10 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.11 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -39,8 +39,12 @@ .data __minbrk: .long _end + END(__minbrk) + .type __minbrk,@object .text + .weak brk + ENTRY(brk) #ifdef __PIC__ movl 4(%esp),%ecx @@ -54,14 +58,14 @@ ENTRY(brk) 1: movl $(SYS_break),%eax int $0x80 - jc err + jc 2f PIC_PROLOGUE movl PIC_GOT(__curbrk),%edx # set up GOT addressing PIC_EPILOGUE xorl %eax,%eax movl %ecx,(%edx) ret -err: +2: PIC_PROLOGUE movl PIC_GOT(CERROR),%ecx # set up GOT addressing PIC_EPILOGUE @@ -77,10 +81,11 @@ err: 1: movl $(SYS_break),%eax int $0x80 - jc err + jc 2f xorl %eax,%eax movl %ecx,__curbrk ret -err: +2: jmp CERROR #endif +END(brk) diff --git a/lib/libc/arch/i386/sys/cerror.S b/lib/libc/arch/i386/sys/cerror.S index de36747aa6c..e30a46e1aa6 100644 --- a/lib/libc/arch/i386/sys/cerror.S +++ b/lib/libc/arch/i386/sys/cerror.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cerror.S,v 1.9 2012/08/22 17:19:34 pascal Exp $ */ +/* $OpenBSD: cerror.S,v 1.10 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -49,3 +49,4 @@ _ENTRY(_CERROR) movl $-1,%eax movl $-1,%edx ret +END(_CERROR) diff --git a/lib/libc/arch/i386/sys/sbrk.S b/lib/libc/arch/i386/sys/sbrk.S index a57d96c5987..6c0da58b8a2 100644 --- a/lib/libc/arch/i386/sys/sbrk.S +++ b/lib/libc/arch/i386/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.10 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.11 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -39,8 +39,12 @@ .data __curbrk: .long _end + END(__curbrk) + .type __curbrk,@object .text + .weak sbrk + ENTRY(sbrk) #ifdef __PIC__ movl 4(%esp),%ecx @@ -51,14 +55,14 @@ ENTRY(sbrk) addl %eax,4(%esp) movl $(SYS_break),%eax int $0x80 - jc err + jc 2f PIC_PROLOGUE movl PIC_GOT(__curbrk),%edx PIC_EPILOGUE movl (%edx),%eax addl %ecx,(%edx) ret -err: +2: PIC_PROLOGUE movl PIC_GOT(CERROR), %ecx PIC_EPILOGUE @@ -71,10 +75,11 @@ err: addl %eax,4(%esp) movl $(SYS_break),%eax int $0x80 - jc err + jc 2f movl __curbrk,%eax addl %ecx,__curbrk ret -err: +2: jmp CERROR #endif +END(sbrk) diff --git a/lib/libc/arch/i386/sys/sigpending.S b/lib/libc/arch/i386/sys/sigpending.S index 89317d8f791..bd461aa1a34 100644 --- a/lib/libc/arch/i386/sys/sigpending.S +++ b/lib/libc/arch/i386/sys/sigpending.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigpending.S,v 1.4 2005/08/07 11:30:38 espie Exp $ */ +/* $OpenBSD: sigpending.S,v 1.5 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -38,3 +38,4 @@ SYSCALL(sigpending) movl %eax,(%ecx) # store old mask xorl %eax,%eax ret +SYSCALL_END(sigpending) diff --git a/lib/libc/arch/i386/sys/sigprocmask.S b/lib/libc/arch/i386/sys/sigprocmask.S index b99f631e8ff..1c47261a171 100644 --- a/lib/libc/arch/i386/sys/sigprocmask.S +++ b/lib/libc/arch/i386/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.9 2012/08/22 17:19:34 pascal Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.10 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -44,7 +44,7 @@ SYSENTRY(sigprocmask) movl %ecx,8(%esp) # to new mask arg 2: movl $(SYS_sigprocmask),%eax int $0x80 - jc err + jc 1f movl 12(%esp),%ecx # fetch old mask requested testl %ecx,%ecx # test if old mask requested jz out @@ -52,7 +52,7 @@ SYSENTRY(sigprocmask) out: xorl %eax,%eax ret -err: +1: #ifdef __PIC__ PIC_PROLOGUE movl PIC_GOT(CERROR), %ecx @@ -62,3 +62,4 @@ err: #else jmp CERROR #endif +SYSCALL_END(sigprocmask) diff --git a/lib/libc/arch/i386/sys/sigreturn.S b/lib/libc/arch/i386/sys/sigreturn.S index 897edac6b62..48ae83b88c0 100644 --- a/lib/libc/arch/i386/sys/sigreturn.S +++ b/lib/libc/arch/i386/sys/sigreturn.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigreturn.S,v 1.7 2005/08/07 11:30:38 espie Exp $ */ +/* $OpenBSD: sigreturn.S,v 1.8 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -45,3 +45,4 @@ SYSCALL(sigreturn) ret +SYSCALL_END(sigreturn) diff --git a/lib/libc/arch/i386/sys/sigsuspend.S b/lib/libc/arch/i386/sys/sigsuspend.S index ed760b2dfe8..cc9b1dda885 100644 --- a/lib/libc/arch/i386/sys/sigsuspend.S +++ b/lib/libc/arch/i386/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.S,v 1.8 2012/08/22 17:19:34 pascal Exp $ */ +/* $OpenBSD: sigsuspend.S,v 1.9 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -39,10 +39,10 @@ SYSENTRY(sigsuspend) movl %eax,4(%esp) movl $(SYS_sigsuspend),%eax int $0x80 - jc err + jc 1f xorl %eax,%eax # shouldn t happen ret -err: +1: #ifdef __PIC__ PIC_PROLOGUE movl PIC_GOT(CERROR), %ecx @@ -51,3 +51,4 @@ err: #else jmp CERROR #endif +SYSCALL_END(sigsuspend) diff --git a/lib/libc/arch/i386/sys/syscall.S b/lib/libc/arch/i386/sys/syscall.S index c555b100f0e..315c1624536 100644 --- a/lib/libc/arch/i386/sys/syscall.S +++ b/lib/libc/arch/i386/sys/syscall.S @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.S,v 1.9 2012/08/22 17:19:34 pascal Exp $ */ +/* $OpenBSD: syscall.S,v 1.10 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -39,9 +39,9 @@ SYSENTRY(syscall) push %ecx int $0x80 push %ecx /* Keep stack frame consistent */ - jc err + jc 1f ret -err: +1: #ifdef __PIC__ PIC_PROLOGUE movl PIC_GOT(CERROR), %ecx @@ -50,3 +50,4 @@ err: #else jmp CERROR #endif +SYSCALL_END(syscall) diff --git a/lib/libc/arch/i386/sys/tfork_thread.S b/lib/libc/arch/i386/sys/tfork_thread.S index 6affc398e77..2f07845ea68 100644 --- a/lib/libc/arch/i386/sys/tfork_thread.S +++ b/lib/libc/arch/i386/sys/tfork_thread.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tfork_thread.S,v 1.6 2015/04/21 01:24:28 guenther Exp $ */ +/* $OpenBSD: tfork_thread.S,v 1.7 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> * All rights reserved. @@ -120,3 +120,4 @@ ENTRY(__tfork_thread) #else jmp CERROR #endif +END(__tfork_thread) diff --git a/lib/libc/arch/mips64/SYS.h b/lib/libc/arch/mips64/SYS.h index f9b2063dc5b..e6016ddd19d 100644 --- a/lib/libc/arch/mips64/SYS.h +++ b/lib/libc/arch/mips64/SYS.h @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: SYS.h,v 1.8 2015/08/31 02:53:56 guenther Exp $ + * $OpenBSD: SYS.h,v 1.9 2015/09/05 06:22:47 guenther Exp $ */ #include <sys/syscall.h> @@ -72,7 +72,11 @@ # define __LEAF2(p,x,sz) LEAF(p ## x, sz) \ WEAK_ALIAS(x, p ## x); -# define __END2(p,x) END(p ## x) +# define __END2_HIDDEN(p,x) END(p ## x); \ + _HIDDEN_FALIAS(x, p ## x) + .size _HIDDEN(x), . - _HIDDEN(x) +# define __END2(p,x) __END2_HIDDEN(p,x); \ + .size x, . - x # define __CLABEL2(p,x) _C_LABEL(p ## x) @@ -87,11 +91,11 @@ PTR_SUBU sp,32; \ SETUP_GP64(16,__CLABEL2(p,x)); \ __DO_SYSCALL(y); \ - bne a3,zero,err; \ + bne a3,zero,1f; \ RESTORE_GP64; \ PTR_ADDU sp,32; \ j ra; \ - err: LA t9,CERROR; \ + 1: LA t9,CERROR; \ RESTORE_GP64; \ PTR_ADDU sp,32; \ jr t9; \ @@ -101,15 +105,15 @@ PTR_SUBU sp,32; \ SETUP_GP64(16,__CLABEL2(p,x)); \ __DO_SYSCALL(y); \ - bne a3,zero,err; \ + bne a3,zero,1f; \ RESTORE_GP64; \ PTR_ADDU sp,32; \ j ra; \ - err: LA t9,CERROR; \ + 1: LA t9,CERROR; \ RESTORE_GP64; \ PTR_ADDU sp,32; \ jr t9; \ - END(p ## x) + __END2_HIDDEN(p,x) #define RSYSCALL(x) __PSEUDO(_thread_sys_,x,x) diff --git a/lib/libc/arch/mips64/sys/brk.S b/lib/libc/arch/mips64/sys/brk.S index 8a7f90d1e98..f4b6c2c53b1 100644 --- a/lib/libc/arch/mips64/sys/brk.S +++ b/lib/libc/arch/mips64/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.6 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.7 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -38,16 +38,18 @@ .data __minbrk: PTR_VAL _C_LABEL(end) + .size __minbrk, . - __minbrk + .type __minbrk,@object .text FRAMESZ= MKFSIZ(1,1) GPOFF= FRAMESZ-2*REGSZ -WEAK_ALIAS(brk, _brk) + .weak brk -LEAF(_brk, FRAMESZ) +LEAF(brk, FRAMESZ) PTR_SUBU sp, FRAMESZ - SETUP_GP64(GPOFF, _brk) + SETUP_GP64(GPOFF, brk) .set reorder PTR_L v0, __minbrk bgtu a0, v0, 1f @@ -67,4 +69,4 @@ LEAF(_brk, FRAMESZ) RESTORE_GP64 PTR_ADDU sp, FRAMESZ jr t9 -END(_brk) +END(brk) diff --git a/lib/libc/arch/mips64/sys/sbrk.S b/lib/libc/arch/mips64/sys/sbrk.S index 3bb14cd2002..f90cbb7f202 100644 --- a/lib/libc/arch/mips64/sys/sbrk.S +++ b/lib/libc/arch/mips64/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.6 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.7 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -38,16 +38,18 @@ .data __curbrk: PTR_VAL _C_LABEL(end) + .size __curbrk, . - __curbrk + .type __curbrk,@object .text FRAMESZ= MKFSIZ(1,1) GPOFF= FRAMESZ-2*REGSZ -WEAK_ALIAS(sbrk, _sbrk) + .weak sbrk -LEAF(_sbrk, FRAMESZ) +LEAF(sbrk, FRAMESZ) PTR_SUBU sp, FRAMESZ - SETUP_GP64(GPOFF, _sbrk) + SETUP_GP64(GPOFF, sbrk) .set reorder PTR_L v1, __curbrk li v0, SYS_break @@ -65,4 +67,4 @@ LEAF(_sbrk, FRAMESZ) RESTORE_GP64 PTR_ADDU sp, FRAMESZ jr t9 -END(_sbrk) +END(sbrk) diff --git a/lib/libc/arch/mips64/sys/sigprocmask.S b/lib/libc/arch/mips64/sys/sigprocmask.S index c5a93995033..d307ca62b1f 100644 --- a/lib/libc/arch/mips64/sys/sigprocmask.S +++ b/lib/libc/arch/mips64/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.5 2011/04/04 12:42:39 guenther Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.6 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -40,23 +40,23 @@ SYSLEAF(sigprocmask, FRAMESZ) PTR_SUBU sp, FRAMESZ SETUP_GP64(GPOFF, sigprocmask) .set reorder - bne a1, zero, gotptr # if new sigset pointer not null + bne a1, zero, .Lgotptr # if new sigset pointer not null li a0, 1 # how = SIG_BLOCK - b doit # mask = zero -gotptr: + b .Ldoit # mask = zero +.Lgotptr: lw a1, 0(a1) # indirect to new mask arg -doit: +.Ldoit: li v0, SYS_sigprocmask syscall - bne a3, zero, err - beq a2, zero, out # test if old mask requested + bne a3, zero, .Lerr + beq a2, zero, .Lout # test if old mask requested sw v0, 0(a2) # store old mask -out: +.Lout: move v0, zero RESTORE_GP64 PTR_ADDU sp, FRAMESZ j ra -err: +.Lerr: LA t9, CERROR RESTORE_GP64 PTR_ADDU sp, FRAMESZ diff --git a/lib/libc/arch/powerpc/SYS.h b/lib/libc/arch/powerpc/SYS.h index b9cd88b7c30..837258efaa4 100644 --- a/lib/libc/arch/powerpc/SYS.h +++ b/lib/libc/arch/powerpc/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.18 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.19 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1994 * Andrew Cagney. All rights reserved. @@ -78,7 +78,11 @@ #define PSEUDO_NOERROR_SUFFIX blr -#define SUFFIX PSEUDO_SUFFIX +#define __END_HIDDEN(p,x) END(p##x); \ + _HIDDEN_FALIAS(x,p##x); \ + END(_HIDDEN(x)) +#define __END(p,x) __END_HIDDEN(p,x); END(x) + #define ALIAS(x,y) WEAK_ALIAS(y,_CONCAT(x,y)); @@ -89,13 +93,18 @@ #define PSEUDO_NOERROR(x,y) ALIAS(_thread_sys_,x) \ PSEUDO_PREFIX(_thread_sys_,x,y) ; \ sc ; \ - PSEUDO_NOERROR_SUFFIX + PSEUDO_NOERROR_SUFFIX; \ + __END(_thread_sys_,x) #define PSEUDO_HIDDEN(x,y) PSEUDO_PREFIX(_thread_sys_,x,y) ; \ sc ; \ - PSEUDO_SUFFIX + PSEUDO_SUFFIX; \ + __END_HIDDEN(_thread_sys_,x) #define PSEUDO(x,y) ALIAS(_thread_sys_,x) \ - PSEUDO_HIDDEN(x,y) + PSEUDO_HIDDEN(x,y); \ + __END(_thread_sys_,x) #define RSYSCALL(x) PSEUDO(x,x) #define RSYSCALL_HIDDEN(x) PSEUDO_HIDDEN(x,x) +#define SYSCALL_END(x) __END(_thread_sys_,x) + diff --git a/lib/libc/arch/powerpc/sys/brk.S b/lib/libc/arch/powerpc/sys/brk.S index 4ba833e8e1f..91753f5afc1 100644 --- a/lib/libc/arch/powerpc/sys/brk.S +++ b/lib/libc/arch/powerpc/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.10 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.11 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 1996 Dale Rahn @@ -30,9 +30,9 @@ .extern __curbrk .extern _C_LABEL(end) -WEAK_ALIAS(brk, _brk) + .weak brk -PREFIX2(_brk,break) +PSEUDO_PREFIX(,brk,break) /* check >= _end, if not make the call for _end */ #ifndef __PIC__ @@ -73,3 +73,4 @@ PREFIX2(_brk,break) stw 7, 0(6) /* # remember, 6=&__curbrk, 3= new value */ mr 3, 0 /* # return 0 */ blr +END(brk) diff --git a/lib/libc/arch/powerpc/sys/cerror.S b/lib/libc/arch/powerpc/sys/cerror.S index db7ba4a84a6..521ab9193b1 100644 --- a/lib/libc/arch/powerpc/sys/cerror.S +++ b/lib/libc/arch/powerpc/sys/cerror.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cerror.S,v 1.10 2015/08/23 15:51:28 kettenis Exp $ */ +/* $OpenBSD: cerror.S,v 1.11 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 1996 Dale Rahn @@ -61,3 +61,4 @@ ASENTRY(___cerror) addi 3, 0, -1 addi 4, 0, -1 blr +END(___cerror) diff --git a/lib/libc/arch/powerpc/sys/sbrk.S b/lib/libc/arch/powerpc/sys/sbrk.S index c728b9c86ce..7303bc58fbf 100644 --- a/lib/libc/arch/powerpc/sys/sbrk.S +++ b/lib/libc/arch/powerpc/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.9 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.10 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 1996 Dale Rahn @@ -33,11 +33,13 @@ .hidden __curbrk __curbrk: .long _C_LABEL(end) + END(__curbrk) + .type __curbrk,@object -WEAK_ALIAS(sbrk, _sbrk) + .weak sbrk .text -PREFIX2(_sbrk,break) +PSEUDO_PREFIX(,sbrk,break) /* call break(__curbrk + size) */ #ifndef __PIC__ @@ -68,3 +70,4 @@ PREFIX2(_sbrk,break) stw 7, 0(6) /* # remember, 6=&__curbrk, 7=new_curbrk */ mr 3, 5 /* # remember, 5=old_curbrk */ blr +END(sbrk) diff --git a/lib/libc/arch/powerpc/sys/sigpending.S b/lib/libc/arch/powerpc/sys/sigpending.S index 44d6b852cec..4767cfb14d3 100644 --- a/lib/libc/arch/powerpc/sys/sigpending.S +++ b/lib/libc/arch/powerpc/sys/sigpending.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigpending.S,v 1.5 2012/07/01 17:47:12 kettenis Exp $ */ +/* $OpenBSD: sigpending.S,v 1.6 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 2012 Mark Kettenis * @@ -26,3 +26,4 @@ PREFIX(sigpending) stw %r3, 0(%r5) li %r3, 0 blr +SYSCALL_END(sigpending) diff --git a/lib/libc/arch/powerpc/sys/sigprocmask.S b/lib/libc/arch/powerpc/sys/sigprocmask.S index 4bdb7c7b755..5ec4fc00d1c 100644 --- a/lib/libc/arch/powerpc/sys/sigprocmask.S +++ b/lib/libc/arch/powerpc/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.8 2015/08/23 15:51:28 kettenis Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.9 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 1996 Dale Rahn @@ -60,3 +60,4 @@ PREFIX(sigprocmask) li 3, 0 addi 1, 1, 16 blr +SYSCALL_END(sigprocmask) diff --git a/lib/libc/arch/powerpc/sys/sigsuspend.S b/lib/libc/arch/powerpc/sys/sigsuspend.S index d57e4b6a1c4..ebb8f31a9f0 100644 --- a/lib/libc/arch/powerpc/sys/sigsuspend.S +++ b/lib/libc/arch/powerpc/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.S,v 1.2 2002/10/07 04:47:12 drahn Exp $ */ +/* $OpenBSD: sigsuspend.S,v 1.3 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 1996 Dale Rahn @@ -33,4 +33,4 @@ PREFIX(sigsuspend) lwz 3, 0(3) /* load the mask */ sc - SUFFIX +SYSCALL_END(sigsuspend) diff --git a/lib/libc/arch/powerpc/sys/tfork_thread.S b/lib/libc/arch/powerpc/sys/tfork_thread.S index 54ba5dc29d3..6c154b8a22b 100644 --- a/lib/libc/arch/powerpc/sys/tfork_thread.S +++ b/lib/libc/arch/powerpc/sys/tfork_thread.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tfork_thread.S,v 1.4 2015/08/27 07:24:17 guenther Exp $ */ +/* $OpenBSD: tfork_thread.S,v 1.5 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 2005 Tim Wiess <tim@nop.cx> @@ -47,3 +47,4 @@ ENTRY(__tfork_thread) li %r3, -1 2: b _C_LABEL(___cerror) +END(__tfork_thread) diff --git a/lib/libc/arch/sparc64/SYS.h b/lib/libc/arch/sparc64/SYS.h index 6b2897480dd..30cb179ce19 100644 --- a/lib/libc/arch/sparc64/SYS.h +++ b/lib/libc/arch/sparc64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.14 2015/09/05 06:22:47 guenther Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -70,6 +70,11 @@ #define END_WEAK(x) END_STRONG(x); .weak x +#define __END_HIDDEN(p,x) END(_CAT(p,x)); \ + _HIDDEN_FALIAS(x, _CAT(p,x)); \ + END(_HIDDEN(x)) +#define __END(p,x) __END_HIDDEN(p,x); END(x) + /* * ERROR branches to cerror. This is done with a macro so that I can * change it to be position independent later, if need be. @@ -112,17 +117,17 @@ */ #define __RSYSCALL(p,x) \ __ENTRY(p,x); mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; \ - add %o7,8,%g2; t ST_SYSCALL; ERROR() + add %o7,8,%g2; t ST_SYSCALL; ERROR(); __END(p,x) #define __RSYSCALL_HIDDEN(p,x) \ __ENTRY_HIDDEN(p,x); mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; \ - add %o7,8,%g2; t ST_SYSCALL; ERROR() + add %o7,8,%g2; t ST_SYSCALL; ERROR(); __END_HIDDEN(p,x) /* * PSEUDO(x,y) is like RSYSCALL(y) except that the name is x. */ #define __PSEUDO(p,x,y) \ __ENTRY(p,x); mov (_CAT(SYS_,y))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \ - t ST_SYSCALL; ERROR() + t ST_SYSCALL; ERROR(); __END(p,x) /* * SYSCALL_NOERROR is like SYSCALL, except it's used for syscalls @@ -141,14 +146,14 @@ */ #define __RSYSCALL_NOERROR(p,x) \ __ENTRY(p,x); mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \ - t ST_SYSCALL + t ST_SYSCALL; __END(p,x) /* * PSEUDO_NOERROR(x,y) is like RSYSCALL_NOERROR(y) except that the name is x. */ #define __PSEUDO_NOERROR(p,x,y) \ __ENTRY(p,x); mov (_CAT(SYS_,y))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \ - t ST_SYSCALL + t ST_SYSCALL; __END(p,x) .globl _C_LABEL(__cerror) @@ -164,3 +169,4 @@ #define PSEUDO(x,y) __PSEUDO(_thread_sys_,x,y) #define PSEUDO_NOERROR(x,y) __PSEUDO_NOERROR(_thread_sys_,x,y) #define SYSENTRY(x) __SYSENTRY(_thread_sys_,x) +#define SYSCALL_END(x) __END(_thread_sys_,x) diff --git a/lib/libc/arch/sparc64/sys/brk.S b/lib/libc/arch/sparc64/sys/brk.S index 0d0bc32b64a..f6c6d5223ca 100644 --- a/lib/libc/arch/sparc64/sys/brk.S +++ b/lib/libc/arch/sparc64/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.6 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: brk.S,v 1.7 2015/09/05 06:22:47 guenther Exp $ */ /* $NetBSD: brk.S,v 1.9 2000/07/25 20:15:40 mycroft Exp $ */ /* @@ -41,15 +41,17 @@ .globl __curbrk .globl _C_LABEL(_end) -WEAK_ALIAS(brk, _brk) + .weak brk .data .align 8 __minbrk: .xword _C_LABEL(_end) /* lower brk limit; also for gmon code */ + END(__minbrk) + OTYPE(__minbrk) .text -ENTRY(_brk) +ENTRY(brk) #ifdef __PIC__ PIC_PROLOGUE(%o5,%o4) set __minbrk, %o4 @@ -82,3 +84,4 @@ ENTRY(_brk) retl /* success, return 0 & record new break */ stx %o2, [%g1 + %lo(__curbrk)] #endif +END(brk) diff --git a/lib/libc/arch/sparc64/sys/cerror.S b/lib/libc/arch/sparc64/sys/cerror.S index 67d5cd4c054..d00ed87c596 100644 --- a/lib/libc/arch/sparc64/sys/cerror.S +++ b/lib/libc/arch/sparc64/sys/cerror.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cerror.S,v 1.5 2012/08/22 17:19:35 pascal Exp $ */ +/* $OpenBSD: cerror.S,v 1.6 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 1992, 1993 @@ -54,3 +54,4 @@ FUNC(___cerror) mov -1, %o0 retl mov -1, %o1 +END(___cerror) diff --git a/lib/libc/arch/sparc64/sys/sbrk.S b/lib/libc/arch/sparc64/sys/sbrk.S index 82346c5775d..98bb8819f0d 100644 --- a/lib/libc/arch/sparc64/sys/sbrk.S +++ b/lib/libc/arch/sparc64/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.4 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: sbrk.S,v 1.5 2015/09/05 06:22:47 guenther Exp $ */ /* $NetBSD: sbrk.S,v 1.7 2000/07/25 15:14:46 mycroft Exp $ */ /* @@ -46,11 +46,13 @@ .align 8 __curbrk: .xword _C_LABEL(_end) + END(__curbrk) + OTYPE(__curbrk) .text -WEAK_ALIAS(sbrk, _sbrk) + .weak sbrk -ENTRY(_sbrk) +ENTRY(sbrk) #ifdef __PIC__ PIC_PROLOGUE(%o5,%o4) set __curbrk, %o3 @@ -80,3 +82,4 @@ ENTRY(_sbrk) retl /* and update curbrk */ stx %o4, [%o2 + %lo(__curbrk)] #endif +END(sbrk) diff --git a/lib/libc/arch/sparc64/sys/sigpending.S b/lib/libc/arch/sparc64/sys/sigpending.S index 1305cf9b942..0099c267991 100644 --- a/lib/libc/arch/sparc64/sys/sigpending.S +++ b/lib/libc/arch/sparc64/sys/sigpending.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigpending.S,v 1.2 2003/06/02 20:18:33 millert Exp $ */ +/* $OpenBSD: sigpending.S,v 1.3 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -45,3 +45,4 @@ SYSENTRY(sigpending) 1: retl /* and return 0 */ clr %o0 +SYSCALL_END(sigpending) diff --git a/lib/libc/arch/sparc64/sys/sigprocmask.S b/lib/libc/arch/sparc64/sys/sigprocmask.S index 63129db6cb0..e59f98fd72d 100644 --- a/lib/libc/arch/sparc64/sys/sigprocmask.S +++ b/lib/libc/arch/sparc64/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.2 2003/06/02 20:18:33 millert Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.3 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -56,3 +56,4 @@ SYSENTRY(sigprocmask) 3: retl /* in any case, return 0 */ clr %o0 +SYSCALL_END(sigprocmask) diff --git a/lib/libc/arch/sparc64/sys/sigreturn.S b/lib/libc/arch/sparc64/sys/sigreturn.S index 55481ccb6ff..b0d007f78a0 100644 --- a/lib/libc/arch/sparc64/sys/sigreturn.S +++ b/lib/libc/arch/sparc64/sys/sigreturn.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigreturn.S,v 1.2 2003/06/02 20:18:33 millert Exp $ */ +/* $OpenBSD: sigreturn.S,v 1.3 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -40,3 +40,4 @@ SYSENTRY(sigreturn) mov SYS_sigreturn, %g1 t ST_SYSCALL ERROR() +SYSCALL_END(sigreturn) diff --git a/lib/libc/arch/sparc64/sys/sigsuspend.S b/lib/libc/arch/sparc64/sys/sigsuspend.S index c6e42e31921..c81c9d4310e 100644 --- a/lib/libc/arch/sparc64/sys/sigsuspend.S +++ b/lib/libc/arch/sparc64/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.S,v 1.2 2003/06/02 20:18:33 millert Exp $ */ +/* $OpenBSD: sigsuspend.S,v 1.3 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -41,3 +41,4 @@ SYSENTRY(sigsuspend) mov SYS_sigsuspend, %g1 t ST_SYSCALL ERROR() /* always terminates with EINTR */ +SYSCALL_END(sigsuspend) diff --git a/lib/libc/arch/sparc64/sys/tfork_thread.S b/lib/libc/arch/sparc64/sys/tfork_thread.S index cf70b25d401..532fa07c0a6 100644 --- a/lib/libc/arch/sparc64/sys/tfork_thread.S +++ b/lib/libc/arch/sparc64/sys/tfork_thread.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tfork_thread.S,v 1.2 2012/06/21 00:56:59 guenther Exp $ */ +/* $OpenBSD: tfork_thread.S,v 1.3 2015/09/05 06:22:47 guenther Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -66,3 +66,4 @@ ENTRY(__tfork_thread) * System call failure. */ ERROR() +END(__tfork_thread) |