summaryrefslogtreecommitdiff
path: root/lib/libm/arch/amd64/abi.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libm/arch/amd64/abi.h')
-rw-r--r--lib/libm/arch/amd64/abi.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/libm/arch/amd64/abi.h b/lib/libm/arch/amd64/abi.h
index 53b40f196eb..a94d7961b36 100644
--- a/lib/libm/arch/amd64/abi.h
+++ b/lib/libm/arch/amd64/abi.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: abi.h,v 1.4 2010/06/03 16:38:50 deraadt Exp $ */
+/* $OpenBSD: abi.h,v 1.5 2016/09/12 19:47:01 guenther Exp $ */
/* $NetBSD: abi.h,v 1.2 2003/09/14 21:26:14 fvdl Exp $ */
/*
@@ -44,3 +44,25 @@
#define FLDL_VAR(x) fldl x(%rip)
+
+/*
+ * We define a hidden alias with the prefix "_libm_" for each global symbol
+ * that may be used internally. By referencing _libm_x instead of x, other
+ * parts of libm prevent overriding by the application and avoid unnecessary
+ * relocations.
+ */
+#define _HIDDEN(x) _libm_##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 are used internally
+ * END_STD(x) Like DEF_STD() in C; for standard/reserved C names
+ * END_NONSTD(x) Like DEF_NONSTD() in C; for non-ISO C names
+ */
+#define END_STD(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x))
+#define END_NONSTD(x) END_STD(x); .weak x