1 /* ===-- assembly.h - libUnwind assembler support macros -------------------===
3 * The LLVM Compiler Infrastructure
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
8 * ===----------------------------------------------------------------------===
10 * This file defines macros for use in libUnwind assembler source.
11 * This file is not part of the interface of this library.
13 * ===----------------------------------------------------------------------===
16 #ifndef UNWIND_ASSEMBLY_H
17 #define UNWIND_ASSEMBLY_H
19 #if defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__)
21 #elif defined(__arm64__)
27 #if defined(__APPLE__)
28 #define HIDDEN_DIRECTIVE .private_extern
30 #define HIDDEN_DIRECTIVE .hidden
33 #define GLUE2(a, b) a ## b
34 #define GLUE(a, b) GLUE2(a, b)
35 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
37 #if defined(__APPLE__)
39 #define SYMBOL_IS_FUNC(name)
40 #define NO_EXEC_STACK_DIRECTIVE
42 #elif defined(__ELF__)
45 #define SYMBOL_IS_FUNC(name) .type name,%function
47 #define SYMBOL_IS_FUNC(name) .type name,@function
50 #if defined(__GNU__) || defined(__ANDROID__) || defined(__FreeBSD__)
51 #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
53 #define NO_EXEC_STACK_DIRECTIVE
58 #define SYMBOL_IS_FUNC(name) \
64 #define NO_EXEC_STACK_DIRECTIVE
68 #define DEFINE_LIBUNWIND_FUNCTION(name) \
69 .globl SYMBOL_NAME(name) SEPARATOR \
70 SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
73 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name) \
74 .globl SYMBOL_NAME(name) SEPARATOR \
75 HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR \
76 SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
80 #if !defined(__ARM_ARCH)
84 #if defined(__ARM_ARCH_4T__) || __ARM_ARCH >= 5
91 #define JMP(r) mov pc, r
95 #endif /* UNWIND_ASSEMBLY_H */