summaryrefslogtreecommitdiffstats
path: root/toolchain
diff options
context:
space:
mode:
authorWeijie Gao <hackpascal@gmail.com>2024-04-18 18:58:18 +0800
committerChuanhong Guo <gch981213@gmail.com>2024-05-04 14:12:56 +0800
commitc5946c07241272361da702b5eebd5f887b8a68c1 (patch)
treef72f0c5fa3a80d526d1d2d7c42d1770fc24c8eb3 /toolchain
parent6bb2551343fb53423c7129e93fee3b1abde402d1 (diff)
downloadopenwrt-c5946c07241272361da702b5eebd5f887b8a68c1.tar.gz
openwrt-c5946c07241272361da702b5eebd5f887b8a68c1.tar.bz2
openwrt-c5946c07241272361da702b5eebd5f887b8a68c1.zip
toolchain/gcc: fix loongarch64 ldso file name
GCC has changed musl dynamic linker name from ld-musl-loongarch-lp64d.so.1 to ld-musl-loongarch64.so.1 recently [1]. Meanwhile musl 1.2.5 only supports the new name. So it's better to follow the new name. [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8bccee51f0deac64b79cd9ad75df599422f4c8ff Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Diffstat (limited to 'toolchain')
-rw-r--r--toolchain/gcc/patches-13.x/400-LoongArch-Fix-MUSL_DYNAMIC_LINKER.patch41
-rw-r--r--toolchain/gcc/patches-13.x/401-LoongArch-Modify-MUSL_DYNAMIC_LINKER.patch43
2 files changed, 84 insertions, 0 deletions
diff --git a/toolchain/gcc/patches-13.x/400-LoongArch-Fix-MUSL_DYNAMIC_LINKER.patch b/toolchain/gcc/patches-13.x/400-LoongArch-Fix-MUSL_DYNAMIC_LINKER.patch
new file mode 100644
index 0000000000..4fddc3f77e
--- /dev/null
+++ b/toolchain/gcc/patches-13.x/400-LoongArch-Fix-MUSL_DYNAMIC_LINKER.patch
@@ -0,0 +1,41 @@
+From a80c68a08604b0ac625ac7fc59eae40b551b1176 Mon Sep 17 00:00:00 2001
+From: Peng Fan <fanpeng@loongson.cn>
+Date: Wed, 19 Apr 2023 16:23:42 +0800
+Subject: [PATCH] LoongArch: Fix MUSL_DYNAMIC_LINKER
+
+The system based on musl has no '/lib64', so change it.
+
+https://wiki.musl-libc.org/guidelines-for-distributions.html,
+"Multilib/multi-arch" section of this introduces it.
+
+gcc/
+ * config/loongarch/gnu-user.h (MUSL_DYNAMIC_LINKER): Redefine.
+
+Signed-off-by: Peng Fan <fanpeng@loongson.cn>
+Suggested-by: Xi Ruoyao <xry111@xry111.site>
+---
+ gcc/config/loongarch/gnu-user.h | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
+index aecaa02a199..fa1a5211419 100644
+--- a/gcc/config/loongarch/gnu-user.h
++++ b/gcc/config/loongarch/gnu-user.h
+@@ -33,9 +33,14 @@ along with GCC; see the file COPYING3. If not see
+ #define GLIBC_DYNAMIC_LINKER \
+ "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1"
+
++#define MUSL_ABI_SPEC \
++ "%{mabi=lp64d:-lp64d}" \
++ "%{mabi=lp64f:-lp64f}" \
++ "%{mabi=lp64s:-lp64s}"
++
+ #undef MUSL_DYNAMIC_LINKER
+ #define MUSL_DYNAMIC_LINKER \
+- "/lib" ABI_GRLEN_SPEC "/ld-musl-loongarch-" ABI_SPEC ".so.1"
++ "/lib/ld-musl-loongarch" ABI_GRLEN_SPEC MUSL_ABI_SPEC ".so.1"
+
+ #undef GNU_USER_TARGET_LINK_SPEC
+ #define GNU_USER_TARGET_LINK_SPEC \
+--
+2.39.3
diff --git a/toolchain/gcc/patches-13.x/401-LoongArch-Modify-MUSL_DYNAMIC_LINKER.patch b/toolchain/gcc/patches-13.x/401-LoongArch-Modify-MUSL_DYNAMIC_LINKER.patch
new file mode 100644
index 0000000000..218a692578
--- /dev/null
+++ b/toolchain/gcc/patches-13.x/401-LoongArch-Modify-MUSL_DYNAMIC_LINKER.patch
@@ -0,0 +1,43 @@
+From 8bccee51f0deac64b79cd9ad75df599422f4c8ff Mon Sep 17 00:00:00 2001
+From: Lulu Cheng <chenglulu@loongson.cn>
+Date: Sat, 18 Nov 2023 11:04:42 +0800
+Subject: [PATCH] LoongArch: Modify MUSL_DYNAMIC_LINKER.
+
+Use no suffix at all in the musl dynamic linker name for hard
+float ABI. Use -sf and -sp suffixes in musl dynamic linker name
+for soft float and single precision ABIs. The following table
+outlines the musl interpreter names for the LoongArch64 ABI names.
+
+musl interpreter | LoongArch64 ABI
+--------------------------- | -----------------
+ld-musl-loongarch64.so.1 | loongarch64-lp64d
+ld-musl-loongarch64-sp.so.1 | loongarch64-lp64f
+ld-musl-loongarch64-sf.so.1 | loongarch64-lp64s
+
+gcc/ChangeLog:
+
+ * config/loongarch/gnu-user.h (MUSL_ABI_SPEC): Modify suffix.
+---
+ gcc/config/loongarch/gnu-user.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
+index 9616d6e8a0b..e9f4bcef1d4 100644
+--- a/gcc/config/loongarch/gnu-user.h
++++ b/gcc/config/loongarch/gnu-user.h
+@@ -34,9 +34,9 @@ along with GCC; see the file COPYING3. If not see
+ "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1"
+
+ #define MUSL_ABI_SPEC \
+- "%{mabi=lp64d:-lp64d}" \
+- "%{mabi=lp64f:-lp64f}" \
+- "%{mabi=lp64s:-lp64s}"
++ "%{mabi=lp64d:}" \
++ "%{mabi=lp64f:-sp}" \
++ "%{mabi=lp64s:-sf}"
+
+ #undef MUSL_DYNAMIC_LINKER
+ #define MUSL_DYNAMIC_LINKER \
+--
+2.39.3
+