diff mbox series

RISC-V: Define MUSL_DYNAMIC_LINKER for riscv

Message ID 20171106191124.4998-1-palmer@dabbelt.com
State New
Headers show
Series RISC-V: Define MUSL_DYNAMIC_LINKER for riscv | expand

Commit Message

Palmer Dabbelt Nov. 6, 2017, 7:11 p.m. UTC
From: Michael Clark <michaeljclark@mac.com>

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 RISC-V ABI names.

musl interpreter        | RISC-V ABI
----------------------- | -------------
ld-musl-riscv32.so.1    | riscv32-ilp32d
ld-musl-riscv64.so.1    | riscv64-lp64d
ld-musl-riscv32-sf.so.1 | riscv32-ilp32
ld-musl-riscv64-sf.so.1 | riscv64-lp64
ld-musl-riscv32-sp.so.1 | riscv32-ilp32f
ld-musl-riscv64-sp.so.1 | riscv64-lp64f

gcc/ChangeLog

2017-11-06  Michael Clark  <michaeljclark@mac.com>

        * config/riscv/linux.h (MUSL_ABI_SUFFIX): New define.
        (MUSL_DYNAMIC_LINKER): Likewise.
---
 gcc/config/riscv/linux.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Palmer Dabbelt Nov. 7, 2017, 4:58 p.m. UTC | #1
Committed.

On Mon, 06 Nov 2017 11:11:24 PST (-0800), Palmer Dabbelt wrote:
> From: Michael Clark <michaeljclark@mac.com>
>
> 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 RISC-V ABI names.
>
> musl interpreter        | RISC-V ABI
> ----------------------- | -------------
> ld-musl-riscv32.so.1    | riscv32-ilp32d
> ld-musl-riscv64.so.1    | riscv64-lp64d
> ld-musl-riscv32-sf.so.1 | riscv32-ilp32
> ld-musl-riscv64-sf.so.1 | riscv64-lp64
> ld-musl-riscv32-sp.so.1 | riscv32-ilp32f
> ld-musl-riscv64-sp.so.1 | riscv64-lp64f
>
> gcc/ChangeLog
>
> 2017-11-06  Michael Clark  <michaeljclark@mac.com>
>
>         * config/riscv/linux.h (MUSL_ABI_SUFFIX): New define.
>         (MUSL_DYNAMIC_LINKER): Likewise.
> ---
>  gcc/config/riscv/linux.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
> index ecf424d1a2bb..6c7e3c4e819f 100644
> --- a/gcc/config/riscv/linux.h
> +++ b/gcc/config/riscv/linux.h
> @@ -24,6 +24,17 @@ along with GCC; see the file COPYING3.  If not see
>
>  #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
>
> +#define MUSL_ABI_SUFFIX \
> +  "%{mabi=ilp32:-sf}" \
> +  "%{mabi=ilp32f:-sp}" \
> +  "%{mabi=ilp32d:}" \
> +  "%{mabi=lp64:-sf}" \
> +  "%{mabi=lp64f:-sp}" \
> +  "%{mabi=lp64d:}" \
> +
> +#undef MUSL_DYNAMIC_LINKER
> +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
> +
>  /* Because RISC-V only has word-sized atomics, it requries libatomic where
>     others do not.  So link libatomic by default, as needed.  */
>  #undef LIB_SPEC
diff mbox series

Patch

diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index ecf424d1a2bb..6c7e3c4e819f 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -24,6 +24,17 @@  along with GCC; see the file COPYING3.  If not see
 
 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
 
+#define MUSL_ABI_SUFFIX \
+  "%{mabi=ilp32:-sf}" \
+  "%{mabi=ilp32f:-sp}" \
+  "%{mabi=ilp32d:}" \
+  "%{mabi=lp64:-sf}" \
+  "%{mabi=lp64f:-sp}" \
+  "%{mabi=lp64d:}" \
+
+#undef MUSL_DYNAMIC_LINKER
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
+
 /* Because RISC-V only has word-sized atomics, it requries libatomic where
    others do not.  So link libatomic by default, as needed.  */
 #undef LIB_SPEC