LoongArch: fix MUSL_DYNAMIC_LINKER

Message ID 20230419082342.21705-1-fanpeng@loongson.cn
State Accepted
Headers
Series LoongArch: fix MUSL_DYNAMIC_LINKER |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

ticat_fp April 19, 2023, 8:23 a.m. UTC
  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(-)
  

Comments

chenglulu April 21, 2023, 7:30 a.m. UTC | #1
Pushed to r14-130.

在 2023/4/19 下午4:23, Peng Fan 写道:
> 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 \
  

Patch

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 \