From 3e2a03de0a2f98f0f9957ff72cb0ce93b0eb92b1 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Mon, 31 Aug 2015 02:53:57 +0000 Subject: [PATCH] Add framework for resolving (pun intended) libc namespace issues, using wrapper .h files and asm labels to let internal calls resolve directly and not be overridable or use the PLT. Then, apply that framework to most of the functions in stdio.h, string.h, err.h, and wchar.h. Delete the should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here. tests clean on i386, amd64, sparc64, powerpc, and mips64 naming feedback from kettenis@ and millert@ ok kettenis@ --- src/include/err.h | 30 +------------------------ src/lib/libc/string/bcmp.c | 3 ++- src/lib/libc/string/bcopy.c | 3 ++- src/lib/libc/string/bzero.c | 3 ++- src/lib/libc/string/explicit_bzero.c | 3 ++- src/lib/libc/string/ffs.c | 3 ++- src/lib/libc/string/memccpy.c | 3 ++- src/lib/libc/string/memchr.c | 3 ++- src/lib/libc/string/memcmp.c | 3 ++- src/lib/libc/string/memcpy.c | 3 ++- src/lib/libc/string/memmem.c | 3 ++- src/lib/libc/string/memmove.c | 3 ++- src/lib/libc/string/memrchr.c | 3 ++- src/lib/libc/string/memset.c | 3 ++- src/lib/libc/string/stpncpy.c | 3 ++- src/lib/libc/string/strcasecmp.c | 4 +++- src/lib/libc/string/strcasestr.c | 3 ++- src/lib/libc/string/strchr.c | 3 ++- src/lib/libc/string/strcmp.c | 3 ++- src/lib/libc/string/strcoll.c | 3 ++- src/lib/libc/string/strcspn.c | 3 ++- src/lib/libc/string/strdup.c | 3 ++- src/lib/libc/string/strerror.c | 3 ++- src/lib/libc/string/strerror_r.c | 3 ++- src/lib/libc/string/strlcat.c | 3 ++- src/lib/libc/string/strlcpy.c | 3 ++- src/lib/libc/string/strlen.c | 3 ++- src/lib/libc/string/strmode.c | 3 ++- src/lib/libc/string/strncat.c | 3 ++- src/lib/libc/string/strncmp.c | 3 ++- src/lib/libc/string/strncpy.c | 3 ++- src/lib/libc/string/strndup.c | 3 ++- src/lib/libc/string/strnlen.c | 3 ++- src/lib/libc/string/strpbrk.c | 3 ++- src/lib/libc/string/strrchr.c | 3 ++- src/lib/libc/string/strsep.c | 3 ++- src/lib/libc/string/strsignal.c | 1 + src/lib/libc/string/strspn.c | 3 ++- src/lib/libc/string/strstr.c | 3 ++- src/lib/libc/string/strtok.c | 2 ++ src/lib/libc/string/strxfrm.c | 3 ++- src/lib/libc/string/timingsafe_bcmp.c | 3 ++- src/lib/libc/string/timingsafe_memcmp.c | 3 ++- 43 files changed, 85 insertions(+), 69 deletions(-) diff --git a/src/include/err.h b/src/include/err.h index af973685..3fed1b53 100644 --- a/src/include/err.h +++ b/src/include/err.h @@ -1,4 +1,4 @@ -/* $OpenBSD: err.h,v 1.12 2014/04/22 00:33:02 guenther Exp $ */ +/* $OpenBSD: err.h,v 1.13 2015/08/31 02:53:56 guenther Exp $ */ /* $NetBSD: err.h,v 1.11 1994/10/26 00:55:52 cgd Exp $ */ /*- @@ -65,34 +65,6 @@ void warnx(const char *, ...) void vwarnx(const char *, __va_list) __attribute__((__format__ (printf, 1, 0))); -/* - * The _* versions are for use inside libc only and will go away - */ -__dead void _err(int, const char *, ...) - __attribute__((__format__ (printf, 2, 3))); -__dead void _verr(int, const char *, __va_list) - __attribute__((__format__ (printf, 2, 0))); -__dead void _errc(int, int, const char *, ...) - __attribute__((__format__ (printf, 3, 4))); -__dead void _verrc(int, int, const char *, __va_list) - __attribute__((__format__ (printf, 3, 0))); -__dead void _errx(int, const char *, ...) - __attribute__((__format__ (printf, 2, 3))); -__dead void _verrx(int, const char *, __va_list) - __attribute__((__format__ (printf, 2, 0))); -void _warn(const char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void _vwarn(const char *, __va_list) - __attribute__((__format__ (printf, 1, 0))); -void _warnc(int, const char *, ...) - __attribute__((__format__ (printf, 2, 3))); -void _vwarnc(int, const char *, __va_list) - __attribute__((__format__ (printf, 2, 0))); -void _warnx(const char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void _vwarnx(const char *, __va_list) - __attribute__((__format__ (printf, 1, 0))); - __END_DECLS #endif /* !_ERR_H_ */ diff --git a/src/lib/libc/string/bcmp.c b/src/lib/libc/string/bcmp.c index f6467299..5d446bf0 100644 --- a/src/lib/libc/string/bcmp.c +++ b/src/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/src/lib/libc/string/bcopy.c b/src/lib/libc/string/bcopy.c index fcaa843c..ef0d3680 100644 --- a/src/lib/libc/string/bcopy.c +++ b/src/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/src/lib/libc/string/bzero.c b/src/lib/libc/string/bzero.c index fdd3d9cc..5173de26 100644 --- a/src/lib/libc/string/bzero.c +++ b/src/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/src/lib/libc/string/explicit_bzero.c b/src/lib/libc/string/explicit_bzero.c index 3e33ca85..003ea7cc 100644 --- a/src/lib/libc/string/explicit_bzero.c +++ b/src/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/src/lib/libc/string/ffs.c b/src/lib/libc/string/ffs.c index de4480a7..a75fd9d7 100644 --- a/src/lib/libc/string/ffs.c +++ b/src/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/src/lib/libc/string/memccpy.c b/src/lib/libc/string/memccpy.c index 485c55fc..635061b8 100644 --- a/src/lib/libc/string/memccpy.c +++ b/src/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/src/lib/libc/string/memchr.c b/src/lib/libc/string/memchr.c index 4573e3ce..a6a4bd60 100644 --- a/src/lib/libc/string/memchr.c +++ b/src/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/src/lib/libc/string/memcmp.c b/src/lib/libc/string/memcmp.c index 49384a6f..0df2c54d 100644 --- a/src/lib/libc/string/memcmp.c +++ b/src/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/src/lib/libc/string/memcpy.c b/src/lib/libc/string/memcpy.c index 1b9715e4..73136edd 100644 --- a/src/lib/libc/string/memcpy.c +++ b/src/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/src/lib/libc/string/memmem.c b/src/lib/libc/string/memmem.c index 5793a7df..823443b0 100644 --- a/src/lib/libc/string/memmem.c +++ b/src/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 * @@ -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/src/lib/libc/string/memmove.c b/src/lib/libc/string/memmove.c index 1baad535..2f1deb2c 100644 --- a/src/lib/libc/string/memmove.c +++ b/src/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/src/lib/libc/string/memrchr.c b/src/lib/libc/string/memrchr.c index bd27ebc6..26a33995 100644 --- a/src/lib/libc/string/memrchr.c +++ b/src/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 @@ -36,3 +36,4 @@ memrchr(const void *s, int c, size_t n) } return(NULL); } +DEF_WEAK(memrchr); diff --git a/src/lib/libc/string/memset.c b/src/lib/libc/string/memset.c index 61709c13..242529ee 100644 --- a/src/lib/libc/string/memset.c +++ b/src/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/src/lib/libc/string/stpncpy.c b/src/lib/libc/string/stpncpy.c index c7c2a57c..6bdee5de 100644 --- a/src/lib/libc/string/stpncpy.c +++ b/src/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/src/lib/libc/string/strcasecmp.c b/src/lib/libc/string/strcasecmp.c index 2be09136..edbd6387 100644 --- a/src/lib/libc/string/strcasecmp.c +++ b/src/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/src/lib/libc/string/strcasestr.c b/src/lib/libc/string/strcasestr.c index aa74c017..abb3e155 100644 --- a/src/lib/libc/string/strcasestr.c +++ b/src/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/src/lib/libc/string/strchr.c b/src/lib/libc/string/strchr.c index 596e407c..b396b45b 100644 --- a/src/lib/libc/string/strchr.c +++ b/src/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/src/lib/libc/string/strcmp.c b/src/lib/libc/string/strcmp.c index d1b6c50d..be175563 100644 --- a/src/lib/libc/string/strcmp.c +++ b/src/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/src/lib/libc/string/strcoll.c b/src/lib/libc/string/strcoll.c index 2df983bd..47a6ea4f 100644 --- a/src/lib/libc/string/strcoll.c +++ b/src/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/src/lib/libc/string/strcspn.c b/src/lib/libc/string/strcspn.c index 1eb23361..3c1f5a4c 100644 --- a/src/lib/libc/string/strcspn.c +++ b/src/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/src/lib/libc/string/strdup.c b/src/lib/libc/string/strdup.c index a6aa1e03..9aebf399 100644 --- a/src/lib/libc/string/strdup.c +++ b/src/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/src/lib/libc/string/strerror.c b/src/lib/libc/string/strerror.c index 13996f08..c6f05446 100644 --- a/src/lib/libc/string/strerror.c +++ b/src/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/src/lib/libc/string/strerror_r.c b/src/lib/libc/string/strerror_r.c index b8513605..90aa0123 100644 --- a/src/lib/libc/string/strerror_r.c +++ b/src/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 */ #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/src/lib/libc/string/strlcat.c b/src/lib/libc/string/strlcat.c index 14c53a1f..073b0d42 100644 --- a/src/lib/libc/string/strlcat.c +++ b/src/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 @@ -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/src/lib/libc/string/strlcpy.c b/src/lib/libc/string/strlcpy.c index e9a7fe4b..5fcf084a 100644 --- a/src/lib/libc/string/strlcpy.c +++ b/src/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 @@ -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/src/lib/libc/string/strlen.c b/src/lib/libc/string/strlen.c index 7e0e27b1..a5721d3e 100644 --- a/src/lib/libc/string/strlen.c +++ b/src/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/src/lib/libc/string/strmode.c b/src/lib/libc/string/strmode.c index 6f0fa34e..609b8931 100644 --- a/src/lib/libc/string/strmode.c +++ b/src/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/src/lib/libc/string/strncat.c b/src/lib/libc/string/strncat.c index c4df4f2f..b3388acc 100644 --- a/src/lib/libc/string/strncat.c +++ b/src/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/src/lib/libc/string/strncmp.c b/src/lib/libc/string/strncmp.c index 0a4ddc1d..535d2a60 100644 --- a/src/lib/libc/string/strncmp.c +++ b/src/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/src/lib/libc/string/strncpy.c b/src/lib/libc/string/strncpy.c index 5003a199..d6d8647f 100644 --- a/src/lib/libc/string/strncpy.c +++ b/src/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/src/lib/libc/string/strndup.c b/src/lib/libc/string/strndup.c index 27701ac5..a6e5bff7 100644 --- a/src/lib/libc/string/strndup.c +++ b/src/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 @@ -37,3 +37,4 @@ strndup(const char *str, size_t maxlen) return copy; } +DEF_WEAK(strndup); diff --git a/src/lib/libc/string/strnlen.c b/src/lib/libc/string/strnlen.c index 872cfa6c..26e9743f 100644 --- a/src/lib/libc/string/strnlen.c +++ b/src/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 @@ -30,3 +30,4 @@ strnlen(const char *str, size_t maxlen) return (size_t)(cp - str); } +DEF_WEAK(strnlen); diff --git a/src/lib/libc/string/strpbrk.c b/src/lib/libc/string/strpbrk.c index cd3b71c0..336c22de 100644 --- a/src/lib/libc/string/strpbrk.c +++ b/src/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/src/lib/libc/string/strrchr.c b/src/lib/libc/string/strrchr.c index 181f56ea..93755721 100644 --- a/src/lib/libc/string/strrchr.c +++ b/src/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/src/lib/libc/string/strsep.c b/src/lib/libc/string/strsep.c index 2ffc4b4c..97c3cbf1 100644 --- a/src/lib/libc/string/strsep.c +++ b/src/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/src/lib/libc/string/strsignal.c b/src/lib/libc/string/strsignal.c index aa541cef..a71a291f 100644 --- a/src/lib/libc/string/strsignal.c +++ b/src/lib/libc/string/strsignal.c @@ -39,3 +39,4 @@ strsignal(int sig) return __strsignal(sig, buf); } +DEF_WEAK(strsignal); diff --git a/src/lib/libc/string/strspn.c b/src/lib/libc/string/strspn.c index 385649c0..0ce41cbb 100644 --- a/src/lib/libc/string/strspn.c +++ b/src/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/src/lib/libc/string/strstr.c b/src/lib/libc/string/strstr.c index 95a865bf..ccd08717 100644 --- a/src/lib/libc/string/strstr.c +++ b/src/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/src/lib/libc/string/strtok.c b/src/lib/libc/string/strtok.c index 6ba6b21c..c5765756 100644 --- a/src/lib/libc/string/strtok.c +++ b/src/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/src/lib/libc/string/strxfrm.c b/src/lib/libc/string/strxfrm.c index 6f289c90..97df097b 100644 --- a/src/lib/libc/string/strxfrm.c +++ b/src/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/src/lib/libc/string/timingsafe_bcmp.c b/src/lib/libc/string/timingsafe_bcmp.c index 0b736154..0409ec32 100644 --- a/src/lib/libc/string/timingsafe_bcmp.c +++ b/src/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/src/lib/libc/string/timingsafe_memcmp.c b/src/lib/libc/string/timingsafe_memcmp.c index 04e2ac5e..373f8cb1 100644 --- a/src/lib/libc/string/timingsafe_memcmp.c +++ b/src/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);