2009-10-28 01:49:50 +08:00
|
|
|
/* ===-- assembly.h - compiler-rt assembler support macros -----------------===
|
|
|
|
*
|
|
|
|
* The LLVM Compiler Infrastructure
|
|
|
|
*
|
2010-11-17 06:13:33 +08:00
|
|
|
* This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
* Source Licenses. See LICENSE.TXT for details.
|
2009-10-28 01:49:50 +08:00
|
|
|
*
|
|
|
|
* ===----------------------------------------------------------------------===
|
|
|
|
*
|
|
|
|
* This file defines macros for use in compiler-rt assembler source.
|
|
|
|
* This file is not part of the interface of this library.
|
|
|
|
*
|
|
|
|
* ===----------------------------------------------------------------------===
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef COMPILERRT_ASSEMBLY_H
|
|
|
|
#define COMPILERRT_ASSEMBLY_H
|
|
|
|
|
|
|
|
#if defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__)
|
|
|
|
#define SEPARATOR @
|
|
|
|
#else
|
|
|
|
#define SEPARATOR ;
|
2010-01-19 06:19:25 +08:00
|
|
|
#endif
|
2009-10-28 01:49:50 +08:00
|
|
|
|
2010-01-19 06:19:25 +08:00
|
|
|
#if defined(__APPLE__)
|
2011-04-20 01:50:09 +08:00
|
|
|
#define HIDDEN_DIRECTIVE .private_extern
|
|
|
|
#define LOCAL_LABEL(name) L_##name
|
2014-05-13 01:38:36 +08:00
|
|
|
// tell linker it can break up file at label boundaries
|
2014-05-16 14:16:21 +08:00
|
|
|
#define FILE_LEVEL_DIRECTIVE .subsections_via_symbols
|
2014-01-15 07:31:23 +08:00
|
|
|
#define SYMBOL_IS_FUNC(name)
|
2010-01-19 06:19:25 +08:00
|
|
|
#else
|
2011-04-20 01:50:09 +08:00
|
|
|
#define HIDDEN_DIRECTIVE .hidden
|
|
|
|
#define LOCAL_LABEL(name) .L_##name
|
2014-01-15 07:31:23 +08:00
|
|
|
#define FILE_LEVEL_DIRECTIVE
|
2014-05-16 14:16:21 +08:00
|
|
|
#if defined(__arm__)
|
|
|
|
#define SYMBOL_IS_FUNC(name) .type name,%function
|
|
|
|
#else
|
|
|
|
#define SYMBOL_IS_FUNC(name) .type name,@function
|
|
|
|
#endif
|
2009-10-28 01:49:50 +08:00
|
|
|
#endif
|
|
|
|
|
2014-01-24 21:39:51 +08:00
|
|
|
#if defined(__arm__)
|
2014-05-16 14:16:21 +08:00
|
|
|
#ifndef __ARM_ARCH
|
|
|
|
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \
|
|
|
|
defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || \
|
|
|
|
defined(__ARM_ARCH_7EM__)
|
|
|
|
#define __ARM_ARCH 7
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __ARM_ARCH
|
|
|
|
#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
|
|
|
|
defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || \
|
|
|
|
defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6ZM__)
|
|
|
|
#define __ARM_ARCH 6
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __ARM_ARCH
|
|
|
|
#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \
|
|
|
|
defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__)
|
|
|
|
#define __ARM_ARCH 5
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __ARM_ARCH
|
|
|
|
#define __ARM_ARCH 4
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__ARM_ARCH_4T__) || __ARM_ARCH >= 5
|
|
|
|
#define ARM_HAS_BX
|
|
|
|
#endif
|
|
|
|
#if !defined(__ARM_FEATURE_CLZ) && \
|
|
|
|
(__ARM_ARCH >= 6 || (__ARM_ARCH == 5 && !defined(__ARM_ARCH_5__)))
|
|
|
|
#define __ARM_FEATURE_CLZ
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ARM_HAS_BX
|
|
|
|
#define JMP(r) bx r
|
|
|
|
#define JMPc(r, c) bx##c r
|
|
|
|
#else
|
|
|
|
#define JMP(r) mov pc, r
|
|
|
|
#define JMPc(r, c) mov##c pc, r
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define GLUE2(a, b) a##b
|
2011-04-20 05:22:14 +08:00
|
|
|
#define GLUE(a, b) GLUE2(a, b)
|
|
|
|
#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
|
|
|
|
|
2012-02-11 00:41:46 +08:00
|
|
|
#ifdef VISIBILITY_HIDDEN
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DECLARE_SYMBOL_VISIBILITY(name) \
|
2012-02-11 00:41:46 +08:00
|
|
|
HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR
|
2010-01-19 06:19:34 +08:00
|
|
|
#else
|
2011-08-23 05:49:47 +08:00
|
|
|
#define DECLARE_SYMBOL_VISIBILITY(name)
|
|
|
|
#endif
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DEFINE_COMPILERRT_FUNCTION(name) \
|
|
|
|
FILE_LEVEL_DIRECTIVE SEPARATOR \
|
|
|
|
.globl SYMBOL_NAME(name) SEPARATOR \
|
|
|
|
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
|
|
|
|
DECLARE_SYMBOL_VISIBILITY(name) \
|
2009-10-28 01:49:50 +08:00
|
|
|
SYMBOL_NAME(name):
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \
|
|
|
|
FILE_LEVEL_DIRECTIVE SEPARATOR \
|
|
|
|
.globl SYMBOL_NAME(name) SEPARATOR \
|
|
|
|
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
|
|
|
|
HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR \
|
2009-10-28 01:49:50 +08:00
|
|
|
SYMBOL_NAME(name):
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \
|
|
|
|
.globl name SEPARATOR \
|
|
|
|
SYMBOL_IS_FUNC(name) SEPARATOR \
|
|
|
|
HIDDEN_DIRECTIVE name SEPARATOR \
|
2010-01-19 06:19:20 +08:00
|
|
|
name:
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target) \
|
|
|
|
.globl SYMBOL_NAME(name) SEPARATOR \
|
|
|
|
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
|
2011-04-20 01:51:24 +08:00
|
|
|
.set SYMBOL_NAME(name), SYMBOL_NAME(target) SEPARATOR
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#if defined(__ARM_EABI__)
|
|
|
|
#define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) \
|
2011-04-20 01:51:24 +08:00
|
|
|
DEFINE_COMPILERRT_FUNCTION_ALIAS(aeabi_name, name)
|
|
|
|
#else
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name)
|
2011-04-20 01:51:24 +08:00
|
|
|
#endif
|
|
|
|
|
2014-01-24 02:31:46 +08:00
|
|
|
#ifdef __ELF__
|
2014-05-16 14:16:21 +08:00
|
|
|
#define END_COMPILERRT_FUNCTION(name) \
|
|
|
|
.size SYMBOL_NAME(name), . - SYMBOL_NAME(name)
|
2014-01-24 02:31:46 +08:00
|
|
|
#else
|
|
|
|
#define END_COMPILERRT_FUNCTION(name)
|
|
|
|
#endif
|
|
|
|
|
2009-10-28 01:49:50 +08:00
|
|
|
#endif /* COMPILERRT_ASSEMBLY_H */
|