summaryrefslogtreecommitdiff
path: root/lib/libc/arch/mips64/SYS.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/arch/mips64/SYS.h')
-rw-r--r--lib/libc/arch/mips64/SYS.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/libc/arch/mips64/SYS.h b/lib/libc/arch/mips64/SYS.h
index 55926724eb9..f9b2063dc5b 100644
--- a/lib/libc/arch/mips64/SYS.h
+++ b/lib/libc/arch/mips64/SYS.h
@@ -29,12 +29,37 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: SYS.h,v 1.7 2015/04/07 01:27:06 guenther Exp $
+ * $OpenBSD: SYS.h,v 1.8 2015/08/31 02:53:56 guenther Exp $
*/
#include <sys/syscall.h>
#include <machine/asm.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) END(x); \
+ _HIDDEN_FALIAS(x,x); \
+ .size _HIDDEN(x), . - _HIDDEN(x)
+#define END_WEAK(x) END_STRONG(x); .weak x
+
+
#define CERROR _C_LABEL(__cerror)
#define _CERROR _C_LABEL(___cerror)