diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libc/include/namespace.h | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h deleted file mode 100644 index 8503de47be..0000000000 --- a/src/lib/libc/include/namespace.h +++ /dev/null | |||
| @@ -1,98 +0,0 @@ | |||
| 1 | /* $OpenBSD: namespace.h,v 1.16 2023/10/29 14:26:13 millert 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 | * ISO C11 or higher is required to build libc. | ||
| 24 | * This must come _before_ sys/cdefs.h is included. | ||
| 25 | */ | ||
| 26 | #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112 | ||
| 27 | #define _ISOC11_SOURCE 1 | ||
| 28 | #endif | ||
| 29 | |||
| 30 | /* | ||
| 31 | * For explanations of how to use these, see README | ||
| 32 | * For explanations of why we use them and how they work, see DETAILS | ||
| 33 | */ | ||
| 34 | |||
| 35 | #include <sys/cdefs.h> /* for __dso_hidden and __{weak,strong}_alias */ | ||
| 36 | |||
| 37 | #define __dso_protected __attribute__((__visibility__("protected"))) | ||
| 38 | |||
| 39 | #define HIDDEN(x) _libc_##x | ||
| 40 | #define CANCEL(x) _libc_##x##_cancel | ||
| 41 | #define WRAP(x) _libc_##x##_wrap | ||
| 42 | #define HIDDEN_STRING(x) "_libc_" __STRING(x) | ||
| 43 | #define CANCEL_STRING(x) "_libc_" __STRING(x) "_cancel" | ||
| 44 | #define WRAP_STRING(x) "_libc_" __STRING(x) "_wrap" | ||
| 45 | |||
| 46 | #define PROTO_NORMAL(x) __dso_hidden typeof(x) x asm(HIDDEN_STRING(x)) | ||
| 47 | #define PROTO_STD_DEPRECATED(x) typeof(x) x __attribute__((deprecated)) | ||
| 48 | #define PROTO_DEPRECATED(x) typeof(x) x __attribute__((deprecated, weak)) | ||
| 49 | #define PROTO_CANCEL(x) __dso_hidden typeof(x) HIDDEN(x), \ | ||
| 50 | x asm(CANCEL_STRING(x)) | ||
| 51 | #define PROTO_WRAP(x) PROTO_NORMAL(x), WRAP(x) | ||
| 52 | #define PROTO_PROTECTED(x) __dso_protected typeof(x) x | ||
| 53 | |||
| 54 | #define DEF_STRONG(x) __strong_alias(x, HIDDEN(x)) | ||
| 55 | #define DEF_WEAK(x) __weak_alias(x, HIDDEN(x)) | ||
| 56 | #define DEF_CANCEL(x) __weak_alias(x, CANCEL(x)) | ||
| 57 | #define DEF_WRAP(x) __weak_alias(x, WRAP(x)) | ||
| 58 | #define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) | ||
| 59 | |||
| 60 | #if !defined(__clang__) && __GNUC__ != 3 | ||
| 61 | /* our gcc 4.2 handles redirecting builtins via PROTO_NORMAL()'s asm() label */ | ||
| 62 | #define DEF_BUILTIN(x) DEF_STRONG(x) | ||
| 63 | #define BUILTIN | ||
| 64 | #else | ||
| 65 | /* | ||
| 66 | * clang and gcc can't redirect builtins via asm() labels, so mark | ||
| 67 | * them protected instead. | ||
| 68 | */ | ||
| 69 | #define DEF_BUILTIN(x) __asm("") | ||
| 70 | #define BUILTIN __dso_protected | ||
| 71 | #endif | ||
| 72 | |||
| 73 | #define MAKE_CLONE(dst, src) __dso_hidden typeof(dst) HIDDEN(dst) \ | ||
| 74 | __attribute__((alias (HIDDEN_STRING(src)))) | ||
| 75 | |||
| 76 | #define __relro __attribute__((section(".data.rel.ro"))) | ||
| 77 | |||
| 78 | |||
| 79 | /* | ||
| 80 | * gcc and clang will generate calls to the functions below. | ||
| 81 | * Declare and redirect them here so we always go | ||
| 82 | * directly to our hidden aliases. | ||
| 83 | */ | ||
| 84 | #include <sys/_types.h> | ||
| 85 | BUILTIN void *memmove(void *, const void *, __size_t); | ||
| 86 | BUILTIN void *memcpy(void *__restrict, const void *__restrict, __size_t); | ||
| 87 | BUILTIN void *memset(void *, int, __size_t); | ||
| 88 | BUILTIN void __stack_smash_handler(const char [], int __unused); | ||
| 89 | #if !defined(__clang__) && __GNUC__ != 3 | ||
| 90 | PROTO_NORMAL(memmove); | ||
| 91 | PROTO_NORMAL(memcpy); | ||
| 92 | PROTO_NORMAL(memset); | ||
| 93 | PROTO_NORMAL(__stack_smash_handler); | ||
| 94 | #endif | ||
| 95 | #undef BUILTIN | ||
| 96 | |||
| 97 | #endif /* _LIBC_NAMESPACE_H_ */ | ||
| 98 | |||
