blob: 245f96d88bbe706ffe2a3811eb2a53b1ea9e9eb3 [file] [log] [blame]
Daniel Dunbar19336a22009-10-27 17:49:50 +00001/* ===-- assembly.h - compiler-rt assembler support macros -----------------===
2 *
3 * The LLVM Compiler Infrastructure
4 *
Howard Hinnant9ad441f2010-11-16 22:13:33 +00005 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
Daniel Dunbar19336a22009-10-27 17:49:50 +00007 *
8 * ===----------------------------------------------------------------------===
9 *
10 * This file defines macros for use in compiler-rt assembler source.
11 * This file is not part of the interface of this library.
12 *
13 * ===----------------------------------------------------------------------===
14 */
15
16#ifndef COMPILERRT_ASSEMBLY_H
17#define COMPILERRT_ASSEMBLY_H
18
Daniel Dunbar19336a22009-10-27 17:49:50 +000019#if defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__)
Daniel Dunbar19336a22009-10-27 17:49:50 +000020#define SEPARATOR @
Daniel Dunbar19336a22009-10-27 17:49:50 +000021#else
Daniel Dunbar19336a22009-10-27 17:49:50 +000022#define SEPARATOR ;
Daniel Dunbar4c01bb72010-01-18 22:19:25 +000023#endif
Daniel Dunbar19336a22009-10-27 17:49:50 +000024
Daniel Dunbar4c01bb72010-01-18 22:19:25 +000025/* We can't use __USER_LABEL_PREFIX__ here, it isn't possible to concatenate the
26 *values* of two macros. This is quite brittle, though. */
27#if defined(__APPLE__)
28#define SYMBOL_NAME(name) _##name
Anton Korobeynikov647fc732011-04-19 17:50:09 +000029#define HIDDEN_DIRECTIVE .private_extern
30#define LOCAL_LABEL(name) L_##name
Daniel Dunbar4c01bb72010-01-18 22:19:25 +000031#else
32#define SYMBOL_NAME(name) name
Anton Korobeynikov647fc732011-04-19 17:50:09 +000033#define HIDDEN_DIRECTIVE .hidden
34#define LOCAL_LABEL(name) .L_##name
Daniel Dunbar19336a22009-10-27 17:49:50 +000035#endif
36
Daniel Dunbar6a571fb2010-01-18 22:19:34 +000037#ifdef VISIBILITY_HIDDEN
Anton Korobeynikov647fc732011-04-19 17:50:09 +000038#define DEFINE_COMPILERRT_FUNCTION(name) \
39 .globl SYMBOL_NAME(name) SEPARATOR \
40 HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR \
Daniel Dunbar6a571fb2010-01-18 22:19:34 +000041 SYMBOL_NAME(name):
42#else
Anton Korobeynikov647fc732011-04-19 17:50:09 +000043#define DEFINE_COMPILERRT_FUNCTION(name) \
44 .globl SYMBOL_NAME(name) SEPARATOR \
Daniel Dunbar19336a22009-10-27 17:49:50 +000045 SYMBOL_NAME(name):
Daniel Dunbar6a571fb2010-01-18 22:19:34 +000046#endif
Daniel Dunbar19336a22009-10-27 17:49:50 +000047
Anton Korobeynikov647fc732011-04-19 17:50:09 +000048#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \
49 .globl SYMBOL_NAME(name) SEPARATOR \
50 HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR \
Daniel Dunbar19336a22009-10-27 17:49:50 +000051 SYMBOL_NAME(name):
52
Daniel Dunbare136da92010-01-18 22:19:20 +000053#define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \
Anton Korobeynikov647fc732011-04-19 17:50:09 +000054 .globl name SEPARATOR \
55 HIDDEN_DIRECTIVE name SEPARATOR \
Daniel Dunbare136da92010-01-18 22:19:20 +000056 name:
57
Anton Korobeynikov37b97d12011-04-19 17:51:24 +000058#define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target) \
59 .globl SYMBOL_NAME(name) SEPARATOR \
60 .set SYMBOL_NAME(name), SYMBOL_NAME(target) SEPARATOR
61
62#if defined (__ARM_EABI__)
63# define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) \
64 DEFINE_COMPILERRT_FUNCTION_ALIAS(aeabi_name, name)
65#else
66# define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name)
67#endif
68
Daniel Dunbar19336a22009-10-27 17:49:50 +000069#endif /* COMPILERRT_ASSEMBLY_H */