]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/riscv/dl-cache.h
1 /* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
2 Copyright (C) 2003-2019 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/>. */
21 /* For now we only support the natural XLEN ABI length on all targets, so the
22 only bits that need to go into ld.so.cache are the FLEG ABI length. */
23 #if defined __riscv_float_abi_double
24 # define _DL_CACHE_DEFAULT_ID (FLAG_RISCV_FLOAT_ABI_DOUBLE | FLAG_ELF_LIBC6)
26 # define _DL_CACHE_DEFAULT_ID (FLAG_RISCV_FLOAT_ABI_SOFT | FLAG_ELF_LIBC6)
29 #define _dl_cache_check_flags(flags) \
30 ((flags) == _DL_CACHE_DEFAULT_ID)
32 /* If given a path to one of our library directories, adds every library
33 directory via add_dir (), otherwise just adds the giver directory. On
34 RISC-V, libraries can be found in paths ending in:
38 so this will add all of those paths.
40 According to Joseph Myers:
41 My reasoning for that would be: generic autoconf-configured (etc.)
42 software may only know about using the lib directory, so you want the
43 lib directory to be searched regardless of the ABI - but it's also
44 useful to be able to e.g. list /usr/local/lib in /etc/ld.so.conf for all
45 architectures and have that automatically imply /usr/local/lib64/lp64d
46 etc. so that libraries can be found that come from software that does
47 use the ABI-specific directories. */
48 #define add_system_dir(dir) \
51 size_t len = strlen (dir); \
53 memcpy (path, dir, len + 1); \
54 if (len >= 12 && ! memcmp(path + len - 12, "/lib64/lp64d", 12)) \
59 if (len >= 11 && ! memcmp(path + len - 11, "/lib64/lp64", 11)) \
65 if (len >= 4 && ! memcmp(path + len - 4, "/lib", 4)) \
67 memcpy (path + len, "64/lp64d", 9); \
69 memcpy (path + len, "64/lp64", 8); \
75 #include_next <dl-cache.h>