]>
Commit | Line | Data |
---|---|---|
361742ed RM |
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 | ||
cb162e13 | 25 | # include <abi-versions.h> /* header generated by abi-versions.awk */ |
361742ed RM |
26 | |
27 | /* The file abi-versions.h (generated by scripts/abi-versions.awk) defines | |
cb832354 RM |
28 | symbols like `ABI_libm_GLIBC_2_0' for each version set in the source |
29 | code for each library. For a version set that is subsumed by a later | |
30 | version set, the definition gives the subsuming set, i.e. if GLIBC_2_0 | |
31 | is subsumed by GLIBC_2_1, then ABI_libm_GLIBC_2_0 == ABI_libm_GLIBC_2_1. | |
32 | Each version set that is to be distinctly defined in the output has an | |
33 | unique positive integer value, increasing with newer versions. Thus, | |
34 | evaluating two ABI_* symbols reduces to integer values that differ only | |
35 | when the two version sets named are in fact two different ABIs we are | |
36 | supporting. If these do not differ, then there is no need to compile in | |
37 | extra code to support this version set where it has been superseded by a | |
38 | newer version. The compatibility code should be conditionalized with | |
39 | e.g. `#if SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_2)' for code introduced | |
40 | in the GLIBC_2.0 version and obsoleted in the GLIBC_2.2 version. */ | |
41 | ||
42 | # define SHLIB_COMPAT(lib, introduced, obsoleted) \ | |
43 | (ABI_##lib##_##introduced < ABI_##lib##_##obsoleted) | |
361742ed RM |
44 | |
45 | /* That header also defines symbols like `VERSION_libm_GLIBC_2_1' to | |
46 | the version set name to use for e.g. symbols first introduced into | |
47 | libm in the GLIBC_2.1 version. Definitions of symbols with explicit | |
48 | versions should look like: | |
49 | versioned_symbol (libm, new_foo, foo, GLIBC_2_1); | |
50 | This will define the symbol `foo' with the appropriate default version, | |
51 | i.e. either GLIBC_2.1 or the "earliest version" specified in | |
52 | shlib-versions if that is newer. */ | |
53 | ||
cb162e13 UD |
54 | # define versioned_symbol(lib, local, symbol, version) \ |
55 | versioned_symbol2 (local, symbol, VERSION_##lib##_##version) | |
56 | # define versioned_symbol2(local, symbol, name) \ | |
57 | default_symbol_version (local, symbol, name) | |
361742ed RM |
58 | |
59 | #else | |
60 | ||
61 | /* Not compiling ELF shared libraries at all, so never any old versions. */ | |
cb832354 | 62 | # define SHLIB_COMPAT(lib, introduced, obsoleted) 0 |
361742ed RM |
63 | |
64 | /* No versions to worry about, just make this the global definition. */ | |
cb162e13 | 65 | # define versioned_symbol(lib, local, symbol, version) \ |
361742ed RM |
66 | weak_alias (local, symbol) |
67 | ||
68 | #endif | |
69 | ||
70 | ||
71 | #endif /* shlib-compat.h */ |