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(__powerpc64__)
21 #define PPC64_OFFS_SRR0 0
22 #define PPC64_OFFS_CR 272
23 #define PPC64_OFFS_XER 280
24 #define PPC64_OFFS_LR 288
25 #define PPC64_OFFS_CTR 296
26 #define PPC64_OFFS_VRSAVE 304
27 #define PPC64_OFFS_FP 312
28 #define PPC64_OFFS_V 824
32 #elif defined(__arm64__)
38 #if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
39 #define PPC64_OPD1 .section .opd,"aw",@progbits SEPARATOR
40 #define PPC64_OPD2 SEPARATOR \
41 .p2align 3 SEPARATOR \
42 .quad .Lfunc_begin0 SEPARATOR \
43 .quad .TOC.@tocbase SEPARATOR \
52 #define GLUE2(a, b) a ## b
53 #define GLUE(a, b) GLUE2(a, b)
54 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
56 #if defined(__APPLE__)
58 #define SYMBOL_IS_FUNC(name)
59 #define EXPORT_SYMBOL(name)
60 #define HIDDEN_SYMBOL(name) .private_extern name
61 #define NO_EXEC_STACK_DIRECTIVE
63 #elif defined(__ELF__)
66 #define SYMBOL_IS_FUNC(name) .type name,%function
68 #define SYMBOL_IS_FUNC(name) .type name,@function
70 #define EXPORT_SYMBOL(name)
71 #define HIDDEN_SYMBOL(name) .hidden name
73 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
75 #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
77 #define NO_EXEC_STACK_DIRECTIVE
82 #define SYMBOL_IS_FUNC(name) \
87 #define EXPORT_SYMBOL2(name) \
88 .section .drectve,"yn" SEPARATOR \
89 .ascii "-export:", #name, "\0" SEPARATOR \
91 #if defined(_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS)
92 #define EXPORT_SYMBOL(name)
94 #define EXPORT_SYMBOL(name) EXPORT_SYMBOL2(name)
96 #define HIDDEN_SYMBOL(name)
98 #define NO_EXEC_STACK_DIRECTIVE
100 #elif defined(__sparc__)
104 #error Unsupported target
108 #define DEFINE_LIBUNWIND_FUNCTION(name) \
109 .globl SYMBOL_NAME(name) SEPARATOR \
110 EXPORT_SYMBOL(name) SEPARATOR \
111 SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
116 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name) \
117 .globl SYMBOL_NAME(name) SEPARATOR \
118 HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \
119 SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
125 #if !defined(__ARM_ARCH)
129 #if defined(__ARM_ARCH_4T__) || __ARM_ARCH >= 5
136 #define JMP(r) mov pc, r
140 #endif /* UNWIND_ASSEMBLY_H */