diff options
author | guenther <> | 2019-11-25 22:57:28 +0000 |
---|---|---|
committer | guenther <> | 2019-11-25 22:57:28 +0000 |
commit | a8b02ce01d0a38df6a9720eaa0957322fb626833 (patch) | |
tree | 467c4582e79b3b5c473e2b82515f9b3230277576 | |
parent | df62394d0d5b4caa378a276a43967717da5edc58 (diff) | |
download | openbsd-a8b02ce01d0a38df6a9720eaa0957322fb626833.tar.gz openbsd-a8b02ce01d0a38df6a9720eaa0957322fb626833.tar.bz2 openbsd-a8b02ce01d0a38df6a9720eaa0957322fb626833.zip |
gcc3, like clang and unlike our gcc4, doesn't support redirecting builtins
like mem{set,cpy,move} or __stack_smash_handler using asm() renaming. So
treat gcc3 like clang and mark such functions as protected instead.
ok ayoma@
-rw-r--r-- | src/lib/libc/include/namespace.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h index 330af4050a..b42c00e4a1 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.14 2019/06/02 01:03:01 guenther Exp $ */ | 1 | /* $OpenBSD: namespace.h,v 1.15 2019/11/25 22:57:28 guenther Exp $ */ |
2 | 2 | ||
3 | #ifndef _LIBC_NAMESPACE_H_ | 3 | #ifndef _LIBC_NAMESPACE_H_ |
4 | #define _LIBC_NAMESPACE_H_ | 4 | #define _LIBC_NAMESPACE_H_ |
@@ -48,12 +48,18 @@ | |||
48 | #define DEF_CANCEL(x) __weak_alias(x, CANCEL(x)) | 48 | #define DEF_CANCEL(x) __weak_alias(x, CANCEL(x)) |
49 | #define DEF_WRAP(x) __weak_alias(x, WRAP(x)) | 49 | #define DEF_WRAP(x) __weak_alias(x, WRAP(x)) |
50 | #define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) | 50 | #define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) |
51 | #ifdef __clang__ | 51 | |
52 | #define DEF_BUILTIN(x) __asm("") | 52 | #if !defined(__clang__) && __GNUC__ != 3 |
53 | #define BUILTIN __dso_protected | 53 | /* our gcc 4.2 handles redirecting builtins via PROTO_NORMAL()'s asm() label */ |
54 | #else | ||
55 | #define DEF_BUILTIN(x) DEF_STRONG(x) | 54 | #define DEF_BUILTIN(x) DEF_STRONG(x) |
56 | #define BUILTIN | 55 | #define BUILTIN |
56 | #else | ||
57 | /* | ||
58 | * clang and gcc can't redirect builtins via asm() labels, so mark | ||
59 | * them protected instead. | ||
60 | */ | ||
61 | #define DEF_BUILTIN(x) __asm("") | ||
62 | #define BUILTIN __dso_protected | ||
57 | #endif | 63 | #endif |
58 | 64 | ||
59 | #define MAKE_CLONE(dst, src) __dso_hidden typeof(dst) HIDDEN(dst) \ | 65 | #define MAKE_CLONE(dst, src) __dso_hidden typeof(dst) HIDDEN(dst) \ |
@@ -72,7 +78,7 @@ BUILTIN void *memmove(void *, const void *, __size_t); | |||
72 | BUILTIN void *memcpy(void *__restrict, const void *__restrict, __size_t); | 78 | BUILTIN void *memcpy(void *__restrict, const void *__restrict, __size_t); |
73 | BUILTIN void *memset(void *, int, __size_t); | 79 | BUILTIN void *memset(void *, int, __size_t); |
74 | BUILTIN void __stack_smash_handler(const char [], int __unused); | 80 | BUILTIN void __stack_smash_handler(const char [], int __unused); |
75 | #ifndef __clang__ | 81 | #if !defined(__clang__) && __GNUC__ != 3 |
76 | PROTO_NORMAL(memmove); | 82 | PROTO_NORMAL(memmove); |
77 | PROTO_NORMAL(memcpy); | 83 | PROTO_NORMAL(memcpy); |
78 | PROTO_NORMAL(memset); | 84 | PROTO_NORMAL(memset); |