]>
Commit | Line | Data |
---|---|---|
e2102c14 | 1 | /* Optional code to distinguish library flavours. |
04277e02 | 2 | Copyright (C) 1998-2019 Free Software Foundation, Inc. |
e2102c14 UD |
3 | This file is part of the GNU C Library. |
4 | Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. | |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
e2102c14 UD |
10 | |
11 | The GNU C Library 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 GNU | |
41bdb6e2 | 14 | Lesser General Public License for more details. |
e2102c14 | 15 | |
41bdb6e2 | 16 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ | |
e2102c14 UD |
19 | |
20 | #ifndef _DL_LIBRECON_H | |
4e71f81e RM |
21 | |
22 | #include <sysdeps/unix/sysv/linux/dl-librecon.h> | |
e2102c14 UD |
23 | |
24 | #define DISTINGUISH_LIB_VERSIONS \ | |
25 | do \ | |
26 | { \ | |
27 | /* We have to find out whether the binary is linked against \ | |
28 | libc 5 or glibc. We do this by looking at all the DT_NEEDED \ | |
29 | entries. If one is libc.so.5 this is a libc 5 linked binary. */ \ | |
c0f62c56 | 30 | if (main_map->l_info[DT_NEEDED]) \ |
e2102c14 UD |
31 | { \ |
32 | /* We have dependencies. */ \ | |
e2102c14 | 33 | const ElfW(Dyn) *d; \ |
be935610 | 34 | const char *strtab; \ |
e2102c14 | 35 | \ |
c0f62c56 | 36 | strtab = (const char *) D_PTR (main_map, l_info[DT_STRTAB]); \ |
be935610 | 37 | \ |
c0f62c56 | 38 | for (d = main_map->l_ld; d->d_tag != DT_NULL; ++d) \ |
e2102c14 UD |
39 | if (d->d_tag == DT_NEEDED \ |
40 | && strcmp (strtab + d->d_un.d_val, "libc.so.5") == 0) \ | |
41 | break; \ | |
42 | \ | |
43 | /* We print a `5' or `6' depending on the outcome. */ \ | |
35fc382a | 44 | _dl_printf (d->d_tag != DT_NULL ? "5\n" : "6\n"); \ |
e2102c14 UD |
45 | } \ |
46 | } \ | |
47 | while (0) | |
48 | ||
49 | /* Recognizing extra environment variables. */ | |
97fd3a30 | 50 | #define EXTRA_LD_ENVVARS \ |
e2102c14 | 51 | case 15: \ |
c95f3fd4 | 52 | if (memcmp (envline, "LIBRARY_VERSION", 15) == 0) \ |
afdca0f2 | 53 | GLRO(dl_correct_cache_id) = envline[16] == '5' ? 2 : 3; \ |
4e71f81e | 54 | break; \ |
e2102c14 | 55 | |
c95f3fd4 UD |
56 | /* Extra unsecure variables. The names are all stuffed in a single |
57 | string which means they have to be terminated with a '\0' explicitly. */ | |
58 | #define EXTRA_UNSECURE_ENVVARS \ | |
59 | "LD_AOUT_LIBRARY_PATH\0" \ | |
60 | "LD_AOUT_PRELOAD\0" | |
4bae5567 | 61 | |
e2102c14 | 62 | #endif /* dl-librecon.h */ |