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