Remove _dl_initial_dtv
[glibc.git] / include / shlib-compat.h
blob912f5423e57ac6ee0fdf99d19709a7f457261b8d
1 /* Macros for managing ABI-compatibility definitions using ELF symbol versions.
2 Copyright (C) 2000, 2002, 2006, 2012 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _SHLIB_COMPAT_H
20 #define _SHLIB_COMPAT_H 1
22 #if defined DO_VERSIONING
23 /* Since there is just one set of .d files generated, we need to
24 include this unconditionally to have the dependency noticed properly. */
25 #include <abi-versions.h> /* header generated by abi-versions.awk */
26 #endif
28 #if defined SHARED && defined DO_VERSIONING
30 /* The file abi-versions.h (generated by scripts/abi-versions.awk) defines
31 symbols like `ABI_libm_GLIBC_2_0' for each version set in the source
32 code for each library. For a version set that is subsumed by a later
33 version set, the definition gives the subsuming set, i.e. if GLIBC_2_0
34 is subsumed by GLIBC_2_1, then ABI_libm_GLIBC_2_0 == ABI_libm_GLIBC_2_1.
35 Each version set that is to be distinctly defined in the output has an
36 unique positive integer value, increasing with newer versions. Thus,
37 evaluating two ABI_* symbols reduces to integer values that differ only
38 when the two version sets named are in fact two different ABIs we are
39 supporting. If these do not differ, then there is no need to compile in
40 extra code to support this version set where it has been superseded by a
41 newer version. The compatibility code should be conditionalized with
42 e.g. `#if SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_2)' for code introduced
43 in the GLIBC_2.0 version and obsoleted in the GLIBC_2.2 version. */
45 # define SHLIB_COMPAT(lib, introduced, obsoleted) \
46 _SHLIB_COMPAT (lib, introduced, obsoleted)
47 # define _SHLIB_COMPAT(lib, introduced, obsoleted) \
48 ((IS_IN_##lib - 0) \
49 && (!(ABI_##lib##_##obsoleted - 0) \
50 || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))))
52 # ifndef NOT_IN_libc
53 # define IS_IN_libc 1
54 # endif
56 /* That header also defines symbols like `VERSION_libm_GLIBC_2_1' to
57 the version set name to use for e.g. symbols first introduced into
58 libm in the GLIBC_2.1 version. Definitions of symbols with explicit
59 versions should look like:
60 versioned_symbol (libm, new_foo, foo, GLIBC_2_1);
61 This will define the symbol `foo' with the appropriate default version,
62 i.e. either GLIBC_2.1 or the "earliest version" specified in
63 shlib-versions if that is newer. */
65 # define versioned_symbol(lib, local, symbol, version) \
66 versioned_symbol_1 (lib, local, symbol, version)
67 # define versioned_symbol_1(lib, local, symbol, version) \
68 versioned_symbol_2 (local, symbol, VERSION_##lib##_##version)
69 # define versioned_symbol_2(local, symbol, name) \
70 default_symbol_version (local, symbol, name)
72 # define compat_symbol(lib, local, symbol, version) \
73 compat_symbol_1 (lib, local, symbol, version)
74 # define compat_symbol_1(lib, local, symbol, version) \
75 compat_symbol_2 (local, symbol, VERSION_##lib##_##version)
76 # define compat_symbol_2(local, symbol, name) \
77 symbol_version (local, symbol, name)
79 #else
81 /* Not compiling ELF shared libraries at all, so never any old versions. */
82 # define SHLIB_COMPAT(lib, introduced, obsoleted) 0
84 /* No versions to worry about, just make this the global definition. */
85 # define versioned_symbol(lib, local, symbol, version) \
86 weak_alias (local, symbol)
88 /* This should not appear outside `#if SHLIB_COMPAT (...)'. */
89 # define compat_symbol(lib, local, symbol, version) ...
91 #endif
94 # ifdef LINK_OBSOLETE_RPC
95 /* Export the symbol for both static and dynamic linking. */
96 # define libc_sunrpc_symbol(name, aliasname, version) \
97 strong_alias (name, aliasname)
98 # else
99 /* Export the symbol only for shared-library compatibility. */
100 # define libc_sunrpc_symbol(name, aliasname, version) \
101 compat_symbol (libc, name, aliasname, version);
102 # endif
104 #endif /* shlib-compat.h */