Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 1 | /* ===-- assembly.h - compiler-rt assembler support macros -----------------=== |
| 2 | * |
| 3 | * The LLVM Compiler Infrastructure |
| 4 | * |
Howard Hinnant | 9ad441f | 2010-11-16 22:13:33 +0000 | [diff] [blame] | 5 | * This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | * Source Licenses. See LICENSE.TXT for details. |
Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 7 | * |
| 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 Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 19 | #if defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__) |
Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 20 | #define SEPARATOR @ |
Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 21 | #else |
Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 22 | #define SEPARATOR ; |
Daniel Dunbar | 4c01bb7 | 2010-01-18 22:19:25 +0000 | [diff] [blame] | 23 | #endif |
Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 24 | |
Daniel Dunbar | 4c01bb7 | 2010-01-18 22:19:25 +0000 | [diff] [blame] | 25 | #if defined(__APPLE__) |
Anton Korobeynikov | 647fc73 | 2011-04-19 17:50:09 +0000 | [diff] [blame] | 26 | #define HIDDEN_DIRECTIVE .private_extern |
| 27 | #define LOCAL_LABEL(name) L_##name |
Daniel Dunbar | 4c01bb7 | 2010-01-18 22:19:25 +0000 | [diff] [blame] | 28 | #else |
Anton Korobeynikov | 647fc73 | 2011-04-19 17:50:09 +0000 | [diff] [blame] | 29 | #define HIDDEN_DIRECTIVE .hidden |
| 30 | #define LOCAL_LABEL(name) .L_##name |
Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 31 | #endif |
| 32 | |
Anton Korobeynikov | e294935 | 2011-04-19 21:22:14 +0000 | [diff] [blame] | 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) |
| 36 | |
Bob Wilson | 36c2425 | 2012-02-10 16:41:46 +0000 | [diff] [blame^] | 37 | #ifdef VISIBILITY_HIDDEN |
Bob Wilson | 41ae71d | 2011-08-22 21:49:47 +0000 | [diff] [blame] | 38 | #define DECLARE_SYMBOL_VISIBILITY(name) \ |
Bob Wilson | 36c2425 | 2012-02-10 16:41:46 +0000 | [diff] [blame^] | 39 | HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR |
Daniel Dunbar | 6a571fb | 2010-01-18 22:19:34 +0000 | [diff] [blame] | 40 | #else |
Bob Wilson | 41ae71d | 2011-08-22 21:49:47 +0000 | [diff] [blame] | 41 | #define DECLARE_SYMBOL_VISIBILITY(name) |
| 42 | #endif |
| 43 | |
Anton Korobeynikov | 647fc73 | 2011-04-19 17:50:09 +0000 | [diff] [blame] | 44 | #define DEFINE_COMPILERRT_FUNCTION(name) \ |
| 45 | .globl SYMBOL_NAME(name) SEPARATOR \ |
Bob Wilson | 36c2425 | 2012-02-10 16:41:46 +0000 | [diff] [blame^] | 46 | DECLARE_SYMBOL_VISIBILITY(name) \ |
Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 47 | SYMBOL_NAME(name): |
| 48 | |
Anton Korobeynikov | 647fc73 | 2011-04-19 17:50:09 +0000 | [diff] [blame] | 49 | #define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \ |
| 50 | .globl SYMBOL_NAME(name) SEPARATOR \ |
| 51 | HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR \ |
Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 52 | SYMBOL_NAME(name): |
| 53 | |
Daniel Dunbar | e136da9 | 2010-01-18 22:19:20 +0000 | [diff] [blame] | 54 | #define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \ |
Anton Korobeynikov | 647fc73 | 2011-04-19 17:50:09 +0000 | [diff] [blame] | 55 | .globl name SEPARATOR \ |
| 56 | HIDDEN_DIRECTIVE name SEPARATOR \ |
Daniel Dunbar | e136da9 | 2010-01-18 22:19:20 +0000 | [diff] [blame] | 57 | name: |
| 58 | |
Anton Korobeynikov | 37b97d1 | 2011-04-19 17:51:24 +0000 | [diff] [blame] | 59 | #define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target) \ |
| 60 | .globl SYMBOL_NAME(name) SEPARATOR \ |
| 61 | .set SYMBOL_NAME(name), SYMBOL_NAME(target) SEPARATOR |
| 62 | |
| 63 | #if defined (__ARM_EABI__) |
| 64 | # define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) \ |
| 65 | DEFINE_COMPILERRT_FUNCTION_ALIAS(aeabi_name, name) |
| 66 | #else |
| 67 | # define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) |
| 68 | #endif |
| 69 | |
Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 70 | #endif /* COMPILERRT_ASSEMBLY_H */ |