1 /* $OpenBSD: DEFS.h,v 1.5 2023/12/11 22:24:15 kettenis Exp $ */ 2 3 #include <machine/asm.h> 4 5 /* 6 * We define a hidden alias with the prefix "_libc_" for each global symbol 7 * that may be used internally. By referencing _libc_x instead of x, other 8 * parts of libc prevent overriding by the application and avoid unnecessary 9 * relocations. 10 */ 11 #define _HIDDEN(x) _libc_##x 12 #define _HIDDEN_ALIAS(x,y) \ 13 STRONG_ALIAS(_HIDDEN(x),y); \ 14 .hidden _HIDDEN(x) 15 #define _HIDDEN_FALIAS(x,y) \ 16 _HIDDEN_ALIAS(x,y); \ 17 .type _HIDDEN(x),@function 18 19 /* 20 * For functions implemented in ASM that aren't syscalls. 21 * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names 22 * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names 23 */ 24 #define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) 25 #define END_WEAK(x) END_STRONG(x); .weak x 26 27 #define PINSYSCALL(sysno, label) \ 28 .pushsection .openbsd.syscalls,"",@progbits; \ 29 .p2align 2; \ 30 .long label; \ 31 .long sysno; \ 32 .popsection; 33