toolchain/gcc: fix loongarch64 ldso file name
[openwrt/openwrt.git] / toolchain / gcc / patches-13.x / 400-LoongArch-Fix-MUSL_DYNAMIC_LINKER.patch
1 From a80c68a08604b0ac625ac7fc59eae40b551b1176 Mon Sep 17 00:00:00 2001
2 From: Peng Fan <fanpeng@loongson.cn>
3 Date: Wed, 19 Apr 2023 16:23:42 +0800
4 Subject: [PATCH] LoongArch: Fix MUSL_DYNAMIC_LINKER
5
6 The system based on musl has no '/lib64', so change it.
7
8 https://wiki.musl-libc.org/guidelines-for-distributions.html,
9 "Multilib/multi-arch" section of this introduces it.
10
11 gcc/
12 * config/loongarch/gnu-user.h (MUSL_DYNAMIC_LINKER): Redefine.
13
14 Signed-off-by: Peng Fan <fanpeng@loongson.cn>
15 Suggested-by: Xi Ruoyao <xry111@xry111.site>
16 ---
17 gcc/config/loongarch/gnu-user.h | 7 ++++++-
18 1 file changed, 6 insertions(+), 1 deletion(-)
19
20 diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
21 index aecaa02a199..fa1a5211419 100644
22 --- a/gcc/config/loongarch/gnu-user.h
23 +++ b/gcc/config/loongarch/gnu-user.h
24 @@ -33,9 +33,14 @@ along with GCC; see the file COPYING3. If not see
25 #define GLIBC_DYNAMIC_LINKER \
26 "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1"
27
28 +#define MUSL_ABI_SPEC \
29 + "%{mabi=lp64d:-lp64d}" \
30 + "%{mabi=lp64f:-lp64f}" \
31 + "%{mabi=lp64s:-lp64s}"
32 +
33 #undef MUSL_DYNAMIC_LINKER
34 #define MUSL_DYNAMIC_LINKER \
35 - "/lib" ABI_GRLEN_SPEC "/ld-musl-loongarch-" ABI_SPEC ".so.1"
36 + "/lib/ld-musl-loongarch" ABI_GRLEN_SPEC MUSL_ABI_SPEC ".so.1"
37
38 #undef GNU_USER_TARGET_LINK_SPEC
39 #define GNU_USER_TARGET_LINK_SPEC \
40 --
41 2.39.3