diff mbox series

[gcc-7] Add riscv musl support.

Message ID 20171128194914.6279-1-jimw@sifive.com
State New
Headers show
Series [gcc-7] Add riscv musl support. | expand

Commit Message

Jim Wilson Nov. 28, 2017, 7:49 p.m. UTC
This adds MUSL support to the riscv port in gcc-7, as we had a request for it.
Tested with a glibc toolchain build to verify it doesn't break anything, and a
musl gcc build to verify that the dynamic linker names are right for each -mabi
option value.  Committed.

	gcc/
	Backport from mainline
	2017-11-07  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 mbox series

Patch

diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index ecf424d..6c7e3c4 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