summaryrefslogtreecommitdiff
path: root/lib/libc/arch/sh/SYS.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/arch/sh/SYS.h')
-rw-r--r--lib/libc/arch/sh/SYS.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/libc/arch/sh/SYS.h b/lib/libc/arch/sh/SYS.h
index 468e265c947..ac7991f7cd3 100644
--- a/lib/libc/arch/sh/SYS.h
+++ b/lib/libc/arch/sh/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.6 2015/04/07 01:27:06 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.7 2015/08/31 02:53:57 guenther Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -37,6 +37,31 @@
#include <machine/asm.h>
#include <sys/syscall.h>
+/*
+ * We define a hidden alias with the prefix "_libc_" for each global symbol
+ * that may be used internally. By referencing _libc_x instead of x, other
+ * parts of libc prevent overriding by the application and avoid unnecessary
+ * relocations.
+ */
+#define _HIDDEN(x) _libc_##x
+#define _HIDDEN_ALIAS(x,y) \
+ STRONG_ALIAS(_HIDDEN(x),y); \
+ .hidden _HIDDEN(x)
+#define _HIDDEN_FALIAS(x,y) \
+ _HIDDEN_ALIAS(x,y); \
+ .type _HIDDEN(x),@function
+
+/*
+ * For functions implemented in ASM that aren't syscalls.
+ * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names
+ * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names
+ */
+#define END_STRONG(x) SET_ENTRY_SIZE(x); \
+ _HIDDEN_FALIAS(x,x); \
+ SET_ENTRY_SIZE(_HIDDEN(x))
+#define END_WEAK(x) END_STRONG(x); .weak x
+
+
#define SYSENTRY(x) \
WEAK_ALIAS(x,_thread_sys_ ## x); \
ENTRY(_thread_sys_ ## x)