diff options
-rw-r--r-- | src/lib/libc/include/namespace.h | 22 | ||||
-rw-r--r-- | src/lib/libc/string/memcpy.c | 4 | ||||
-rw-r--r-- | src/lib/libc/string/memmove.c | 4 | ||||
-rw-r--r-- | src/lib/libc/string/memset.c | 4 |
4 files changed, 23 insertions, 11 deletions
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h index 980c1a8dd6..73b845e10f 100644 --- a/src/lib/libc/include/namespace.h +++ b/src/lib/libc/include/namespace.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: namespace.h,v 1.10 2016/05/07 19:05:22 guenther Exp $ */ | 1 | /* $OpenBSD: namespace.h,v 1.11 2017/11/29 05:13:57 guenther Exp $ */ |
2 | 2 | ||
3 | #ifndef _LIBC_NAMESPACE_H_ | 3 | #ifndef _LIBC_NAMESPACE_H_ |
4 | #define _LIBC_NAMESPACE_H_ | 4 | #define _LIBC_NAMESPACE_H_ |
@@ -154,23 +154,35 @@ | |||
154 | #define DEF_CANCEL(x) __weak_alias(x, CANCEL(x)) | 154 | #define DEF_CANCEL(x) __weak_alias(x, CANCEL(x)) |
155 | #define DEF_WRAP(x) __weak_alias(x, WRAP(x)) | 155 | #define DEF_WRAP(x) __weak_alias(x, WRAP(x)) |
156 | #define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) | 156 | #define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) |
157 | #ifdef __clang__ | ||
158 | #define DEF_BUILTIN(x) __asm("") | ||
159 | #define BUILTIN __attribute__((__visibility__("protected"))) | ||
160 | #else | ||
161 | #define DEF_BUILTIN(x) DEF_STRONG(x) | ||
162 | #define BUILTIN | ||
163 | #endif | ||
157 | 164 | ||
158 | #define MAKE_CLONE(dst, src) __dso_hidden typeof(dst) HIDDEN(dst) \ | 165 | #define MAKE_CLONE(dst, src) __dso_hidden typeof(dst) HIDDEN(dst) \ |
159 | __attribute__((alias (HIDDEN_STRING(src)))) | 166 | __attribute__((alias (HIDDEN_STRING(src)))) |
160 | 167 | ||
161 | 168 | ||
162 | /* | 169 | /* |
163 | * gcc will generate calls to the functions below. | 170 | * gcc and clang will generate calls to the functions below. |
164 | * Declare and redirect them here so we always go | 171 | * Declare and redirect them here so we always go |
165 | * directly to our hidden aliases. | 172 | * directly to our hidden aliases. |
166 | */ | 173 | */ |
167 | #include <sys/_types.h> | 174 | #include <sys/_types.h> |
168 | void *memcpy(void *__restrict, const void *__restrict, __size_t); | 175 | BUILTIN void *memmove(void *, const void *, __size_t); |
169 | void *memset(void *, int, __size_t); | 176 | BUILTIN void *memcpy(void *__restrict, const void *__restrict, __size_t); |
170 | void __stack_smash_handler(const char [], int __attribute__((__unused__))); | 177 | BUILTIN void *memset(void *, int, __size_t); |
178 | BUILTIN void __stack_smash_handler(const char [], int __unused); | ||
179 | #ifndef __clang__ | ||
180 | PROTO_NORMAL(memmove); | ||
171 | PROTO_NORMAL(memcpy); | 181 | PROTO_NORMAL(memcpy); |
172 | PROTO_NORMAL(memset); | 182 | PROTO_NORMAL(memset); |
173 | PROTO_NORMAL(__stack_smash_handler); | 183 | PROTO_NORMAL(__stack_smash_handler); |
184 | #endif | ||
185 | #undef BUILTIN | ||
174 | 186 | ||
175 | #endif /* _LIBC_NAMESPACE_H_ */ | 187 | #endif /* _LIBC_NAMESPACE_H_ */ |
176 | 188 | ||
diff --git a/src/lib/libc/string/memcpy.c b/src/lib/libc/string/memcpy.c index a2516ed041..19fddc0ab5 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.3 2017/08/14 17:10:02 guenther Exp $ */ | 1 | /* $OpenBSD: memcpy.c,v 1.4 2017/11/29 05:13: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. |
@@ -106,4 +106,4 @@ memcpy(void *dst0, const void *src0, size_t length) | |||
106 | done: | 106 | done: |
107 | return (dst0); | 107 | return (dst0); |
108 | } | 108 | } |
109 | DEF_STRONG(memcpy); | 109 | DEF_BUILTIN(memcpy); |
diff --git a/src/lib/libc/string/memmove.c b/src/lib/libc/string/memmove.c index 2f1deb2c70..1cd1086ab9 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.2 2015/08/31 02:53:57 guenther Exp $ */ | 1 | /* $OpenBSD: memmove.c,v 1.3 2017/11/29 05:13: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,4 +110,4 @@ memmove(void *dst0, const void *src0, size_t length) | |||
110 | done: | 110 | done: |
111 | return (dst0); | 111 | return (dst0); |
112 | } | 112 | } |
113 | DEF_STRONG(memmove); | 113 | DEF_BUILTIN(memmove); |
diff --git a/src/lib/libc/string/memset.c b/src/lib/libc/string/memset.c index 242529ee0f..0c261f0965 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.7 2015/08/31 02:53:57 guenther Exp $ */ | 1 | /* $OpenBSD: memset.c,v 1.8 2017/11/29 05:13: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,4 +45,4 @@ memset(void *dst, int c, size_t n) | |||
45 | } | 45 | } |
46 | return (dst); | 46 | return (dst); |
47 | } | 47 | } |
48 | DEF_STRONG(memset); | 48 | DEF_BUILTIN(memset); |