public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jim Wilson <jimw@sifive.com>
To: gcc-patches@gcc.gnu.org
Cc: Jim Wilson <jimw@sifive.com>
Subject: [PATCH, gcc-7] Add riscv musl support.
Date: Tue, 28 Nov 2017 20:44:00 -0000	[thread overview]
Message-ID: <20171128194914.6279-1-jimw@sifive.com> (raw)

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 --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
-- 
2.7.4

                 reply	other threads:[~2017-11-28 19:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171128194914.6279-1-jimw@sifive.com \
    --to=jimw@sifive.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).