summaryrefslogtreecommitdiff
path: root/src/lib/libc/string
diff options
context:
space:
mode:
authorguenther <>2015-08-31 02:53:57 +0000
committerguenther <>2015-08-31 02:53:57 +0000
commit9bfe2450029c26d54ebb48f0d8c01d35b63865d3 (patch)
treebb414296df7d65acc4ba9b4159bf5979ae934d04 /src/lib/libc/string
parent4f937c61ae895d4e27690c1e2bb8bc911a3b4a12 (diff)
downloadopenbsd-9bfe2450029c26d54ebb48f0d8c01d35b63865d3.tar.gz
openbsd-9bfe2450029c26d54ebb48f0d8c01d35b63865d3.tar.bz2
openbsd-9bfe2450029c26d54ebb48f0d8c01d35b63865d3.zip
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@
Diffstat (limited to 'src/lib/libc/string')
-rw-r--r--src/lib/libc/string/bcmp.c3
-rw-r--r--src/lib/libc/string/bcopy.c3
-rw-r--r--src/lib/libc/string/bzero.c3
-rw-r--r--src/lib/libc/string/explicit_bzero.c3
-rw-r--r--src/lib/libc/string/ffs.c3
-rw-r--r--src/lib/libc/string/memccpy.c3
-rw-r--r--src/lib/libc/string/memchr.c3
-rw-r--r--src/lib/libc/string/memcmp.c3
-rw-r--r--src/lib/libc/string/memcpy.c3
-rw-r--r--src/lib/libc/string/memmem.c3
-rw-r--r--src/lib/libc/string/memmove.c3
-rw-r--r--src/lib/libc/string/memrchr.c3
-rw-r--r--src/lib/libc/string/memset.c3
-rw-r--r--src/lib/libc/string/stpncpy.c3
-rw-r--r--src/lib/libc/string/strcasecmp.c4
-rw-r--r--src/lib/libc/string/strcasestr.c3
-rw-r--r--src/lib/libc/string/strchr.c3
-rw-r--r--src/lib/libc/string/strcmp.c3
-rw-r--r--src/lib/libc/string/strcoll.c3
-rw-r--r--src/lib/libc/string/strcspn.c3
-rw-r--r--src/lib/libc/string/strdup.c3
-rw-r--r--src/lib/libc/string/strerror.c3
-rw-r--r--src/lib/libc/string/strerror_r.c3
-rw-r--r--src/lib/libc/string/strlcat.c3
-rw-r--r--src/lib/libc/string/strlcpy.c3
-rw-r--r--src/lib/libc/string/strlen.c3
-rw-r--r--src/lib/libc/string/strmode.c3
-rw-r--r--src/lib/libc/string/strncat.c3
-rw-r--r--src/lib/libc/string/strncmp.c3
-rw-r--r--src/lib/libc/string/strncpy.c3
-rw-r--r--src/lib/libc/string/strndup.c3
-rw-r--r--src/lib/libc/string/strnlen.c3
-rw-r--r--src/lib/libc/string/strpbrk.c3
-rw-r--r--src/lib/libc/string/strrchr.c3
-rw-r--r--src/lib/libc/string/strsep.c3
-rw-r--r--src/lib/libc/string/strsignal.c1
-rw-r--r--src/lib/libc/string/strspn.c3
-rw-r--r--src/lib/libc/string/strstr.c3
-rw-r--r--src/lib/libc/string/strtok.c2
-rw-r--r--src/lib/libc/string/strxfrm.c3
-rw-r--r--src/lib/libc/string/timingsafe_bcmp.c3
-rw-r--r--src/lib/libc/string/timingsafe_memcmp.c3
42 files changed, 84 insertions, 40 deletions
diff --git a/src/lib/libc/string/bcmp.c b/src/lib/libc/string/bcmp.c
index f64672990c..5d446bf096 100644
--- a/src/lib/libc/string/bcmp.c
+++ b/src/lib/libc/string/bcmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bcmp.c,v 1.10 2014/06/10 04:17:37 deraadt Exp $ */ 1/* $OpenBSD: bcmp.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1987 Regents of the University of California. 4 * Copyright (c) 1987 Regents of the University of California.
@@ -49,3 +49,4 @@ bcmp(const void *b1, const void *b2, size_t length)
49 while (--length); 49 while (--length);
50 return (0); 50 return (0);
51} 51}
52DEF_WEAK(bcmp);
diff --git a/src/lib/libc/string/bcopy.c b/src/lib/libc/string/bcopy.c
index fcaa843c71..ef0d368053 100644
--- a/src/lib/libc/string/bcopy.c
+++ b/src/lib/libc/string/bcopy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bcopy.c,v 1.6 2014/11/30 19:43:56 deraadt Exp $ */ 1/* $OpenBSD: bcopy.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -110,3 +110,4 @@ bcopy(const void *src0, void *dst0, size_t length)
110done: 110done:
111 return; 111 return;
112} 112}
113DEF_WEAK(bcopy);
diff --git a/src/lib/libc/string/bzero.c b/src/lib/libc/string/bzero.c
index fdd3d9cc8d..5173de26dd 100644
--- a/src/lib/libc/string/bzero.c
+++ b/src/lib/libc/string/bzero.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bzero.c,v 1.8 2014/06/10 04:17:37 deraadt Exp $ */ 1/* $OpenBSD: bzero.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1987 Regents of the University of California. 4 * Copyright (c) 1987 Regents of the University of California.
@@ -42,3 +42,4 @@ bzero(void *b, size_t length)
42 for (p = b; length--;) 42 for (p = b; length--;)
43 *p++ = '\0'; 43 *p++ = '\0';
44} 44}
45DEF_WEAK(bzero);
diff --git a/src/lib/libc/string/explicit_bzero.c b/src/lib/libc/string/explicit_bzero.c
index 3e33ca85b8..003ea7cc4c 100644
--- a/src/lib/libc/string/explicit_bzero.c
+++ b/src/lib/libc/string/explicit_bzero.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: explicit_bzero.c,v 1.3 2014/06/21 02:34:26 matthew Exp $ */ 1/* $OpenBSD: explicit_bzero.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */
2/* 2/*
3 * Public domain. 3 * Public domain.
4 * Written by Matthew Dempsky. 4 * Written by Matthew Dempsky.
@@ -17,3 +17,4 @@ explicit_bzero(void *buf, size_t len)
17 memset(buf, 0, len); 17 memset(buf, 0, len);
18 __explicit_bzero_hook(buf, len); 18 __explicit_bzero_hook(buf, len);
19} 19}
20DEF_WEAK(explicit_bzero);
diff --git a/src/lib/libc/string/ffs.c b/src/lib/libc/string/ffs.c
index de4480a7ef..a75fd9d79f 100644
--- a/src/lib/libc/string/ffs.c
+++ b/src/lib/libc/string/ffs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ffs.c,v 1.8 2014/06/10 04:17:37 deraadt Exp $ */ 1/* $OpenBSD: ffs.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Public domain. 4 * Public domain.
@@ -38,3 +38,4 @@ ffs(int mask)
38 38
39 return (bit + t[ r & 0xf ]); 39 return (bit + t[ r & 0xf ]);
40} 40}
41DEF_WEAK(ffs);
diff --git a/src/lib/libc/string/memccpy.c b/src/lib/libc/string/memccpy.c
index 485c55fcab..635061b8cb 100644
--- a/src/lib/libc/string/memccpy.c
+++ b/src/lib/libc/string/memccpy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: memccpy.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: memccpy.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993 4 * Copyright (c) 1990, 1993
@@ -46,3 +46,4 @@ memccpy(void *t, const void *f, int c, size_t n)
46 } 46 }
47 return (0); 47 return (0);
48} 48}
49DEF_WEAK(memccpy);
diff --git a/src/lib/libc/string/memchr.c b/src/lib/libc/string/memchr.c
index 4573e3ceb1..a6a4bd60d0 100644
--- a/src/lib/libc/string/memchr.c
+++ b/src/lib/libc/string/memchr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: memchr.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: memchr.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -46,3 +46,4 @@ memchr(const void *s, int c, size_t n)
46 } 46 }
47 return (NULL); 47 return (NULL);
48} 48}
49DEF_STRONG(memchr);
diff --git a/src/lib/libc/string/memcmp.c b/src/lib/libc/string/memcmp.c
index 49384a6fb9..0df2c54d2a 100644
--- a/src/lib/libc/string/memcmp.c
+++ b/src/lib/libc/string/memcmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: memcmp.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: memcmp.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -49,3 +49,4 @@ memcmp(const void *s1, const void *s2, size_t n)
49 } 49 }
50 return (0); 50 return (0);
51} 51}
52DEF_STRONG(memcmp);
diff --git a/src/lib/libc/string/memcpy.c b/src/lib/libc/string/memcpy.c
index 1b9715e471..73136edd72 100644
--- a/src/lib/libc/string/memcpy.c
+++ b/src/lib/libc/string/memcpy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: memcpy.c,v 1.1 2014/11/30 19:43:56 deraadt Exp $ */ 1/* $OpenBSD: memcpy.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -97,3 +97,4 @@ memcpy(void *dst0, const void *src0, size_t length)
97done: 97done:
98 return (dst0); 98 return (dst0);
99} 99}
100DEF_STRONG(memcpy);
diff --git a/src/lib/libc/string/memmem.c b/src/lib/libc/string/memmem.c
index 5793a7dfd7..823443b08a 100644
--- a/src/lib/libc/string/memmem.c
+++ b/src/lib/libc/string/memmem.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: memmem.c,v 1.3 2013/05/30 01:10:45 ajacoutot Exp $ */ 1/* $OpenBSD: memmem.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com> 3 * Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com>
4 * 4 *
@@ -61,3 +61,4 @@ memmem(const void *l, size_t l_len, const void *s, size_t s_len)
61 61
62 return NULL; 62 return NULL;
63} 63}
64DEF_WEAK(memmem);
diff --git a/src/lib/libc/string/memmove.c b/src/lib/libc/string/memmove.c
index 1baad53544..2f1deb2c70 100644
--- a/src/lib/libc/string/memmove.c
+++ b/src/lib/libc/string/memmove.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: memmove.c,v 1.1 2014/11/30 19:43:56 deraadt Exp $ */ 1/* $OpenBSD: memmove.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -110,3 +110,4 @@ memmove(void *dst0, const void *src0, size_t length)
110done: 110done:
111 return (dst0); 111 return (dst0);
112} 112}
113DEF_STRONG(memmove);
diff --git a/src/lib/libc/string/memrchr.c b/src/lib/libc/string/memrchr.c
index bd27ebc620..26a33995b7 100644
--- a/src/lib/libc/string/memrchr.c
+++ b/src/lib/libc/string/memrchr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: memrchr.c,v 1.2 2007/11/27 16:22:12 martynas Exp $ */ 1/* $OpenBSD: memrchr.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 2007 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -36,3 +36,4 @@ memrchr(const void *s, int c, size_t n)
36 } 36 }
37 return(NULL); 37 return(NULL);
38} 38}
39DEF_WEAK(memrchr);
diff --git a/src/lib/libc/string/memset.c b/src/lib/libc/string/memset.c
index 61709c139d..242529ee0f 100644
--- a/src/lib/libc/string/memset.c
+++ b/src/lib/libc/string/memset.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: memset.c,v 1.6 2008/03/15 21:40:39 ray Exp $ */ 1/* $OpenBSD: memset.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -45,3 +45,4 @@ memset(void *dst, int c, size_t n)
45 } 45 }
46 return (dst); 46 return (dst);
47} 47}
48DEF_STRONG(memset);
diff --git a/src/lib/libc/string/stpncpy.c b/src/lib/libc/string/stpncpy.c
index c7c2a57c4c..6bdee5de16 100644
--- a/src/lib/libc/string/stpncpy.c
+++ b/src/lib/libc/string/stpncpy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: stpncpy.c,v 1.2 2012/07/11 10:44:59 naddy Exp $ */ 1/* $OpenBSD: stpncpy.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990 The Regents of the University of California. 4 * Copyright (c) 1990 The Regents of the University of California.
@@ -54,3 +54,4 @@ stpncpy(char *dst, const char *src, size_t n)
54 } 54 }
55 return (dst); 55 return (dst);
56} 56}
57DEF_WEAK(stpncpy);
diff --git a/src/lib/libc/string/strcasecmp.c b/src/lib/libc/string/strcasecmp.c
index 2be09136c0..edbd638722 100644
--- a/src/lib/libc/string/strcasecmp.c
+++ b/src/lib/libc/string/strcasecmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strcasecmp.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strcasecmp.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1987, 1993 4 * Copyright (c) 1987, 1993
@@ -85,6 +85,7 @@ strcasecmp(const char *s1, const char *s2)
85 return (0); 85 return (0);
86 return (cm[*us1] - cm[*--us2]); 86 return (cm[*us1] - cm[*--us2]);
87} 87}
88DEF_WEAK(strcasecmp);
88 89
89int 90int
90strncasecmp(const char *s1, const char *s2, size_t n) 91strncasecmp(const char *s1, const char *s2, size_t n)
@@ -103,3 +104,4 @@ strncasecmp(const char *s1, const char *s2, size_t n)
103 } 104 }
104 return (0); 105 return (0);
105} 106}
107DEF_WEAK(strncasecmp);
diff --git a/src/lib/libc/string/strcasestr.c b/src/lib/libc/string/strcasestr.c
index aa74c0176d..abb3e15549 100644
--- a/src/lib/libc/string/strcasestr.c
+++ b/src/lib/libc/string/strcasestr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strcasestr.c,v 1.3 2006/03/31 05:34:55 deraadt Exp $ */ 1/* $OpenBSD: strcasestr.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */
2/* $NetBSD: strcasestr.c,v 1.2 2005/02/09 21:35:47 kleink Exp $ */ 2/* $NetBSD: strcasestr.c,v 1.2 2005/02/09 21:35:47 kleink Exp $ */
3 3
4/*- 4/*-
@@ -58,3 +58,4 @@ strcasestr(const char *s, const char *find)
58 } 58 }
59 return ((char *)s); 59 return ((char *)s);
60} 60}
61DEF_WEAK(strcasestr);
diff --git a/src/lib/libc/string/strchr.c b/src/lib/libc/string/strchr.c
index 596e407c9b..b396b45b3b 100644
--- a/src/lib/libc/string/strchr.c
+++ b/src/lib/libc/string/strchr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strchr.c,v 1.2 2015/05/15 22:29:37 millert Exp $ */ 1/* $OpenBSD: strchr.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -43,3 +43,4 @@ strchr(const char *p, int ch)
43 } 43 }
44 /* NOTREACHED */ 44 /* NOTREACHED */
45} 45}
46DEF_STRONG(strchr);
diff --git a/src/lib/libc/string/strcmp.c b/src/lib/libc/string/strcmp.c
index d1b6c50d79..be175563d4 100644
--- a/src/lib/libc/string/strcmp.c
+++ b/src/lib/libc/string/strcmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strcmp.c,v 1.8 2014/06/10 04:17:37 deraadt Exp $ */ 1/* $OpenBSD: strcmp.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990 The Regents of the University of California. 4 * Copyright (c) 1990 The Regents of the University of California.
@@ -45,3 +45,4 @@ strcmp(const char *s1, const char *s2)
45 return (0); 45 return (0);
46 return (*(unsigned char *)s1 - *(unsigned char *)--s2); 46 return (*(unsigned char *)s1 - *(unsigned char *)--s2);
47} 47}
48DEF_STRONG(strcmp);
diff --git a/src/lib/libc/string/strcoll.c b/src/lib/libc/string/strcoll.c
index 2df983bd65..47a6ea4f24 100644
--- a/src/lib/libc/string/strcoll.c
+++ b/src/lib/libc/string/strcoll.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strcoll.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strcoll.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -42,3 +42,4 @@ strcoll(const char *s1, const char *s2)
42 /* LC_COLLATE is unimplemented, hence always "C" */ 42 /* LC_COLLATE is unimplemented, hence always "C" */
43 return (strcmp(s1, s2)); 43 return (strcmp(s1, s2));
44} 44}
45DEF_STRONG(strcoll);
diff --git a/src/lib/libc/string/strcspn.c b/src/lib/libc/string/strcspn.c
index 1eb233614d..3c1f5a4cec 100644
--- a/src/lib/libc/string/strcspn.c
+++ b/src/lib/libc/string/strcspn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strcspn.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strcspn.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -56,3 +56,4 @@ strcspn(const char *s1, const char *s2)
56 } 56 }
57 /* NOTREACHED */ 57 /* NOTREACHED */
58} 58}
59DEF_STRONG(strcspn);
diff --git a/src/lib/libc/string/strdup.c b/src/lib/libc/string/strdup.c
index a6aa1e03b0..9aebf399c1 100644
--- a/src/lib/libc/string/strdup.c
+++ b/src/lib/libc/string/strdup.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strdup.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strdup.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1993 4 * Copyright (c) 1988, 1993
@@ -47,3 +47,4 @@ strdup(const char *str)
47 (void)memcpy(copy, str, siz); 47 (void)memcpy(copy, str, siz);
48 return(copy); 48 return(copy);
49} 49}
50DEF_WEAK(strdup);
diff --git a/src/lib/libc/string/strerror.c b/src/lib/libc/string/strerror.c
index 13996f08e9..c6f05446fd 100644
--- a/src/lib/libc/string/strerror.c
+++ b/src/lib/libc/string/strerror.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strerror.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strerror.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 1988 Regents of the University of California. 3 * Copyright (c) 1988 Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -39,3 +39,4 @@ strerror(int num)
39 (void)strerror_r(num, buf, sizeof(buf)); 39 (void)strerror_r(num, buf, sizeof(buf));
40 return (buf); 40 return (buf);
41} 41}
42DEF_STRONG(strerror);
diff --git a/src/lib/libc/string/strerror_r.c b/src/lib/libc/string/strerror_r.c
index b85136055b..90aa012360 100644
--- a/src/lib/libc/string/strerror_r.c
+++ b/src/lib/libc/string/strerror_r.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strerror_r.c,v 1.8 2013/06/01 21:26:18 stsp Exp $ */ 1/* $OpenBSD: strerror_r.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */
2/* Public Domain <marc@snafu.org> */ 2/* Public Domain <marc@snafu.org> */
3 3
4#ifdef NLS 4#ifdef NLS
@@ -125,6 +125,7 @@ strerror_r(int errnum, char *strerrbuf, size_t buflen)
125 errno = ret_errno ? ret_errno : save_errno; 125 errno = ret_errno ? ret_errno : save_errno;
126 return (ret_errno); 126 return (ret_errno);
127} 127}
128DEF_WEAK(strerror_r);
128 129
129#define USIGPREFIX "Unknown signal: " 130#define USIGPREFIX "Unknown signal: "
130 131
diff --git a/src/lib/libc/string/strlcat.c b/src/lib/libc/string/strlcat.c
index 14c53a1f69..073b0d4259 100644
--- a/src/lib/libc/string/strlcat.c
+++ b/src/lib/libc/string/strlcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strlcat.c,v 1.15 2015/03/02 21:41:08 millert Exp $ */ 1/* $OpenBSD: strlcat.c,v 1.16 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -53,3 +53,4 @@ strlcat(char *dst, const char *src, size_t dsize)
53 53
54 return(dlen + (src - osrc)); /* count does not include NUL */ 54 return(dlen + (src - osrc)); /* count does not include NUL */
55} 55}
56DEF_WEAK(strlcat);
diff --git a/src/lib/libc/string/strlcpy.c b/src/lib/libc/string/strlcpy.c
index e9a7fe4be7..5fcf084aaa 100644
--- a/src/lib/libc/string/strlcpy.c
+++ b/src/lib/libc/string/strlcpy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strlcpy.c,v 1.12 2015/01/15 03:54:12 millert Exp $ */ 1/* $OpenBSD: strlcpy.c,v 1.13 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -48,3 +48,4 @@ strlcpy(char *dst, const char *src, size_t dsize)
48 48
49 return(src - osrc - 1); /* count does not include NUL */ 49 return(src - osrc - 1); /* count does not include NUL */
50} 50}
51DEF_WEAK(strlcpy);
diff --git a/src/lib/libc/string/strlen.c b/src/lib/libc/string/strlen.c
index 7e0e27b1d8..a5721d3e7f 100644
--- a/src/lib/libc/string/strlen.c
+++ b/src/lib/libc/string/strlen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strlen.c,v 1.8 2014/06/10 04:17:37 deraadt Exp $ */ 1/* $OpenBSD: strlen.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993 4 * Copyright (c) 1990, 1993
@@ -41,3 +41,4 @@ strlen(const char *str)
41 return (s - str); 41 return (s - str);
42} 42}
43 43
44DEF_STRONG(strlen);
diff --git a/src/lib/libc/string/strmode.c b/src/lib/libc/string/strmode.c
index 6f0fa34ed8..609b8931fb 100644
--- a/src/lib/libc/string/strmode.c
+++ b/src/lib/libc/string/strmode.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strmode.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strmode.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -138,3 +138,4 @@ strmode(int mode, char *p)
138 *p++ = ' '; /* will be a '+' if ACL's implemented */ 138 *p++ = ' '; /* will be a '+' if ACL's implemented */
139 *p = '\0'; 139 *p = '\0';
140} 140}
141DEF_WEAK(strmode);
diff --git a/src/lib/libc/string/strncat.c b/src/lib/libc/string/strncat.c
index c4df4f2fad..b3388accf3 100644
--- a/src/lib/libc/string/strncat.c
+++ b/src/lib/libc/string/strncat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strncat.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strncat.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -55,3 +55,4 @@ strncat(char *dst, const char *src, size_t n)
55 } 55 }
56 return (dst); 56 return (dst);
57} 57}
58DEF_STRONG(strncat);
diff --git a/src/lib/libc/string/strncmp.c b/src/lib/libc/string/strncmp.c
index 0a4ddc1d9e..535d2a60fd 100644
--- a/src/lib/libc/string/strncmp.c
+++ b/src/lib/libc/string/strncmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strncmp.c,v 1.8 2014/06/10 04:17:37 deraadt Exp $ */ 1/* $OpenBSD: strncmp.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1989 The Regents of the University of California. 4 * Copyright (c) 1989 The Regents of the University of California.
@@ -45,3 +45,4 @@ strncmp(const char *s1, const char *s2, size_t n)
45 } while (--n != 0); 45 } while (--n != 0);
46 return (0); 46 return (0);
47} 47}
48DEF_STRONG(strncmp);
diff --git a/src/lib/libc/string/strncpy.c b/src/lib/libc/string/strncpy.c
index 5003a199a9..d6d8647fc7 100644
--- a/src/lib/libc/string/strncpy.c
+++ b/src/lib/libc/string/strncpy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strncpy.c,v 1.7 2014/06/10 04:17:37 deraadt Exp $ */ 1/* $OpenBSD: strncpy.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990 The Regents of the University of California. 4 * Copyright (c) 1990 The Regents of the University of California.
@@ -56,3 +56,4 @@ strncpy(char *dst, const char *src, size_t n)
56 } 56 }
57 return (dst); 57 return (dst);
58} 58}
59DEF_STRONG(strncpy);
diff --git a/src/lib/libc/string/strndup.c b/src/lib/libc/string/strndup.c
index 27701ac555..a6e5bff7ca 100644
--- a/src/lib/libc/string/strndup.c
+++ b/src/lib/libc/string/strndup.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strndup.c,v 1.1 2010/05/18 22:24:55 tedu Exp $ */ 1/* $OpenBSD: strndup.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -37,3 +37,4 @@ strndup(const char *str, size_t maxlen)
37 37
38 return copy; 38 return copy;
39} 39}
40DEF_WEAK(strndup);
diff --git a/src/lib/libc/string/strnlen.c b/src/lib/libc/string/strnlen.c
index 872cfa6cce..26e9743f18 100644
--- a/src/lib/libc/string/strnlen.c
+++ b/src/lib/libc/string/strnlen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strnlen.c,v 1.5 2014/06/10 04:17:37 deraadt Exp $ */ 1/* $OpenBSD: strnlen.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -30,3 +30,4 @@ strnlen(const char *str, size_t maxlen)
30 30
31 return (size_t)(cp - str); 31 return (size_t)(cp - str);
32} 32}
33DEF_WEAK(strnlen);
diff --git a/src/lib/libc/string/strpbrk.c b/src/lib/libc/string/strpbrk.c
index cd3b71c0d3..336c22dedd 100644
--- a/src/lib/libc/string/strpbrk.c
+++ b/src/lib/libc/string/strpbrk.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strpbrk.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strpbrk.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 1985 Regents of the University of California. 3 * Copyright (c) 1985 Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -46,3 +46,4 @@ strpbrk(const char *s1, const char *s2)
46 } 46 }
47 return (NULL); 47 return (NULL);
48} 48}
49DEF_STRONG(strpbrk);
diff --git a/src/lib/libc/string/strrchr.c b/src/lib/libc/string/strrchr.c
index 181f56ea69..9375572144 100644
--- a/src/lib/libc/string/strrchr.c
+++ b/src/lib/libc/string/strrchr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strrchr.c,v 1.2 2015/05/15 22:29:37 millert Exp $ */ 1/* $OpenBSD: strrchr.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 1988 Regents of the University of California. 3 * Copyright (c) 1988 Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -45,3 +45,4 @@ strrchr(const char *p, int ch)
45 } 45 }
46 /* NOTREACHED */ 46 /* NOTREACHED */
47} 47}
48DEF_STRONG(strrchr);
diff --git a/src/lib/libc/string/strsep.c b/src/lib/libc/string/strsep.c
index 2ffc4b4c46..97c3cbf1f5 100644
--- a/src/lib/libc/string/strsep.c
+++ b/src/lib/libc/string/strsep.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strsep.c,v 1.7 2014/02/05 20:42:32 stsp Exp $ */ 1/* $OpenBSD: strsep.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993 4 * Copyright (c) 1990, 1993
@@ -68,3 +68,4 @@ strsep(char **stringp, const char *delim)
68 } 68 }
69 /* NOTREACHED */ 69 /* NOTREACHED */
70} 70}
71DEF_WEAK(strsep);
diff --git a/src/lib/libc/string/strsignal.c b/src/lib/libc/string/strsignal.c
index aa541cefed..a71a291fbc 100644
--- a/src/lib/libc/string/strsignal.c
+++ b/src/lib/libc/string/strsignal.c
@@ -39,3 +39,4 @@ strsignal(int sig)
39 39
40 return __strsignal(sig, buf); 40 return __strsignal(sig, buf);
41} 41}
42DEF_WEAK(strsignal);
diff --git a/src/lib/libc/string/strspn.c b/src/lib/libc/string/strspn.c
index 385649c041..0ce41cbb49 100644
--- a/src/lib/libc/string/strspn.c
+++ b/src/lib/libc/string/strspn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strspn.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strspn.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 1989 The Regents of the University of California. 3 * Copyright (c) 1989 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -49,3 +49,4 @@ cont:
49 goto cont; 49 goto cont;
50 return (p - 1 - s1); 50 return (p - 1 - s1);
51} 51}
52DEF_STRONG(strspn);
diff --git a/src/lib/libc/string/strstr.c b/src/lib/libc/string/strstr.c
index 95a865bf79..ccd0871700 100644
--- a/src/lib/libc/string/strstr.c
+++ b/src/lib/libc/string/strstr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strstr.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strstr.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -54,3 +54,4 @@ strstr(const char *s, const char *find)
54 } 54 }
55 return ((char *)s); 55 return ((char *)s);
56} 56}
57DEF_STRONG(strstr);
diff --git a/src/lib/libc/string/strtok.c b/src/lib/libc/string/strtok.c
index 6ba6b21cd6..c5765756fc 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)
36 36
37 return strtok_r(s, delim, &last); 37 return strtok_r(s, delim, &last);
38} 38}
39DEF_STRONG(strtok);
39 40
40char * 41char *
41strtok_r(char *s, const char *delim, char **last) 42strtok_r(char *s, const char *delim, char **last)
@@ -83,3 +84,4 @@ cont:
83 } 84 }
84 /* NOTREACHED */ 85 /* NOTREACHED */
85} 86}
87DEF_WEAK(strtok_r);
diff --git a/src/lib/libc/string/strxfrm.c b/src/lib/libc/string/strxfrm.c
index 6f289c901e..97df097b29 100644
--- a/src/lib/libc/string/strxfrm.c
+++ b/src/lib/libc/string/strxfrm.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strxfrm.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strxfrm.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */
2/*- 2/*-
3 * Copyright (c) 1990 The Regents of the University of California. 3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -49,3 +49,4 @@ strxfrm(char *dst, const char *src, size_t n)
49 return (strlen(src)); 49 return (strlen(src));
50 return (strlcpy(dst, src, n)); 50 return (strlcpy(dst, src, n));
51} 51}
52DEF_STRONG(strxfrm);
diff --git a/src/lib/libc/string/timingsafe_bcmp.c b/src/lib/libc/string/timingsafe_bcmp.c
index 0b736154ca..0409ec3244 100644
--- a/src/lib/libc/string/timingsafe_bcmp.c
+++ b/src/lib/libc/string/timingsafe_bcmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: timingsafe_bcmp.c,v 1.2 2014/06/10 04:17:37 deraadt Exp $ */ 1/* $OpenBSD: timingsafe_bcmp.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 2010 Damien Miller. All rights reserved. 3 * Copyright (c) 2010 Damien Miller. All rights reserved.
4 * 4 *
@@ -27,3 +27,4 @@ timingsafe_bcmp(const void *b1, const void *b2, size_t n)
27 ret |= *p1++ ^ *p2++; 27 ret |= *p1++ ^ *p2++;
28 return (ret != 0); 28 return (ret != 0);
29} 29}
30DEF_WEAK(timingsafe_bcmp);
diff --git a/src/lib/libc/string/timingsafe_memcmp.c b/src/lib/libc/string/timingsafe_memcmp.c
index 04e2ac5e20..373f8cb197 100644
--- a/src/lib/libc/string/timingsafe_memcmp.c
+++ b/src/lib/libc/string/timingsafe_memcmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: timingsafe_memcmp.c,v 1.1 2014/06/13 02:12:17 matthew Exp $ */ 1/* $OpenBSD: timingsafe_memcmp.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Google Inc. 3 * Copyright (c) 2014 Google Inc.
4 * 4 *
@@ -44,3 +44,4 @@ timingsafe_memcmp(const void *b1, const void *b2, size_t len)
44 44
45 return (res); 45 return (res);
46} 46}
47DEF_WEAK(timingsafe_memcmp);