1*5bcead81Skettenis /* $OpenBSD: DEFS.h,v 1.3 2023/12/11 22:24:16 kettenis Exp $ */ 2b074422eSdrahn 3b074422eSdrahn /*- 4b074422eSdrahn * Copyright (c) 1990 The Regents of the University of California. 5b074422eSdrahn * All rights reserved. 6b074422eSdrahn * 7b074422eSdrahn * This code is derived from software contributed to Berkeley by 8b074422eSdrahn * William Jolitz. 9b074422eSdrahn * 10b074422eSdrahn * Redistribution and use in source and binary forms, with or without 11b074422eSdrahn * modification, are permitted provided that the following conditions 12b074422eSdrahn * are met: 13b074422eSdrahn * 1. Redistributions of source code must retain the above copyright 14b074422eSdrahn * notice, this list of conditions and the following disclaimer. 15b074422eSdrahn * 2. Redistributions in binary form must reproduce the above copyright 16b074422eSdrahn * notice, this list of conditions and the following disclaimer in the 17b074422eSdrahn * documentation and/or other materials provided with the distribution. 18b074422eSdrahn * 3. Neither the name of the University nor the names of its contributors 19b074422eSdrahn * may be used to endorse or promote products derived from this software 20b074422eSdrahn * without specific prior written permission. 21b074422eSdrahn * 22b074422eSdrahn * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23b074422eSdrahn * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24b074422eSdrahn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25b074422eSdrahn * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26b074422eSdrahn * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27b074422eSdrahn * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28b074422eSdrahn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29b074422eSdrahn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30b074422eSdrahn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31b074422eSdrahn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32b074422eSdrahn * SUCH DAMAGE. 33b074422eSdrahn * 34b074422eSdrahn * from: @(#)SYS.h 5.5 (Berkeley) 5/7/91 35b074422eSdrahn * $NetBSD: SYS.h,v 1.5 2002/06/03 18:30:32 fvdl Exp $ 36b074422eSdrahn */ 37b074422eSdrahn 38b074422eSdrahn #include <machine/asm.h> 39b074422eSdrahn 40b074422eSdrahn /* 41b074422eSdrahn * We define a hidden alias with the prefix "_libc_" for each global symbol 42b074422eSdrahn * that may be used internally. By referencing _libc_x instead of x, other 43b074422eSdrahn * parts of libc prevent overriding by the application and avoid unnecessary 44b074422eSdrahn * relocations. 45b074422eSdrahn */ 46b074422eSdrahn #define _HIDDEN(x) _libc_##x 47b074422eSdrahn #define _HIDDEN_ALIAS(x,y) \ 48b074422eSdrahn STRONG_ALIAS(_HIDDEN(x),y); \ 49b074422eSdrahn .hidden _HIDDEN(x) 50b074422eSdrahn #define _HIDDEN_FALIAS(x,y) \ 51b074422eSdrahn _HIDDEN_ALIAS(x,y); \ 52b074422eSdrahn .type _HIDDEN(x),@function 53b074422eSdrahn 54b074422eSdrahn /* 55b074422eSdrahn * For functions implemented in ASM that aren't syscalls. 56b074422eSdrahn * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names 57b074422eSdrahn * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names 58b074422eSdrahn * END_BUILTIN(x) If compiling with clang, then just END() and 59b074422eSdrahn * mark it .protected, else be like END_STRONG(); 60b074422eSdrahn * for clang builtins like memcpy 61b074422eSdrahn */ 62b074422eSdrahn #define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) 63b074422eSdrahn #define END_WEAK(x) END_STRONG(x); .weak x 64b074422eSdrahn 65b074422eSdrahn #ifdef __clang__ 66b074422eSdrahn #define END_BUILTIN(x) END(x); .protected x 67b074422eSdrahn #else 68b074422eSdrahn #define END_BUILTIN(x) END_STRONG(x) 69b074422eSdrahn #endif 7083762a71Sderaadt 7183762a71Sderaadt #define PINSYSCALL(sysno, label) \ 7283762a71Sderaadt .pushsection .openbsd.syscalls,"",@progbits; \ 73*5bcead81Skettenis .p2align 2; \ 7483762a71Sderaadt .long label; \ 7583762a71Sderaadt .long sysno; \ 7683762a71Sderaadt .popsection; 77