summaryrefslogtreecommitdiff
path: root/lib/assembly.h
blob: 41c24d74ead35024205908ca9ebd1eeb6a32e578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* ===-- assembly.h - compiler-rt assembler support macros -----------------===
 *
 *                     The LLVM Compiler Infrastructure
 *
 * This file is dual licensed under the MIT and the University of Illinois Open
 * Source Licenses. See LICENSE.TXT for details.
 *
 * ===----------------------------------------------------------------------===
 *
 * 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 ;
#endif

/* We can't use __USER_LABEL_PREFIX__ here, it isn't possible to concatenate the
   *values* of two macros. This is quite brittle, though. */
#if defined(__APPLE__)
#define SYMBOL_NAME(name) _##name
#else
#define SYMBOL_NAME(name) name
#endif

#ifdef VISIBILITY_HIDDEN
#define DEFINE_COMPILERRT_FUNCTION(name) \
  .globl SYMBOL_NAME(name) SEPARATOR     \
  .private_extern SYMBOL_NAME(name) SEPARATOR    \
  SYMBOL_NAME(name):
#else
#define DEFINE_COMPILERRT_FUNCTION(name) \
  .globl SYMBOL_NAME(name) SEPARATOR     \
  SYMBOL_NAME(name):
#endif

#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \
  .globl SYMBOL_NAME(name) SEPARATOR             \
  .private_extern SYMBOL_NAME(name) SEPARATOR    \
  SYMBOL_NAME(name):

#define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \
  .globl name SEPARATOR             \
  .private_extern name SEPARATOR    \
  name:

#endif /* COMPILERRT_ASSEMBLY_H */