From b022c4b5d5862d2163006883afb64e8e3dcf6cd3 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Thu, 10 Sep 2015 18:13:46 +0000 Subject: 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@ --- src/lib/libc/include/namespace.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/lib/libc/include/namespace.h') diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h index 939515251e..c8c864a266 100644 --- a/src/lib/libc/include/namespace.h +++ b/src/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 /* 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 +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_ */ -- cgit v1.2.3-55-g6feb