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 @
2165b726605835d1b3947d648497729a4be05deddeNick Kledzik#elif defined(__arm64__)
2265b726605835d1b3947d648497729a4be05deddeNick Kledzik#define SEPARATOR %%
237c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#else
247c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define SEPARATOR ;
257c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#endif
267c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
277c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#if defined(__APPLE__)
287c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define HIDDEN_DIRECTIVE .private_extern
297c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#else
307c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define HIDDEN_DIRECTIVE .hidden
317c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#endif
327c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
337c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define GLUE2(a, b) a ## b
347c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define GLUE(a, b) GLUE2(a, b)
357c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
367c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
377c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define DEFINE_LIBUNWIND_FUNCTION(name)                   \
387c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber  .globl SYMBOL_NAME(name) SEPARATOR                      \
397c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber  SYMBOL_NAME(name):
407c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
417c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)           \
427c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber  .globl SYMBOL_NAME(name) SEPARATOR                      \
437c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR            \
447c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber  SYMBOL_NAME(name):
457c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber
467c61d80c68ef9af39fbc49ef532c2252fa719ac9Nico Weber#endif /* UNWIND_ASSEMBLY_H */
47