summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorguenther <>2015-09-10 18:13:46 +0000
committerguenther <>2015-09-10 18:13:46 +0000
commitb022c4b5d5862d2163006883afb64e8e3dcf6cd3 (patch)
tree6aaac16d7329a2515c241e88af030f17d748ff9b /src
parent4d8f1b8a1c6038052fa50739b021c737eedb444f (diff)
downloadopenbsd-b022c4b5d5862d2163006883afb64e8e3dcf6cd3.tar.gz
openbsd-b022c4b5d5862d2163006883afb64e8e3dcf6cd3.tar.bz2
openbsd-b022c4b5d5862d2163006883afb64e8e3dcf6cd3.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 'src')
-rw-r--r--src/lib/libc/include/namespace.h18
-rw-r--r--src/lib/libc/stdlib/hcreate.c3
2 files changed, 18 insertions, 3 deletions
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 @@
1/* $OpenBSD: namespace.h,v 1.5 2015/09/06 20:26:20 guenther Exp $ */ 1/* $OpenBSD: namespace.h,v 1.6 2015/09/10 18:13:46 guenther Exp $ */
2 2
3#ifndef _LIBC_NAMESPACE_H_ 3#ifndef _LIBC_NAMESPACE_H_
4#define _LIBC_NAMESPACE_H_ 4#define _LIBC_NAMESPACE_H_
@@ -126,6 +126,8 @@
126 * ex: DEF_SYS(pread) 126 * ex: DEF_SYS(pread)
127 */ 127 */
128 128
129#include <sys/cdefs.h> /* for __dso_hidden and __{weak,strong}_alias */
130
129#define HIDDEN(x) _libc_##x 131#define HIDDEN(x) _libc_##x
130#define CANCEL(x) _libc_##x##_cancel 132#define CANCEL(x) _libc_##x##_cancel
131#define WRAP(x) _libc_##x##_wrap 133#define WRAP(x) _libc_##x##_wrap
@@ -144,5 +146,19 @@
144#define DEF_WRAP(x) __weak_alias(x, WRAP(x)) 146#define DEF_WRAP(x) __weak_alias(x, WRAP(x))
145#define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) 147#define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x))
146 148
149
150/*
151 * gcc will generate calls to the functions below.
152 * Declare and redirect them here so we always go
153 * directly to our hidden aliases.
154 */
155#include <sys/_types.h>
156void *memcpy(void *__restrict, const void *__restrict, __size_t);
157void *memset(void *, int, __size_t);
158void __stack_smash_handler(const char [], int __attribute__((__unused__)));
159PROTO_NORMAL(memcpy);
160PROTO_NORMAL(memset);
161PROTO_NORMAL(__stack_smash_handler);
162
147#endif /* _LIBC_NAMESPACE_H_ */ 163#endif /* _LIBC_NAMESPACE_H_ */
148 164
diff --git a/src/lib/libc/stdlib/hcreate.c b/src/lib/libc/stdlib/hcreate.c
index d0a377010e..cb547a8d36 100644
--- a/src/lib/libc/stdlib/hcreate.c
+++ b/src/lib/libc/stdlib/hcreate.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hcreate.c,v 1.5 2014/08/10 02:15:18 guenther Exp $ */ 1/* $OpenBSD: hcreate.c,v 1.6 2015/09/10 18:13:46 guenther Exp $ */
2/* $NetBSD: hcreate.c,v 1.5 2004/04/23 02:48:12 simonb Exp $ */ 2/* $NetBSD: hcreate.c,v 1.5 2004/04/23 02:48:12 simonb Exp $ */
3 3
4/* 4/*
@@ -47,7 +47,6 @@
47 * nobody had a copy in the office, so... 47 * nobody had a copy in the office, so...
48 */ 48 */
49 49
50#include "namespace.h"
51#include <assert.h> 50#include <assert.h>
52#include <errno.h> 51#include <errno.h>
53#include <stdint.h> 52#include <stdint.h>