diff options
author | 2015-09-10 18:13:46 +0000 | |
---|---|---|
committer | 2015-09-10 18:13:46 +0000 | |
commit | e6f98e3a163d69d2a20131b8c80e6fad49fe7683 (patch) | |
tree | 5ab5a47b62d9d534bee925c48d67d4c5031e09a1 /lib/libc/include | |
parent | When loading a DSA key from an raw (without DH parameters) ASN.1 serialization, (diff) | |
download | wireguard-openbsd-e6f98e3a163d69d2a20131b8c80e6fad49fe7683.tar.xz wireguard-openbsd-e6f98e3a163d69d2a20131b8c80e6fad49fe7683.zip |
Pull in namespace.h when building all .c files using gcc's -include option,
so that we can provide asm labels for the memcpy/memset/__stack_smash_handler
calls that it generates ab initio. Eliminate direct #includes of it. Make
sure it's a dependency of all objects (unnecessary for asm, but close enough).
ok deraadt@
Diffstat (limited to 'lib/libc/include')
-rw-r--r-- | lib/libc/include/namespace.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h index 939515251e9..c8c864a266e 100644 --- a/lib/libc/include/namespace.h +++ b/lib/libc/include/namespace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: namespace.h,v 1.5 2015/09/06 20:26:20 guenther Exp $ */ +/* $OpenBSD: namespace.h,v 1.6 2015/09/10 18:13:46 guenther Exp $ */ #ifndef _LIBC_NAMESPACE_H_ #define _LIBC_NAMESPACE_H_ @@ -126,6 +126,8 @@ * ex: DEF_SYS(pread) */ +#include <sys/cdefs.h> /* for __dso_hidden and __{weak,strong}_alias */ + #define HIDDEN(x) _libc_##x #define CANCEL(x) _libc_##x##_cancel #define WRAP(x) _libc_##x##_wrap @@ -144,5 +146,19 @@ #define DEF_WRAP(x) __weak_alias(x, WRAP(x)) #define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) + +/* + * gcc will generate calls to the functions below. + * Declare and redirect them here so we always go + * directly to our hidden aliases. + */ +#include <sys/_types.h> +void *memcpy(void *__restrict, const void *__restrict, __size_t); +void *memset(void *, int, __size_t); +void __stack_smash_handler(const char [], int __attribute__((__unused__))); +PROTO_NORMAL(memcpy); +PROTO_NORMAL(memset); +PROTO_NORMAL(__stack_smash_handler); + #endif /* _LIBC_NAMESPACE_H_ */ |