aboutsummaryrefslogtreecommitdiffstats
path: root/src/assembly.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/assembly.h')
-rw-r--r--src/assembly.h74
1 files changed, 54 insertions, 20 deletions
diff --git a/src/assembly.h b/src/assembly.h
index 2df930214fae..7132b6c561b0 100644
--- a/src/assembly.h
+++ b/src/assembly.h
@@ -1,9 +1,8 @@
/* ===-- assembly.h - libUnwind assembler support macros -------------------===
*
- * The LLVM Compiler Infrastructure
- *
- * This file is dual licensed under the MIT and the University of Illinois Open
- * Source Licenses. See LICENSE.TXT for details.
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
* ===----------------------------------------------------------------------===
*
@@ -29,14 +28,26 @@
#ifdef _ARCH_PWR8
#define PPC64_HAS_VMX
#endif
-#elif defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__)
-#define SEPARATOR @
#elif defined(__arm64__)
#define SEPARATOR %%
#else
#define SEPARATOR ;
#endif
+#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
+#define PPC64_OPD1 .section .opd,"aw",@progbits SEPARATOR
+#define PPC64_OPD2 SEPARATOR \
+ .p2align 3 SEPARATOR \
+ .quad .Lfunc_begin0 SEPARATOR \
+ .quad .TOC.@tocbase SEPARATOR \
+ .quad 0 SEPARATOR \
+ .text SEPARATOR \
+.Lfunc_begin0:
+#else
+#define PPC64_OPD1
+#define PPC64_OPD2
+#endif
+
#define GLUE2(a, b) a ## b
#define GLUE(a, b) GLUE2(a, b)
#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
@@ -46,6 +57,12 @@
#define SYMBOL_IS_FUNC(name)
#define EXPORT_SYMBOL(name)
#define HIDDEN_SYMBOL(name) .private_extern name
+#define WEAK_SYMBOL(name) .weak_reference name
+#define WEAK_ALIAS(name, aliasname) \
+ .globl SYMBOL_NAME(aliasname) SEPARATOR \
+ WEAK_SYMBOL(aliasname) SEPARATOR \
+ SYMBOL_NAME(aliasname) = SYMBOL_NAME(name)
+
#define NO_EXEC_STACK_DIRECTIVE
#elif defined(__ELF__)
@@ -57,6 +74,10 @@
#endif
#define EXPORT_SYMBOL(name)
#define HIDDEN_SYMBOL(name) .hidden name
+#define WEAK_SYMBOL(name) .weak name
+#define WEAK_ALIAS(name, aliasname) \
+ WEAK_SYMBOL(aliasname) SEPARATOR \
+ SYMBOL_NAME(aliasname) = SYMBOL_NAME(name)
#if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
defined(__linux__)
@@ -72,9 +93,9 @@
.scl 2 SEPARATOR \
.type 32 SEPARATOR \
.endef
-#define EXPORT_SYMBOL2(name) \
- .section .drectve,"yn" SEPARATOR \
- .ascii "-export:", #name, "\0" SEPARATOR \
+#define EXPORT_SYMBOL2(name) \
+ .section .drectve,"yn" SEPARATOR \
+ .ascii "-export:", #name, "\0" SEPARATOR \
.text
#if defined(_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS)
#define EXPORT_SYMBOL(name)
@@ -83,6 +104,23 @@
#endif
#define HIDDEN_SYMBOL(name)
+#if defined(__MINGW32__)
+#define WEAK_ALIAS(name, aliasname) \
+ .globl SYMBOL_NAME(aliasname) SEPARATOR \
+ EXPORT_SYMBOL(aliasname) SEPARATOR \
+ SYMBOL_NAME(aliasname) = SYMBOL_NAME(name)
+#else
+#define WEAK_ALIAS3(name, aliasname) \
+ .section .drectve,"yn" SEPARATOR \
+ .ascii "-alternatename:", #aliasname, "=", #name, "\0" SEPARATOR \
+ .text
+#define WEAK_ALIAS2(name, aliasname) \
+ WEAK_ALIAS3(name, aliasname)
+#define WEAK_ALIAS(name, aliasname) \
+ EXPORT_SYMBOL(SYMBOL_NAME(aliasname)) SEPARATOR \
+ WEAK_ALIAS2(SYMBOL_NAME(name), SYMBOL_NAME(aliasname))
+#endif
+
#define NO_EXEC_STACK_DIRECTIVE
#elif defined(__sparc__)
@@ -93,17 +131,13 @@
#endif
-#define DEFINE_LIBUNWIND_FUNCTION(name) \
- .globl SYMBOL_NAME(name) SEPARATOR \
- EXPORT_SYMBOL(name) SEPARATOR \
- SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
- SYMBOL_NAME(name):
-
-#define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name) \
- .globl SYMBOL_NAME(name) SEPARATOR \
- HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \
- SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
- SYMBOL_NAME(name):
+#define DEFINE_LIBUNWIND_FUNCTION(name) \
+ .globl SYMBOL_NAME(name) SEPARATOR \
+ HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \
+ SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
+ PPC64_OPD1 \
+ SYMBOL_NAME(name): \
+ PPC64_OPD2
#if defined(__arm__)
#if !defined(__ARM_ARCH)