assembly.h revision 7c61d80c68ef9af39fbc49ef532c2252fa719ac9
17c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber/* ===-- assembly.h - libUnwind assembler support macros -------------------===
27c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber *
37c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber *                     The LLVM Compiler Infrastructure
47c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber *
57c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber * This file is dual licensed under the MIT and the University of Illinois Open
67c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber * Source Licenses. See LICENSE.TXT for details.
77c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber *
87c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber * ===----------------------------------------------------------------------===
97c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber *
107c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber * This file defines macros for use in libUnwind assembler source.
117c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber * This file is not part of the interface of this library.
127c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber *
137c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber * ===----------------------------------------------------------------------===
147c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber */
157c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
167c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#ifndef UNWIND_ASSEMBLY_H
177c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define UNWIND_ASSEMBLY_H
187c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
197c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#if defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__)
207c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define SEPARATOR @
217c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#else
227c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define SEPARATOR ;
237c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#endif
247c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
257c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#if defined(__APPLE__)
267c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define HIDDEN_DIRECTIVE .private_extern
277c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#else
287c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define HIDDEN_DIRECTIVE .hidden
297c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#endif
307c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
317c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define GLUE2(a, b) a ## b
327c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define GLUE(a, b) GLUE2(a, b)
337c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
347c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
357c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define DEFINE_LIBUNWIND_FUNCTION(name)                   \
367c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber  .globl SYMBOL_NAME(name) SEPARATOR                      \
377c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber  SYMBOL_NAME(name):
387c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
397c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)           \
407c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber  .globl SYMBOL_NAME(name) SEPARATOR                      \
417c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR            \
427c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber  SYMBOL_NAME(name):
437c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
447c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#endif /* UNWIND_ASSEMBLY_H */
45