summaryrefslogtreecommitdiffstats
path: root/src/shared/base-filesystem.c
diff options
context:
space:
mode:
authorAdrian Vovk <adrianvovk@gmail.com>2023-03-02 19:20:51 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2023-03-06 21:53:43 +0100
commit27e695840c74fc95ae50e7ea0074512bbc778f73 (patch)
treef6351c4ba6a908815280e228fca9e950f63ce399 /src/shared/base-filesystem.c
parentMerge pull request #26502 from DaanDeMeyer/chase-symlinks-additions (diff)
downloadsystemd-27e695840c74fc95ae50e7ea0074512bbc778f73.tar.xz
systemd-27e695840c74fc95ae50e7ea0074512bbc778f73.zip
base-filesystem: Support Arch-style multilib
On distros like Arch and on carbonOS, libraries end up in /usr/lib. Thus, /lib64 should point to /usr/lib. This commit adds this functionality as a final fallback (if neither Debian-style nor Fedora-style multilib can be detected)
Diffstat (limited to 'src/shared/base-filesystem.c')
-rw-r--r--src/shared/base-filesystem.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
index be6dd1654a..5890f30383 100644
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
@@ -45,13 +45,14 @@ static const BaseFilesystem table[] = {
* been mounted into) it is thus necessary to create a symlink pointing to the right subdirectory of
* /usr/ first — otherwise we couldn't invoke any dynamic binary. Let's detect this case here, and
* create the symlink as needed should it be missing. We prefer doing this consistently with Debian's
- * multiarch logic, but support Fedora-style multilib too. */
+ * multiarch logic, but support Fedora-style and Arch-style multilib too. */
#if defined(__aarch64__)
/* aarch64 ELF ABI actually says dynamic loader is in /lib/, but Fedora puts it in /lib64/ anyway and
* just symlinks /lib/ld-linux-aarch64.so.1 to ../lib64/ld-linux-aarch64.so.1. For this to work
* correctly, /lib64/ must be symlinked to /usr/lib64/. */
{ "lib64", 0, "usr/lib/"LIB_ARCH_TUPLE"\0"
- "usr/lib64\0", "ld-linux-aarch64.so.1" },
+ "usr/lib64\0"
+ "usr/lib\0", "ld-linux-aarch64.so.1" },
# define KNOW_LIB64_DIRS 1
#elif defined(__alpha__)
#elif defined(__arc__) || defined(__tilegx__)
@@ -60,20 +61,24 @@ static const BaseFilesystem table[] = {
# define KNOW_LIB64_DIRS 1
#elif defined(__i386__) || defined(__x86_64__)
{ "lib64", 0, "usr/lib/"LIB_ARCH_TUPLE"\0"
- "usr/lib64\0", "ld-linux-x86-64.so.2" },
+ "usr/lib64\0"
+ "usr/lib\0", "ld-linux-x86-64.so.2" },
# define KNOW_LIB64_DIRS 1
#elif defined(__ia64__)
#elif defined(__loongarch64)
# define KNOW_LIB64_DIRS 1
# if defined(__loongarch_double_float)
{ "lib64", 0, "usr/lib/"LIB_ARCH_TUPLE"\0"
- "usr/lib64\0", "ld-linux-loongarch-lp64d.so.1" },
+ "usr/lib64\0"
+ "usr/lib\0", "ld-linux-loongarch-lp64d.so.1" },
# elif defined(__loongarch_single_float)
{ "lib64", 0, "usr/lib/"LIB_ARCH_TUPLE"\0"
- "usr/lib64\0", "ld-linux-loongarch-lp64f.so.1" },
+ "usr/lib64\0"
+ "usr/lib\0", "ld-linux-loongarch-lp64f.so.1" },
# elif defined(__loongarch_soft_float)
{ "lib64", 0, "usr/lib/"LIB_ARCH_TUPLE"\0"
- "usr/lib64\0", "ld-linux-loongarch-lp64s.so.1" },
+ "usr/lib64\0"
+ "usr/lib\0", "ld-linux-loongarch-lp64s.so.1" },
# else
# error "Unknown LoongArch ABI"
# endif
@@ -90,7 +95,8 @@ static const BaseFilesystem table[] = {
#elif defined(__powerpc__)
# if defined(__PPC64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
{ "lib64", 0, "usr/lib/"LIB_ARCH_TUPLE"\0"
- "usr/lib64\0", "ld64.so.2" },
+ "usr/lib64\0"
+ "usr/lib\0", "ld64.so.2" },
# define KNOW_LIB64_DIRS 1
# elif defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
/* powerpc64-linux-gnu */
@@ -102,7 +108,8 @@ static const BaseFilesystem table[] = {
# elif __riscv_xlen == 64
/* Same situation as for aarch64 */
{ "lib64", 0, "usr/lib/"LIB_ARCH_TUPLE"\0"
- "usr/lib64\0", "ld-linux-riscv64-lp64d.so.1" },
+ "usr/lib64\0"
+ "usr/lib\0", "ld-linux-riscv64-lp64d.so.1" },
# define KNOW_LIB64_DIRS 1
# else
# error "Unknown RISC-V ABI"
@@ -111,7 +118,8 @@ static const BaseFilesystem table[] = {
/* s390-linux-gnu */
#elif defined(__s390x__)
{ "lib64", 0, "usr/lib/"LIB_ARCH_TUPLE"\0"
- "usr/lib64\0", "ld-lsb-s390x.so.3" },
+ "usr/lib64\0"
+ "usr/lib\0", "ld-lsb-s390x.so.3" },
# define KNOW_LIB64_DIRS 1
#elif defined(__sparc__)
#endif