]> git.ipfire.org Git - thirdparty/glibc.git/blob - include/shlib-compat.h
Update.
[thirdparty/glibc.git] / include / shlib-compat.h
1 /* Macros for managing ABI-compatibility definitions using ELF symbol versions.
2 Copyright (C) 2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
19
20 #ifndef _SHLIB_COMPAT_H
21 #define _SHLIB_COMPAT_H 1
22
23 #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
24
25 # include <abi-versions.h> /* header generated by abi-versions.awk */
26
27 /* The file abi-versions.h (generated by scripts/abi-versions.awk) defines
28 symbols like `ABI_libm_GLIBC_2_0' to either 1 or 0 indicating whether or
29 not we want to build binary compatibility for e.g. the GLIBC_2.0 version
30 set into the libm shared object. If this evaluates to zero, then there
31 is no need to compile in extra code to support this version set where it
32 has been superseded by a newer version. The compatibility code should
33 be conditionalized with `#if SHLIB_COMPAT (libm, GLIBC_2_0)'. */
34
35 # define SHLIB_COMPAT(lib, version) ABI_##lib##_##version
36
37 /* That header also defines symbols like `VERSION_libm_GLIBC_2_1' to
38 the version set name to use for e.g. symbols first introduced into
39 libm in the GLIBC_2.1 version. Definitions of symbols with explicit
40 versions should look like:
41 versioned_symbol (libm, new_foo, foo, GLIBC_2_1);
42 This will define the symbol `foo' with the appropriate default version,
43 i.e. either GLIBC_2.1 or the "earliest version" specified in
44 shlib-versions if that is newer. */
45
46 # define versioned_symbol(lib, local, symbol, version) \
47 versioned_symbol2 (local, symbol, VERSION_##lib##_##version)
48 # define versioned_symbol2(local, symbol, name) \
49 default_symbol_version (local, symbol, name)
50
51 #else
52
53 /* Not compiling ELF shared libraries at all, so never any old versions. */
54 # define SHLIB_COMPAT(lib, version) 0
55
56 /* No versions to worry about, just make this the global definition. */
57 # define versioned_symbol(lib, local, symbol, version) \
58 weak_alias (local, symbol)
59
60 #endif
61
62
63 #endif /* shlib-compat.h */