summaryrefslogtreecommitdiff
path: root/src/lib/libc/include/namespace.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/include/namespace.h')
-rw-r--r--src/lib/libc/include/namespace.h90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h
deleted file mode 100644
index b42c00e4a1..0000000000
--- a/src/lib/libc/include/namespace.h
+++ /dev/null
@@ -1,90 +0,0 @@
1/* $OpenBSD: namespace.h,v 1.15 2019/11/25 22:57:28 guenther Exp $ */
2
3#ifndef _LIBC_NAMESPACE_H_
4#define _LIBC_NAMESPACE_H_
5
6/*
7 * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
8 *
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * For explanations of how to use these, see README
24 * For explanations of why we use them and how they work, see DETAILS
25 */
26
27#include <sys/cdefs.h> /* for __dso_hidden and __{weak,strong}_alias */
28
29#define __dso_protected __attribute__((__visibility__("protected")))
30
31#define HIDDEN(x) _libc_##x
32#define CANCEL(x) _libc_##x##_cancel
33#define WRAP(x) _libc_##x##_wrap
34#define HIDDEN_STRING(x) "_libc_" __STRING(x)
35#define CANCEL_STRING(x) "_libc_" __STRING(x) "_cancel"
36#define WRAP_STRING(x) "_libc_" __STRING(x) "_wrap"
37
38#define PROTO_NORMAL(x) __dso_hidden typeof(x) x asm(HIDDEN_STRING(x))
39#define PROTO_STD_DEPRECATED(x) typeof(x) x __attribute__((deprecated))
40#define PROTO_DEPRECATED(x) typeof(x) x __attribute__((deprecated, weak))
41#define PROTO_CANCEL(x) __dso_hidden typeof(x) HIDDEN(x), \
42 x asm(CANCEL_STRING(x))
43#define PROTO_WRAP(x) PROTO_NORMAL(x), WRAP(x)
44#define PROTO_PROTECTED(x) __dso_protected typeof(x) x
45
46#define DEF_STRONG(x) __strong_alias(x, HIDDEN(x))
47#define DEF_WEAK(x) __weak_alias(x, HIDDEN(x))
48#define DEF_CANCEL(x) __weak_alias(x, CANCEL(x))
49#define DEF_WRAP(x) __weak_alias(x, WRAP(x))
50#define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x))
51
52#if !defined(__clang__) && __GNUC__ != 3
53/* our gcc 4.2 handles redirecting builtins via PROTO_NORMAL()'s asm() label */
54#define DEF_BUILTIN(x) DEF_STRONG(x)
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
63#endif
64
65#define MAKE_CLONE(dst, src) __dso_hidden typeof(dst) HIDDEN(dst) \
66 __attribute__((alias (HIDDEN_STRING(src))))
67
68#define __relro __attribute__((section(".data.rel.ro")))
69
70
71/*
72 * gcc and clang will generate calls to the functions below.
73 * Declare and redirect them here so we always go
74 * directly to our hidden aliases.
75 */
76#include <sys/_types.h>
77BUILTIN void *memmove(void *, const void *, __size_t);
78BUILTIN void *memcpy(void *__restrict, const void *__restrict, __size_t);
79BUILTIN void *memset(void *, int, __size_t);
80BUILTIN void __stack_smash_handler(const char [], int __unused);
81#if !defined(__clang__) && __GNUC__ != 3
82PROTO_NORMAL(memmove);
83PROTO_NORMAL(memcpy);
84PROTO_NORMAL(memset);
85PROTO_NORMAL(__stack_smash_handler);
86#endif
87#undef BUILTIN
88
89#endif /* _LIBC_NAMESPACE_H_ */
90