summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libc/include/namespace.h158
-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
43 files changed, 233 insertions, 49 deletions
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h
index 4a51f15ddf..b0cad502a3 100644
--- a/src/lib/libc/include/namespace.h
+++ b/src/lib/libc/include/namespace.h
@@ -1,18 +1,158 @@
1/* $OpenBSD: namespace.h,v 1.2 1996/08/19 08:28:08 tholo Exp $ */ 1/* $OpenBSD: namespace.h,v 1.3 2015/08/31 02:53:56 guenther Exp $ */
2 2
3#ifndef _LIBC_NAMESPACE_H_
4#define _LIBC_NAMESPACE_H_
5
6/* These will be replaced with symbol renaming ala PROTO_NORMAL */
3#define catclose _catclose 7#define catclose _catclose
4#define catgets _catgets 8#define catgets _catgets
5#define catopen _catopen 9#define catopen _catopen
6#define err _err
7#define errx _errx
8#define strtoq _strtoq 10#define strtoq _strtoq
9#define strtouq _strtouq 11#define strtouq _strtouq
10#define sys_errlist _sys_errlist 12#define sys_errlist _sys_errlist
11#define sys_nerr _sys_nerr 13#define sys_nerr _sys_nerr
12#define sys_siglist _sys_siglist 14#define sys_siglist _sys_siglist
13#define verr _verr 15
14#define verrx _verrx 16/*
15#define vwarn _vwarn 17 * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
16#define vwarnx _vwarnx 18 *
17#define warn _warn 19 * Permission to use, copy, modify, and distribute this software for any
18#define warnx _warnx 20 * purpose with or without fee is hereby granted, provided that the above
21 * copyright notice and this permission notice appear in all copies.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
24 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
26 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
28 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
29 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30 */
31
32/*
33 * The goal: calls from inside libc to other libc functions should be via
34 * identifiers that are of hidden visibility and--to avoid confusion--are
35 * in the reserved namespace. By doing this these calls are protected
36 * from overriding by applications and on many platforms can avoid creation
37 * or use of GOT or PLT entries. I've chosen a prefix of underbar-C-underbar
38 * ("_libc_") for this. These will not be declared directly; instead, the
39 * gcc "asm labels" extension will be used rename the function.
40 *
41 * For syscalls which are cancellation points, such as wait4(), there
42 * are identifiers that do not provide cancellation:
43 * _libc_wait4 hidden alias, for use internal to libc only
44 * _thread_sys_wait4 global name, for use outside libc only
45 * ...and identifiers that do provide cancellation:
46 * wait4 weak alias, for general use
47 * _libc_wait4_cancel hidden alias, for use internal to libc only
48 * Inside libc, the bare name ("wait4") binds to the version *without*
49 * cancellation; the few times where cancellation is desired it can be
50 * obtained by calling CANCEL(x) instead of just x.
51 *
52 * Some other calls need to be wrapped for reasons other than cancellation,
53 * such as to provide functionality beyond the underlying syscall (e.g.,
54 * setlogin). For these, there are identifiers for the raw call, without
55 * the wrapping:
56 * _libc_setlogin hidden alias, for use internal to libc only
57 * _thread_sys_setlogin global name, for use outside libc only
58 * ...and identifiers that do provide the libc wrapping:
59 * setlogin weak alias, for general use
60 * _libc_setlogin_wrap hidden alias, for use internal to libc only
61 * Inside libc, the bare name ("setlogin") binds to the wrapper; when the
62 * raw version is necessary it can be obtained by calling HIDDEN(x) instead of
63 * just x.
64 *
65 * For syscalls which are not cancellation points, such as getpid(),
66 * the identifiers are just:
67 * _libc_getpid hidden alias, for use internal to libc only
68 * _thread_sys_getpid global name, for use outside libc only
69 * getpid weak alias, for use outside libc only
70 *
71 * By using gcc's "asm label" extension, we can usually avoid having
72 * to type those prefixes in the .h and .c files. However, for those
73 * cases where a non-default binding is necessary we can use these macros
74 * to get the desired identifier:
75 *
76 * CANCEL(x)
77 * This expands to the internal, hidden name of a cancellation
78 * wrapper: _libc_x_cancel. ex: CANCEL(fsync)(fd)
79 *
80 * WRAP(x)
81 * This expands to the internal, hidden name of a non-cancellation
82 * wrapper: _libc_x_wrap. ex: WRAP(sigpending)(set)
83 *
84 *
85 * In order to actually set up the desired asm labels, we use these in
86 * the internal .h files:
87 * PROTO_NORMAL(x) Symbols used both internally and externally
88 * This makes gcc convert use of x to use _libc_x instead
89 * ex: PROTO_NORMAL(getpid)
90 *
91 * PROTO_STD_DEPRECATED(x) Standard C symbols that we don't want to use
92 * This just marks the symbol as deprecated, with no renaming.
93 * ex: PROTO_STD_DEPRECATED(strcpy)
94 *
95 * PROTO_DEPRECATED(x) Symbols not in ISO C that we don't want to use
96 * This marks the symbol as both weak and deprecated, with no renaming
97 * ex: PROTO_DEPRECATED(creat)
98 *
99 * PROTO_CANCEL(x) Functions that have cancellation wrappers
100 * Like PROTO_NORMAL(x), but also declares _libc_x_cancel
101 * ex: PROTO_CANCEL(wait4)
102 *
103 * PROTO_WRAP(x) Functions that have wrappers for other reasons
104 * This makes gcc convert use of x to use _libc_x_wrap instead.
105 * ex: PROTO_WRAP(setlogin)
106 *
107 *
108 * Finally, to create the expected aliases, we use these in the .c files
109 * where the definitions are:
110 * DEF_STRONG(x) Symbols reserved to or specified by ISO C
111 * This defines x as a strong alias for _libc_x; this must only
112 * be used for symbols that are reserved by the C standard
113 * (or reserved in the external identifier namespace).
114 * Matches with PROTO_NORMAL()
115 * ex: DEF_STRONG(fopen)
116 *
117 * DEF_WEAK(x) Symbols used internally and not in ISO C
118 * This defines x as a weak alias for _libc_x
119 * Matches with PROTO_NORMAL()
120 * ex: DEF_WEAK(lseek)
121 *
122 * DEF_CANCEL(x) Symbols that have a cancellation wrapper
123 * This defines x as a weak alias for _libc_x_cancel.
124 * Matches with PROTO_CANCEL()
125 * ex: DEF_CANCEL(read)
126 *
127 * DEF_WRAP(x)
128 * This defines x as a weak alias for _libc_x_wrap.
129 * Matches with PROTO_WRAP()
130 * ex: DEF_WRAP(setlogin)
131 *
132 * DEF_SYS(x)
133 * This defines _thread_sys_x as a strong alias for _libc_x. This should
134 * only be needed for syscalls that have C instead of asm stubs.
135 * Matches with PROTO_NORMAL(), PROTO_CANCEL(), or PROTO_WRAP()
136 * ex: DEF_SYS(pread)
137 */
138
139#define HIDDEN(x) _libc_##x
140#define CANCEL(x) _libc_##x##_cancel
141#define WRAP(x) _libc_##x##_wrap
142#define HIDDEN_STRING(x) "_libc_" __STRING(x)
143#define WRAP_STRING(x) "_libc_" __STRING(x) "_wrap"
144
145#define PROTO_NORMAL(x) __dso_hidden typeof(x) x asm(HIDDEN_STRING(x))
146#define PROTO_STD_DEPRECATED(x) typeof(x) x __attribute__((deprecated))
147#define PROTO_DEPRECATED(x) typeof(x) x __attribute__((deprecated, weak))
148#define PROTO_CANCEL(x) PROTO_NORMAL(x), CANCEL(x)
149#define PROTO_WRAP(x) __dso_hidden typeof(x) x asm(WRAP_STRING(x))
150
151#define DEF_STRONG(x) __strong_alias(x, HIDDEN(x))
152#define DEF_WEAK(x) __weak_alias(x, HIDDEN(x))
153#define DEF_CANCEL(x) __weak_alias(x, CANCEL(x))
154#define DEF_WRAP(x) __weak_alias(x, WRAP(x))
155#define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x))
156
157#endif /* _LIBC_NAMESPACE_H_ */
158
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);