From 219271e05791f714c6773e2c340b9b4edd65ecb5 Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Sun, 13 Sep 2015 08:31:49 +0000 Subject: Wrap so that calls go direct and the symbols not in the C standard are all weak. Apply __{BEGIN,END}_HIDDEN_DECLS to gdtoa{,imp}.h, hiding the arch-specific __strtorx, __ULtox_D2A, __strtorQ, __ULtoQ_D2A symbols. --- lib/libc/arch/amd64/Symbols.list | 2 - lib/libc/arch/amd64/gdtoa/strtold.c | 3 +- lib/libc/arch/i386/Symbols.list | 2 - lib/libc/arch/i386/gdtoa/strtold.c | 3 +- lib/libc/arch/mips64/Symbols.list | 2 - lib/libc/arch/mips64/gdtoa/strtold.c | 3 +- lib/libc/arch/sparc64/Symbols.list | 2 - lib/libc/arch/sparc64/gdtoa/strtold.c | 3 +- lib/libc/arch/vax/gdtoa/strtof.c | 1 + lib/libc/crypt/arc4random.c | 4 +- lib/libc/crypt/arc4random_uniform.c | 3 +- lib/libc/gdtoa/gdtoa.h | 2 + lib/libc/gdtoa/gdtoaimp.h | 5 +- lib/libc/gdtoa/strtod.c | 2 +- lib/libc/gdtoa/strtof.c | 1 + lib/libc/gdtoa/strtold.c | 3 +- lib/libc/gen/devname.c | 3 +- lib/libc/gen/getcap.c | 13 ++- lib/libc/hidden/stdlib.h | 158 ++++++++++++++++++++++++++++++++++ lib/libc/hidden/unistd.h | 4 +- lib/libc/locale/__mb_cur_max.c | 6 +- lib/libc/stdio/mktemp.c | 4 +- lib/libc/stdlib/abort.c | 3 +- lib/libc/stdlib/abs.c | 3 +- lib/libc/stdlib/atoi.c | 3 +- lib/libc/stdlib/div.c | 3 +- lib/libc/stdlib/erand48.c | 3 +- lib/libc/stdlib/exit.c | 3 +- lib/libc/stdlib/getenv.c | 4 +- lib/libc/stdlib/lcong48.c | 3 +- lib/libc/stdlib/malloc.c | 9 +- lib/libc/stdlib/qsort.c | 3 +- lib/libc/stdlib/rand.c | 1 + lib/libc/stdlib/reallocarray.c | 3 +- lib/libc/stdlib/setenv.c | 7 +- lib/libc/stdlib/srand48.c | 3 +- lib/libc/stdlib/strtol.c | 3 +- lib/libc/stdlib/strtoll.c | 5 +- lib/libc/stdlib/strtonum.c | 3 +- lib/libc/stdlib/strtoul.c | 3 +- lib/libc/stdlib/strtoull.c | 5 +- lib/libc/stdlib/system.c | 3 +- 42 files changed, 250 insertions(+), 52 deletions(-) create mode 100644 lib/libc/hidden/stdlib.h (limited to 'lib/libc') diff --git a/lib/libc/arch/amd64/Symbols.list b/lib/libc/arch/amd64/Symbols.list index c8692e1e33f..ed97a8ffbb3 100644 --- a/lib/libc/arch/amd64/Symbols.list +++ b/lib/libc/arch/amd64/Symbols.list @@ -1,6 +1,4 @@ -__ULtox_D2A __mcount -__strtorx _fpgetmask _fpgetround _fpgetsticky diff --git a/lib/libc/arch/amd64/gdtoa/strtold.c b/lib/libc/arch/amd64/gdtoa/strtold.c index 20b50655348..61669581426 100644 --- a/lib/libc/arch/amd64/gdtoa/strtold.c +++ b/lib/libc/arch/amd64/gdtoa/strtold.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtold.c,v 1.1 2008/09/07 20:36:07 martynas Exp $ */ +/* $OpenBSD: strtold.c,v 1.2 2015/09/13 08:31:47 guenther Exp $ */ /*- * Copyright (c) 2003 David Schultz * All rights reserved. @@ -43,3 +43,4 @@ strtold(const char * __restrict s, char ** __restrict sp) strtorx(s, sp, FLT_ROUNDS, &result); return result; } +DEF_STRONG(strtold); diff --git a/lib/libc/arch/i386/Symbols.list b/lib/libc/arch/i386/Symbols.list index 5d73def05f6..0c9be9b5ec5 100644 --- a/lib/libc/arch/i386/Symbols.list +++ b/lib/libc/arch/i386/Symbols.list @@ -1,8 +1,6 @@ -__ULtox_D2A __divsi3 __fixdfsi __fixunsdfsi __mcount -__strtorx __udivsi3 mcount diff --git a/lib/libc/arch/i386/gdtoa/strtold.c b/lib/libc/arch/i386/gdtoa/strtold.c index 20b50655348..61669581426 100644 --- a/lib/libc/arch/i386/gdtoa/strtold.c +++ b/lib/libc/arch/i386/gdtoa/strtold.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtold.c,v 1.1 2008/09/07 20:36:07 martynas Exp $ */ +/* $OpenBSD: strtold.c,v 1.2 2015/09/13 08:31:47 guenther Exp $ */ /*- * Copyright (c) 2003 David Schultz * All rights reserved. @@ -43,3 +43,4 @@ strtold(const char * __restrict s, char ** __restrict sp) strtorx(s, sp, FLT_ROUNDS, &result); return result; } +DEF_STRONG(strtold); diff --git a/lib/libc/arch/mips64/Symbols.list b/lib/libc/arch/mips64/Symbols.list index f88528faa1d..25155a2b788 100644 --- a/lib/libc/arch/mips64/Symbols.list +++ b/lib/libc/arch/mips64/Symbols.list @@ -1,8 +1,6 @@ _GLOBAL_OFFSET_TABLE_ -__ULtoQ_D2A __multf3 __pack_t -__strtorQ __thenan_tf __unpack_t _fbss diff --git a/lib/libc/arch/mips64/gdtoa/strtold.c b/lib/libc/arch/mips64/gdtoa/strtold.c index 3a5e322f01a..9c25cb2f09f 100644 --- a/lib/libc/arch/mips64/gdtoa/strtold.c +++ b/lib/libc/arch/mips64/gdtoa/strtold.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtold.c,v 1.1 2008/09/07 20:36:07 martynas Exp $ */ +/* $OpenBSD: strtold.c,v 1.2 2015/09/13 08:31:47 guenther Exp $ */ /*- * Copyright (c) 2003 David Schultz * All rights reserved. @@ -43,3 +43,4 @@ strtold(const char * __restrict s, char ** __restrict sp) strtorQ(s, sp, FLT_ROUNDS, &result); return result; } +DEF_STRONG(strtold); diff --git a/lib/libc/arch/sparc64/Symbols.list b/lib/libc/arch/sparc64/Symbols.list index 750c688f4df..c34776bbc62 100644 --- a/lib/libc/arch/sparc64/Symbols.list +++ b/lib/libc/arch/sparc64/Symbols.list @@ -49,7 +49,6 @@ _Qp_sub _Qp_uitoq _Qp_uxtoq _Qp_xtoq -__ULtoQ_D2A __builtin_saveregs __dtoul __fpu_add @@ -81,5 +80,4 @@ __fpu_xtof __ftoul __plt_end __plt_start -__strtorQ _mcount diff --git a/lib/libc/arch/sparc64/gdtoa/strtold.c b/lib/libc/arch/sparc64/gdtoa/strtold.c index ecbfd5507fa..9c25cb2f09f 100644 --- a/lib/libc/arch/sparc64/gdtoa/strtold.c +++ b/lib/libc/arch/sparc64/gdtoa/strtold.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtold.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ +/* $OpenBSD: strtold.c,v 1.2 2015/09/13 08:31:47 guenther Exp $ */ /*- * Copyright (c) 2003 David Schultz * All rights reserved. @@ -43,3 +43,4 @@ strtold(const char * __restrict s, char ** __restrict sp) strtorQ(s, sp, FLT_ROUNDS, &result); return result; } +DEF_STRONG(strtold); diff --git a/lib/libc/arch/vax/gdtoa/strtof.c b/lib/libc/arch/vax/gdtoa/strtof.c index 7406440582c..cc129e8e0c2 100644 --- a/lib/libc/arch/vax/gdtoa/strtof.c +++ b/lib/libc/arch/vax/gdtoa/strtof.c @@ -73,3 +73,4 @@ strtof(CONST char *s, char **sp) u.L[0] |= 0x00008000L; return u.f; } +DEF_STRONG(strtof); diff --git a/lib/libc/crypt/arc4random.c b/lib/libc/crypt/arc4random.c index 5afc6a15ab0..8a4ecc9e893 100644 --- a/lib/libc/crypt/arc4random.c +++ b/lib/libc/crypt/arc4random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random.c,v 1.53 2015/09/10 18:53:50 bcook Exp $ */ +/* $OpenBSD: arc4random.c,v 1.54 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -186,6 +186,7 @@ arc4random(void) _ARC4_UNLOCK(); return val; } +DEF_WEAK(arc4random); void arc4random_buf(void *buf, size_t n) @@ -194,3 +195,4 @@ arc4random_buf(void *buf, size_t n) _rs_random_buf(buf, n); _ARC4_UNLOCK(); } +DEF_WEAK(arc4random_buf); diff --git a/lib/libc/crypt/arc4random_uniform.c b/lib/libc/crypt/arc4random_uniform.c index 1aa9a622f1d..23a15e34fd5 100644 --- a/lib/libc/crypt/arc4random_uniform.c +++ b/lib/libc/crypt/arc4random_uniform.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_uniform.c,v 1.1 2014/07/12 13:24:54 deraadt Exp $ */ +/* $OpenBSD: arc4random_uniform.c,v 1.2 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 2008, Damien Miller @@ -54,3 +54,4 @@ arc4random_uniform(uint32_t upper_bound) return r % upper_bound; } +DEF_WEAK(arc4random_uniform); diff --git a/lib/libc/gdtoa/gdtoa.h b/lib/libc/gdtoa/gdtoa.h index 9e1cea07cfd..a883194012a 100644 --- a/lib/libc/gdtoa/gdtoa.h +++ b/lib/libc/gdtoa/gdtoa.h @@ -113,6 +113,7 @@ extern float strtof ANSI((CONST char *, char **)); extern double strtod ANSI((CONST char *, char **)); extern int __strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*)); +__BEGIN_HIDDEN_DECLS extern char* __g_ddfmt ANSI((char*, double*, int, size_t)); extern char* __g_dfmt ANSI((char*, double*, int, size_t)); extern char* __g_ffmt ANSI((char*, float*, int, size_t)); @@ -148,6 +149,7 @@ extern int __strtopxL ANSI((CONST char*, char**, void*)); #define __strtopx(s,se,x) strtorx(s,se,1,x) #define __strtopxL(s,se,x) strtorxL(s,se,1,x) #endif +__END_HIDDEN_DECLS #ifdef __cplusplus } diff --git a/lib/libc/gdtoa/gdtoaimp.h b/lib/libc/gdtoa/gdtoaimp.h index 8823aa8f197..823f2a9b113 100644 --- a/lib/libc/gdtoa/gdtoaimp.h +++ b/lib/libc/gdtoa/gdtoaimp.h @@ -566,6 +566,7 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t)); #define trailz __trailz_D2A #define ulp __ulp_D2A +__BEGIN_HIDDEN_DECLS extern char *dtoa_result; extern CONST double bigtens[], tens[], tinytens[]; extern unsigned char hexdig[]; @@ -585,8 +586,6 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t)); extern Bigint *d2b ANSI((double, int*, int*)); extern void decrement ANSI((Bigint*)); extern Bigint *diff ANSI((Bigint*, Bigint*)); - extern char *dtoa ANSI((double d, int mode, int ndigits, - int *decpt, int *sign, char **rve)); extern char *g__fmt ANSI((char*, char*, char*, int, ULong, size_t)); extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int)); extern void __hexdig_init_D2A(Void); @@ -609,10 +608,10 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t)); extern Bigint *set_ones ANSI((Bigint*, int)); extern char *strcp ANSI((char*, const char*)); extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*)); - extern double strtod ANSI((const char *s00, char **se)); extern Bigint *sum ANSI((Bigint*, Bigint*)); extern int trailz ANSI((Bigint*)); extern double ulp ANSI((U*)); +__END_HIDDEN_DECLS #ifdef __cplusplus } diff --git a/lib/libc/gdtoa/strtod.c b/lib/libc/gdtoa/strtod.c index ded47d86248..ac2283c6249 100644 --- a/lib/libc/gdtoa/strtod.c +++ b/lib/libc/gdtoa/strtod.c @@ -1102,4 +1102,4 @@ strtod *se = (char *)s; return sign ? -dval(&rv) : dval(&rv); } - +DEF_STRONG(strtod); diff --git a/lib/libc/gdtoa/strtof.c b/lib/libc/gdtoa/strtof.c index 224491b50f3..914e2182a92 100644 --- a/lib/libc/gdtoa/strtof.c +++ b/lib/libc/gdtoa/strtof.c @@ -79,3 +79,4 @@ strtof(CONST char *s, char **sp) u.L[0] |= 0x80000000L; return u.f; } +DEF_STRONG(strtof); diff --git a/lib/libc/gdtoa/strtold.c b/lib/libc/gdtoa/strtold.c index 0de6d88c008..7df15c0e66b 100644 --- a/lib/libc/gdtoa/strtold.c +++ b/lib/libc/gdtoa/strtold.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtold.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ +/* $OpenBSD: strtold.c,v 1.2 2015/09/13 08:31:47 guenther Exp $ */ /*- * Copyright (c) 2003 David Schultz * All rights reserved. @@ -38,3 +38,4 @@ strtold(const char * __restrict s, char ** __restrict sp) { return strtod(s, sp); } +DEF_STRONG(strtold); diff --git a/lib/libc/gen/devname.c b/lib/libc/gen/devname.c index 7518c91cc8b..1009be8b0ae 100644 --- a/lib/libc/gen/devname.c +++ b/lib/libc/gen/devname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devname.c,v 1.11 2015/08/26 01:54:09 guenther Exp $ */ +/* $OpenBSD: devname.c,v 1.12 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -106,3 +106,4 @@ devname(dev_t dev, mode_t type) } return (name ? name : "??"); } +DEF_WEAK(devname); diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c index 797ddb0cecd..fff16280c49 100644 --- a/lib/libc/gen/getcap.c +++ b/lib/libc/gen/getcap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getcap.c,v 1.31 2014/09/15 06:15:48 guenther Exp $ */ +/* $OpenBSD: getcap.c,v 1.32 2015/09/13 08:31:47 guenther Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -76,6 +76,7 @@ cgetusedb(int new_usedb) usedb = new_usedb; return(old_usedb); } +DEF_WEAK(cgetusedb); /* * Cgetset() allows the addition of a user specified buffer to be added @@ -99,6 +100,7 @@ cgetset(const char *ent) memcpy(toprec, ent, topreclen + 1); return (0); } +DEF_WEAK(cgetset); /* * Cgetcap searches the capability record buf for the capability cap with @@ -153,6 +155,7 @@ cgetcap(char *buf, const char *cap, int type) } /* NOTREACHED */ } +DEF_WEAK(cgetcap); /* * Cgetent extracts the capability record name from the NULL terminated file @@ -170,6 +173,7 @@ cgetent(char **buf, char **db_array, const char *name) return (getent(buf, &dummy, db_array, NULL, name, 0, NULL)); } +DEF_WEAK(cgetent); /* * Getent implements the functions of cgetent. If fp is non-NULL, @@ -623,6 +627,7 @@ cgetmatch(char *buf, const char *name) break; /* found next name */ } } +DEF_WEAK(cgetmatch); int cgetfirst(char **buf, char **db_array) @@ -631,6 +636,7 @@ cgetfirst(char **buf, char **db_array) (void)cgetclose(); return (cgetnext(buf, db_array)); } +DEF_WEAK(cgetfirst); static FILE *pfp; static int slash; @@ -649,6 +655,7 @@ cgetclose(void) slash = 0; return(0); } +DEF_WEAK(cgetclose); /* * Cgetnext() gets either the first or next entry in the logical database @@ -799,6 +806,7 @@ done: return (status); } +DEF_WEAK(cgetnext); /* * Cgetstr retrieves the value of the string capability cap from the @@ -931,6 +939,7 @@ cgetstr(char *buf, const char *cap, char **str) *str = mem; return (len); } +DEF_WEAK(cgetstr); /* * Cgetustr retrieves the value of the string capability cap from the @@ -1013,6 +1022,7 @@ cgetustr(char *buf, const char *cap, char **str) *str = mem; return (len); } +DEF_WEAK(cgetustr); /* * Cgetnum retrieves the value of the numeric capability cap from the @@ -1077,6 +1087,7 @@ cgetnum(char *buf, const char *cap, long *num) *num = n; return (0); } +DEF_WEAK(cgetnum); /* * Compare name field of record. diff --git a/lib/libc/hidden/stdlib.h b/lib/libc/hidden/stdlib.h new file mode 100644 index 00000000000..c57d4cd488c --- /dev/null +++ b/lib/libc/hidden/stdlib.h @@ -0,0 +1,158 @@ +/* $OpenBSD: stdlib.h,v 1.1 2015/09/13 08:31:47 guenther Exp $ */ +/* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stdlib.h 5.13 (Berkeley) 6/4/91 + */ + +#ifndef _LIBC_STDLIB_H_ +#define _LIBC_STDLIB_H_ + +#include_next + +__BEGIN_HIDDEN_DECLS +char *__findenv(const char *, int, int *); +__END_HIDDEN_DECLS + +extern PROTO_NORMAL(__mb_cur_max); +/*extern PROTO_NORMAL(suboptarg);*/ + +PROTO_STD_DEPRECATED(_Exit); +PROTO_DEPRECATED(a64l); +PROTO_NORMAL(abort); +PROTO_NORMAL(abs); +PROTO_NORMAL(arc4random); +PROTO_NORMAL(arc4random_buf); +PROTO_NORMAL(arc4random_uniform); +/*PROTO_NORMAL(atexit); actually in csu */ +PROTO_STD_DEPRECATED(atof); +PROTO_NORMAL(atoi); +PROTO_STD_DEPRECATED(atol); +PROTO_STD_DEPRECATED(atoll); +PROTO_STD_DEPRECATED(bsearch); +PROTO_NORMAL(calloc); +PROTO_NORMAL(cgetcap); +PROTO_NORMAL(cgetclose); +PROTO_NORMAL(cgetent); +PROTO_NORMAL(cgetfirst); +PROTO_NORMAL(cgetmatch); +PROTO_NORMAL(cgetnext); +PROTO_NORMAL(cgetnum); +PROTO_NORMAL(cgetset); +PROTO_NORMAL(cgetstr); +PROTO_NORMAL(cgetusedb); +PROTO_NORMAL(cgetustr); +PROTO_DEPRECATED(daemon); +PROTO_NORMAL(devname); +PROTO_NORMAL(div); +PROTO_DEPRECATED(drand48); +PROTO_DEPRECATED(ecvt); +PROTO_NORMAL(erand48); +PROTO_NORMAL(exit); +PROTO_DEPRECATED(fcvt); +PROTO_NORMAL(free); +PROTO_DEPRECATED(gcvt); +PROTO_DEPRECATED(getbsize); +PROTO_NORMAL(getenv); +PROTO_DEPRECATED(getloadavg); +PROTO_DEPRECATED(getprogname); +PROTO_DEPRECATED(getsubopt); +PROTO_DEPRECATED(grantpt); +PROTO_DEPRECATED(heapsort); +PROTO_DEPRECATED(initstate); +PROTO_DEPRECATED(jrand48); +PROTO_DEPRECATED(l64a); +PROTO_STD_DEPRECATED(labs); +PROTO_DEPRECATED(lcong48); +PROTO_NORMAL(lcong48_deterministic); +PROTO_DEPRECATED(ldiv); +PROTO_STD_DEPRECATED(llabs); +PROTO_STD_DEPRECATED(lldiv); +PROTO_DEPRECATED(lrand48); +PROTO_NORMAL(malloc); +PROTO_STD_DEPRECATED(mblen); +PROTO_STD_DEPRECATED(mbstowcs); +PROTO_STD_DEPRECATED(mbtowc); +PROTO_DEPRECATED(mergesort); +PROTO_DEPRECATED(mkdtemp); +PROTO_NORMAL(mkostemp); +PROTO_DEPRECATED(mkostemps); +PROTO_NORMAL(mkstemp); +PROTO_DEPRECATED(mkstemps); +PROTO_DEPRECATED(mktemp); +PROTO_DEPRECATED(mrand48); +PROTO_DEPRECATED(nrand48); +PROTO_NORMAL(posix_memalign); +PROTO_DEPRECATED(posix_openpt); +PROTO_DEPRECATED(ptsname); +PROTO_NORMAL(putenv); +PROTO_DEPRECATED(qabs); +PROTO_DEPRECATED(qdiv); +PROTO_NORMAL(qsort); +PROTO_DEPRECATED(radixsort); +PROTO_STD_DEPRECATED(rand); +PROTO_NORMAL(rand_r); +PROTO_DEPRECATED(random); +PROTO_NORMAL(realloc); +PROTO_NORMAL(reallocarray); +PROTO_DEPRECATED(realpath); +PROTO_DEPRECATED(seed48); +PROTO_DEPRECATED(seed48_deterministic); +PROTO_NORMAL(setenv); +PROTO_DEPRECATED(setproctitle); +PROTO_DEPRECATED(setprogname); +PROTO_DEPRECATED(setstate); +PROTO_DEPRECATED(sradixsort); +PROTO_DEPRECATED(srand); +PROTO_DEPRECATED(srand_deterministic); +PROTO_DEPRECATED(srand48); +PROTO_NORMAL(srand48_deterministic); +PROTO_DEPRECATED(srandom); +PROTO_DEPRECATED(srandom_deterministic); +PROTO_DEPRECATED(srandomdev); +PROTO_NORMAL(strtod); +PROTO_NORMAL(strtof); +PROTO_NORMAL(strtol); +PROTO_NORMAL(strtold); +PROTO_NORMAL(strtoll); +PROTO_NORMAL(strtonum); +/*PROTO_NORMAL(strtoq); alias of strtoll */ +PROTO_NORMAL(strtoul); +PROTO_NORMAL(strtoull); +/*PROTO_NORMAL(strtouq); alias of strtoull */ +PROTO_NORMAL(system); +PROTO_DEPRECATED(ttyslot); +PROTO_DEPRECATED(unlockpt); +PROTO_NORMAL(unsetenv); +PROTO_STD_DEPRECATED(valloc); +PROTO_STD_DEPRECATED(wcstombs); +PROTO_STD_DEPRECATED(wctomb); + +#endif /* _LIBC_STDLIB_H_ */ diff --git a/lib/libc/hidden/unistd.h b/lib/libc/hidden/unistd.h index 66c0b0ae335..c4cc9a1def4 100644 --- a/lib/libc/hidden/unistd.h +++ b/lib/libc/hidden/unistd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unistd.h,v 1.3 2015/09/12 14:56:50 guenther Exp $ */ +/* $OpenBSD: unistd.h,v 1.4 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 2015 Philip Guenther * @@ -95,7 +95,7 @@ PROTO_NORMAL(link); PROTO_NORMAL(linkat); /*PROTO_CANCEL(lockf);*/ PROTO_NORMAL(lseek); -PROTO_NORMAL(mkdtemp); +/*PROTO_DEPRECATED(mkdtemp); use declaration from stdlib.h */ PROTO_NORMAL(mkstemp); /*PROTO_DEPRECATED(mkstemps); use declaration from stdlib.h */ /*PROTO_DEPRECATED(mktemp); use declaration from stdlib.h */ diff --git a/lib/libc/locale/__mb_cur_max.c b/lib/libc/locale/__mb_cur_max.c index ec99fb6b399..8849a23c681 100644 --- a/lib/libc/locale/__mb_cur_max.c +++ b/lib/libc/locale/__mb_cur_max.c @@ -1,4 +1,4 @@ -/* $OpenBSD: __mb_cur_max.c,v 1.2 2005/08/08 08:05:35 espie Exp $ */ +/* $OpenBSD: __mb_cur_max.c,v 1.3 2015/09/13 08:31:47 guenther Exp $ */ /* $NetBSD: __mb_cur_max.c,v 1.2 2001/01/25 01:25:06 itojun Exp $ */ /*- @@ -27,9 +27,9 @@ * SUCH DAMAGE. */ -#include +#include #include size_t __mb_cur_max = 1; size_t __mb_len_max_runtime = MB_LEN_MAX; - +DEF_STRONG(__mb_cur_max); diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index abb7c544d55..4b81d5d4715 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mktemp.c,v 1.37 2015/09/12 14:56:50 guenther Exp $ */ +/* $OpenBSD: mktemp.c,v 1.38 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 1996-1998, 2008 Theo de Raadt * Copyright (c) 1997, 2008-2009 Todd C. Miller @@ -145,6 +145,7 @@ mkostemp(char *path, int flags) { return(mktemp_internal(path, 0, MKTEMP_FILE, flags)); } +DEF_WEAK(mkostemp); int mkstemps(char *path, int slen) @@ -160,4 +161,3 @@ mkdtemp(char *path) error = mktemp_internal(path, 0, MKTEMP_DIR, 0); return(error ? NULL : path); } -DEF_WEAK(mkdtemp); diff --git a/lib/libc/stdlib/abort.c b/lib/libc/stdlib/abort.c index dd057710ff2..903bfa78e18 100644 --- a/lib/libc/stdlib/abort.c +++ b/lib/libc/stdlib/abort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: abort.c,v 1.17 2014/05/14 21:54:20 tedu Exp $ */ +/* $OpenBSD: abort.c,v 1.18 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 1985 Regents of the University of California. * All rights reserved. @@ -61,3 +61,4 @@ abort(void) (void)raise(SIGABRT); _exit(1); } +DEF_STRONG(abort); diff --git a/lib/libc/stdlib/abs.c b/lib/libc/stdlib/abs.c index 5d2fbae69f1..0e39cc55367 100644 --- a/lib/libc/stdlib/abs.c +++ b/lib/libc/stdlib/abs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: abs.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: abs.c,v 1.6 2015/09/13 08:31:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -35,3 +35,4 @@ abs(int j) { return(j < 0 ? -j : j); } +DEF_STRONG(abs); diff --git a/lib/libc/stdlib/atoi.c b/lib/libc/stdlib/atoi.c index b0842678e2f..7c9eb1331b0 100644 --- a/lib/libc/stdlib/atoi.c +++ b/lib/libc/stdlib/atoi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atoi.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: atoi.c,v 1.6 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -35,3 +35,4 @@ atoi(const char *str) { return((int)strtol(str, (char **)NULL, 10)); } +DEF_STRONG(atoi); diff --git a/lib/libc/stdlib/div.c b/lib/libc/stdlib/div.c index f7ac2db4b04..beaa428c7a8 100644 --- a/lib/libc/stdlib/div.c +++ b/lib/libc/stdlib/div.c @@ -1,4 +1,4 @@ -/* $OpenBSD: div.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: div.c,v 1.6 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 1990 Regents of the University of California. * All rights reserved. @@ -69,3 +69,4 @@ div(int num, int denom) } return (r); } +DEF_STRONG(div); diff --git a/lib/libc/stdlib/erand48.c b/lib/libc/stdlib/erand48.c index 2ffeaa6e710..20d6a2dd690 100644 --- a/lib/libc/stdlib/erand48.c +++ b/lib/libc/stdlib/erand48.c @@ -1,4 +1,4 @@ -/* $OpenBSD: erand48.c,v 1.3 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: erand48.c,v 1.4 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 1993 Martin Birgmeier * All rights reserved. @@ -22,3 +22,4 @@ erand48(unsigned short xseed[3]) ldexp((double) xseed[1], -32) + ldexp((double) xseed[2], -16); } +DEF_WEAK(erand48); diff --git a/lib/libc/stdlib/exit.c b/lib/libc/stdlib/exit.c index 83fe3d2de56..d30b91ed46a 100644 --- a/lib/libc/stdlib/exit.c +++ b/lib/libc/stdlib/exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exit.c,v 1.12 2007/09/03 14:40:16 millert Exp $ */ +/* $OpenBSD: exit.c,v 1.13 2015/09/13 08:31:47 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -57,3 +57,4 @@ exit(int status) __cxa_finalize(NULL); _exit(status); } +DEF_STRONG(exit); diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index fd8482e9e3c..6ddad9225a3 100644 --- a/lib/libc/stdlib/getenv.c +++ b/lib/libc/stdlib/getenv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getenv.c,v 1.10 2010/08/23 22:31:50 millert Exp $ */ +/* $OpenBSD: getenv.c,v 1.11 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. @@ -31,7 +31,6 @@ #include #include -char *__findenv(const char *name, int len, int *offset); /* * __findenv -- @@ -79,3 +78,4 @@ getenv(const char *name) ; return (__findenv(name, (int)(np - name), &offset)); } +DEF_STRONG(getenv); diff --git a/lib/libc/stdlib/lcong48.c b/lib/libc/stdlib/lcong48.c index 5b297ddbfc1..f03083e3c87 100644 --- a/lib/libc/stdlib/lcong48.c +++ b/lib/libc/stdlib/lcong48.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcong48.c,v 1.5 2015/08/27 04:33:31 guenther Exp $ */ +/* $OpenBSD: lcong48.c,v 1.6 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 1993 Martin Birgmeier * All rights reserved. @@ -33,3 +33,4 @@ lcong48_deterministic(unsigned short p[7]) __rand48_mult[2] = p[5]; __rand48_add = p[6]; } +DEF_WEAK(lcong48_deterministic); diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 5e5dafbd179..0967fe3a088 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.174 2015/04/06 09:18:51 tedu Exp $ */ +/* $OpenBSD: malloc.c,v 1.175 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 2008, 2010, 2011 Otto Moerbeek * Copyright (c) 2012 Matthew Dempsky @@ -211,6 +211,7 @@ extern char *__progname; #ifdef MALLOC_STATS void malloc_dump(int); +PROTO_NORMAL(malloc_dump); static void malloc_exit(void); #define CALLER __builtin_return_address(0) #else @@ -1186,6 +1187,7 @@ malloc(size_t size) errno = saved_errno; return r; } +DEF_STRONG(malloc); static void ofree(void *p) @@ -1289,6 +1291,7 @@ free(void *ptr) _MALLOC_UNLOCK(); errno = saved_errno; } +DEF_STRONG(free); static void * @@ -1429,6 +1432,7 @@ realloc(void *ptr, size_t size) errno = saved_errno; return r; } +DEF_STRONG(realloc); /* @@ -1476,6 +1480,7 @@ calloc(size_t nmemb, size_t size) errno = saved_errno; return r; } +DEF_STRONG(calloc); static void * mapalign(struct dir_info *d, size_t alignment, size_t sz, int zero_fill) @@ -1609,6 +1614,7 @@ err: errno = saved_errno; return res; } +DEF_STRONG(posix_memalign); #ifdef MALLOC_STATS @@ -1853,6 +1859,7 @@ malloc_dump(int fd) malloc_dump1(fd, pool); errno = saved_errno; } +DEF_WEAK(malloc_dump); static void malloc_exit(void) diff --git a/lib/libc/stdlib/qsort.c b/lib/libc/stdlib/qsort.c index 2a51c776349..1d9b1e91221 100644 --- a/lib/libc/stdlib/qsort.c +++ b/lib/libc/stdlib/qsort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qsort.c,v 1.12 2014/06/12 14:54:25 millert Exp $ */ +/* $OpenBSD: qsort.c,v 1.13 2015/09/13 08:31:47 guenther Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -149,3 +149,4 @@ loop: SWAPINIT(a, es); } /* qsort(pn - r, r / es, es, cmp);*/ } +DEF_STRONG(qsort); diff --git a/lib/libc/stdlib/rand.c b/lib/libc/stdlib/rand.c index f163581e8d7..7054b81c647 100644 --- a/lib/libc/stdlib/rand.c +++ b/lib/libc/stdlib/rand.c @@ -39,6 +39,7 @@ rand_r(u_int *seed) *seed = *seed * 1103515245 + 12345; return (*seed % ((u_int)RAND_MAX + 1)); } +DEF_WEAK(rand_r); #if defined(APIWARN) __warn_references(rand_r, diff --git a/lib/libc/stdlib/reallocarray.c b/lib/libc/stdlib/reallocarray.c index ed3244e22f7..baea252a874 100644 --- a/lib/libc/stdlib/reallocarray.c +++ b/lib/libc/stdlib/reallocarray.c @@ -1,4 +1,4 @@ -/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */ +/* $OpenBSD: reallocarray.c,v 1.3 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 2008 Otto Moerbeek * @@ -36,3 +36,4 @@ reallocarray(void *optr, size_t nmemb, size_t size) } return realloc(optr, size * nmemb); } +DEF_WEAK(reallocarray); diff --git a/lib/libc/stdlib/setenv.c b/lib/libc/stdlib/setenv.c index 10b55445f76..e55a1feb6f9 100644 --- a/lib/libc/stdlib/setenv.c +++ b/lib/libc/stdlib/setenv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setenv.c,v 1.15 2014/10/08 05:33:31 deraadt Exp $ */ +/* $OpenBSD: setenv.c,v 1.16 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 1987 Regents of the University of California. * All rights reserved. @@ -32,8 +32,6 @@ #include #include -char *__findenv(const char *name, int len, int *offset); - extern char **environ; static char **lastenv; /* last value of environ */ @@ -81,6 +79,7 @@ putenv(char *str) environ[cnt + 1] = NULL; return (0); } +DEF_WEAK(putenv); /* * setenv -- @@ -147,6 +146,7 @@ setenv(const char *name, const char *value, int rewrite) ; return (0); } +DEF_WEAK(setenv); /* * unsetenv(name) -- @@ -178,3 +178,4 @@ unsetenv(const char *name) } return (0); } +DEF_WEAK(unsetenv); diff --git a/lib/libc/stdlib/srand48.c b/lib/libc/stdlib/srand48.c index ce4b45225dc..d41391d4452 100644 --- a/lib/libc/stdlib/srand48.c +++ b/lib/libc/stdlib/srand48.c @@ -1,4 +1,4 @@ -/* $OpenBSD: srand48.c,v 1.5 2015/08/27 04:33:31 guenther Exp $ */ +/* $OpenBSD: srand48.c,v 1.6 2015/09/13 08:31:48 guenther Exp $ */ /* * Copyright (c) 1993 Martin Birgmeier * All rights reserved. @@ -35,3 +35,4 @@ srand48_deterministic(long seed) __rand48_mult[2] = RAND48_MULT_2; __rand48_add = RAND48_ADD; } +DEF_WEAK(srand48_deterministic); diff --git a/lib/libc/stdlib/strtol.c b/lib/libc/stdlib/strtol.c index 86cec350864..49465e28ee8 100644 --- a/lib/libc/stdlib/strtol.c +++ b/lib/libc/stdlib/strtol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtol.c,v 1.10 2014/09/13 20:10:12 schwarze Exp $ */ +/* $OpenBSD: strtol.c,v 1.11 2015/09/13 08:31:48 guenther Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -148,3 +148,4 @@ strtol(const char *nptr, char **endptr, int base) *endptr = (char *) (any ? s - 1 : nptr); return (acc); } +DEF_STRONG(strtol); diff --git a/lib/libc/stdlib/strtoll.c b/lib/libc/stdlib/strtoll.c index cf82c8e1a6f..0ba51da77e8 100644 --- a/lib/libc/stdlib/strtoll.c +++ b/lib/libc/stdlib/strtoll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtoll.c,v 1.8 2014/09/13 20:10:12 schwarze Exp $ */ +/* $OpenBSD: strtoll.c,v 1.9 2015/09/13 08:31:48 guenther Exp $ */ /* * Copyright (c) 1992 The Regents of the University of California. * All rights reserved. @@ -151,5 +151,6 @@ strtoll(const char *nptr, char **endptr, int base) *endptr = (char *) (any ? s - 1 : nptr); return (acc); } +DEF_STRONG(strtoll); -__strong_alias(strtoq, strtoll); +__weak_alias(strtoq, strtoll); diff --git a/lib/libc/stdlib/strtonum.c b/lib/libc/stdlib/strtonum.c index 1aeee3467b8..ad22d1c30c5 100644 --- a/lib/libc/stdlib/strtonum.c +++ b/lib/libc/stdlib/strtonum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $ */ +/* $OpenBSD: strtonum.c,v 1.8 2015/09/13 08:31:48 guenther Exp $ */ /* * Copyright (c) 2004 Ted Unangst and Todd Miller @@ -63,3 +63,4 @@ strtonum(const char *numstr, long long minval, long long maxval, return (ll); } +DEF_WEAK(strtonum); diff --git a/lib/libc/stdlib/strtoul.c b/lib/libc/stdlib/strtoul.c index 2aa41b76e4a..98e8abcbdba 100644 --- a/lib/libc/stdlib/strtoul.c +++ b/lib/libc/stdlib/strtoul.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtoul.c,v 1.9 2014/09/13 20:10:12 schwarze Exp $ */ +/* $OpenBSD: strtoul.c,v 1.10 2015/09/13 08:31:48 guenther Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -107,3 +107,4 @@ strtoul(const char *nptr, char **endptr, int base) *endptr = (char *) (any ? s - 1 : nptr); return (acc); } +DEF_STRONG(strtoul); diff --git a/lib/libc/stdlib/strtoull.c b/lib/libc/stdlib/strtoull.c index 846417630f9..a5d07de6cff 100644 --- a/lib/libc/stdlib/strtoull.c +++ b/lib/libc/stdlib/strtoull.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtoull.c,v 1.7 2014/09/13 20:10:12 schwarze Exp $ */ +/* $OpenBSD: strtoull.c,v 1.8 2015/09/13 08:31:48 guenther Exp $ */ /* * Copyright (c) 1992 The Regents of the University of California. * All rights reserved. @@ -109,5 +109,6 @@ strtoull(const char *nptr, char **endptr, int base) *endptr = (char *) (any ? s - 1 : nptr); return (acc); } +DEF_STRONG(strtoull); -__strong_alias(strtouq, strtoull); +__weak_alias(strtouq, strtoull); diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c index 14ddcae8d3e..2a50ec74900 100644 --- a/lib/libc/stdlib/system.c +++ b/lib/libc/stdlib/system.c @@ -1,4 +1,4 @@ -/* $OpenBSD: system.c,v 1.8 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: system.c,v 1.9 2015/09/13 08:31:48 guenther Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. * All rights reserved. @@ -72,3 +72,4 @@ system(const char *command) (void)signal(SIGQUIT, quitsave); return (pid == -1 ? -1 : pstat); } +DEF_STRONG(system); -- cgit v1.2.3