1d5ac70f0Sopenharmony_ci/*
2d5ac70f0Sopenharmony_ci *  ALSA lib - dynamic symbol versions
3d5ac70f0Sopenharmony_ci *  Copyright (c) 2002 by Jaroslav Kysela <perex@perex.cz>
4d5ac70f0Sopenharmony_ci *
5d5ac70f0Sopenharmony_ci *
6d5ac70f0Sopenharmony_ci *   This library is free software; you can redistribute it and/or modify
7d5ac70f0Sopenharmony_ci *   it under the terms of the GNU Lesser General Public License as
8d5ac70f0Sopenharmony_ci *   published by the Free Software Foundation; either version 2.1 of
9d5ac70f0Sopenharmony_ci *   the License, or (at your option) any later version.
10d5ac70f0Sopenharmony_ci *
11d5ac70f0Sopenharmony_ci *   This program is distributed in the hope that it will be useful,
12d5ac70f0Sopenharmony_ci *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13d5ac70f0Sopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14d5ac70f0Sopenharmony_ci *   GNU Lesser General Public License for more details.
15d5ac70f0Sopenharmony_ci *
16d5ac70f0Sopenharmony_ci *   You should have received a copy of the GNU Lesser General Public
17d5ac70f0Sopenharmony_ci *   License along with this library; if not, write to the Free Software
18d5ac70f0Sopenharmony_ci *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19d5ac70f0Sopenharmony_ci *
20d5ac70f0Sopenharmony_ci */
21d5ac70f0Sopenharmony_ci
22d5ac70f0Sopenharmony_ci#ifndef __ALSA_SYMBOLS_H
23d5ac70f0Sopenharmony_ci#define __ALSA_SYMBOLS_H
24d5ac70f0Sopenharmony_ci
25d5ac70f0Sopenharmony_ci#if defined(PIC) && defined(VERSIONED_SYMBOLS) /* might be also configurable */
26d5ac70f0Sopenharmony_ci#define USE_VERSIONED_SYMBOLS
27d5ac70f0Sopenharmony_ci#endif
28d5ac70f0Sopenharmony_ci
29d5ac70f0Sopenharmony_ci#define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
30d5ac70f0Sopenharmony_ci#define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
31d5ac70f0Sopenharmony_ci
32d5ac70f0Sopenharmony_ci#if HAVE_ATTRIBUTE_SYMVER && __GNUC__ > 10
33d5ac70f0Sopenharmony_ci#define symbol_version(real, name, version) \
34d5ac70f0Sopenharmony_ci	extern __typeof (real) real __attribute__((symver (#name "@" #version)))
35d5ac70f0Sopenharmony_ci#define default_symbol_version(real, name, version) \
36d5ac70f0Sopenharmony_ci	extern __typeof (real) real __attribute__((symver (#name "@@" #version)))
37d5ac70f0Sopenharmony_ci#else
38d5ac70f0Sopenharmony_ci#define symbol_version(real, name, version) \
39d5ac70f0Sopenharmony_ci	__asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@" #version)
40d5ac70f0Sopenharmony_ci#define default_symbol_version(real, name, version) \
41d5ac70f0Sopenharmony_ci	__asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@@" #version)
42d5ac70f0Sopenharmony_ci#endif
43d5ac70f0Sopenharmony_ci
44d5ac70f0Sopenharmony_ci#ifdef __clang__
45d5ac70f0Sopenharmony_ci#define EXPORT_SYMBOL __attribute__((visibility("default")))
46d5ac70f0Sopenharmony_ci#else
47d5ac70f0Sopenharmony_ci#define EXPORT_SYMBOL __attribute__((visibility("default"),externally_visible))
48d5ac70f0Sopenharmony_ci#endif
49d5ac70f0Sopenharmony_ci
50d5ac70f0Sopenharmony_ci#ifdef USE_VERSIONED_SYMBOLS
51d5ac70f0Sopenharmony_ci#define use_symbol_version(real, name, version) \
52d5ac70f0Sopenharmony_ci		symbol_version(real, name, version)
53d5ac70f0Sopenharmony_ci#define use_default_symbol_version(real, name, version) \
54d5ac70f0Sopenharmony_ci		default_symbol_version(real, name, version)
55d5ac70f0Sopenharmony_ci#else
56d5ac70f0Sopenharmony_ci#define use_symbol_version(real, name, version) /* nothing */
57d5ac70f0Sopenharmony_ci#if defined(__alpha__) || defined(__mips__)
58d5ac70f0Sopenharmony_ci#define use_default_symbol_version(real, name, version) \
59d5ac70f0Sopenharmony_ci        __asm__ (".weak " ASM_NAME(#name)); \
60d5ac70f0Sopenharmony_ci        __asm__ (ASM_NAME(#name) " = " ASM_NAME(#real))
61d5ac70f0Sopenharmony_ci#else
62d5ac70f0Sopenharmony_ci#define use_default_symbol_version(real, name, version) \
63d5ac70f0Sopenharmony_ci	__asm__ (".weak " ASM_NAME(#name)); \
64d5ac70f0Sopenharmony_ci	__asm__ (".set " ASM_NAME(#name) "," ASM_NAME(#real))
65d5ac70f0Sopenharmony_ci#endif
66d5ac70f0Sopenharmony_ci#endif
67d5ac70f0Sopenharmony_ci
68d5ac70f0Sopenharmony_ci#endif /* __ALSA_SYMBOLS_H */
69