diff options
Diffstat (limited to 'lib/libc')
236 files changed, 1320 insertions, 432 deletions
diff --git a/lib/libc/Makefile.inc b/lib/libc/Makefile.inc index b989cb6b3ca..d6b30e1c593 100644 --- a/lib/libc/Makefile.inc +++ b/lib/libc/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.22 2014/08/31 09:36:39 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.23 2015/08/31 02:53:56 guenther Exp $ # # This file contains make rules used to build libc # @@ -8,7 +8,8 @@ all: @echo "need to define LIBCSRCDIR" >&2; exit 1 .endif -CFLAGS+= -I${LIBCSRCDIR}/include -Werror-implicit-function-declaration +CFLAGS+=-I${LIBCSRCDIR}/include -I${LIBCSRCDIR}/hidden \ + -Werror-implicit-function-declaration # Include link-time warnings about unsafe API uses (ie. strcpy) CFLAGS+=-DAPIWARN diff --git a/lib/libc/Symbols.list b/lib/libc/Symbols.list index 3a05331230b..10e01678c7d 100644 --- a/lib/libc/Symbols.list +++ b/lib/libc/Symbols.list @@ -519,8 +519,6 @@ __sys_errlist __sys_nerr __sys_siglist _ctype_ -_err -_errx _getgrent_yp _longjmp _ng_makekey @@ -538,12 +536,6 @@ _tolower _tolower_tab_ _toupper _toupper_tab_ -_verr -_verrx -_vwarn -_vwarnx -_warn -_warnx alarm alphasort auth_approval @@ -827,10 +819,6 @@ errc verrc vwarnc warnc -_errc -_verrc -_vwarnc -_warnc /* crypt */ Blowfish_decipher diff --git a/lib/libc/arch/alpha/SYS.h b/lib/libc/arch/alpha/SYS.h index f1d15c6a501..e05715cca4b 100644 --- a/lib/libc/arch/alpha/SYS.h +++ b/lib/libc/arch/alpha/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.10 2015/04/07 01:27:06 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.11 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: SYS.h,v 1.4 1996/10/17 03:03:53 cgd Exp $ */ /* @@ -31,6 +31,29 @@ #include <machine/asm.h> #include <sys/syscall.h> +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); \ + .size _HIDDEN(x), . - _HIDDEN(x) +#define END_WEAK(x) END_STRONG(x); .weak x + #define CALLSYS_ERROR(name) \ CALLSYS_NOERROR(name); \ diff --git a/lib/libc/arch/alpha/string/bcopy.S b/lib/libc/arch/alpha/string/bcopy.S index 65a7d55e407..8008a44c9db 100644 --- a/lib/libc/arch/alpha/string/bcopy.S +++ b/lib/libc/arch/alpha/string/bcopy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bcopy.S,v 1.7 2014/11/30 19:43:54 deraadt Exp $ */ +/* $OpenBSD: bcopy.S,v 1.8 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: bcopy.S,v 1.3 1996/10/17 03:08:11 cgd Exp $ */ /* @@ -29,7 +29,7 @@ * rights to redistribute these changes. */ -#include <machine/asm.h> +#include "SYS.h" #define SRCREG a0 #define DSTREG a1 @@ -266,4 +266,4 @@ bcopy_ov_short: ldq_u t2,0(SRCREG) br zero,bcopy_da_finish - END(bcopy) + END_WEAK(bcopy) diff --git a/lib/libc/arch/alpha/string/bzero.S b/lib/libc/arch/alpha/string/bzero.S index 5967dcb0f1a..159a2fd815b 100644 --- a/lib/libc/arch/alpha/string/bzero.S +++ b/lib/libc/arch/alpha/string/bzero.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bzero.S,v 1.4 2005/08/07 16:40:13 espie Exp $ */ +/* $OpenBSD: bzero.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: bzero.S,v 1.2 1996/10/17 03:08:12 cgd Exp $ */ /* @@ -28,7 +28,7 @@ * rights to redistribute these changes. */ -#include <machine/asm.h> +#include "SYS.h" LEAF(bzero,2) ble a1,bzero_done @@ -108,4 +108,4 @@ bzero_finish_lp_done: bzero_done: RET - END(bzero) + END_WEAK(bzero) diff --git a/lib/libc/arch/alpha/string/ffs.S b/lib/libc/arch/alpha/string/ffs.S index 9ad222a4806..6600b3aeeb2 100644 --- a/lib/libc/arch/alpha/string/ffs.S +++ b/lib/libc/arch/alpha/string/ffs.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs.S,v 1.2 2004/10/01 04:08:45 jsg Exp $ */ +/* $OpenBSD: ffs.S,v 1.3 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: ffs.S,v 1.3 1996/10/17 03:08:13 cgd Exp $ */ /* @@ -32,7 +32,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" LEAF(ffs, 1) addl a0, 0, t0 @@ -89,4 +89,4 @@ Ldone: Lallzero: bis zero, zero, v0 RET -END(ffs) +END_WEAK(ffs) diff --git a/lib/libc/arch/alpha/string/memcpy.S b/lib/libc/arch/alpha/string/memcpy.S index 695872491ea..ffdcea3b832 100644 --- a/lib/libc/arch/alpha/string/memcpy.S +++ b/lib/libc/arch/alpha/string/memcpy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memcpy.S,v 1.5 2014/11/30 19:43:54 deraadt Exp $ */ +/* $OpenBSD: memcpy.S,v 1.6 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: bcopy.S,v 1.3 1996/10/17 03:08:11 cgd Exp $ */ /* @@ -29,7 +29,7 @@ * rights to redistribute these changes. */ -#include <machine/asm.h> +#include "SYS.h" #define SRCREG a1 #define DSTREG a0 @@ -197,4 +197,4 @@ bcopy_da_finish: bcopy_done: RET - END(memcpy) + END_STRONG(memcpy) diff --git a/lib/libc/arch/alpha/string/memmove.S b/lib/libc/arch/alpha/string/memmove.S index dc74e8c3de4..f0ebde808e8 100644 --- a/lib/libc/arch/alpha/string/memmove.S +++ b/lib/libc/arch/alpha/string/memmove.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memmove.S,v 1.5 2014/11/30 19:43:54 deraadt Exp $ */ +/* $OpenBSD: memmove.S,v 1.6 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: bcopy.S,v 1.3 1996/10/17 03:08:11 cgd Exp $ */ /* @@ -29,7 +29,7 @@ * rights to redistribute these changes. */ -#include <machine/asm.h> +#include "SYS.h" #define SRCREG a1 #define DSTREG a0 @@ -270,4 +270,4 @@ bcopy_ov_short: ldq_u t2,0(SRCREG) br zero,bcopy_da_finish - END(memmove) + END_STRONG(memmove) diff --git a/lib/libc/arch/amd64/SYS.h b/lib/libc/arch/amd64/SYS.h index a61385fc13a..d96101b77c4 100644 --- a/lib/libc/arch/amd64/SYS.h +++ b/lib/libc/arch/amd64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.13 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.14 2015/08/31 02:53:56 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -38,18 +38,40 @@ #include <machine/asm.h> #include <sys/syscall.h> +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) +#define END_WEAK(x) END_STRONG(x); .weak x + #define SYSTRAP(x) movl $(SYS_ ## x),%eax; movq %rcx, %r10; syscall #define SYSENTRY(x) \ SYSENTRY_HIDDEN(x); \ - .weak _C_LABEL(x); \ - _C_LABEL(x) = _C_LABEL(_thread_sys_ ## x) + WEAK_ALIAS(x, _thread_sys_##x) #define SYSENTRY_HIDDEN(x) \ - ENTRY(_thread_sys_ ## x) \ + ENTRY(_thread_sys_ ## x); \ + _HIDDEN_FALIAS(x,_thread_sys_##x) #define SYSEXIT_HIDDEN(x) END(_thread_sys_ ## x) -#define SYSEXIT(x) SYSEXIT_HIDDEN(x); END(x) +#define SYSEXIT(x) SYSEXIT_HIDDEN(x); END(x) #define CERROR _C_LABEL(__cerror) #define _CERROR _C_LABEL(___cerror) diff --git a/lib/libc/arch/amd64/string/bcmp.S b/lib/libc/arch/amd64/string/bcmp.S index 82d239bd233..fc7afe5b8be 100644 --- a/lib/libc/arch/amd64/string/bcmp.S +++ b/lib/libc/arch/amd64/string/bcmp.S @@ -1,4 +1,4 @@ -#include <machine/asm.h> +#include "SYS.h" ENTRY(bcmp) xorl %eax,%eax /* clear return value */ @@ -18,4 +18,4 @@ ENTRY(bcmp) L1: incl %eax L2: ret -END(bcmp) +END_WEAK(bcmp) diff --git a/lib/libc/arch/amd64/string/bzero.S b/lib/libc/arch/amd64/string/bzero.S index e91dd882115..eb3a7713be7 100644 --- a/lib/libc/arch/amd64/string/bzero.S +++ b/lib/libc/arch/amd64/string/bzero.S @@ -4,7 +4,7 @@ * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(bzero) movq %rsi,%rdx @@ -38,4 +38,4 @@ L1: movq %rdx,%rcx /* zero remainder by bytes */ stosb ret -END(bzero) +END_WEAK(bzero) diff --git a/lib/libc/arch/amd64/string/ffs.S b/lib/libc/arch/amd64/string/ffs.S index 6738183a4ec..3e2d81e56b5 100644 --- a/lib/libc/arch/amd64/string/ffs.S +++ b/lib/libc/arch/amd64/string/ffs.S @@ -1,11 +1,11 @@ -/* $OpenBSD: ffs.S,v 1.2 2015/05/29 07:21:09 uebayasi Exp $ */ +/* $OpenBSD: ffs.S,v 1.3 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(ffs) bsfl %edi,%eax @@ -16,4 +16,4 @@ ENTRY(ffs) _ALIGN_TEXT L1: xorl %eax,%eax /* clear result */ ret -END(ffs) +END_WEAK(ffs) diff --git a/lib/libc/arch/amd64/string/memchr.S b/lib/libc/arch/amd64/string/memchr.S index 9458f87eb4c..4fe2d4d996a 100644 --- a/lib/libc/arch/amd64/string/memchr.S +++ b/lib/libc/arch/amd64/string/memchr.S @@ -4,7 +4,7 @@ * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(memchr) movb %sil,%al /* set character to search for */ @@ -19,4 +19,4 @@ ENTRY(memchr) ret L1: xorq %rax,%rax ret -END(memchr) +END_STRONG(memchr) diff --git a/lib/libc/arch/amd64/string/memmove.S b/lib/libc/arch/amd64/string/memmove.S index f8bd571252c..8a924a06801 100644 --- a/lib/libc/arch/amd64/string/memmove.S +++ b/lib/libc/arch/amd64/string/memmove.S @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* * memmove (dst,src,cnt) @@ -86,5 +86,5 @@ ENTRY(memmove) cld ret // END(memcpy) -END(memmove) -END(bcopy) +END_STRONG(memmove) +END_WEAK(bcopy) diff --git a/lib/libc/arch/amd64/string/memset.S b/lib/libc/arch/amd64/string/memset.S index 5b9d9a16ffc..779ea53b9f8 100644 --- a/lib/libc/arch/amd64/string/memset.S +++ b/lib/libc/arch/amd64/string/memset.S @@ -4,7 +4,7 @@ * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(memset) movq %rsi,%rax @@ -53,4 +53,4 @@ L1: rep movq %r11,%rax ret -END(memset) +END_STRONG(memset) diff --git a/lib/libc/arch/amd64/string/strchr.S b/lib/libc/arch/amd64/string/strchr.S index a2f02a09664..285ce084114 100644 --- a/lib/libc/arch/amd64/string/strchr.S +++ b/lib/libc/arch/amd64/string/strchr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strchr.S,v 1.6 2015/05/29 07:21:09 uebayasi Exp $ */ +/* $OpenBSD: strchr.S,v 1.7 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: strchr.S,v 1.7 2014/03/22 19:16:34 jakllsch Exp $ */ /*- @@ -32,7 +32,7 @@ /* See comments in strlen.S about checking words for byte values */ -#include <machine/asm.h> +#include "SYS.h" WEAK_ALIAS(index, strchr) @@ -123,4 +123,4 @@ ENTRY(strchr) sar %cl,%r10 /* top bytes 0xff */ and %r10,%rax /* clear lsb from unwanted low bytes */ jmp 21b -END(strchr) +END_STRONG(strchr) diff --git a/lib/libc/arch/amd64/string/strcmp.S b/lib/libc/arch/amd64/string/strcmp.S index 2aa55f45f15..752d8e8c1d7 100644 --- a/lib/libc/arch/amd64/string/strcmp.S +++ b/lib/libc/arch/amd64/string/strcmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strcmp.S,v 1.5 2015/05/29 07:21:09 uebayasi Exp $ */ +/* $OpenBSD: strcmp.S,v 1.6 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: strcmp.S,v 1.2 2014/03/22 19:16:34 jakllsch Exp $ */ /* @@ -6,7 +6,7 @@ * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(strcmp) /* @@ -69,4 +69,4 @@ ENTRY(strcmp) movzbq %dl,%rdx subq %rdx,%rax ret -END(strcmp) +END_STRONG(strcmp) diff --git a/lib/libc/arch/amd64/string/strlen.S b/lib/libc/arch/amd64/string/strlen.S index 7e7395385f2..bde5df68e6e 100644 --- a/lib/libc/arch/amd64/string/strlen.S +++ b/lib/libc/arch/amd64/string/strlen.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strlen.S,v 1.4 2015/05/29 07:21:09 uebayasi Exp $ */ +/* $OpenBSD: strlen.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: strlen.S,v 1.6 2014/03/22 19:16:34 jakllsch Exp $ */ /*- @@ -35,7 +35,7 @@ * (Only the long comment really remains his work!) */ -#include <machine/asm.h> +#include "SYS.h" /* * There are many well known branch-free sequences which are used @@ -154,4 +154,4 @@ ENTRY(strlen) dec %rsi or %rsi,%rdx /* low bytes now non-zero */ jmp 2b -END(strlen) +END_STRONG(strlen) diff --git a/lib/libc/arch/amd64/string/strrchr.S b/lib/libc/arch/amd64/string/strrchr.S index 802be5a2831..44a3839cf96 100644 --- a/lib/libc/arch/amd64/string/strrchr.S +++ b/lib/libc/arch/amd64/string/strrchr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strrchr.S,v 1.6 2015/05/29 07:21:09 uebayasi Exp $ */ +/* $OpenBSD: strrchr.S,v 1.7 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: strrchr.S,v 1.3 2014/03/22 19:16:34 jakllsch Exp $ */ /* @@ -6,7 +6,7 @@ * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" WEAK_ALIAS(rindex, strrchr) @@ -121,4 +121,4 @@ ENTRY(strrchr) .Ldone: ret -END(strrchr) +END_STRONG(strrchr) diff --git a/lib/libc/arch/arm/SYS.h b/lib/libc/arch/arm/SYS.h index ce42349711a..df72e5c1b3c 100644 --- a/lib/libc/arch/arm/SYS.h +++ b/lib/libc/arch/arm/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.10 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.11 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: SYS.h,v 1.8 2003/08/07 16:42:02 agc Exp $ */ /*- @@ -38,6 +38,30 @@ #include <machine/asm.h> #include <sys/syscall.h> + +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) +#define END_WEAK(x) END_STRONG(x); .weak x + + #define SYSENTRY(x) \ .weak _C_LABEL(x); \ _C_LABEL(x) = _C_LABEL(_thread_sys_ ## x); \ diff --git a/lib/libc/arch/arm/string/_memcpy.S b/lib/libc/arch/arm/string/_memcpy.S index dee8de3e080..ef2ccc442b9 100644 --- a/lib/libc/arch/arm/string/_memcpy.S +++ b/lib/libc/arch/arm/string/_memcpy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: _memcpy.S,v 1.4 2015/06/08 14:22:05 jsg Exp $ */ +/* $OpenBSD: _memcpy.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: _memcpy.S,v 1.4 2003/04/05 23:08:52 bjh21 Exp $ */ /*- @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* * This is one fun bit of code ... @@ -462,3 +462,4 @@ ENTRY(_memcpy) .Lmemcpy_bsrcul1l4: add r1, r1, #1 b .Lmemcpy_bl4 +END(_memcpy) diff --git a/lib/libc/arch/arm/string/bcopy.S b/lib/libc/arch/arm/string/bcopy.S index 3953fef1732..f71b5ce7cbd 100644 --- a/lib/libc/arch/arm/string/bcopy.S +++ b/lib/libc/arch/arm/string/bcopy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bcopy.S,v 1.3 2008/06/26 05:42:04 ray Exp $ */ +/* $OpenBSD: bcopy.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: bcopy.S,v 1.2 2001/07/16 05:50:06 matt Exp $ */ /*- @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* bcopy = memcpy/memmove with arguments reversed. */ @@ -40,3 +40,4 @@ ENTRY(bcopy) eor r1, r0, r1 eor r0, r1, r0 b PIC_SYM(_C_LABEL(_memcpy), PLT) +END_WEAK(bcopy) diff --git a/lib/libc/arch/arm/string/bzero.S b/lib/libc/arch/arm/string/bzero.S index 40430a86873..419e2bbdc9d 100644 --- a/lib/libc/arch/arm/string/bzero.S +++ b/lib/libc/arch/arm/string/bzero.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bzero.S,v 1.3 2008/06/26 05:42:04 ray Exp $ */ +/* $OpenBSD: bzero.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: bzero.S,v 1.2 2001/07/16 05:50:06 matt Exp $ */ /*- @@ -30,9 +30,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(bzero) mov r2, r1 mov r1, #0 b PIC_SYM(_C_LABEL(memset), PLT) +END_WEAK(bzero) diff --git a/lib/libc/arch/arm/string/ffs.S b/lib/libc/arch/arm/string/ffs.S index 9dd7e5aef2f..7f4b289d860 100644 --- a/lib/libc/arch/arm/string/ffs.S +++ b/lib/libc/arch/arm/string/ffs.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs.S,v 1.3 2009/10/28 06:49:54 deraadt Exp $ */ +/* $OpenBSD: ffs.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: ffs.S,v 1.5 2003/04/05 23:08:52 bjh21 Exp $ */ /* * Copyright (c) 2001 Christopher Gilbert @@ -29,7 +29,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* * ffs - find first set bit, this algorithm isolates the first set @@ -61,6 +61,7 @@ ENTRY(ffs) ldrneb r0, [ r2, r0, lsr #26 ] mov pc, lr +END_WEAK(ffs) .text; .type .L_ffs_table, _ASM_TYPE_OBJECT; .L_ffs_table: diff --git a/lib/libc/arch/arm/string/memcmp.S b/lib/libc/arch/arm/string/memcmp.S index 3a564c7338a..f7c5c966663 100644 --- a/lib/libc/arch/arm/string/memcmp.S +++ b/lib/libc/arch/arm/string/memcmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memcmp.S,v 1.4 2009/10/28 06:49:54 deraadt Exp $ */ +/* $OpenBSD: memcmp.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: memcmp.S,v 1.2 2003/04/05 23:08:52 bjh21 Exp $ */ /* @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(memcmp) /* if (len == 0) return 0 */ @@ -50,3 +50,4 @@ ENTRY(memcmp) beq 1b sub r0, r2, r3 mov pc, lr +END_STRONG(memcmp) diff --git a/lib/libc/arch/arm/string/memcpy.S b/lib/libc/arch/arm/string/memcpy.S index 6aeb5b84bac..5797c6d6f33 100644 --- a/lib/libc/arch/arm/string/memcpy.S +++ b/lib/libc/arch/arm/string/memcpy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memcpy.S,v 1.4 2014/11/30 19:43:56 deraadt Exp $ */ +/* $OpenBSD: memcpy.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: memcpy.S,v 1.3 2003/04/05 23:08:52 bjh21 Exp $ */ /*- @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* * XXX @@ -42,3 +42,4 @@ ENTRY(memcpy) stmfd sp!, {r0, lr} bl PIC_SYM(_C_LABEL(_memcpy), PLT) ldmfd sp!, {r0, pc} +END_STRONG(memcpy) diff --git a/lib/libc/arch/arm/string/memmove.S b/lib/libc/arch/arm/string/memmove.S index 8244afb7de1..c2f107e3cd8 100644 --- a/lib/libc/arch/arm/string/memmove.S +++ b/lib/libc/arch/arm/string/memmove.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memmove.S,v 1.3 2008/06/26 05:42:04 ray Exp $ */ +/* $OpenBSD: memmove.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: memmove.S,v 1.3 2003/04/05 23:08:52 bjh21 Exp $ */ /*- @@ -30,9 +30,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(memmove) stmfd sp!, {r0, lr} bl PIC_SYM(_C_LABEL(_memcpy), PLT) ldmfd sp!, {r0, pc} +END_STRONG(memmove) diff --git a/lib/libc/arch/arm/string/memset.S b/lib/libc/arch/arm/string/memset.S index a4c3d158938..5ab2f9f3bcd 100644 --- a/lib/libc/arch/arm/string/memset.S +++ b/lib/libc/arch/arm/string/memset.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memset.S,v 1.3 2015/06/08 14:22:05 jsg Exp $ */ +/* $OpenBSD: memset.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: memset.S,v 1.3 2003/04/05 23:08:52 bjh21 Exp $ */ /* @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* * Sets a block of memory to the specified value @@ -127,3 +127,4 @@ ENTRY(memset) ldmfd sp!, {r0} mov pc, lr /* Exit */ +END_STRONG(memset) diff --git a/lib/libc/arch/arm/string/strcmp.S b/lib/libc/arch/arm/string/strcmp.S index ea6078e7f9c..223610d0925 100644 --- a/lib/libc/arch/arm/string/strcmp.S +++ b/lib/libc/arch/arm/string/strcmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strcmp.S,v 1.3 2005/08/07 16:40:14 espie Exp $ */ +/* $OpenBSD: strcmp.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: strcmp.S,v 1.3 2003/04/05 23:08:52 bjh21 Exp $ */ /* @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(strcmp) 1: @@ -40,3 +40,4 @@ ENTRY(strcmp) beq 1b sub r0, r2, r3 mov pc, lr +END_STRONG(strcmp) diff --git a/lib/libc/arch/arm/string/strncmp.S b/lib/libc/arch/arm/string/strncmp.S index f8960bbc84b..1014d5dc4ea 100644 --- a/lib/libc/arch/arm/string/strncmp.S +++ b/lib/libc/arch/arm/string/strncmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strncmp.S,v 1.4 2009/05/03 05:09:40 drahn Exp $ */ +/* $OpenBSD: strncmp.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: strncmp.S,v 1.2 2003/04/05 23:08:52 bjh21 Exp $ */ /* @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(strncmp) /* if (len == 0) return 0 */ @@ -51,3 +51,4 @@ ENTRY(strncmp) beq 1b sub r0, r2, r3 mov pc, lr +END_STRONG(strncmp) diff --git a/lib/libc/arch/hppa/SYS.h b/lib/libc/arch/hppa/SYS.h index a2dbef50244..b07287224b2 100644 --- a/lib/libc/arch/hppa/SYS.h +++ b/lib/libc/arch/hppa/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.17 2015/04/07 01:27:06 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.18 2015/08/31 02:53:56 guenther Exp $ */ /* * Copyright (c) 1998-2002 Michael Shalayeff @@ -33,6 +33,32 @@ #include <machine/vmparam.h> #undef _LOCORE +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y) !\ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y) !\ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * EXIT_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * EXIT_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define EXIT_STRONG(x) EXIT(x) !\ + _HIDDEN_FALIAS(x,x) !\ + .size _HIDDEN(x), . - _HIDDEN(x) +#define EXIT_WEAK(x) EXIT_STRONG(x) !\ + .weak x + + #define SYSENTRY(x) !\ LEAF_ENTRY(__CONCAT(_thread_sys_,x)) !\ WEAK_ALIAS(x,__CONCAT(_thread_sys_,x)) diff --git a/lib/libc/arch/hppa/string/memmove.S b/lib/libc/arch/hppa/string/memmove.S index 8ed210a168a..4b14de65110 100644 --- a/lib/libc/arch/hppa/string/memmove.S +++ b/lib/libc/arch/hppa/string/memmove.S @@ -31,11 +31,7 @@ */ - -#undef _LOCORE -#define _LOCORE -#include <machine/asm.h> -#include <machine/frame.h> +#include "SYS.h" LEAF_ENTRY(bcopy) @@ -155,6 +151,6 @@ $bcopy_r.done bv 0(rp) nop -EXIT(bcopy) +EXIT_WEAK(bcopy) .end diff --git a/lib/libc/arch/hppa64/SYS.h b/lib/libc/arch/hppa64/SYS.h index 510ab2c5fba..c61fcface6b 100644 --- a/lib/libc/arch/hppa64/SYS.h +++ b/lib/libc/arch/hppa64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.7 2015/04/07 01:27:06 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.8 2015/08/31 02:53:56 guenther Exp $ */ /* * Copyright (c) 1998-2002 Michael Shalayeff @@ -33,6 +33,32 @@ #include <machine/vmparam.h> #undef _LOCORE +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y) !\ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y) !\ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * EXIT_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * EXIT_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define EXIT_STRONG(x) EXIT(x) !\ + _HIDDEN_FALIAS(x,x) !\ + .size _HIDDEN(x), . - _HIDDEN(x) +#define EXIT_WEAK(x) EXIT_STRONG(x) !\ + .weak x + + #define SYSENTRY(x) !\ LEAF_ENTRY(__CONCAT(_thread_sys_,x)) !\ WEAK_ALIAS(x,__CONCAT(_thread_sys_,x)) diff --git a/lib/libc/arch/i386/SYS.h b/lib/libc/arch/i386/SYS.h index 9328b480020..4e1a54f003e 100644 --- a/lib/libc/arch/i386/SYS.h +++ b/lib/libc/arch/i386/SYS.h @@ -29,12 +29,36 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: SYS.h,v 1.21 2015/08/26 01:54:09 guenther Exp $ + * $OpenBSD: SYS.h,v 1.22 2015/08/31 02:53:56 guenther Exp $ */ #include <machine/asm.h> #include <sys/syscall.h> + +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) +#define END_WEAK(x) END_STRONG(x); .weak x + + /* * Design note: * diff --git a/lib/libc/arch/i386/string/bcmp.S b/lib/libc/arch/i386/string/bcmp.S index a5b46ae745a..b55c93a6e14 100644 --- a/lib/libc/arch/i386/string/bcmp.S +++ b/lib/libc/arch/i386/string/bcmp.S @@ -1,10 +1,10 @@ -/* $OpenBSD: bcmp.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */ +/* $OpenBSD: bcmp.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(bcmp) pushl %edi @@ -30,3 +30,4 @@ L1: incl %eax L2: popl %esi popl %edi ret +END_WEAK(bcmp) diff --git a/lib/libc/arch/i386/string/bzero.S b/lib/libc/arch/i386/string/bzero.S index eea840afdca..43251b5cdff 100644 --- a/lib/libc/arch/i386/string/bzero.S +++ b/lib/libc/arch/i386/string/bzero.S @@ -1,10 +1,10 @@ -/* $OpenBSD: bzero.S,v 1.4 2007/05/25 20:32:29 krw Exp $ */ +/* $OpenBSD: bzero.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(bzero) pushl %edi @@ -41,3 +41,4 @@ L1: movl %edx,%ecx /* zero remainder by bytes */ popl %edi ret +END_WEAK(bzero) diff --git a/lib/libc/arch/i386/string/ffs.S b/lib/libc/arch/i386/string/ffs.S index 96affabed07..4de8c6aaaf0 100644 --- a/lib/libc/arch/i386/string/ffs.S +++ b/lib/libc/arch/i386/string/ffs.S @@ -1,10 +1,10 @@ -/* $OpenBSD: ffs.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */ +/* $OpenBSD: ffs.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(ffs) bsfl 4(%esp),%eax @@ -15,3 +15,4 @@ ENTRY(ffs) .align 2 L1: xorl %eax,%eax /* clear result */ ret +END_WEAK(ffs) diff --git a/lib/libc/arch/i386/string/memchr.S b/lib/libc/arch/i386/string/memchr.S index d6bcbe688b5..87191eb0f2d 100644 --- a/lib/libc/arch/i386/string/memchr.S +++ b/lib/libc/arch/i386/string/memchr.S @@ -1,10 +1,10 @@ -/* $OpenBSD: memchr.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */ +/* $OpenBSD: memchr.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(memchr) pushl %edi @@ -24,3 +24,4 @@ ENTRY(memchr) L1: xorl %eax,%eax popl %edi ret +END_STRONG(memchr) diff --git a/lib/libc/arch/i386/string/memcmp.S b/lib/libc/arch/i386/string/memcmp.S index 1be189aefbb..171af0734b1 100644 --- a/lib/libc/arch/i386/string/memcmp.S +++ b/lib/libc/arch/i386/string/memcmp.S @@ -1,10 +1,10 @@ -/* $OpenBSD: memcmp.S,v 1.4 2005/08/07 11:30:38 espie Exp $ */ +/* $OpenBSD: memcmp.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(memcmp) pushl %edi @@ -41,3 +41,4 @@ L6: movzbl -1(%edi),%eax /* Perform unsigned comparison */ popl %esi popl %edi ret +END_STRONG(memcmp) diff --git a/lib/libc/arch/i386/string/memmove.S b/lib/libc/arch/i386/string/memmove.S index a1621ec1f1e..afa465aa4dd 100644 --- a/lib/libc/arch/i386/string/memmove.S +++ b/lib/libc/arch/i386/string/memmove.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memmove.S,v 1.5 2014/12/02 03:07:13 tedu Exp $ */ +/* $OpenBSD: memmove.S,v 1.6 2015/08/31 02:53:56 guenther Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -33,8 +33,7 @@ * SUCH DAMAGE. */ -#include <machine/param.h> -#include <machine/asm.h> +#include "SYS.h" /* * Emulate bcopy() by swapping the first two arguments, and jumping @@ -105,4 +104,5 @@ docopyf: popl %esi cld ret - +END_STRONG(memmove) +END_WEAK(bcopy) diff --git a/lib/libc/arch/i386/string/memset.S b/lib/libc/arch/i386/string/memset.S index 912b74a19e1..0eb4381558e 100644 --- a/lib/libc/arch/i386/string/memset.S +++ b/lib/libc/arch/i386/string/memset.S @@ -1,10 +1,10 @@ -/* $OpenBSD: memset.S,v 1.4 2007/05/25 20:32:29 krw Exp $ */ +/* $OpenBSD: memset.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(memset) pushl %edi @@ -53,3 +53,4 @@ L1: rep popl %ebx popl %edi ret +END_STRONG(memset) diff --git a/lib/libc/arch/i386/string/strcat.S b/lib/libc/arch/i386/string/strcat.S index 60fdd554ee0..fb8008e8035 100644 --- a/lib/libc/arch/i386/string/strcat.S +++ b/lib/libc/arch/i386/string/strcat.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strcat.S,v 1.8 2005/08/07 11:30:38 espie Exp $ */ +/* $OpenBSD: strcat.S,v 1.9 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. @@ -71,3 +71,4 @@ L1: movb (%edx),%al /* unroll loop, but not too much */ L2: popl %eax /* pop destination address */ popl %edi /* restore edi */ ret +END(strcat) diff --git a/lib/libc/arch/i386/string/strchr.S b/lib/libc/arch/i386/string/strchr.S index f8cd8e6589a..3792d2292ab 100644 --- a/lib/libc/arch/i386/string/strchr.S +++ b/lib/libc/arch/i386/string/strchr.S @@ -1,10 +1,10 @@ -/* $OpenBSD: strchr.S,v 1.6 2015/05/15 22:29:37 millert Exp $ */ +/* $OpenBSD: strchr.S,v 1.7 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" WEAK_ALIAS(index, strchr) @@ -22,3 +22,4 @@ L1: xorl %eax,%eax L2: ret +END_STRONG(strchr) diff --git a/lib/libc/arch/i386/string/strcmp.S b/lib/libc/arch/i386/string/strcmp.S index 22ba5460eae..373232419e9 100644 --- a/lib/libc/arch/i386/string/strcmp.S +++ b/lib/libc/arch/i386/string/strcmp.S @@ -1,10 +1,10 @@ -/* $OpenBSD: strcmp.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */ +/* $OpenBSD: strcmp.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" /* * NOTE: I've unrolled the loop eight times: large enough to make a @@ -79,3 +79,4 @@ L3: movzbl (%eax),%eax /* unsigned comparison */ movzbl (%edx),%edx subl %edx,%eax ret +END_STRONG(strcmp) diff --git a/lib/libc/arch/i386/string/strcpy.S b/lib/libc/arch/i386/string/strcpy.S index 341eb6c39a9..f72990f8f0e 100644 --- a/lib/libc/arch/i386/string/strcpy.S +++ b/lib/libc/arch/i386/string/strcpy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strcpy.S,v 1.8 2005/08/07 11:30:38 espie Exp $ */ +/* $OpenBSD: strcpy.S,v 1.9 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. @@ -61,3 +61,4 @@ L1: movb (%edx),%al /* unroll loop, but not too much */ jnz L1 L2: popl %eax /* pop dst address */ ret +END(strcpy) diff --git a/lib/libc/arch/i386/string/strncmp.S b/lib/libc/arch/i386/string/strncmp.S index 5aa88d7e798..6e480c95f2e 100644 --- a/lib/libc/arch/i386/string/strncmp.S +++ b/lib/libc/arch/i386/string/strncmp.S @@ -1,10 +1,10 @@ -/* $OpenBSD: strncmp.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */ +/* $OpenBSD: strncmp.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" /* * NOTE: I've unrolled the loop eight times: large enough to make a @@ -111,3 +111,4 @@ L3: movzbl (%eax),%eax /* unsigned comparision */ L4: xorl %eax,%eax popl %ebx ret +END_STRONG(strncmp) diff --git a/lib/libc/arch/i386/string/strrchr.S b/lib/libc/arch/i386/string/strrchr.S index 738c369b378..e1f5cc2e32e 100644 --- a/lib/libc/arch/i386/string/strrchr.S +++ b/lib/libc/arch/i386/string/strrchr.S @@ -1,10 +1,10 @@ -/* $OpenBSD: strrchr.S,v 1.6 2015/05/15 22:29:37 millert Exp $ */ +/* $OpenBSD: strrchr.S,v 1.7 2015/08/31 02:53:56 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. */ -#include <machine/asm.h> +#include "SYS.h" WEAK_ALIAS(rindex, strrchr) @@ -25,3 +25,4 @@ L2: jnz L1 popl %ebx ret +END_STRONG(strrchr) diff --git a/lib/libc/arch/m88k/SYS.h b/lib/libc/arch/m88k/SYS.h index 70292c9d585..0c48e6cedeb 100644 --- a/lib/libc/arch/m88k/SYS.h +++ b/lib/libc/arch/m88k/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.19 2015/04/07 01:27:06 guenther Exp $*/ +/* $OpenBSD: SYS.h,v 1.20 2015/08/31 02:53:56 guenther Exp $*/ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -37,6 +37,29 @@ #include <sys/syscall.h> #include <machine/asm.h> +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) +#define END_WEAK(x) END_STRONG(x); .weak x + + #define __CONCAT(p,x) p##x #define __ENTRY(p,x) ENTRY(__CONCAT(p,x)) #define __END(p,x) END(__CONCAT(p,x)) diff --git a/lib/libc/arch/mips64/SYS.h b/lib/libc/arch/mips64/SYS.h index 55926724eb9..f9b2063dc5b 100644 --- a/lib/libc/arch/mips64/SYS.h +++ b/lib/libc/arch/mips64/SYS.h @@ -29,12 +29,37 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: SYS.h,v 1.7 2015/04/07 01:27:06 guenther Exp $ + * $OpenBSD: SYS.h,v 1.8 2015/08/31 02:53:56 guenther Exp $ */ #include <sys/syscall.h> #include <machine/asm.h> +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); \ + _HIDDEN_FALIAS(x,x); \ + .size _HIDDEN(x), . - _HIDDEN(x) +#define END_WEAK(x) END_STRONG(x); .weak x + + #define CERROR _C_LABEL(__cerror) #define _CERROR _C_LABEL(___cerror) diff --git a/lib/libc/arch/mips64/string/bcmp.S b/lib/libc/arch/mips64/string/bcmp.S index 2ff4a6e817e..fe51d35fce4 100644 --- a/lib/libc/arch/mips64/string/bcmp.S +++ b/lib/libc/arch/mips64/string/bcmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bcmp.S,v 1.4 2009/12/11 05:10:17 miod Exp $ */ +/* $OpenBSD: bcmp.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* bcmp(s1, s2, n) */ @@ -109,4 +109,4 @@ nomatch: j ra li v0, 1 .set reorder -END(bcmp) +END_WEAK(bcmp) diff --git a/lib/libc/arch/mips64/string/bcopy.S b/lib/libc/arch/mips64/string/bcopy.S index e5098a2cffc..bd63a62a890 100644 --- a/lib/libc/arch/mips64/string/bcopy.S +++ b/lib/libc/arch/mips64/string/bcopy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bcopy.S,v 1.4 2009/12/11 05:10:17 miod Exp $ */ +/* $OpenBSD: bcopy.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* bcopy(s1, s2, n) */ @@ -116,4 +116,4 @@ smallcpy: j ra nop .set reorder -END(bcopy) +END_WEAK(bcopy) diff --git a/lib/libc/arch/mips64/string/bzero.S b/lib/libc/arch/mips64/string/bzero.S index 0b0c477aaa7..8fae96ec188 100644 --- a/lib/libc/arch/mips64/string/bzero.S +++ b/lib/libc/arch/mips64/string/bzero.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bzero.S,v 1.5 2009/12/11 05:10:17 miod Exp $ */ +/* $OpenBSD: bzero.S,v 1.6 2015/08/31 02:53:56 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* bzero(s1, n) */ @@ -63,4 +63,4 @@ smallclr: 2: j ra nop -END(bzero) +END_WEAK(bzero) diff --git a/lib/libc/arch/mips64/string/ffs.S b/lib/libc/arch/mips64/string/ffs.S index 0fa0803e316..f09de46a930 100644 --- a/lib/libc/arch/mips64/string/ffs.S +++ b/lib/libc/arch/mips64/string/ffs.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs.S,v 1.3 2005/08/07 16:40:15 espie Exp $ */ +/* $OpenBSD: ffs.S,v 1.4 2015/08/31 02:53:56 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* bit = ffs(value) */ @@ -46,4 +46,4 @@ LEAF(ffs, 0) beq v1, zero, 1b # no, continue done: j ra -END(ffs) +END_WEAK(ffs) diff --git a/lib/libc/arch/mips64/string/strchr.S b/lib/libc/arch/mips64/string/strchr.S index a5a12c53940..05f50f0da73 100644 --- a/lib/libc/arch/mips64/string/strchr.S +++ b/lib/libc/arch/mips64/string/strchr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strchr.S,v 1.2 2015/05/15 22:29:37 millert Exp $ */ +/* $OpenBSD: strchr.S,v 1.3 2015/08/31 02:53:56 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" WEAK_ALIAS(index, strchr) @@ -48,4 +48,4 @@ notfnd: fnd: dsubu v0, a0, 1 j ra -END(strchr) +END_STRONG(strchr) diff --git a/lib/libc/arch/mips64/string/strcmp.S b/lib/libc/arch/mips64/string/strcmp.S index 7193a6bf131..282cc929441 100644 --- a/lib/libc/arch/mips64/string/strcmp.S +++ b/lib/libc/arch/mips64/string/strcmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strcmp.S,v 1.4 2009/12/11 05:10:17 miod Exp $ */ +/* $OpenBSD: strcmp.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* * NOTE: this version assumes unsigned chars in order to be "8 bit clean". @@ -55,4 +55,4 @@ NotEq: LessOrEq: dsubu v0, zero, t1 j ra -END(strcmp) +END_STRONG(strcmp) diff --git a/lib/libc/arch/mips64/string/strlen.S b/lib/libc/arch/mips64/string/strlen.S index 5bc80bf847c..7817d753fdb 100644 --- a/lib/libc/arch/mips64/string/strlen.S +++ b/lib/libc/arch/mips64/string/strlen.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strlen.S,v 1.4 2009/12/11 05:10:17 miod Exp $ */ +/* $OpenBSD: strlen.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" LEAF(strlen, 0) .set reorder @@ -42,4 +42,4 @@ LEAF(strlen, 0) bne v0, zero, 1b # continue if not end dsubu v0, a0, v1 # compute length - 1 for '\0' char j ra -END(strlen) +END_STRONG(strlen) diff --git a/lib/libc/arch/mips64/string/strrchr.S b/lib/libc/arch/mips64/string/strrchr.S index a7f5b74c320..ad35b84cb95 100644 --- a/lib/libc/arch/mips64/string/strrchr.S +++ b/lib/libc/arch/mips64/string/strrchr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strrchr.S,v 1.2 2015/05/15 22:29:37 millert Exp $ */ +/* $OpenBSD: strrchr.S,v 1.3 2015/08/31 02:53:56 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" WEAK_ALIAS(rindex, strrchr) @@ -46,4 +46,4 @@ LEAF(strrchr, 0) 2: bne a3, zero, 1b # continue if not end j ra -END(strrchr) +END_STRONG(strrchr) diff --git a/lib/libc/arch/powerpc/SYS.h b/lib/libc/arch/powerpc/SYS.h index 6303d68f7b6..b9cd88b7c30 100644 --- a/lib/libc/arch/powerpc/SYS.h +++ b/lib/libc/arch/powerpc/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.17 2015/08/23 15:51:28 kettenis Exp $ */ +/* $OpenBSD: SYS.h,v 1.18 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1994 * Andrew Cagney. All rights reserved. @@ -44,6 +44,29 @@ #include "machine/asm.h" +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) +#define END_WEAK(x) END_STRONG(x); .weak x + + #define _CONCAT(x,y) x##y #define PSEUDO_PREFIX(p,x,y) .extern _ASM_LABEL(___cerror) ; \ ENTRY(p##x) \ diff --git a/lib/libc/arch/powerpc/string/memmove.S b/lib/libc/arch/powerpc/string/memmove.S index 875c562b0b2..80aca10ce78 100644 --- a/lib/libc/arch/powerpc/string/memmove.S +++ b/lib/libc/arch/powerpc/string/memmove.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memmove.S,v 1.1 2014/12/04 12:10:26 deraadt Exp $ */ +/* $OpenBSD: memmove.S,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: memmove.S,v 1.3 2011/01/15 07:31:12 matt Exp $ */ /* stropt/memmove.S, pl_string_common, pl_linux 10/11/04 11:45:37 @@ -39,7 +39,7 @@ * ========================================================================== */ -#include <machine/asm.h> +#include "SYS.h" .text @@ -166,3 +166,5 @@ rlast2: bdnz+ rlast2 /* Dec ctr, and branch if more */ /* bytes left */ blr +END_STRONG(memmove) +END_WEAK(bcopy) diff --git a/lib/libc/arch/sh/SYS.h b/lib/libc/arch/sh/SYS.h index 468e265c947..ac7991f7cd3 100644 --- a/lib/libc/arch/sh/SYS.h +++ b/lib/libc/arch/sh/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.6 2015/04/07 01:27:06 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -37,6 +37,31 @@ #include <machine/asm.h> #include <sys/syscall.h> +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) SET_ENTRY_SIZE(x); \ + _HIDDEN_FALIAS(x,x); \ + SET_ENTRY_SIZE(_HIDDEN(x)) +#define END_WEAK(x) END_STRONG(x); .weak x + + #define SYSENTRY(x) \ WEAK_ALIAS(x,_thread_sys_ ## x); \ ENTRY(_thread_sys_ ## x) diff --git a/lib/libc/arch/sh/string/bcopy.S b/lib/libc/arch/sh/string/bcopy.S index 533583d9792..473bc429bbe 100644 --- a/lib/libc/arch/sh/string/bcopy.S +++ b/lib/libc/arch/sh/string/bcopy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bcopy.S,v 1.2 2014/11/30 19:43:56 deraadt Exp $ */ +/* $OpenBSD: bcopy.S,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: memcpy.S,v 1.2 2006/04/22 23:53:47 uwe Exp $ */ /* @@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" #define REG_SRC r4 #define REG_DST r5 @@ -238,3 +238,4 @@ ov_no_align_delay: 9: rts nop +END_WEAK(bcopy) diff --git a/lib/libc/arch/sh/string/ffs.S b/lib/libc/arch/sh/string/ffs.S index 7e0dd7e2834..0a639c79211 100644 --- a/lib/libc/arch/sh/string/ffs.S +++ b/lib/libc/arch/sh/string/ffs.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs.S,v 1.2 2008/06/26 05:42:05 ray Exp $ */ +/* $OpenBSD: ffs.S,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: ffs.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ /*- @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* * ffs - find first bit set @@ -91,3 +91,4 @@ L8bit: Lzero: rts nop +END_WEAK(ffs) diff --git a/lib/libc/arch/sh/string/memcpy.S b/lib/libc/arch/sh/string/memcpy.S index f12004e1edd..ed266caa71c 100644 --- a/lib/libc/arch/sh/string/memcpy.S +++ b/lib/libc/arch/sh/string/memcpy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memcpy.S,v 1.2 2014/11/30 19:43:56 deraadt Exp $ */ +/* $OpenBSD: memcpy.S,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: memcpy.S,v 1.2 2006/04/22 23:53:47 uwe Exp $ */ /* @@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" #define REG_DST0 r3 #define REG_SRC r5 @@ -137,3 +137,4 @@ no_align_delay: bcopy_return: rts mov REG_DST0,r0 +END_STRONG(memcpy) diff --git a/lib/libc/arch/sh/string/memmove.S b/lib/libc/arch/sh/string/memmove.S index 3a570c62355..131be417efc 100644 --- a/lib/libc/arch/sh/string/memmove.S +++ b/lib/libc/arch/sh/string/memmove.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memmove.S,v 1.2 2014/11/30 19:43:56 deraadt Exp $ */ +/* $OpenBSD: memmove.S,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: memcpy.S,v 1.2 2006/04/22 23:53:47 uwe Exp $ */ /* @@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" #define REG_DST0 r3 #define REG_SRC r5 @@ -239,3 +239,4 @@ ov_no_align_delay: 9: rts mov REG_DST0,r0 +END_STRONG(memmove) diff --git a/lib/libc/arch/sh/string/memset.S b/lib/libc/arch/sh/string/memset.S index 2ed22197ce8..f82f4a4ecfb 100644 --- a/lib/libc/arch/sh/string/memset.S +++ b/lib/libc/arch/sh/string/memset.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memset.S,v 1.1 2006/10/10 22:07:10 miod Exp $ */ +/* $OpenBSD: memset.S,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: memset.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ /*- @@ -27,7 +27,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" #define REG_PTR r0 #define REG_TMP1 r1 @@ -293,3 +293,8 @@ unaligned_len: bra aligned sub REG_DST,REG_LEN +#ifdef BZERO +END_WEAK(bzero) +#else +END_STRONG(memset) +#endif diff --git a/lib/libc/arch/sparc/DEFS.h b/lib/libc/arch/sparc/DEFS.h index 151b30fd946..13efbc6a428 100644 --- a/lib/libc/arch/sparc/DEFS.h +++ b/lib/libc/arch/sparc/DEFS.h @@ -30,7 +30,30 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: DEFS.h,v 1.3 2003/06/02 20:18:32 millert Exp $ + * $OpenBSD: DEFS.h,v 1.4 2015/08/31 02:53:57 guenther Exp $ */ #include <machine/asm.h> + +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) +#define END_WEAK(x) END_STRONG(x); .weak x + diff --git a/lib/libc/arch/sparc/SYS.h b/lib/libc/arch/sparc/SYS.h index 729c386bfaa..be262c8abfd 100644 --- a/lib/libc/arch/sparc/SYS.h +++ b/lib/libc/arch/sparc/SYS.h @@ -30,10 +30,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: SYS.h,v 1.17 2015/04/07 01:27:07 guenther Exp $ + * $OpenBSD: SYS.h,v 1.18 2015/08/31 02:53:57 guenther Exp $ */ -#include <machine/asm.h> +#include "DEFS.h" #include <sys/syscall.h> #include <machine/trap.h> diff --git a/lib/libc/arch/sparc/string/bzero.S b/lib/libc/arch/sparc/string/bzero.S index cb0a6845062..13ffe17f56b 100644 --- a/lib/libc/arch/sparc/string/bzero.S +++ b/lib/libc/arch/sparc/string/bzero.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bzero.S,v 1.4 2005/08/07 16:40:15 espie Exp $ */ +/* $OpenBSD: bzero.S,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -134,3 +134,4 @@ Lstd: 1: retl nop +END_WEAK(bzero) diff --git a/lib/libc/arch/sparc/string/ffs.S b/lib/libc/arch/sparc/string/ffs.S index ae885d896c4..530d7e706e6 100644 --- a/lib/libc/arch/sparc/string/ffs.S +++ b/lib/libc/arch/sparc/string/ffs.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs.S,v 1.5 2012/08/22 17:19:35 pascal Exp $ */ +/* $OpenBSD: ffs.S,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -83,6 +83,7 @@ ENTRY(ffs) ldsb [%o2 + %o0], %o0 retl add %o0, 24, %o0 +END_WEAK(ffs) ffstab: .byte -24,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 00-0f */ diff --git a/lib/libc/arch/sparc/string/strlen.S b/lib/libc/arch/sparc/string/strlen.S index 0144bd00a36..c23bfbeff0d 100644 --- a/lib/libc/arch/sparc/string/strlen.S +++ b/lib/libc/arch/sparc/string/strlen.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strlen.S,v 1.4 2005/08/07 16:40:15 espie Exp $ */ +/* $OpenBSD: strlen.S,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -43,3 +43,4 @@ ENTRY(strlen) inc %o0 ! always increment pointer retl sub %o0, %o1, %o0 ! return length (ptr - (origptr+1)) +END_STRONG(strlen) diff --git a/lib/libc/arch/sparc64/SYS.h b/lib/libc/arch/sparc64/SYS.h index 3f934da0323..6b2897480dd 100644 --- a/lib/libc/arch/sparc64/SYS.h +++ b/lib/libc/arch/sparc64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.12 2015/04/07 01:27:07 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -46,6 +46,30 @@ #define __ENTRY(p,x) ENTRY(_CAT(p,x)) ; .weak x; x = _CAT(p,x) #define __ENTRY_HIDDEN(p,x) ENTRY(_CAT(p,x)) + +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) +#define END_WEAK(x) END_STRONG(x); .weak 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. diff --git a/lib/libc/arch/sparc64/string/ffs.S b/lib/libc/arch/sparc64/string/ffs.S index ee55fdab384..7fd91f871b6 100644 --- a/lib/libc/arch/sparc64/string/ffs.S +++ b/lib/libc/arch/sparc64/string/ffs.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs.S,v 1.4 2012/08/22 17:19:35 pascal Exp $ */ +/* $OpenBSD: ffs.S,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1992, 1993 @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" /* * ffs returns the number of the rightmost bit set in its argument, * i.e., the lowest value such that (x & (ffs(x) - 1)) is nonzero. @@ -83,6 +83,7 @@ ENTRY(ffs) ldsb [%o2 + %o0], %o0 retl add %o0, 24, %o0 +END_WEAK(ffs) _C_LABEL(__ffstab): .byte -24,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 00-0f */ diff --git a/lib/libc/arch/sparc64/string/strlen.S b/lib/libc/arch/sparc64/string/strlen.S index 08082ef8d58..8ef36a19870 100644 --- a/lib/libc/arch/sparc64/string/strlen.S +++ b/lib/libc/arch/sparc64/string/strlen.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strlen.S,v 1.2 2003/06/02 20:18:33 millert Exp $ */ +/* $OpenBSD: strlen.S,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: strlen.S,v 1.1 1998/09/11 04:56:33 eeh Exp $ */ /* @@ -34,7 +34,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "SYS.h" ENTRY(strlen) add %o0, 1, %o1 ! save starting point + 1 @@ -44,3 +44,4 @@ ENTRY(strlen) inc %o0 ! always increment pointer retl sub %o0, %o1, %o0 ! return length (ptr - (origptr+1)) +END_STRONG(strlen) diff --git a/lib/libc/arch/vax/DEFS.h b/lib/libc/arch/vax/DEFS.h index 415e86df113..13e0859dfa6 100644 --- a/lib/libc/arch/vax/DEFS.h +++ b/lib/libc/arch/vax/DEFS.h @@ -1,4 +1,27 @@ -/* $OpenBSD: DEFS.h,v 1.4 1996/08/19 08:18:17 tholo Exp $ */ +/* $OpenBSD: DEFS.h,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ #include <machine/asm.h> +/* + * We define a hidden alias with the prefix "_libc_" for each global symbol + * that may be used internally. By referencing _libc_x instead of x, other + * parts of libc prevent overriding by the application and avoid unnecessary + * relocations. + */ +#define _HIDDEN(x) _libc_##x +#define _HIDDEN_ALIAS(x,y) \ + STRONG_ALIAS(_HIDDEN(x),y); \ + .hidden _HIDDEN(x) +#define _HIDDEN_FALIAS(x,y) \ + _HIDDEN_ALIAS(x,y); \ + .type _HIDDEN(x),@function + +/* + * For functions implemented in ASM that aren't syscalls. + * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names + * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names + */ +#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) +#define END_WEAK(x) END_STRONG(x); .weak x + + diff --git a/lib/libc/arch/vax/SYS.h b/lib/libc/arch/vax/SYS.h index 2449243f186..cba02a0678a 100644 --- a/lib/libc/arch/vax/SYS.h +++ b/lib/libc/arch/vax/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.17 2015/04/07 01:27:07 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.18 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: SYS.h,v 1.4 1997/05/02 18:15:32 kleink Exp $ */ /* @@ -30,7 +30,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include "DEFS.h" #include <sys/syscall.h> #define _CAT(x,y) x##y diff --git a/lib/libc/arch/vax/string/bcmp.S b/lib/libc/arch/vax/string/bcmp.S index ccb63da20f2..c25d46c5102 100644 --- a/lib/libc/arch/vax/string/bcmp.S +++ b/lib/libc/arch/vax/string/bcmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bcmp.S,v 1.5 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: bcmp.S,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -54,3 +54,4 @@ ENTRY(bcmp, 0) clrl %r0 # we have a match! 9: ret +END_WEAK(bcmp) diff --git a/lib/libc/arch/vax/string/bcopy.S b/lib/libc/arch/vax/string/bcopy.S index 5af2edea373..27d5d8fd24a 100644 --- a/lib/libc/arch/vax/string/bcopy.S +++ b/lib/libc/arch/vax/string/bcopy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bcopy.S,v 1.6 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: bcopy.S,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -69,3 +69,4 @@ ENTRY(bcopy, R2|R3|R4|R5|R6) subl2 %r6,%r3 movc3 %r6,(%r1),(%r3) ret +END_WEAK(bcopy) diff --git a/lib/libc/arch/vax/string/bzero.S b/lib/libc/arch/vax/string/bzero.S index 55febbe11b5..0867d3971c3 100644 --- a/lib/libc/arch/vax/string/bzero.S +++ b/lib/libc/arch/vax/string/bzero.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bzero.S,v 1.6 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: bzero.S,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -44,3 +44,4 @@ ENTRY(bzero, R2|R3|R4|R5) jgtr 1b movc5 $0,(%r3),$0,8(%ap),(%r3) ret +END_WEAK(bzero) diff --git a/lib/libc/arch/vax/string/ffs.S b/lib/libc/arch/vax/string/ffs.S index e2caa68c607..1e75f128a06 100644 --- a/lib/libc/arch/vax/string/ffs.S +++ b/lib/libc/arch/vax/string/ffs.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs.S,v 1.5 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: ffs.S,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -39,3 +39,4 @@ ENTRY(ffs, 0) 1: incl %r0 ret +END_WEAK(ffs) diff --git a/lib/libc/arch/vax/string/memcmp.S b/lib/libc/arch/vax/string/memcmp.S index 6a794547d5d..8fdf29435bb 100644 --- a/lib/libc/arch/vax/string/memcmp.S +++ b/lib/libc/arch/vax/string/memcmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memcmp.S,v 1.5 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: memcmp.S,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -63,3 +63,4 @@ ENTRY(memcmp, 0) subl3 %r4,%r3,%r0 9: ret +END_STRONG(memcmp) diff --git a/lib/libc/arch/vax/string/memcpy.S b/lib/libc/arch/vax/string/memcpy.S index d456a9a2d4f..e13ae0baa24 100644 --- a/lib/libc/arch/vax/string/memcpy.S +++ b/lib/libc/arch/vax/string/memcpy.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memcpy.S,v 1.8 2015/05/26 20:23:39 miod Exp $ */ +/* $OpenBSD: memcpy.S,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -56,3 +56,4 @@ ENTRY(memcpy, R2|R3|R4|R5) movl 12(%ap),%r2 decw %r0 /* from 0 to 65535 */ brb 1b /* retry */ +END_STRONG(memcpy) diff --git a/lib/libc/arch/vax/string/memmove.S b/lib/libc/arch/vax/string/memmove.S index 86513fdbba9..3f71d2629c1 100644 --- a/lib/libc/arch/vax/string/memmove.S +++ b/lib/libc/arch/vax/string/memmove.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memmove.S,v 1.6 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: memmove.S,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -84,3 +84,4 @@ ENTRY(memmove, R2|R3|R4|R5) subl2 %r0,%r1 subl2 %r0,%r3 brb 5b +END_STRONG(memmove) diff --git a/lib/libc/arch/vax/string/memset.S b/lib/libc/arch/vax/string/memset.S index b861477884f..40bada34ea7 100644 --- a/lib/libc/arch/vax/string/memset.S +++ b/lib/libc/arch/vax/string/memset.S @@ -1,4 +1,4 @@ -/* $OpenBSD: memset.S,v 1.6 2013/07/05 21:10:50 miod Exp $ */ +/* $OpenBSD: memset.S,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -46,3 +46,4 @@ ENTRY(memset, R2|R3|R4|R5) subl2 %r0,12(%ap) movc5 $0,(%r3),%r1,%r0,(%r3) jbr 1b +END_STRONG(memset) diff --git a/lib/libc/arch/vax/string/strchr.S b/lib/libc/arch/vax/string/strchr.S index 9d1b75423e7..7c8b8de57dd 100644 --- a/lib/libc/arch/vax/string/strchr.S +++ b/lib/libc/arch/vax/string/strchr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strchr.S,v 1.2 2015/05/15 22:29:37 millert Exp $ */ +/* $OpenBSD: strchr.S,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. @@ -56,3 +56,4 @@ ENTRY(strchr, 0) jneq 3b decl %r0 jbr 2b +END_STRONG(strchr) diff --git a/lib/libc/gen/auth_subr.c b/lib/libc/gen/auth_subr.c index cfa857c6b3d..25c71a29152 100644 --- a/lib/libc/gen/auth_subr.c +++ b/lib/libc/gen/auth_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth_subr.c,v 1.41 2014/08/25 07:50:25 doug Exp $ */ +/* $OpenBSD: auth_subr.c,v 1.42 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 2000-2002,2004 Todd C. Miller <Todd.Miller@courtesan.com> @@ -361,7 +361,7 @@ auth_setenv(auth_session_t *as) for (; isblank((unsigned char)*line); ++line) ; if (*line != '\0' && setenv(name, line, 1)) - _warn("setenv(%s, %s)", name, line); + warn("setenv(%s, %s)", name, line); } } else if (!strncasecmp(line, BI_UNSETENV, sizeof(BI_UNSETENV)-1)) { @@ -842,20 +842,20 @@ auth_call(auth_session_t *as, char *path, ...) if (secure_path(path) < 0) { syslog(LOG_ERR, "%s: path not secure", path); - _warnx("invalid script: %s", path); + warnx("invalid script: %s", path); goto fail; } if (socketpair(PF_LOCAL, SOCK_STREAM, 0, pfd) < 0) { syslog(LOG_ERR, "unable to create backchannel %m"); - _warnx("internal resource failure"); + warnx("internal resource failure"); goto fail; } switch (pid = fork()) { case -1: syslog(LOG_ERR, "%s: %m", path); - _warnx("internal resource failure"); + warnx("internal resource failure"); close(pfd[0]); close(pfd[1]); goto fail; @@ -896,7 +896,7 @@ auth_call(auth_session_t *as, char *path, ...) if (pid < 0) { if (errno != ECHILD) { syslog(LOG_ERR, "%s: waitpid: %m", path); - _warnx("internal failure"); + warnx("internal failure"); goto fail; } } else if (!WIFEXITED(status)) diff --git a/lib/libc/gen/authenticate.c b/lib/libc/gen/authenticate.c index 37c178540a2..4ab4a600b64 100644 --- a/lib/libc/gen/authenticate.c +++ b/lib/libc/gen/authenticate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: authenticate.c,v 1.21 2015/08/27 13:33:24 dlg Exp $ */ +/* $OpenBSD: authenticate.c,v 1.22 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. @@ -193,7 +193,7 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type) else { if ((pwd = getpwuid(getuid())) == NULL) { syslog(LOG_ERR, "no such user id %u", getuid()); - _warnx("cannot approve who we don't recognize"); + warnx("cannot approve who we don't recognize"); return (0); } name = pwd->pw_name; @@ -207,7 +207,7 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type) if (strlen(name) >= PATH_MAX) { syslog(LOG_ERR, "username to login %.*s...", PATH_MAX, name); - _warnx("username too long"); + warnx("username too long"); return (0); } if (pwd == NULL && (approve = strchr(name, '.')) != NULL) { @@ -217,7 +217,7 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type) } lc = login_getclass(pwd ? pwd->pw_class : NULL); if (lc == NULL) { - _warnx("unable to classify user"); + warnx("unable to classify user"); return (0); } } @@ -234,7 +234,7 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type) login_close(lc); syslog(LOG_ERR, "approval path too long %.*s...", PATH_MAX, type); - _warnx("approval script path too long"); + warnx("approval script path too long"); return (0); } } @@ -246,7 +246,7 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type) if (close_lc_on_exit) login_close(lc); syslog(LOG_ERR, "Invalid %s script: %s", s, approve); - _warnx("invalid path to approval script"); + warnx("invalid path to approval script"); free(approve); return (0); } @@ -255,7 +255,7 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type) if (close_lc_on_exit) login_close(lc); syslog(LOG_ERR, "%m"); - _warn(NULL); + warn(NULL); if (approve) free(approve); return (0); @@ -264,7 +264,7 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type) auth_setstate(as, AUTH_OKAY); if (auth_setitem(as, AUTHV_NAME, name) < 0) { syslog(LOG_ERR, "%m"); - _warn(NULL); + warn(NULL); goto out; } if (auth_check_expire(as) < 0) /* is this account expired */ diff --git a/lib/libc/gen/ctermid.c b/lib/libc/gen/ctermid.c index fddce642d9b..1fe8ba482aa 100644 --- a/lib/libc/gen/ctermid.c +++ b/lib/libc/gen/ctermid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ctermid.c,v 1.7 2006/01/13 18:10:10 miod Exp $ */ +/* $OpenBSD: ctermid.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -43,3 +43,4 @@ ctermid(char *s) } return(def); } +DEF_WEAK(ctermid); diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c index e7ec29de4fb..15e1b97c417 100644 --- a/lib/libc/gen/err.c +++ b/lib/libc/gen/err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err.c,v 1.11 2012/12/05 23:19:59 deraadt Exp $ */ +/* $OpenBSD: err.c,v 1.12 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -31,17 +31,13 @@ #include <err.h> #include <stdarg.h> -/* PRINTFLIKE2 */ __dead void -_err(int eval, const char *fmt, ...) +err(int eval, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - _verr(eval, fmt, ap); + verr(eval, fmt, ap); va_end(ap); } - -/* PRINTFLIKE2 */ -__weak_alias(err, _err); - +DEF_WEAK(err); diff --git a/lib/libc/gen/errc.c b/lib/libc/gen/errc.c index 345bdc2e465..730822b4a0f 100644 --- a/lib/libc/gen/errc.c +++ b/lib/libc/gen/errc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: errc.c,v 1.1 2014/04/22 00:33:02 guenther Exp $ */ +/* $OpenBSD: errc.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -32,14 +32,12 @@ #include <stdarg.h> __dead void -_errc(int eval, int code, const char *fmt, ...) +errc(int eval, int code, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - _verrc(eval, code, fmt, ap); + verrc(eval, code, fmt, ap); va_end(ap); } - -__weak_alias(errc, _errc); - +DEF_WEAK(errc); diff --git a/lib/libc/gen/errx.c b/lib/libc/gen/errx.c index d213435dbc7..e6b5d2389e4 100644 --- a/lib/libc/gen/errx.c +++ b/lib/libc/gen/errx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: errx.c,v 1.10 2012/12/05 23:19:59 deraadt Exp $ */ +/* $OpenBSD: errx.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -31,17 +31,13 @@ #include <err.h> #include <stdarg.h> -/* PRINTFLIKE2 */ __dead void -_errx(int eval, const char *fmt, ...) +errx(int eval, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - _verrx(eval, fmt, ap); + verrx(eval, fmt, ap); va_end(ap); } - -/* PRINTFLIKE2 */ -__weak_alias(errx, _errx); - +DEF_WEAK(errx); diff --git a/lib/libc/gen/getbsize.c b/lib/libc/gen/getbsize.c index 0e23ed3c91d..8b6e4f06949 100644 --- a/lib/libc/gen/getbsize.c +++ b/lib/libc/gen/getbsize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getbsize.c,v 1.10 2005/08/08 08:05:34 espie Exp $ */ +/* $OpenBSD: getbsize.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -73,18 +73,18 @@ getbsize(int *headerlenp, long *blocksizep) mul = 1; break; default: -fmterr: _warnx("%s: unknown blocksize", p); +fmterr: warnx("%s: unknown blocksize", p); n = 512; max = MAXB; mul = 1; break; } if (n > max) { - _warnx("maximum blocksize is %dG", MAXB / GB); + warnx("maximum blocksize is %dG", MAXB / GB); n = max; } if ((blocksize = n * mul) < 512) { -underflow: _warnx("%s: minimum blocksize is 512", p); +underflow: warnx("%s: minimum blocksize is 512", p); form = ""; blocksize = n = 512; } diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index 5597dba2ff4..b2256516794 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getnetgrent.c,v 1.23 2014/10/08 04:37:02 deraadt Exp $ */ +/* $OpenBSD: getnetgrent.c,v 1.24 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1994 Christos Zoulas @@ -364,7 +364,7 @@ addgroup(char *ypdom, struct stringlist *sl, char *grp) #endif /* check for cycles */ if (_ng_sl_find(sl, grp) != NULL) { - _warnx("netgroup: Cycle in group `%s'", grp); + warnx("netgroup: Cycle in group `%s'", grp); free(grp); return; } @@ -445,7 +445,7 @@ in_find(char *ypdom, struct stringlist *sl, char *grp, const char *host, #endif /* check for cycles */ if (_ng_sl_find(sl, grp) != NULL) { - _warnx("netgroup: Cycle in group `%s'", grp); + warnx("netgroup: Cycle in group `%s'", grp); free(grp); return 0; } diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c index 3b07f473982..0779f70cae6 100644 --- a/lib/libc/gen/popen.c +++ b/lib/libc/gen/popen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: popen.c,v 1.20 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: popen.c,v 1.21 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -137,6 +137,7 @@ popen(const char *program, const char *type) return (iop); } +DEF_WEAK(popen); /* * pclose -- @@ -178,3 +179,4 @@ pclose(FILE *iop) return (pid == -1 ? -1 : pstat); } +DEF_WEAK(pclose); diff --git a/lib/libc/gen/psignal.c b/lib/libc/gen/psignal.c index dfe62753b17..dca921d5a5a 100644 --- a/lib/libc/gen/psignal.c +++ b/lib/libc/gen/psignal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: psignal.c,v 1.9 2007/05/17 04:57:31 ray Exp $ */ +/* $OpenBSD: psignal.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -39,8 +39,6 @@ #include <unistd.h> #include <limits.h> -extern char *__strsignal(int , char *); - void psignal(unsigned int sig, const char *s) { diff --git a/lib/libc/gen/shm_open.c b/lib/libc/gen/shm_open.c index 1ebe7c86257..002ffcfb57a 100644 --- a/lib/libc/gen/shm_open.c +++ b/lib/libc/gen/shm_open.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shm_open.c,v 1.5 2015/05/11 00:42:54 guenther Exp $ */ +/* $OpenBSD: shm_open.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org> * @@ -86,8 +86,6 @@ shm_unlink(const char *path) return unlink(shmpath); } -char *_mktemp(char *); - int shm_mkstemp(char *template) { diff --git a/lib/libc/gen/verr.c b/lib/libc/gen/verr.c index dcd8edcd06c..8f4722b9ee5 100644 --- a/lib/libc/gen/verr.c +++ b/lib/libc/gen/verr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verr.c,v 1.9 2012/12/05 23:20:00 deraadt Exp $ */ +/* $OpenBSD: verr.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -38,7 +38,7 @@ extern char *__progname; /* Program name, from crt0. */ __dead void -_verr(int eval, const char *fmt, va_list ap) +verr(int eval, const char *fmt, va_list ap) { int sverrno; @@ -51,6 +51,4 @@ _verr(int eval, const char *fmt, va_list ap) (void)fprintf(stderr, "%s\n", strerror(sverrno)); exit(eval); } - -__weak_alias(verr, _verr); - +DEF_WEAK(verr); diff --git a/lib/libc/gen/verrc.c b/lib/libc/gen/verrc.c index 5babb671522..27aac8b5b0c 100644 --- a/lib/libc/gen/verrc.c +++ b/lib/libc/gen/verrc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verrc.c,v 1.1 2014/04/22 00:33:02 guenther Exp $ */ +/* $OpenBSD: verrc.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -37,7 +37,7 @@ extern char *__progname; /* Program name, from crt0. */ __dead void -_verrc(int eval, int code, const char *fmt, va_list ap) +verrc(int eval, int code, const char *fmt, va_list ap) { (void)fprintf(stderr, "%s: ", __progname); if (fmt != NULL) { @@ -47,6 +47,4 @@ _verrc(int eval, int code, const char *fmt, va_list ap) (void)fprintf(stderr, "%s\n", strerror(code)); exit(eval); } - -__weak_alias(verrc, _verrc); - +DEF_WEAK(verrc); diff --git a/lib/libc/gen/verrx.c b/lib/libc/gen/verrx.c index 60da062f5af..f0186b607ee 100644 --- a/lib/libc/gen/verrx.c +++ b/lib/libc/gen/verrx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verrx.c,v 1.9 2012/12/05 23:20:00 deraadt Exp $ */ +/* $OpenBSD: verrx.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -36,7 +36,7 @@ extern char *__progname; /* Program name, from crt0. */ __dead void -_verrx(int eval, const char *fmt, va_list ap) +verrx(int eval, const char *fmt, va_list ap) { (void)fprintf(stderr, "%s: ", __progname); if (fmt != NULL) @@ -44,6 +44,4 @@ _verrx(int eval, const char *fmt, va_list ap) (void)fprintf(stderr, "\n"); exit(eval); } - -__weak_alias(verrx, _verrx); - +DEF_WEAK(verrx); diff --git a/lib/libc/gen/vwarn.c b/lib/libc/gen/vwarn.c index 26b60f33641..44d8be48ef5 100644 --- a/lib/libc/gen/vwarn.c +++ b/lib/libc/gen/vwarn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vwarn.c,v 1.9 2012/12/05 23:20:00 deraadt Exp $ */ +/* $OpenBSD: vwarn.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -37,7 +37,7 @@ extern char *__progname; /* Program name, from crt0. */ void -_vwarn(const char *fmt, va_list ap) +vwarn(const char *fmt, va_list ap) { int sverrno; @@ -49,6 +49,4 @@ _vwarn(const char *fmt, va_list ap) } (void)fprintf(stderr, "%s\n", strerror(sverrno)); } - -__weak_alias(vwarn, _vwarn); - +DEF_WEAK(vwarn); diff --git a/lib/libc/gen/vwarnc.c b/lib/libc/gen/vwarnc.c index 1cfc518cdac..eb95d15c24f 100644 --- a/lib/libc/gen/vwarnc.c +++ b/lib/libc/gen/vwarnc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vwarnc.c,v 1.1 2014/04/22 00:33:02 guenther Exp $ */ +/* $OpenBSD: vwarnc.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -36,7 +36,7 @@ extern char *__progname; /* Program name, from crt0. */ void -_vwarnc(int code, const char *fmt, va_list ap) +vwarnc(int code, const char *fmt, va_list ap) { (void)fprintf(stderr, "%s: ", __progname); if (fmt != NULL) { @@ -45,6 +45,4 @@ _vwarnc(int code, const char *fmt, va_list ap) } (void)fprintf(stderr, "%s\n", strerror(code)); } - -__weak_alias(vwarnc, _vwarnc); - +DEF_WEAK(vwarnc); diff --git a/lib/libc/gen/vwarnx.c b/lib/libc/gen/vwarnx.c index e6b1957d4f3..67d8f5b5706 100644 --- a/lib/libc/gen/vwarnx.c +++ b/lib/libc/gen/vwarnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vwarnx.c,v 1.9 2012/12/05 23:20:00 deraadt Exp $ */ +/* $OpenBSD: vwarnx.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -35,13 +35,11 @@ extern char *__progname; /* Program name, from crt0. */ void -_vwarnx(const char *fmt, va_list ap) +vwarnx(const char *fmt, va_list ap) { (void)fprintf(stderr, "%s: ", __progname); if (fmt != NULL) (void)vfprintf(stderr, fmt, ap); (void)fprintf(stderr, "\n"); } - -__weak_alias(vwarnx, _vwarnx); - +DEF_WEAK(vwarnx); diff --git a/lib/libc/gen/warn.c b/lib/libc/gen/warn.c index c1b47a65f27..6784cf6669a 100644 --- a/lib/libc/gen/warn.c +++ b/lib/libc/gen/warn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: warn.c,v 1.10 2012/12/05 23:20:00 deraadt Exp $ */ +/* $OpenBSD: warn.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -31,17 +31,13 @@ #include <err.h> #include <stdarg.h> -/* PRINTFLIKE1 */ void -_warn(const char *fmt, ...) +warn(const char *fmt, ...) { va_list ap; va_start(ap, fmt); - _vwarn(fmt, ap); + vwarn(fmt, ap); va_end(ap); } - -/* PRINTFLIKE1 */ -__weak_alias(warn, _warn); - +DEF_WEAK(warn); diff --git a/lib/libc/gen/warnc.c b/lib/libc/gen/warnc.c index 0ad8df27dd5..bbda54ba927 100644 --- a/lib/libc/gen/warnc.c +++ b/lib/libc/gen/warnc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: warnc.c,v 1.1 2014/04/22 00:33:02 guenther Exp $ */ +/* $OpenBSD: warnc.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -32,14 +32,12 @@ #include <stdarg.h> void -_warnc(int code, const char *fmt, ...) +warnc(int code, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - _vwarnc(code, fmt, ap); + vwarnc(code, fmt, ap); va_end(ap); } - -__weak_alias(warnc, _warnc); - +DEF_WEAK(warnc); diff --git a/lib/libc/gen/warnx.c b/lib/libc/gen/warnx.c index af2ab669cc7..723bc0db8f1 100644 --- a/lib/libc/gen/warnx.c +++ b/lib/libc/gen/warnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: warnx.c,v 1.9 2012/12/05 23:20:00 deraadt Exp $ */ +/* $OpenBSD: warnx.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -31,17 +31,13 @@ #include <err.h> #include <stdarg.h> -/* PRINTFLIKE1 */ void -_warnx(const char *fmt, ...) +warnx(const char *fmt, ...) { va_list ap; va_start(ap, fmt); - _vwarnx(fmt, ap); + vwarnx(fmt, ap); va_end(ap); } - -/* PRINTFLIKE1 */ -__weak_alias(warnx, _warnx); - +DEF_WEAK(warnx); diff --git a/lib/libc/hidden/err.h b/lib/libc/hidden/err.h new file mode 100644 index 00000000000..d634141db9b --- /dev/null +++ b/lib/libc/hidden/err.h @@ -0,0 +1,37 @@ +/* $OpenBSD: err.h,v 1.1 2015/08/31 02:53:56 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBC_ERR_H_ +#define _LIBC_ERR_H_ + +#include_next <err.h> +#include "namespace.h" + +PROTO_NORMAL(err); +PROTO_NORMAL(errc); +PROTO_NORMAL(errx); +PROTO_NORMAL(verr); +PROTO_NORMAL(verrc); +PROTO_NORMAL(verrx); +PROTO_NORMAL(vwarn); +PROTO_NORMAL(vwarnc); +PROTO_NORMAL(vwarnx); +PROTO_NORMAL(warn); +PROTO_NORMAL(warnc); +PROTO_NORMAL(warnx); + +#endif /* !_LIBC_ERR_H_ */ diff --git a/lib/libc/hidden/stdio.h b/lib/libc/hidden/stdio.h new file mode 100644 index 00000000000..8a5530cd54f --- /dev/null +++ b/lib/libc/hidden/stdio.h @@ -0,0 +1,109 @@ +/* $OpenBSD: stdio.h,v 1.1 2015/08/31 02:53:56 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +/* $OpenBSD: stdio.h,v 1.1 2015/08/31 02:53:56 guenther Exp $ */ +/* $NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $ */ + +#ifndef _LIBC_STDIO_H_ +#define _LIBC_STDIO_H_ + +#include_next <stdio.h> +#include "namespace.h" + +__BEGIN_HIDDEN_DECLS +char *_mktemp(char *); +__END_HIDDEN_DECLS + +PROTO_NORMAL(__srget); +PROTO_NORMAL(__swbuf); +PROTO_NORMAL(asprintf); +PROTO_NORMAL(clearerr); +PROTO_NORMAL(ctermid); +PROTO_NORMAL(dprintf); +PROTO_NORMAL(fclose); +PROTO_NORMAL(fdopen); +PROTO_NORMAL(feof); +PROTO_NORMAL(ferror); +PROTO_NORMAL(fflush); +PROTO_NORMAL(fgetc); +PROTO_NORMAL(fgetln); +PROTO_NORMAL(fgetpos); +PROTO_NORMAL(fgets); +PROTO_NORMAL(fileno); +/*PROTO_NORMAL(flockfile);*/ +PROTO_NORMAL(fmemopen); +PROTO_NORMAL(fopen); +PROTO_NORMAL(fprintf); +PROTO_NORMAL(fpurge); +PROTO_NORMAL(fputc); +PROTO_NORMAL(fputs); +PROTO_NORMAL(fread); +PROTO_NORMAL(freopen); +PROTO_NORMAL(fscanf); +PROTO_NORMAL(fseek); +PROTO_NORMAL(fseeko); +PROTO_NORMAL(fsetpos); +PROTO_NORMAL(ftell); +PROTO_NORMAL(ftello); +/*PROTO_NORMAL(ftrylockfile);*/ +/*PROTO_NORMAL(funlockfile);*/ +PROTO_NORMAL(funopen); +PROTO_NORMAL(fwrite); +PROTO_NORMAL(getc); +PROTO_NORMAL(getc_unlocked); +PROTO_NORMAL(getchar); +PROTO_NORMAL(getchar_unlocked); +PROTO_NORMAL(getdelim); +PROTO_NORMAL(getline); +PROTO_NORMAL(getw); +PROTO_NORMAL(open_memstream); +PROTO_NORMAL(pclose); +PROTO_NORMAL(perror); +PROTO_NORMAL(popen); +PROTO_NORMAL(printf); +PROTO_NORMAL(putc); +PROTO_NORMAL(putc_unlocked); +PROTO_NORMAL(putchar); +PROTO_NORMAL(putchar_unlocked); +PROTO_NORMAL(puts); +PROTO_NORMAL(putw); +PROTO_NORMAL(remove); +/*PROTO_NORMAL(rename);*/ +/*PROTO_NORMAL(renameat);*/ +PROTO_NORMAL(rewind); +PROTO_NORMAL(scanf); +PROTO_NORMAL(setbuf); +PROTO_NORMAL(setbuffer); +PROTO_NORMAL(setlinebuf); +PROTO_NORMAL(setvbuf); +PROTO_NORMAL(snprintf); +PROTO_STD_DEPRECATED(sprintf); +PROTO_NORMAL(sscanf); +PROTO_DEPRECATED(tempnam); +PROTO_NORMAL(tmpfile); +PROTO_STD_DEPRECATED(tmpnam); +PROTO_NORMAL(ungetc); +PROTO_NORMAL(vasprintf); +PROTO_NORMAL(vdprintf); +PROTO_NORMAL(vfprintf); +PROTO_NORMAL(vfscanf); +PROTO_NORMAL(vprintf); +PROTO_NORMAL(vscanf); +PROTO_NORMAL(vsnprintf); +PROTO_STD_DEPRECATED(vsprintf); +PROTO_NORMAL(vsscanf); + +#endif /* _LIBC_STDIO_H_ */ diff --git a/lib/libc/hidden/string.h b/lib/libc/hidden/string.h new file mode 100644 index 00000000000..dc4e4801e02 --- /dev/null +++ b/lib/libc/hidden/string.h @@ -0,0 +1,79 @@ +/* $OpenBSD: string.h,v 1.1 2015/08/31 02:53:56 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBC_STRING_H_ +#define _LIBC_STRING_H_ + +#include_next <string.h> +#include "namespace.h" + +/* XXX should make this __BEGIN_HIDDEN_DECLS */ +__BEGIN_DECLS +char *__strsignal(int , char *); +__END_DECLS + +PROTO_NORMAL(bcmp); +PROTO_NORMAL(bcopy); +PROTO_NORMAL(bzero); +PROTO_NORMAL(explicit_bzero); +PROTO_NORMAL(ffs); +PROTO_DEPRECATED(index); +PROTO_NORMAL(memccpy); +PROTO_NORMAL(memchr); +PROTO_NORMAL(memcmp); +PROTO_NORMAL(memcpy); +PROTO_NORMAL(memmem); +PROTO_NORMAL(memmove); +PROTO_NORMAL(memrchr); +PROTO_NORMAL(memset); +PROTO_DEPRECATED(rindex); +PROTO_DEPRECATED(stpcpy); +PROTO_NORMAL(stpncpy); +PROTO_NORMAL(strcasecmp); +PROTO_NORMAL(strcasestr); +PROTO_STD_DEPRECATED(strcat); +PROTO_NORMAL(strchr); +PROTO_NORMAL(strcmp); +PROTO_NORMAL(strcoll); +PROTO_STD_DEPRECATED(strcpy); +PROTO_NORMAL(strcspn); +PROTO_NORMAL(strdup); +PROTO_NORMAL(strerror); +PROTO_NORMAL(strerror_r); +PROTO_NORMAL(strlcat); +PROTO_NORMAL(strlcpy); +PROTO_NORMAL(strlen); +PROTO_NORMAL(strmode); +PROTO_NORMAL(strncasecmp); +PROTO_NORMAL(strncat); +PROTO_NORMAL(strncmp); +PROTO_NORMAL(strncpy); +PROTO_NORMAL(strndup); +PROTO_NORMAL(strnlen); +PROTO_NORMAL(strpbrk); +PROTO_NORMAL(strrchr); +PROTO_NORMAL(strsep); +PROTO_NORMAL(strsignal); +PROTO_NORMAL(strspn); +PROTO_NORMAL(strstr); +PROTO_NORMAL(strtok); +PROTO_NORMAL(strtok_r); +PROTO_NORMAL(strxfrm); +PROTO_NORMAL(timingsafe_bcmp); +PROTO_NORMAL(timingsafe_memcmp); + +#endif /* _LIBC_STRING_H_ */ diff --git a/lib/libc/hidden/wchar.h b/lib/libc/hidden/wchar.h new file mode 100644 index 00000000000..de1891267fc --- /dev/null +++ b/lib/libc/hidden/wchar.h @@ -0,0 +1,95 @@ +/* $OpenBSD: wchar.h,v 1.1 2015/08/31 02:53:56 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBC_WCHAR_H_ +#define _LIBC_WCHAR_H_ + +#include_next <wchar.h> +#include "namespace.h" + +/*PROTO_NORMAL(btowc);*/ +PROTO_NORMAL(fgetwc); +PROTO_NORMAL(fgetws); +PROTO_NORMAL(fputwc); +PROTO_NORMAL(fputws); +PROTO_NORMAL(fwide); +PROTO_NORMAL(fwprintf); +PROTO_NORMAL(fwscanf); +PROTO_NORMAL(getwc); +PROTO_NORMAL(getwchar); +/*PROTO_NORMAL(mbrlen);*/ +/*PROTO_NORMAL(mbrtowc);*/ +/*PROTO_NORMAL(mbsinit);*/ +/*PROTO_NORMAL(mbsnrtowcs);*/ +/*PROTO_NORMAL(mbsrtowcs);*/ +PROTO_NORMAL(open_wmemstream); +PROTO_NORMAL(putwc); +PROTO_NORMAL(putwchar); +PROTO_NORMAL(swprintf); +PROTO_NORMAL(swscanf); +PROTO_NORMAL(ungetwc); +PROTO_NORMAL(vfwprintf); +PROTO_NORMAL(vfwscanf); +PROTO_NORMAL(vswprintf); +PROTO_NORMAL(vswscanf); +PROTO_NORMAL(vwprintf); +PROTO_NORMAL(vwscanf); +/*PROTO_NORMAL(wcrtomb);*/ +/*PROTO_NORMAL(wcscasecmp);*/ +/*PROTO_NORMAL(wcscat);*/ +/*PROTO_NORMAL(wcschr);*/ +/*PROTO_NORMAL(wcscmp);*/ +/*PROTO_NORMAL(wcscoll);*/ +/*PROTO_NORMAL(wcscpy);*/ +/*PROTO_NORMAL(wcscspn);*/ +/*PROTO_NORMAL(wcsdup);*/ +/*PROTO_NORMAL(wcsftime);*/ +/*PROTO_NORMAL(wcslcat);*/ +/*PROTO_NORMAL(wcslcpy);*/ +/*PROTO_NORMAL(wcslen);*/ +/*PROTO_NORMAL(wcsncasecmp);*/ +/*PROTO_NORMAL(wcsncat);*/ +/*PROTO_NORMAL(wcsncmp);*/ +/*PROTO_NORMAL(wcsncpy);*/ +/*PROTO_NORMAL(wcsnrtombs);*/ +/*PROTO_NORMAL(wcspbrk);*/ +/*PROTO_NORMAL(wcsrchr);*/ +/*PROTO_NORMAL(wcsrtombs);*/ +/*PROTO_NORMAL(wcsspn);*/ +/*PROTO_NORMAL(wcsstr);*/ +/*PROTO_NORMAL(wcstod);*/ +/*PROTO_NORMAL(wcstof);*/ +/*PROTO_NORMAL(wcstok);*/ +/*PROTO_NORMAL(wcstol);*/ +/*PROTO_NORMAL(wcstold);*/ +/*PROTO_NORMAL(wcstoll);*/ +/*PROTO_NORMAL(wcstoul);*/ +/*PROTO_NORMAL(wcstoull);*/ +/*PROTO_NORMAL(wcswcs);*/ +/*PROTO_NORMAL(wcswidth);*/ +/*PROTO_NORMAL(wcsxfrm);*/ +/*PROTO_NORMAL(wctob);*/ +/*PROTO_NORMAL(wcwidth);*/ +/*PROTO_NORMAL(wmemchr);*/ +/*PROTO_NORMAL(wmemcmp);*/ +/*PROTO_NORMAL(wmemcpy);*/ +/*PROTO_NORMAL(wmemmove);*/ +/*PROTO_NORMAL(wmemset);*/ +PROTO_NORMAL(wprintf); +PROTO_NORMAL(wscanf); + +#endif /* !_LIBC_WCHAR_H_ */ diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h index 4a51f15ddf9..b0cad502a31 100644 --- a/lib/libc/include/namespace.h +++ b/lib/libc/include/namespace.h @@ -1,18 +1,158 @@ -/* $OpenBSD: namespace.h,v 1.2 1996/08/19 08:28:08 tholo Exp $ */ +/* $OpenBSD: namespace.h,v 1.3 2015/08/31 02:53:56 guenther Exp $ */ +#ifndef _LIBC_NAMESPACE_H_ +#define _LIBC_NAMESPACE_H_ + +/* These will be replaced with symbol renaming ala PROTO_NORMAL */ #define catclose _catclose #define catgets _catgets #define catopen _catopen -#define err _err -#define errx _errx #define strtoq _strtoq #define strtouq _strtouq #define sys_errlist _sys_errlist #define sys_nerr _sys_nerr #define sys_siglist _sys_siglist -#define verr _verr -#define verrx _verrx -#define vwarn _vwarn -#define vwarnx _vwarnx -#define warn _warn -#define warnx _warnx + +/* + * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * The goal: calls from inside libc to other libc functions should be via + * identifiers that are of hidden visibility and--to avoid confusion--are + * in the reserved namespace. By doing this these calls are protected + * from overriding by applications and on many platforms can avoid creation + * or use of GOT or PLT entries. I've chosen a prefix of underbar-C-underbar + * ("_libc_") for this. These will not be declared directly; instead, the + * gcc "asm labels" extension will be used rename the function. + * + * For syscalls which are cancellation points, such as wait4(), there + * are identifiers that do not provide cancellation: + * _libc_wait4 hidden alias, for use internal to libc only + * _thread_sys_wait4 global name, for use outside libc only + * ...and identifiers that do provide cancellation: + * wait4 weak alias, for general use + * _libc_wait4_cancel hidden alias, for use internal to libc only + * Inside libc, the bare name ("wait4") binds to the version *without* + * cancellation; the few times where cancellation is desired it can be + * obtained by calling CANCEL(x) instead of just x. + * + * Some other calls need to be wrapped for reasons other than cancellation, + * such as to provide functionality beyond the underlying syscall (e.g., + * setlogin). For these, there are identifiers for the raw call, without + * the wrapping: + * _libc_setlogin hidden alias, for use internal to libc only + * _thread_sys_setlogin global name, for use outside libc only + * ...and identifiers that do provide the libc wrapping: + * setlogin weak alias, for general use + * _libc_setlogin_wrap hidden alias, for use internal to libc only + * Inside libc, the bare name ("setlogin") binds to the wrapper; when the + * raw version is necessary it can be obtained by calling HIDDEN(x) instead of + * just x. + * + * For syscalls which are not cancellation points, such as getpid(), + * the identifiers are just: + * _libc_getpid hidden alias, for use internal to libc only + * _thread_sys_getpid global name, for use outside libc only + * getpid weak alias, for use outside libc only + * + * By using gcc's "asm label" extension, we can usually avoid having + * to type those prefixes in the .h and .c files. However, for those + * cases where a non-default binding is necessary we can use these macros + * to get the desired identifier: + * + * CANCEL(x) + * This expands to the internal, hidden name of a cancellation + * wrapper: _libc_x_cancel. ex: CANCEL(fsync)(fd) + * + * WRAP(x) + * This expands to the internal, hidden name of a non-cancellation + * wrapper: _libc_x_wrap. ex: WRAP(sigpending)(set) + * + * + * In order to actually set up the desired asm labels, we use these in + * the internal .h files: + * PROTO_NORMAL(x) Symbols used both internally and externally + * This makes gcc convert use of x to use _libc_x instead + * ex: PROTO_NORMAL(getpid) + * + * PROTO_STD_DEPRECATED(x) Standard C symbols that we don't want to use + * This just marks the symbol as deprecated, with no renaming. + * ex: PROTO_STD_DEPRECATED(strcpy) + * + * PROTO_DEPRECATED(x) Symbols not in ISO C that we don't want to use + * This marks the symbol as both weak and deprecated, with no renaming + * ex: PROTO_DEPRECATED(creat) + * + * PROTO_CANCEL(x) Functions that have cancellation wrappers + * Like PROTO_NORMAL(x), but also declares _libc_x_cancel + * ex: PROTO_CANCEL(wait4) + * + * PROTO_WRAP(x) Functions that have wrappers for other reasons + * This makes gcc convert use of x to use _libc_x_wrap instead. + * ex: PROTO_WRAP(setlogin) + * + * + * Finally, to create the expected aliases, we use these in the .c files + * where the definitions are: + * DEF_STRONG(x) Symbols reserved to or specified by ISO C + * This defines x as a strong alias for _libc_x; this must only + * be used for symbols that are reserved by the C standard + * (or reserved in the external identifier namespace). + * Matches with PROTO_NORMAL() + * ex: DEF_STRONG(fopen) + * + * DEF_WEAK(x) Symbols used internally and not in ISO C + * This defines x as a weak alias for _libc_x + * Matches with PROTO_NORMAL() + * ex: DEF_WEAK(lseek) + * + * DEF_CANCEL(x) Symbols that have a cancellation wrapper + * This defines x as a weak alias for _libc_x_cancel. + * Matches with PROTO_CANCEL() + * ex: DEF_CANCEL(read) + * + * DEF_WRAP(x) + * This defines x as a weak alias for _libc_x_wrap. + * Matches with PROTO_WRAP() + * ex: DEF_WRAP(setlogin) + * + * DEF_SYS(x) + * This defines _thread_sys_x as a strong alias for _libc_x. This should + * only be needed for syscalls that have C instead of asm stubs. + * Matches with PROTO_NORMAL(), PROTO_CANCEL(), or PROTO_WRAP() + * ex: DEF_SYS(pread) + */ + +#define HIDDEN(x) _libc_##x +#define CANCEL(x) _libc_##x##_cancel +#define WRAP(x) _libc_##x##_wrap +#define HIDDEN_STRING(x) "_libc_" __STRING(x) +#define WRAP_STRING(x) "_libc_" __STRING(x) "_wrap" + +#define PROTO_NORMAL(x) __dso_hidden typeof(x) x asm(HIDDEN_STRING(x)) +#define PROTO_STD_DEPRECATED(x) typeof(x) x __attribute__((deprecated)) +#define PROTO_DEPRECATED(x) typeof(x) x __attribute__((deprecated, weak)) +#define PROTO_CANCEL(x) PROTO_NORMAL(x), CANCEL(x) +#define PROTO_WRAP(x) __dso_hidden typeof(x) x asm(WRAP_STRING(x)) + +#define DEF_STRONG(x) __strong_alias(x, HIDDEN(x)) +#define DEF_WEAK(x) __weak_alias(x, HIDDEN(x)) +#define DEF_CANCEL(x) __weak_alias(x, CANCEL(x)) +#define DEF_WRAP(x) __weak_alias(x, WRAP(x)) +#define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) + +#endif /* _LIBC_NAMESPACE_H_ */ + diff --git a/lib/libc/stdio/asprintf.c b/lib/libc/stdio/asprintf.c index 861bb0a797d..bd12726fbf0 100644 --- a/lib/libc/stdio/asprintf.c +++ b/lib/libc/stdio/asprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asprintf.c,v 1.20 2015/08/20 21:49:29 deraadt Exp $ */ +/* $OpenBSD: asprintf.c,v 1.21 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> @@ -23,7 +23,6 @@ #include <stdarg.h> #include "local.h" -/* PRINTFLIKE2 */ int asprintf(char **str, const char *fmt, ...) { @@ -61,3 +60,4 @@ err: errno = ENOMEM; return (-1); } +DEF_WEAK(asprintf); diff --git a/lib/libc/stdio/clrerr.c b/lib/libc/stdio/clrerr.c index ac08c72cd11..8ee1bb1ff45 100644 --- a/lib/libc/stdio/clrerr.c +++ b/lib/libc/stdio/clrerr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clrerr.c,v 1.9 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: clrerr.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -42,3 +42,4 @@ clearerr(FILE *fp) __sclearerr(fp); FUNLOCKFILE(fp); } +DEF_STRONG(clearerr); diff --git a/lib/libc/stdio/dprintf.c b/lib/libc/stdio/dprintf.c index dbf7d3457ff..e8e7f5453e9 100644 --- a/lib/libc/stdio/dprintf.c +++ b/lib/libc/stdio/dprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dprintf.c,v 1.1 2013/01/30 00:08:13 brad Exp $ */ +/* $OpenBSD: dprintf.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* $FreeBSD: src/lib/libc/stdio/dprintf.c,v 1.2 2012/11/17 01:49:39 svnexp Exp $ */ /*- @@ -46,3 +46,4 @@ dprintf(int fd, const char * __restrict fmt, ...) va_end(ap); return ret; } +DEF_WEAK(dprintf); diff --git a/lib/libc/stdio/fclose.c b/lib/libc/stdio/fclose.c index c72af540586..4bd162abc84 100644 --- a/lib/libc/stdio/fclose.c +++ b/lib/libc/stdio/fclose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fclose.c,v 1.9 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fclose.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -61,3 +61,4 @@ fclose(FILE *fp) FUNLOCKFILE(fp); return (r); } +DEF_STRONG(fclose); diff --git a/lib/libc/stdio/fdopen.c b/lib/libc/stdio/fdopen.c index 1c0c8132fd2..f98cffac8c3 100644 --- a/lib/libc/stdio/fdopen.c +++ b/lib/libc/stdio/fdopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdopen.c,v 1.7 2014/08/31 02:21:18 guenther Exp $ */ +/* $OpenBSD: fdopen.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -89,3 +89,4 @@ fdopen(int fd, const char *mode) fp->_close = __sclose; return (fp); } +DEF_WEAK(fdopen); diff --git a/lib/libc/stdio/feof.c b/lib/libc/stdio/feof.c index 0036bab7d0e..0d6718a68c4 100644 --- a/lib/libc/stdio/feof.c +++ b/lib/libc/stdio/feof.c @@ -1,4 +1,4 @@ -/* $OpenBSD: feof.c,v 1.8 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: feof.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -49,3 +49,4 @@ feof(FILE *fp) FUNLOCKFILE(fp); return (ret); } +DEF_STRONG(feof); diff --git a/lib/libc/stdio/ferror.c b/lib/libc/stdio/ferror.c index 00b9c8b2c68..61c86b52ca6 100644 --- a/lib/libc/stdio/ferror.c +++ b/lib/libc/stdio/ferror.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ferror.c,v 1.8 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: ferror.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -49,3 +49,4 @@ ferror(FILE *fp) FUNLOCKFILE(fp); return (ret); } +DEF_STRONG(ferror); diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c index 3e30f1086ff..fd1a4b3504b 100644 --- a/lib/libc/stdio/fflush.c +++ b/lib/libc/stdio/fflush.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fflush.c,v 1.8 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fflush.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -52,6 +52,7 @@ fflush(FILE *fp) FUNLOCKFILE(fp); return (r); } +DEF_STRONG(fflush); int __sflush(FILE *fp) diff --git a/lib/libc/stdio/fgetc.c b/lib/libc/stdio/fgetc.c index c5d7dde2d06..bfe9266953c 100644 --- a/lib/libc/stdio/fgetc.c +++ b/lib/libc/stdio/fgetc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fgetc.c,v 1.8 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fgetc.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -38,3 +38,4 @@ fgetc(FILE *fp) { return (getc(fp)); } +DEF_STRONG(fgetc); diff --git a/lib/libc/stdio/fgetln.c b/lib/libc/stdio/fgetln.c index 1109cf25c01..ae2eb10f96c 100644 --- a/lib/libc/stdio/fgetln.c +++ b/lib/libc/stdio/fgetln.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fgetln.c,v 1.13 2015/01/05 21:58:52 millert Exp $ */ +/* $OpenBSD: fgetln.c,v 1.14 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -142,3 +142,4 @@ error: *lenp = 0; return (NULL); } +DEF_WEAK(fgetln); diff --git a/lib/libc/stdio/fgetpos.c b/lib/libc/stdio/fgetpos.c index e6188e5a6b1..05ba0b005b1 100644 --- a/lib/libc/stdio/fgetpos.c +++ b/lib/libc/stdio/fgetpos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fgetpos.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: fgetpos.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -41,3 +41,4 @@ fgetpos(FILE *fp, fpos_t *pos) { return((*pos = ftello(fp)) == (fpos_t)-1); } +DEF_STRONG(fgetpos); diff --git a/lib/libc/stdio/fgets.c b/lib/libc/stdio/fgets.c index 0ba8770e33b..5966c0bf903 100644 --- a/lib/libc/stdio/fgets.c +++ b/lib/libc/stdio/fgets.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fgets.c,v 1.14 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fgets.c,v 1.15 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -103,3 +103,4 @@ fgets(char *buf, int n, FILE *fp) FUNLOCKFILE(fp); return (buf); } +DEF_STRONG(fgets); diff --git a/lib/libc/stdio/fgetwc.c b/lib/libc/stdio/fgetwc.c index c16ffaf2997..6c850cc9680 100644 --- a/lib/libc/stdio/fgetwc.c +++ b/lib/libc/stdio/fgetwc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fgetwc.c,v 1.4 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fgetwc.c,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: fgetwc.c,v 1.3 2003/03/07 07:11:36 tshiozak Exp $ */ /*- @@ -88,3 +88,4 @@ fgetwc(FILE *fp) return (r); } +DEF_STRONG(fgetwc); diff --git a/lib/libc/stdio/fgetws.c b/lib/libc/stdio/fgetws.c index e8cd2490089..0e66552ea45 100644 --- a/lib/libc/stdio/fgetws.c +++ b/lib/libc/stdio/fgetws.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fgetws.c,v 1.6 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fgetws.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: fgetws.c,v 1.1 2003/03/07 07:11:37 tshiozak Exp $ */ /*- @@ -77,3 +77,4 @@ error: FUNLOCKFILE(fp); return (NULL); } +DEF_STRONG(fgetws); diff --git a/lib/libc/stdio/fileno.c b/lib/libc/stdio/fileno.c index 58628da3c10..f7baee597a6 100644 --- a/lib/libc/stdio/fileno.c +++ b/lib/libc/stdio/fileno.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fileno.c,v 1.8 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fileno.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -49,3 +49,4 @@ fileno(FILE *fp) FUNLOCKFILE(fp); return (ret); } +DEF_WEAK(fileno); diff --git a/lib/libc/stdio/fmemopen.c b/lib/libc/stdio/fmemopen.c index 8cda0476340..00c27646b96 100644 --- a/lib/libc/stdio/fmemopen.c +++ b/lib/libc/stdio/fmemopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fmemopen.c,v 1.2 2013/03/27 15:06:25 mpi Exp $ */ +/* $OpenBSD: fmemopen.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org> @@ -181,3 +181,4 @@ fmemopen(void *buf, size_t size, const char *mode) return (fp); } +DEF_WEAK(fmemopen); diff --git a/lib/libc/stdio/fopen.c b/lib/libc/stdio/fopen.c index 14650523e08..6936321d643 100644 --- a/lib/libc/stdio/fopen.c +++ b/lib/libc/stdio/fopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fopen.c,v 1.7 2008/05/03 18:46:41 chl Exp $ */ +/* $OpenBSD: fopen.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -84,3 +84,4 @@ fopen(const char *file, const char *mode) (void) __sseek((void *)fp, (fpos_t)0, SEEK_END); return (fp); } +DEF_STRONG(fopen); diff --git a/lib/libc/stdio/fprintf.c b/lib/libc/stdio/fprintf.c index a391142ea25..abc04b01951 100644 --- a/lib/libc/stdio/fprintf.c +++ b/lib/libc/stdio/fprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fprintf.c,v 1.7 2011/05/30 18:48:33 martynas Exp $ */ +/* $OpenBSD: fprintf.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -34,7 +34,6 @@ #include <stdio.h> #include <stdarg.h> -/* PRINTFLIKE2 */ int fprintf(FILE *fp, const char *fmt, ...) { @@ -46,3 +45,4 @@ fprintf(FILE *fp, const char *fmt, ...) va_end(ap); return (ret); } +DEF_STRONG(fprintf); diff --git a/lib/libc/stdio/fpurge.c b/lib/libc/stdio/fpurge.c index 65bd74994f4..8dd8a916118 100644 --- a/lib/libc/stdio/fpurge.c +++ b/lib/libc/stdio/fpurge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpurge.c,v 1.9 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fpurge.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -59,3 +59,4 @@ fpurge(FILE *fp) FUNLOCKFILE(fp); return (0); } +DEF_WEAK(fpurge); diff --git a/lib/libc/stdio/fputc.c b/lib/libc/stdio/fputc.c index 98e39603f04..de365c224f3 100644 --- a/lib/libc/stdio/fputc.c +++ b/lib/libc/stdio/fputc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fputc.c,v 1.10 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fputc.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -39,3 +39,4 @@ fputc(int c, FILE *fp) { return (putc(c, fp)); } +DEF_STRONG(fputc); diff --git a/lib/libc/stdio/fputs.c b/lib/libc/stdio/fputs.c index ea8556a29cf..05ead5c83b6 100644 --- a/lib/libc/stdio/fputs.c +++ b/lib/libc/stdio/fputs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fputs.c,v 1.10 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fputs.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -56,3 +56,4 @@ fputs(const char *s, FILE *fp) FUNLOCKFILE(fp); return (ret); } +DEF_STRONG(fputs); diff --git a/lib/libc/stdio/fputwc.c b/lib/libc/stdio/fputwc.c index 9db70d061ae..fa3f3704445 100644 --- a/lib/libc/stdio/fputwc.c +++ b/lib/libc/stdio/fputwc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fputwc.c,v 1.4 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fputwc.c,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: fputwc.c,v 1.3 2003/03/07 07:11:37 tshiozak Exp $ */ /*- @@ -86,3 +86,4 @@ fputwc(wchar_t wc, FILE *fp) return (r); } +DEF_STRONG(fputwc); diff --git a/lib/libc/stdio/fputws.c b/lib/libc/stdio/fputws.c index 108846e7099..8961571188d 100644 --- a/lib/libc/stdio/fputws.c +++ b/lib/libc/stdio/fputws.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fputws.c,v 1.7 2013/11/12 07:04:35 deraadt Exp $ */ +/* $OpenBSD: fputws.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: fputws.c,v 1.1 2003/03/07 07:11:37 tshiozak Exp $ */ /*- @@ -55,3 +55,4 @@ fputws(ws, fp) return (0); } +DEF_STRONG(fputws); diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c index 6e957623e1f..35c73322a58 100644 --- a/lib/libc/stdio/fread.c +++ b/lib/libc/stdio/fread.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fread.c,v 1.13 2014/12/08 20:40:53 tedu Exp $ */ +/* $OpenBSD: fread.c,v 1.14 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -101,3 +101,4 @@ fread(void *buf, size_t size, size_t count, FILE *fp) FUNLOCKFILE(fp); return (count); } +DEF_STRONG(fread); diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c index 82717b1e26c..442370d870b 100644 --- a/lib/libc/stdio/freopen.c +++ b/lib/libc/stdio/freopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: freopen.c,v 1.14 2014/08/31 02:21:18 guenther Exp $ */ +/* $OpenBSD: freopen.c,v 1.15 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -169,3 +169,4 @@ freopen(const char *file, const char *mode, FILE *fp) FUNLOCKFILE(fp); return (fp); } +DEF_STRONG(freopen); diff --git a/lib/libc/stdio/fscanf.c b/lib/libc/stdio/fscanf.c index 5fd10d4a464..e401398d8eb 100644 --- a/lib/libc/stdio/fscanf.c +++ b/lib/libc/stdio/fscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fscanf.c,v 1.10 2011/05/30 18:48:33 martynas Exp $ */ +/* $OpenBSD: fscanf.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -34,7 +34,6 @@ #include <stdio.h> #include <stdarg.h> -/* SCANFLIKE2 */ int fscanf(FILE *fp, const char *fmt, ...) { @@ -46,3 +45,4 @@ fscanf(FILE *fp, const char *fmt, ...) va_end(ap); return (ret); } +DEF_STRONG(fscanf); diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c index cdd40b62f8a..f2e975df69e 100644 --- a/lib/libc/stdio/fseek.c +++ b/lib/libc/stdio/fseek.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fseek.c,v 1.11 2012/05/21 22:24:19 matthew Exp $ */ +/* $OpenBSD: fseek.c,v 1.12 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -243,9 +243,11 @@ dumb: FUNLOCKFILE(fp); return (0); } +DEF_WEAK(fseeko); int fseek(FILE *fp, long offset, int whence) { return (fseeko(fp, offset, whence)); } +DEF_STRONG(fseek); diff --git a/lib/libc/stdio/fsetpos.c b/lib/libc/stdio/fsetpos.c index 9624fe56542..d389f5efa7f 100644 --- a/lib/libc/stdio/fsetpos.c +++ b/lib/libc/stdio/fsetpos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fsetpos.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: fsetpos.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -41,3 +41,4 @@ fsetpos(FILE *iop, const fpos_t *pos) { return (fseeko(iop, (off_t)*pos, SEEK_SET)); } +DEF_STRONG(fsetpos); diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c index 0a2016ce10b..a75ebbbaad7 100644 --- a/lib/libc/stdio/ftell.c +++ b/lib/libc/stdio/ftell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftell.c,v 1.10 2012/05/21 22:24:19 matthew Exp $ */ +/* $OpenBSD: ftell.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -83,6 +83,7 @@ ftello(FILE *fp) out: FUNLOCKFILE(fp); return (pos); } +DEF_WEAK(ftello); long ftell(FILE *fp) @@ -94,3 +95,4 @@ ftell(FILE *fp) } return ((long)offset); } +DEF_STRONG(ftell); diff --git a/lib/libc/stdio/funopen.c b/lib/libc/stdio/funopen.c index b85ee96a1f7..b6fc464b4aa 100644 --- a/lib/libc/stdio/funopen.c +++ b/lib/libc/stdio/funopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: funopen.c,v 1.8 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: funopen.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -66,3 +66,4 @@ funopen(const void *cookie, int (*readfn)(void *, char *, int), fp->_close = closefn; return (fp); } +DEF_WEAK(funopen); diff --git a/lib/libc/stdio/fwide.c b/lib/libc/stdio/fwide.c index 93cddc68e9d..27ca0f8ac59 100644 --- a/lib/libc/stdio/fwide.c +++ b/lib/libc/stdio/fwide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fwide.c,v 1.4 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fwide.c,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: fwide.c,v 1.2 2003/01/18 11:29:54 thorpej Exp $ */ /*- @@ -62,3 +62,4 @@ fwide(FILE *fp, int mode) return mode; } +DEF_STRONG(fwide); diff --git a/lib/libc/stdio/fwprintf.c b/lib/libc/stdio/fwprintf.c index 4474e8b3566..61a017b652d 100644 --- a/lib/libc/stdio/fwprintf.c +++ b/lib/libc/stdio/fwprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fwprintf.c,v 1.3 2011/04/28 17:38:46 stsp Exp $ */ +/* $OpenBSD: fwprintf.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -46,3 +46,4 @@ fwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...) va_end(ap); return (ret); } +DEF_STRONG(fwprintf); diff --git a/lib/libc/stdio/fwrite.c b/lib/libc/stdio/fwrite.c index f0a17bfb9a8..fcabc7c3c06 100644 --- a/lib/libc/stdio/fwrite.c +++ b/lib/libc/stdio/fwrite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fwrite.c,v 1.11 2014/05/01 16:40:36 deraadt Exp $ */ +/* $OpenBSD: fwrite.c,v 1.12 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -86,3 +86,4 @@ fwrite(const void *buf, size_t size, size_t count, FILE *fp) return (count); return ((n - uio.uio_resid) / size); } +DEF_STRONG(fwrite); diff --git a/lib/libc/stdio/fwscanf.c b/lib/libc/stdio/fwscanf.c index b716cbff3d3..648e1bfb5fd 100644 --- a/lib/libc/stdio/fwscanf.c +++ b/lib/libc/stdio/fwscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fwscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */ +/* $OpenBSD: fwscanf.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 2002 Tim J. Robbins @@ -42,3 +42,4 @@ fwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...) return (r); } +DEF_STRONG(fwscanf); diff --git a/lib/libc/stdio/getc.c b/lib/libc/stdio/getc.c index 6879cbb7913..53cd3d84797 100644 --- a/lib/libc/stdio/getc.c +++ b/lib/libc/stdio/getc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getc.c,v 1.9 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: getc.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -44,6 +44,7 @@ getc_unlocked(FILE *fp) { return (__sgetc(fp)); } +DEF_WEAK(getc_unlocked); /* * A subroutine version of the macro getc. @@ -60,3 +61,4 @@ getc(FILE *fp) FUNLOCKFILE(fp); return (c); } +DEF_STRONG(getc); diff --git a/lib/libc/stdio/getchar.c b/lib/libc/stdio/getchar.c index 550817de028..0bf6ce1ad19 100644 --- a/lib/libc/stdio/getchar.c +++ b/lib/libc/stdio/getchar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getchar.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: getchar.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -43,6 +43,7 @@ getchar_unlocked(void) { return (getc_unlocked(stdin)); } +DEF_WEAK(getchar_unlocked); /* @@ -56,3 +57,4 @@ getchar(void) { return (getc(stdin)); } +DEF_STRONG(getchar); diff --git a/lib/libc/stdio/getdelim.c b/lib/libc/stdio/getdelim.c index faf245ca6b1..58ff0a1be12 100644 --- a/lib/libc/stdio/getdelim.c +++ b/lib/libc/stdio/getdelim.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getdelim.c,v 1.3 2015/02/06 23:21:58 millert Exp $ */ +/* $OpenBSD: getdelim.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: getdelim.c,v 1.13 2011/07/22 23:12:30 joerg Exp $ */ /* @@ -132,3 +132,4 @@ error: FUNLOCKFILE(fp); return -1; } +DEF_WEAK(getdelim); diff --git a/lib/libc/stdio/getline.c b/lib/libc/stdio/getline.c index 55ad39675b9..68c10104933 100644 --- a/lib/libc/stdio/getline.c +++ b/lib/libc/stdio/getline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getline.c,v 1.1 2012/03/21 23:44:35 fgsch Exp $ */ +/* $OpenBSD: getline.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: getline.c,v 1.3 2009/12/02 08:46:33 roy Exp $ */ /* @@ -35,3 +35,4 @@ getline(char **__restrict buf, size_t *__restrict buflen, FILE *__restrict fp) { return getdelim(buf, buflen, '\n', fp); } +DEF_WEAK(getline); diff --git a/lib/libc/stdio/getw.c b/lib/libc/stdio/getw.c index 6bfb97eb9fd..a6688be7c74 100644 --- a/lib/libc/stdio/getw.c +++ b/lib/libc/stdio/getw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getw.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: getw.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -40,3 +40,4 @@ getw(FILE *fp) return (fread((void *)&x, sizeof(x), 1, fp) == 1 ? x : EOF); } +DEF_WEAK(getw); diff --git a/lib/libc/stdio/getwc.c b/lib/libc/stdio/getwc.c index e9bbb7c2421..24d1bed3f60 100644 --- a/lib/libc/stdio/getwc.c +++ b/lib/libc/stdio/getwc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getwc.c,v 1.1 2005/06/17 20:40:32 espie Exp $ */ +/* $OpenBSD: getwc.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: getwc.c,v 1.2 2003/01/18 11:29:55 thorpej Exp $ */ /*- @@ -43,3 +43,4 @@ getwc(FILE *fp) return fgetwc(fp); } +DEF_STRONG(getwc); diff --git a/lib/libc/stdio/getwchar.c b/lib/libc/stdio/getwchar.c index 2a112ed8fbe..644b553ce6c 100644 --- a/lib/libc/stdio/getwchar.c +++ b/lib/libc/stdio/getwchar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getwchar.c,v 1.1 2005/06/17 20:40:32 espie Exp $ */ +/* $OpenBSD: getwchar.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: getwchar.c,v 1.2 2003/01/18 11:29:55 thorpej Exp $ */ /*- @@ -43,3 +43,4 @@ getwchar() return fgetwc(stdin); } +DEF_STRONG(getwchar); diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index 956608c151d..43b38dd8b6d 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mktemp.c,v 1.35 2014/10/31 15:54:14 millert Exp $ */ +/* $OpenBSD: mktemp.c,v 1.36 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1996-1998, 2008 Theo de Raadt * Copyright (c) 1997, 2008-2009 Todd C. Miller @@ -110,8 +110,6 @@ mktemp_internal(char *path, int slen, int mode, int flags) return(-1); } -char *_mktemp(char *); - char * _mktemp(char *path) { diff --git a/lib/libc/stdio/open_memstream.c b/lib/libc/stdio/open_memstream.c index d38c210df9e..f708acc5032 100644 --- a/lib/libc/stdio/open_memstream.c +++ b/lib/libc/stdio/open_memstream.c @@ -1,4 +1,4 @@ -/* $OpenBSD: open_memstream.c,v 1.5 2015/02/05 12:59:57 millert Exp $ */ +/* $OpenBSD: open_memstream.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org> @@ -156,3 +156,4 @@ open_memstream(char **pbuf, size_t *psize) return (fp); } +DEF_WEAK(open_memstream); diff --git a/lib/libc/stdio/open_wmemstream.c b/lib/libc/stdio/open_wmemstream.c index 7de134f6864..f714e9edf46 100644 --- a/lib/libc/stdio/open_wmemstream.c +++ b/lib/libc/stdio/open_wmemstream.c @@ -1,4 +1,4 @@ -/* $OpenBSD: open_wmemstream.c,v 1.6 2015/02/05 12:59:57 millert Exp $ */ +/* $OpenBSD: open_wmemstream.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org> @@ -167,3 +167,4 @@ open_wmemstream(wchar_t **pbuf, size_t *psize) return (fp); } +DEF_WEAK(open_wmemstream); diff --git a/lib/libc/stdio/perror.c b/lib/libc/stdio/perror.c index 8728718c5d5..fdd6120e4f2 100644 --- a/lib/libc/stdio/perror.c +++ b/lib/libc/stdio/perror.c @@ -1,4 +1,4 @@ -/* $OpenBSD: perror.c,v 1.8 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: perror.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -60,3 +60,4 @@ perror(const char *s) v->iov_len = 1; (void)writev(STDERR_FILENO, iov, (v - iov) + 1); } +DEF_STRONG(perror); diff --git a/lib/libc/stdio/printf.c b/lib/libc/stdio/printf.c index 09bb3d7f7db..d8b6f09fcac 100644 --- a/lib/libc/stdio/printf.c +++ b/lib/libc/stdio/printf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printf.c,v 1.8 2011/05/30 18:48:33 martynas Exp $ */ +/* $OpenBSD: printf.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -34,7 +34,6 @@ #include <stdio.h> #include <stdarg.h> -/* PRINTFLIKE1 */ int printf(const char *fmt, ...) { @@ -46,3 +45,4 @@ printf(const char *fmt, ...) va_end(ap); return (ret); } +DEF_STRONG(printf); diff --git a/lib/libc/stdio/putc.c b/lib/libc/stdio/putc.c index 762fecb2d38..9fca905075b 100644 --- a/lib/libc/stdio/putc.c +++ b/lib/libc/stdio/putc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: putc.c,v 1.12 2009/11/21 10:11:54 guenther Exp $ */ +/* $OpenBSD: putc.c,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -50,6 +50,7 @@ putc_unlocked(int c, FILE *fp) _SET_ORIENTATION(fp, -1); return (__sputc(c, fp)); } +DEF_WEAK(putc_unlocked); /* * A subroutine version of the macro putc. @@ -66,3 +67,4 @@ putc(int c, FILE *fp) FUNLOCKFILE(fp); return (ret); } +DEF_STRONG(putc); diff --git a/lib/libc/stdio/putchar.c b/lib/libc/stdio/putchar.c index 233cdfd0268..43287ae071b 100644 --- a/lib/libc/stdio/putchar.c +++ b/lib/libc/stdio/putchar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: putchar.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: putchar.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -44,6 +44,7 @@ putchar_unlocked(int c) return (putc_unlocked(c,so)); } +DEF_WEAK(putchar_unlocked); #undef putchar @@ -57,3 +58,4 @@ putchar(int c) return (putc(c, so)); } +DEF_STRONG(putchar); diff --git a/lib/libc/stdio/puts.c b/lib/libc/stdio/puts.c index 655aed7ec9d..57d4b786f89 100644 --- a/lib/libc/stdio/puts.c +++ b/lib/libc/stdio/puts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: puts.c,v 1.11 2009/11/21 09:53:44 guenther Exp $ */ +/* $OpenBSD: puts.c,v 1.12 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -60,3 +60,4 @@ puts(const char *s) FUNLOCKFILE(stdout); return (ret ? EOF : '\n'); } +DEF_STRONG(puts); diff --git a/lib/libc/stdio/putw.c b/lib/libc/stdio/putw.c index 47941a476c1..be17ead9e05 100644 --- a/lib/libc/stdio/putw.c +++ b/lib/libc/stdio/putw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: putw.c,v 1.10 2009/11/21 09:53:44 guenther Exp $ */ +/* $OpenBSD: putw.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -52,3 +52,4 @@ putw(int w, FILE *fp) FUNLOCKFILE(fp); return (ret); } +DEF_WEAK(putw); diff --git a/lib/libc/stdio/putwc.c b/lib/libc/stdio/putwc.c index 8e2ff2dca45..44096903a8f 100644 --- a/lib/libc/stdio/putwc.c +++ b/lib/libc/stdio/putwc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: putwc.c,v 1.1 2005/06/17 20:40:32 espie Exp $ */ +/* $OpenBSD: putwc.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: putwc.c,v 1.3 2003/01/18 11:29:56 thorpej Exp $ */ /*- @@ -43,3 +43,4 @@ putwc(wchar_t wc, FILE *fp) return fputwc(wc, fp); } +DEF_STRONG(putwc); diff --git a/lib/libc/stdio/putwchar.c b/lib/libc/stdio/putwchar.c index 940ec05ab59..ae01a17045e 100644 --- a/lib/libc/stdio/putwchar.c +++ b/lib/libc/stdio/putwchar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: putwchar.c,v 1.1 2005/06/17 20:40:32 espie Exp $ */ +/* $OpenBSD: putwchar.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: putwchar.c,v 1.3 2003/01/18 11:29:56 thorpej Exp $ */ /*- @@ -43,3 +43,4 @@ putwchar(wchar_t wc) return fputwc(wc, stdout); } +DEF_STRONG(putwchar); diff --git a/lib/libc/stdio/remove.c b/lib/libc/stdio/remove.c index d09d76f9df2..e08e5997658 100644 --- a/lib/libc/stdio/remove.c +++ b/lib/libc/stdio/remove.c @@ -1,4 +1,4 @@ -/* $OpenBSD: remove.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: remove.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -47,3 +47,4 @@ remove(const char *file) return (rmdir(file)); return (unlink(file)); } +DEF_STRONG(remove); diff --git a/lib/libc/stdio/rewind.c b/lib/libc/stdio/rewind.c index 28119b6a884..4a52ed064a5 100644 --- a/lib/libc/stdio/rewind.c +++ b/lib/libc/stdio/rewind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rewind.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: rewind.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -41,3 +41,4 @@ rewind(FILE *fp) clearerr(fp); errno = 0; /* not required, but seems reasonable */ } +DEF_STRONG(rewind); diff --git a/lib/libc/stdio/rget.c b/lib/libc/stdio/rget.c index 4cd97cbe9a4..368815b1614 100644 --- a/lib/libc/stdio/rget.c +++ b/lib/libc/stdio/rget.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rget.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: rget.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -49,3 +49,4 @@ __srget(FILE *fp) } return (EOF); } +DEF_STRONG(__srget); diff --git a/lib/libc/stdio/scanf.c b/lib/libc/stdio/scanf.c index 90cf12a3ba7..4d81c986bd3 100644 --- a/lib/libc/stdio/scanf.c +++ b/lib/libc/stdio/scanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scanf.c,v 1.10 2011/05/30 18:48:33 martynas Exp $ */ +/* $OpenBSD: scanf.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -34,7 +34,6 @@ #include <stdio.h> #include <stdarg.h> -/* SCANFLIKE1 */ int scanf(const char *fmt, ...) { @@ -46,3 +45,4 @@ scanf(const char *fmt, ...) va_end(ap); return (ret); } +DEF_STRONG(scanf); diff --git a/lib/libc/stdio/setbuf.c b/lib/libc/stdio/setbuf.c index 883b89532b8..ababa94bd36 100644 --- a/lib/libc/stdio/setbuf.c +++ b/lib/libc/stdio/setbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setbuf.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: setbuf.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -39,3 +39,4 @@ setbuf(FILE *fp, char *buf) { (void) setvbuf(fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ); } +DEF_STRONG(setbuf); diff --git a/lib/libc/stdio/setbuffer.c b/lib/libc/stdio/setbuffer.c index 8725ff79558..b67d7659494 100644 --- a/lib/libc/stdio/setbuffer.c +++ b/lib/libc/stdio/setbuffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setbuffer.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: setbuffer.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -39,6 +39,7 @@ setbuffer(FILE *fp, char *buf, int size) (void)setvbuf(fp, buf, buf ? _IOFBF : _IONBF, size); } +DEF_WEAK(setbuffer); /* * set line buffering @@ -49,3 +50,4 @@ setlinebuf(FILE *fp) return (setvbuf(fp, (char *)NULL, _IOLBF, (size_t)0)); } +DEF_WEAK(setlinebuf); diff --git a/lib/libc/stdio/setvbuf.c b/lib/libc/stdio/setvbuf.c index dc79adc8244..02879a771a6 100644 --- a/lib/libc/stdio/setvbuf.c +++ b/lib/libc/stdio/setvbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setvbuf.c,v 1.12 2015/01/13 07:18:21 guenther Exp $ */ +/* $OpenBSD: setvbuf.c,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -158,3 +158,4 @@ nbf: return (ret); } +DEF_STRONG(setvbuf); diff --git a/lib/libc/stdio/snprintf.c b/lib/libc/stdio/snprintf.c index 7b087e95dd1..1d7e7c9e80a 100644 --- a/lib/libc/stdio/snprintf.c +++ b/lib/libc/stdio/snprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snprintf.c,v 1.18 2011/05/30 18:48:33 martynas Exp $ */ +/* $OpenBSD: snprintf.c,v 1.19 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -37,7 +37,6 @@ #include <stdarg.h> #include "local.h" -/* PRINTFLIKE3 */ int snprintf(char *str, size_t n, const char *fmt, ...) { @@ -66,3 +65,4 @@ snprintf(char *str, size_t n, const char *fmt, ...) *f._p = '\0'; return (ret); } +DEF_STRONG(snprintf); diff --git a/lib/libc/stdio/sscanf.c b/lib/libc/stdio/sscanf.c index e371ca693c1..30394cb5cc6 100644 --- a/lib/libc/stdio/sscanf.c +++ b/lib/libc/stdio/sscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sscanf.c,v 1.14 2011/11/08 18:30:42 guenther Exp $ */ +/* $OpenBSD: sscanf.c,v 1.15 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -36,7 +36,6 @@ #include <stdarg.h> #include "local.h" -/* ARGSUSED */ static int eofread(void *cookie, char *buf, int len) { @@ -44,7 +43,6 @@ eofread(void *cookie, char *buf, int len) return (0); } -/* SCANFLIKE2 */ int sscanf(const char *str, const char *fmt, ...) { @@ -64,3 +62,4 @@ sscanf(const char *str, const char *fmt, ...) va_end(ap); return (ret); } +DEF_STRONG(sscanf); diff --git a/lib/libc/stdio/swprintf.c b/lib/libc/stdio/swprintf.c index 8928aeabb86..02ba508a445 100644 --- a/lib/libc/stdio/swprintf.c +++ b/lib/libc/stdio/swprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: swprintf.c,v 1.5 2012/12/05 23:20:01 deraadt Exp $ */ +/* $OpenBSD: swprintf.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: swprintf.c,v 1.1 2005/05/14 23:51:02 christos Exp $ */ /*- @@ -43,3 +43,4 @@ swprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, ...) return (ret); } +DEF_STRONG(swprintf); diff --git a/lib/libc/stdio/swscanf.c b/lib/libc/stdio/swscanf.c index a85e9ee2ba8..6758a6d2f67 100644 --- a/lib/libc/stdio/swscanf.c +++ b/lib/libc/stdio/swscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: swscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */ +/* $OpenBSD: swscanf.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 2002 Tim J. Robbins @@ -42,3 +42,4 @@ swscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, ...) return (r); } +DEF_STRONG(swscanf); diff --git a/lib/libc/stdio/tempnam.c b/lib/libc/stdio/tempnam.c index 56d667dadd4..854b871cb40 100644 --- a/lib/libc/stdio/tempnam.c +++ b/lib/libc/stdio/tempnam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tempnam.c,v 1.18 2015/03/23 22:15:11 jsg Exp $ */ +/* $OpenBSD: tempnam.c,v 1.19 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -39,8 +39,6 @@ __warn_references(tempnam, "warning: tempnam() possibly used unsafely; consider using mkstemp()"); -extern char *_mktemp(char *); - char * tempnam(const char *dir, const char *pfx) { diff --git a/lib/libc/stdio/tmpfile.c b/lib/libc/stdio/tmpfile.c index 39f7e929a1a..6ee28caf0f6 100644 --- a/lib/libc/stdio/tmpfile.c +++ b/lib/libc/stdio/tmpfile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmpfile.c,v 1.10 2005/10/10 12:00:52 espie Exp $ */ +/* $OpenBSD: tmpfile.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -79,3 +79,4 @@ tmpfile(void) } return (fp); } +DEF_STRONG(tmpfile); diff --git a/lib/libc/stdio/tmpnam.c b/lib/libc/stdio/tmpnam.c index 32e0a220202..d6dc10eec03 100644 --- a/lib/libc/stdio/tmpnam.c +++ b/lib/libc/stdio/tmpnam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmpnam.c,v 1.10 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: tmpnam.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. @@ -39,8 +39,6 @@ __warn_references(tmpnam, "warning: tmpnam() possibly used unsafely; consider using mkstemp()"); -extern char *_mktemp(char *); - char * tmpnam(char *s) { diff --git a/lib/libc/stdio/ungetc.c b/lib/libc/stdio/ungetc.c index ec98f26c22e..cb49c9bd195 100644 --- a/lib/libc/stdio/ungetc.c +++ b/lib/libc/stdio/ungetc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ungetc.c,v 1.13 2014/10/11 04:05:10 deraadt Exp $ */ +/* $OpenBSD: ungetc.c,v 1.14 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -143,3 +143,4 @@ inc_ret: fp->_r++; FUNLOCKFILE(fp); return (c); } +DEF_STRONG(ungetc); diff --git a/lib/libc/stdio/ungetwc.c b/lib/libc/stdio/ungetwc.c index c0321e9e1e5..9b312df15b1 100644 --- a/lib/libc/stdio/ungetwc.c +++ b/lib/libc/stdio/ungetwc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ungetwc.c,v 1.5 2011/10/16 13:20:51 stsp Exp $ */ +/* $OpenBSD: ungetwc.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: ungetwc.c,v 1.2 2003/01/18 11:29:59 thorpej Exp $ */ /*- @@ -75,3 +75,4 @@ ungetwc(wint_t wc, FILE *fp) FUNLOCKFILE(fp); return (r); } +DEF_STRONG(ungetwc); diff --git a/lib/libc/stdio/vasprintf.c b/lib/libc/stdio/vasprintf.c index 2cc3c7d9356..11d90a4b187 100644 --- a/lib/libc/stdio/vasprintf.c +++ b/lib/libc/stdio/vasprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vasprintf.c,v 1.17 2015/08/20 21:49:29 deraadt Exp $ */ +/* $OpenBSD: vasprintf.c,v 1.18 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> @@ -56,3 +56,4 @@ err: errno = ENOMEM; return (-1); } +DEF_WEAK(vasprintf); diff --git a/lib/libc/stdio/vdprintf.c b/lib/libc/stdio/vdprintf.c index 49c19697710..e76fcd4987b 100644 --- a/lib/libc/stdio/vdprintf.c +++ b/lib/libc/stdio/vdprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vdprintf.c,v 1.1 2013/01/30 00:08:13 brad Exp $ */ +/* $OpenBSD: vdprintf.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* $FreeBSD: src/lib/libc/stdio/vdprintf.c,v 1.4 2012/11/17 01:49:40 svnexp Exp $ */ /*- @@ -71,3 +71,4 @@ vdprintf(int fd, const char * __restrict fmt, va_list ap) return fflush(&f) ? EOF : ret; } +DEF_WEAK(vdprintf); diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index 5f4fb7fa9bb..df26c324588 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfprintf.c,v 1.67 2014/12/21 00:23:30 daniel Exp $ */ +/* $OpenBSD: vfprintf.c,v 1.68 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -268,6 +268,7 @@ vfprintf(FILE *fp, const char *fmt0, __va_list ap) FUNLOCKFILE(fp); return (ret); } +DEF_STRONG(vfprintf); int __vfprintf(FILE *fp, const char *fmt0, __va_list ap) diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index abefe32cbb7..83a3bfb6c05 100644 --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfscanf.c,v 1.31 2014/03/19 05:17:01 guenther Exp $ */ +/* $OpenBSD: vfscanf.c,v 1.32 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -967,3 +967,4 @@ vfscanf(FILE *fp, const char *fmt0, __va_list ap) FUNLOCKFILE(fp); return (r); } +DEF_STRONG(vfscanf); diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c index a6f41232c53..4a8cbcfe094 100644 --- a/lib/libc/stdio/vfwprintf.c +++ b/lib/libc/stdio/vfwprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfwprintf.c,v 1.12 2014/12/21 00:23:30 daniel Exp $ */ +/* $OpenBSD: vfwprintf.c,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -1072,6 +1072,7 @@ vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, __va_list ap) return (r); } +DEF_STRONG(vfwprintf); /* * Type ids for argument type table. diff --git a/lib/libc/stdio/vfwscanf.c b/lib/libc/stdio/vfwscanf.c index cbb36be34a2..f2ec3fb68b2 100644 --- a/lib/libc/stdio/vfwscanf.c +++ b/lib/libc/stdio/vfwscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfwscanf.c,v 1.4 2014/03/19 05:17:01 guenther Exp $ */ +/* $OpenBSD: vfwscanf.c,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -796,3 +796,4 @@ vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, __va_list ap) FUNLOCKFILE(fp); return (r); } +DEF_STRONG(vfwscanf); diff --git a/lib/libc/stdio/vprintf.c b/lib/libc/stdio/vprintf.c index fcc622ca799..5d858b60e5b 100644 --- a/lib/libc/stdio/vprintf.c +++ b/lib/libc/stdio/vprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vprintf.c,v 1.8 2006/01/06 18:53:04 millert Exp $ */ +/* $OpenBSD: vprintf.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -38,3 +38,4 @@ vprintf(const char *fmt, __va_list ap) { return (vfprintf(stdout, fmt, ap)); } +DEF_STRONG(vprintf); diff --git a/lib/libc/stdio/vscanf.c b/lib/libc/stdio/vscanf.c index 228498e75cc..e56738de6b6 100644 --- a/lib/libc/stdio/vscanf.c +++ b/lib/libc/stdio/vscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vscanf.c,v 1.8 2006/01/06 18:53:04 millert Exp $ */ +/* $OpenBSD: vscanf.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -39,3 +39,4 @@ vscanf(const char *fmt, __va_list ap) return (vfscanf(stdin, fmt, ap)); } +DEF_STRONG(vscanf); diff --git a/lib/libc/stdio/vsnprintf.c b/lib/libc/stdio/vsnprintf.c index 8b1a088da85..e14b2a1adb3 100644 --- a/lib/libc/stdio/vsnprintf.c +++ b/lib/libc/stdio/vsnprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsnprintf.c,v 1.15 2009/11/09 00:18:28 kurt Exp $ */ +/* $OpenBSD: vsnprintf.c,v 1.16 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -62,3 +62,4 @@ vsnprintf(char *str, size_t n, const char *fmt, __va_list ap) *f._p = '\0'; return (ret); } +DEF_STRONG(vsnprintf); diff --git a/lib/libc/stdio/vsscanf.c b/lib/libc/stdio/vsscanf.c index 71eb7529879..86e0b4c1e0b 100644 --- a/lib/libc/stdio/vsscanf.c +++ b/lib/libc/stdio/vsscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsscanf.c,v 1.12 2011/11/08 18:30:42 guenther Exp $ */ +/* $OpenBSD: vsscanf.c,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -35,7 +35,6 @@ #include <string.h> #include "local.h" -/* ARGSUSED */ static int eofread(void *cookie, char *buf, int len) { @@ -57,3 +56,4 @@ vsscanf(const char *str, const char *fmt, __va_list ap) f._lb._base = NULL; return (__svfscanf(&f, fmt, ap)); } +DEF_STRONG(vsscanf); diff --git a/lib/libc/stdio/vswprintf.c b/lib/libc/stdio/vswprintf.c index d79563f5568..641db4ae73b 100644 --- a/lib/libc/stdio/vswprintf.c +++ b/lib/libc/stdio/vswprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vswprintf.c,v 1.5 2015/08/20 21:49:29 deraadt Exp $ */ +/* $OpenBSD: vswprintf.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: vswprintf.c,v 1.1 2005/05/14 23:51:02 christos Exp $ */ /* @@ -94,3 +94,4 @@ vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, return (ret); } +DEF_STRONG(vswprintf); diff --git a/lib/libc/stdio/vswscanf.c b/lib/libc/stdio/vswscanf.c index cbaa25091ba..e87dfebd141 100644 --- a/lib/libc/stdio/vswscanf.c +++ b/lib/libc/stdio/vswscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vswscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */ +/* $OpenBSD: vswscanf.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -86,3 +86,4 @@ vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, return (r); } +DEF_STRONG(vswscanf); diff --git a/lib/libc/stdio/vwprintf.c b/lib/libc/stdio/vwprintf.c index 49569c1a27e..9598d331a3f 100644 --- a/lib/libc/stdio/vwprintf.c +++ b/lib/libc/stdio/vwprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vwprintf.c,v 1.3 2011/04/28 17:38:46 stsp Exp $ */ +/* $OpenBSD: vwprintf.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -40,3 +40,4 @@ vwprintf(const wchar_t * __restrict fmt, __va_list ap) { return (vfwprintf(stdout, fmt, ap)); } +DEF_STRONG(vwprintf); diff --git a/lib/libc/stdio/vwscanf.c b/lib/libc/stdio/vwscanf.c index 7039f02d7fe..bd824b4d4bb 100644 --- a/lib/libc/stdio/vwscanf.c +++ b/lib/libc/stdio/vwscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vwscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */ +/* $OpenBSD: vwscanf.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 2002 Tim J. Robbins @@ -36,3 +36,4 @@ vwscanf(const wchar_t * __restrict fmt, __va_list ap) return (vfwscanf(stdin, fmt, ap)); } +DEF_STRONG(vwscanf); diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c index 6aa00e1d6c4..2d077505b80 100644 --- a/lib/libc/stdio/wbuf.c +++ b/lib/libc/stdio/wbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wbuf.c,v 1.12 2009/11/09 00:18:28 kurt Exp $ */ +/* $OpenBSD: wbuf.c,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -82,3 +82,4 @@ __swbuf(int c, FILE *fp) return (EOF); return (c); } +DEF_STRONG(__swbuf); diff --git a/lib/libc/stdio/wprintf.c b/lib/libc/stdio/wprintf.c index 9f7abb64e3b..95243828f00 100644 --- a/lib/libc/stdio/wprintf.c +++ b/lib/libc/stdio/wprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wprintf.c,v 1.3 2011/04/28 17:38:46 stsp Exp $ */ +/* $OpenBSD: wprintf.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -46,3 +46,4 @@ wprintf(const wchar_t * __restrict fmt, ...) va_end(ap); return (ret); } +DEF_STRONG(wprintf); diff --git a/lib/libc/stdio/wscanf.c b/lib/libc/stdio/wscanf.c index 06c0829ab34..c73c9299851 100644 --- a/lib/libc/stdio/wscanf.c +++ b/lib/libc/stdio/wscanf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */ +/* $OpenBSD: wscanf.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 2002 Tim J. Robbins @@ -42,3 +42,4 @@ wscanf(const wchar_t * __restrict fmt, ...) return (r); } +DEF_STRONG(wscanf); diff --git a/lib/libc/string/bcmp.c b/lib/libc/string/bcmp.c index f64672990c6..5d446bf0966 100644 --- a/lib/libc/string/bcmp.c +++ b/lib/libc/string/bcmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcmp.c,v 1.10 2014/06/10 04:17:37 deraadt Exp $ */ +/* $OpenBSD: bcmp.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1987 Regents of the University of California. @@ -49,3 +49,4 @@ bcmp(const void *b1, const void *b2, size_t length) while (--length); return (0); } +DEF_WEAK(bcmp); diff --git a/lib/libc/string/bcopy.c b/lib/libc/string/bcopy.c index fcaa843c71c..ef0d3680538 100644 --- a/lib/libc/string/bcopy.c +++ b/lib/libc/string/bcopy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcopy.c,v 1.6 2014/11/30 19:43:56 deraadt Exp $ */ +/* $OpenBSD: bcopy.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -110,3 +110,4 @@ bcopy(const void *src0, void *dst0, size_t length) done: return; } +DEF_WEAK(bcopy); diff --git a/lib/libc/string/bzero.c b/lib/libc/string/bzero.c index fdd3d9cc8da..5173de26dd1 100644 --- a/lib/libc/string/bzero.c +++ b/lib/libc/string/bzero.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bzero.c,v 1.8 2014/06/10 04:17:37 deraadt Exp $ */ +/* $OpenBSD: bzero.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1987 Regents of the University of California. @@ -42,3 +42,4 @@ bzero(void *b, size_t length) for (p = b; length--;) *p++ = '\0'; } +DEF_WEAK(bzero); diff --git a/lib/libc/string/explicit_bzero.c b/lib/libc/string/explicit_bzero.c index 3e33ca85b83..003ea7cc4c6 100644 --- a/lib/libc/string/explicit_bzero.c +++ b/lib/libc/string/explicit_bzero.c @@ -1,4 +1,4 @@ -/* $OpenBSD: explicit_bzero.c,v 1.3 2014/06/21 02:34:26 matthew Exp $ */ +/* $OpenBSD: explicit_bzero.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */ /* * Public domain. * Written by Matthew Dempsky. @@ -17,3 +17,4 @@ explicit_bzero(void *buf, size_t len) memset(buf, 0, len); __explicit_bzero_hook(buf, len); } +DEF_WEAK(explicit_bzero); diff --git a/lib/libc/string/ffs.c b/lib/libc/string/ffs.c index de4480a7efd..a75fd9d79f8 100644 --- a/lib/libc/string/ffs.c +++ b/lib/libc/string/ffs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs.c,v 1.8 2014/06/10 04:17:37 deraadt Exp $ */ +/* $OpenBSD: ffs.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /* * Public domain. @@ -38,3 +38,4 @@ ffs(int mask) return (bit + t[ r & 0xf ]); } +DEF_WEAK(ffs); diff --git a/lib/libc/string/memccpy.c b/lib/libc/string/memccpy.c index 485c55fcabf..635061b8cb9 100644 --- a/lib/libc/string/memccpy.c +++ b/lib/libc/string/memccpy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memccpy.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: memccpy.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -46,3 +46,4 @@ memccpy(void *t, const void *f, int c, size_t n) } return (0); } +DEF_WEAK(memccpy); diff --git a/lib/libc/string/memchr.c b/lib/libc/string/memchr.c index 4573e3ceb11..a6a4bd60d03 100644 --- a/lib/libc/string/memchr.c +++ b/lib/libc/string/memchr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memchr.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: memchr.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -46,3 +46,4 @@ memchr(const void *s, int c, size_t n) } return (NULL); } +DEF_STRONG(memchr); diff --git a/lib/libc/string/memcmp.c b/lib/libc/string/memcmp.c index 49384a6fb99..0df2c54d2af 100644 --- a/lib/libc/string/memcmp.c +++ b/lib/libc/string/memcmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memcmp.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: memcmp.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -49,3 +49,4 @@ memcmp(const void *s1, const void *s2, size_t n) } return (0); } +DEF_STRONG(memcmp); diff --git a/lib/libc/string/memcpy.c b/lib/libc/string/memcpy.c index 1b9715e4717..73136edd722 100644 --- a/lib/libc/string/memcpy.c +++ b/lib/libc/string/memcpy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memcpy.c,v 1.1 2014/11/30 19:43:56 deraadt Exp $ */ +/* $OpenBSD: memcpy.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -97,3 +97,4 @@ memcpy(void *dst0, const void *src0, size_t length) done: return (dst0); } +DEF_STRONG(memcpy); diff --git a/lib/libc/string/memmem.c b/lib/libc/string/memmem.c index 5793a7dfd75..823443b08a6 100644 --- a/lib/libc/string/memmem.c +++ b/lib/libc/string/memmem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memmem.c,v 1.3 2013/05/30 01:10:45 ajacoutot Exp $ */ +/* $OpenBSD: memmem.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com> * @@ -61,3 +61,4 @@ memmem(const void *l, size_t l_len, const void *s, size_t s_len) return NULL; } +DEF_WEAK(memmem); diff --git a/lib/libc/string/memmove.c b/lib/libc/string/memmove.c index 1baad535440..2f1deb2c70d 100644 --- a/lib/libc/string/memmove.c +++ b/lib/libc/string/memmove.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memmove.c,v 1.1 2014/11/30 19:43:56 deraadt Exp $ */ +/* $OpenBSD: memmove.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -110,3 +110,4 @@ memmove(void *dst0, const void *src0, size_t length) done: return (dst0); } +DEF_STRONG(memmove); diff --git a/lib/libc/string/memrchr.c b/lib/libc/string/memrchr.c index bd27ebc620e..26a33995b70 100644 --- a/lib/libc/string/memrchr.c +++ b/lib/libc/string/memrchr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memrchr.c,v 1.2 2007/11/27 16:22:12 martynas Exp $ */ +/* $OpenBSD: memrchr.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 2007 Todd C. Miller <Todd.Miller@courtesan.com> @@ -36,3 +36,4 @@ memrchr(const void *s, int c, size_t n) } return(NULL); } +DEF_WEAK(memrchr); diff --git a/lib/libc/string/memset.c b/lib/libc/string/memset.c index 61709c139de..242529ee0f2 100644 --- a/lib/libc/string/memset.c +++ b/lib/libc/string/memset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memset.c,v 1.6 2008/03/15 21:40:39 ray Exp $ */ +/* $OpenBSD: memset.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -45,3 +45,4 @@ memset(void *dst, int c, size_t n) } return (dst); } +DEF_STRONG(memset); diff --git a/lib/libc/string/stpncpy.c b/lib/libc/string/stpncpy.c index c7c2a57c4cd..6bdee5de164 100644 --- a/lib/libc/string/stpncpy.c +++ b/lib/libc/string/stpncpy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stpncpy.c,v 1.2 2012/07/11 10:44:59 naddy Exp $ */ +/* $OpenBSD: stpncpy.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -54,3 +54,4 @@ stpncpy(char *dst, const char *src, size_t n) } return (dst); } +DEF_WEAK(stpncpy); diff --git a/lib/libc/string/strcasecmp.c b/lib/libc/string/strcasecmp.c index 2be09136c07..edbd638722e 100644 --- a/lib/libc/string/strcasecmp.c +++ b/lib/libc/string/strcasecmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strcasecmp.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strcasecmp.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1987, 1993 @@ -85,6 +85,7 @@ strcasecmp(const char *s1, const char *s2) return (0); return (cm[*us1] - cm[*--us2]); } +DEF_WEAK(strcasecmp); int strncasecmp(const char *s1, const char *s2, size_t n) @@ -103,3 +104,4 @@ strncasecmp(const char *s1, const char *s2, size_t n) } return (0); } +DEF_WEAK(strncasecmp); diff --git a/lib/libc/string/strcasestr.c b/lib/libc/string/strcasestr.c index aa74c0176dc..abb3e155491 100644 --- a/lib/libc/string/strcasestr.c +++ b/lib/libc/string/strcasestr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strcasestr.c,v 1.3 2006/03/31 05:34:55 deraadt Exp $ */ +/* $OpenBSD: strcasestr.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */ /* $NetBSD: strcasestr.c,v 1.2 2005/02/09 21:35:47 kleink Exp $ */ /*- @@ -58,3 +58,4 @@ strcasestr(const char *s, const char *find) } return ((char *)s); } +DEF_WEAK(strcasestr); diff --git a/lib/libc/string/strchr.c b/lib/libc/string/strchr.c index 596e407c9bd..b396b45b3b0 100644 --- a/lib/libc/string/strchr.c +++ b/lib/libc/string/strchr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strchr.c,v 1.2 2015/05/15 22:29:37 millert Exp $ */ +/* $OpenBSD: strchr.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -43,3 +43,4 @@ strchr(const char *p, int ch) } /* NOTREACHED */ } +DEF_STRONG(strchr); diff --git a/lib/libc/string/strcmp.c b/lib/libc/string/strcmp.c index d1b6c50d791..be175563d47 100644 --- a/lib/libc/string/strcmp.c +++ b/lib/libc/string/strcmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strcmp.c,v 1.8 2014/06/10 04:17:37 deraadt Exp $ */ +/* $OpenBSD: strcmp.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -45,3 +45,4 @@ strcmp(const char *s1, const char *s2) return (0); return (*(unsigned char *)s1 - *(unsigned char *)--s2); } +DEF_STRONG(strcmp); diff --git a/lib/libc/string/strcoll.c b/lib/libc/string/strcoll.c index 2df983bd652..47a6ea4f24e 100644 --- a/lib/libc/string/strcoll.c +++ b/lib/libc/string/strcoll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strcoll.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strcoll.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -42,3 +42,4 @@ strcoll(const char *s1, const char *s2) /* LC_COLLATE is unimplemented, hence always "C" */ return (strcmp(s1, s2)); } +DEF_STRONG(strcoll); diff --git a/lib/libc/string/strcspn.c b/lib/libc/string/strcspn.c index 1eb233614d0..3c1f5a4ceca 100644 --- a/lib/libc/string/strcspn.c +++ b/lib/libc/string/strcspn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strcspn.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strcspn.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -56,3 +56,4 @@ strcspn(const char *s1, const char *s2) } /* NOTREACHED */ } +DEF_STRONG(strcspn); diff --git a/lib/libc/string/strdup.c b/lib/libc/string/strdup.c index a6aa1e03b0f..9aebf399c14 100644 --- a/lib/libc/string/strdup.c +++ b/lib/libc/string/strdup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strdup.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strdup.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1988, 1993 @@ -47,3 +47,4 @@ strdup(const char *str) (void)memcpy(copy, str, siz); return(copy); } +DEF_WEAK(strdup); diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c index 13996f08e98..c6f05446fd9 100644 --- a/lib/libc/string/strerror.c +++ b/lib/libc/string/strerror.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strerror.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strerror.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -39,3 +39,4 @@ strerror(int num) (void)strerror_r(num, buf, sizeof(buf)); return (buf); } +DEF_STRONG(strerror); diff --git a/lib/libc/string/strerror_r.c b/lib/libc/string/strerror_r.c index b85136055b1..90aa012360d 100644 --- a/lib/libc/string/strerror_r.c +++ b/lib/libc/string/strerror_r.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strerror_r.c,v 1.8 2013/06/01 21:26:18 stsp Exp $ */ +/* $OpenBSD: strerror_r.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /* Public Domain <marc@snafu.org> */ #ifdef NLS @@ -125,6 +125,7 @@ strerror_r(int errnum, char *strerrbuf, size_t buflen) errno = ret_errno ? ret_errno : save_errno; return (ret_errno); } +DEF_WEAK(strerror_r); #define USIGPREFIX "Unknown signal: " diff --git a/lib/libc/string/strlcat.c b/lib/libc/string/strlcat.c index 14c53a1f69c..073b0d42594 100644 --- a/lib/libc/string/strlcat.c +++ b/lib/libc/string/strlcat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strlcat.c,v 1.15 2015/03/02 21:41:08 millert Exp $ */ +/* $OpenBSD: strlcat.c,v 1.16 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com> @@ -53,3 +53,4 @@ strlcat(char *dst, const char *src, size_t dsize) return(dlen + (src - osrc)); /* count does not include NUL */ } +DEF_WEAK(strlcat); diff --git a/lib/libc/string/strlcpy.c b/lib/libc/string/strlcpy.c index e9a7fe4be73..5fcf084aaad 100644 --- a/lib/libc/string/strlcpy.c +++ b/lib/libc/string/strlcpy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strlcpy.c,v 1.12 2015/01/15 03:54:12 millert Exp $ */ +/* $OpenBSD: strlcpy.c,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com> @@ -48,3 +48,4 @@ strlcpy(char *dst, const char *src, size_t dsize) return(src - osrc - 1); /* count does not include NUL */ } +DEF_WEAK(strlcpy); diff --git a/lib/libc/string/strlen.c b/lib/libc/string/strlen.c index 7e0e27b1d8d..a5721d3e7f5 100644 --- a/lib/libc/string/strlen.c +++ b/lib/libc/string/strlen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strlen.c,v 1.8 2014/06/10 04:17:37 deraadt Exp $ */ +/* $OpenBSD: strlen.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -41,3 +41,4 @@ strlen(const char *str) return (s - str); } +DEF_STRONG(strlen); diff --git a/lib/libc/string/strmode.c b/lib/libc/string/strmode.c index 6f0fa34ed87..609b8931fbb 100644 --- a/lib/libc/string/strmode.c +++ b/lib/libc/string/strmode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strmode.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strmode.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -138,3 +138,4 @@ strmode(int mode, char *p) *p++ = ' '; /* will be a '+' if ACL's implemented */ *p = '\0'; } +DEF_WEAK(strmode); diff --git a/lib/libc/string/strncat.c b/lib/libc/string/strncat.c index c4df4f2fad6..b3388accf37 100644 --- a/lib/libc/string/strncat.c +++ b/lib/libc/string/strncat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strncat.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strncat.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -55,3 +55,4 @@ strncat(char *dst, const char *src, size_t n) } return (dst); } +DEF_STRONG(strncat); diff --git a/lib/libc/string/strncmp.c b/lib/libc/string/strncmp.c index 0a4ddc1d9e3..535d2a60fde 100644 --- a/lib/libc/string/strncmp.c +++ b/lib/libc/string/strncmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strncmp.c,v 1.8 2014/06/10 04:17:37 deraadt Exp $ */ +/* $OpenBSD: strncmp.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -45,3 +45,4 @@ strncmp(const char *s1, const char *s2, size_t n) } while (--n != 0); return (0); } +DEF_STRONG(strncmp); diff --git a/lib/libc/string/strncpy.c b/lib/libc/string/strncpy.c index 5003a199a9b..d6d8647fc76 100644 --- a/lib/libc/string/strncpy.c +++ b/lib/libc/string/strncpy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strncpy.c,v 1.7 2014/06/10 04:17:37 deraadt Exp $ */ +/* $OpenBSD: strncpy.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -56,3 +56,4 @@ strncpy(char *dst, const char *src, size_t n) } return (dst); } +DEF_STRONG(strncpy); diff --git a/lib/libc/string/strndup.c b/lib/libc/string/strndup.c index 27701ac555a..a6e5bff7ca1 100644 --- a/lib/libc/string/strndup.c +++ b/lib/libc/string/strndup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strndup.c,v 1.1 2010/05/18 22:24:55 tedu Exp $ */ +/* $OpenBSD: strndup.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com> @@ -37,3 +37,4 @@ strndup(const char *str, size_t maxlen) return copy; } +DEF_WEAK(strndup); diff --git a/lib/libc/string/strnlen.c b/lib/libc/string/strnlen.c index 872cfa6ccea..26e9743f183 100644 --- a/lib/libc/string/strnlen.c +++ b/lib/libc/string/strnlen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strnlen.c,v 1.5 2014/06/10 04:17:37 deraadt Exp $ */ +/* $OpenBSD: strnlen.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com> @@ -30,3 +30,4 @@ strnlen(const char *str, size_t maxlen) return (size_t)(cp - str); } +DEF_WEAK(strnlen); diff --git a/lib/libc/string/strpbrk.c b/lib/libc/string/strpbrk.c index cd3b71c0d3e..336c22dedd6 100644 --- a/lib/libc/string/strpbrk.c +++ b/lib/libc/string/strpbrk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strpbrk.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strpbrk.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1985 Regents of the University of California. * All rights reserved. @@ -46,3 +46,4 @@ strpbrk(const char *s1, const char *s2) } return (NULL); } +DEF_STRONG(strpbrk); diff --git a/lib/libc/string/strrchr.c b/lib/libc/string/strrchr.c index 181f56ea698..93755721443 100644 --- a/lib/libc/string/strrchr.c +++ b/lib/libc/string/strrchr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strrchr.c,v 1.2 2015/05/15 22:29:37 millert Exp $ */ +/* $OpenBSD: strrchr.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -45,3 +45,4 @@ strrchr(const char *p, int ch) } /* NOTREACHED */ } +DEF_STRONG(strrchr); diff --git a/lib/libc/string/strsep.c b/lib/libc/string/strsep.c index 2ffc4b4c46a..97c3cbf1f5d 100644 --- a/lib/libc/string/strsep.c +++ b/lib/libc/string/strsep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strsep.c,v 1.7 2014/02/05 20:42:32 stsp Exp $ */ +/* $OpenBSD: strsep.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -68,3 +68,4 @@ strsep(char **stringp, const char *delim) } /* NOTREACHED */ } +DEF_WEAK(strsep); diff --git a/lib/libc/string/strsignal.c b/lib/libc/string/strsignal.c index aa541cefede..a71a291fbc0 100644 --- a/lib/libc/string/strsignal.c +++ b/lib/libc/string/strsignal.c @@ -39,3 +39,4 @@ strsignal(int sig) return __strsignal(sig, buf); } +DEF_WEAK(strsignal); diff --git a/lib/libc/string/strspn.c b/lib/libc/string/strspn.c index 385649c0419..0ce41cbb49b 100644 --- a/lib/libc/string/strspn.c +++ b/lib/libc/string/strspn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strspn.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strspn.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. @@ -49,3 +49,4 @@ cont: goto cont; return (p - 1 - s1); } +DEF_STRONG(strspn); diff --git a/lib/libc/string/strstr.c b/lib/libc/string/strstr.c index 95a865bf791..ccd08717005 100644 --- a/lib/libc/string/strstr.c +++ b/lib/libc/string/strstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strstr.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strstr.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -54,3 +54,4 @@ strstr(const char *s, const char *find) } return ((char *)s); } +DEF_STRONG(strstr); diff --git a/lib/libc/string/strtok.c b/lib/libc/string/strtok.c index 6ba6b21cd6f..c5765756fcd 100644 --- a/lib/libc/string/strtok.c +++ b/lib/libc/string/strtok.c @@ -36,6 +36,7 @@ strtok(char *s, const char *delim) return strtok_r(s, delim, &last); } +DEF_STRONG(strtok); char * strtok_r(char *s, const char *delim, char **last) @@ -83,3 +84,4 @@ cont: } /* NOTREACHED */ } +DEF_WEAK(strtok_r); diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c index 6f289c901ec..97df097b296 100644 --- a/lib/libc/string/strxfrm.c +++ b/lib/libc/string/strxfrm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strxfrm.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strxfrm.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -49,3 +49,4 @@ strxfrm(char *dst, const char *src, size_t n) return (strlen(src)); return (strlcpy(dst, src, n)); } +DEF_STRONG(strxfrm); diff --git a/lib/libc/string/timingsafe_bcmp.c b/lib/libc/string/timingsafe_bcmp.c index 0b736154ca8..0409ec32448 100644 --- a/lib/libc/string/timingsafe_bcmp.c +++ b/lib/libc/string/timingsafe_bcmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: timingsafe_bcmp.c,v 1.2 2014/06/10 04:17:37 deraadt Exp $ */ +/* $OpenBSD: timingsafe_bcmp.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 2010 Damien Miller. All rights reserved. * @@ -27,3 +27,4 @@ timingsafe_bcmp(const void *b1, const void *b2, size_t n) ret |= *p1++ ^ *p2++; return (ret != 0); } +DEF_WEAK(timingsafe_bcmp); diff --git a/lib/libc/string/timingsafe_memcmp.c b/lib/libc/string/timingsafe_memcmp.c index 04e2ac5e206..373f8cb1978 100644 --- a/lib/libc/string/timingsafe_memcmp.c +++ b/lib/libc/string/timingsafe_memcmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: timingsafe_memcmp.c,v 1.1 2014/06/13 02:12:17 matthew Exp $ */ +/* $OpenBSD: timingsafe_memcmp.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ /* * Copyright (c) 2014 Google Inc. * @@ -44,3 +44,4 @@ timingsafe_memcmp(const void *b1, const void *b2, size_t len) return (res); } +DEF_WEAK(timingsafe_memcmp); |