public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: binutils@sourceware.org
Cc: Alex Bradbury <asb@asbradbury.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Subject: [PATCH] RISC-V: Allow ISA subsets to be disabled
Date: Thu, 30 Mar 2017 19:46:00 -0000	[thread overview]
Message-ID: <20170330194542.10927-1-palmer@dabbelt.com> (raw)

Without this patch, passing "-march=rv64ic -march=rv64i" results in
you getting a "RV64IC" toolchain, which isn't expected.

gas/ChangeLog:

2017-03-30  Palmer Dabbelt  <palmer@dabbelt.com>

       * config/tc-riscv.c (riscv_clear_subsets): New function.
       (riscv_add_subset): Call riscv_clear_subsets and riscv_set_rvc to
       clear RVC when it's been previously set.
---
 gas/ChangeLog         |  6 ++++++
 gas/config/tc-riscv.c | 15 +++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index a5c1d08..6f419f7 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-30  Palmer Dabbelt  <palmer@dabbelt.com>
+
+	* config/tc-riscv.c (riscv_clear_subsets): New function.
+	(riscv_add_subset): Call riscv_clear_subsets and riscv_set_rvc to
+	clear RVC when it's been previously set.
+
 2017-03-30  Pip Cet  <pipcet@gmail.com>
 
 	* config/tc-wasm32.h: New file: Add WebAssembly assembler target.
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 68b28f7..2830ba1 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -121,6 +121,18 @@ riscv_subset_supports (const char *feature)
 }
 
 static void
+riscv_clear_subsets (void)
+{
+  while (riscv_subsets != NULL)
+    {
+      struct riscv_subset *next = riscv_subsets->next;
+      free (riscv_subsets->name);
+      free (riscv_subsets);
+      riscv_subsets = next;
+    }
+}
+
+static void
 riscv_add_subset (const char *subset)
 {
   struct riscv_subset *s = xmalloc (sizeof *s);
@@ -139,6 +151,8 @@ riscv_set_arch (const char *s)
   const char *extension = NULL;
   const char *p = s;
 
+  riscv_clear_subsets();
+
   if (strncmp (p, "rv32", 4) == 0)
     {
       xlen = 32;
@@ -1808,6 +1822,7 @@ riscv_after_parse_args (void)
     riscv_set_arch (xlen == 64 ? "rv64g" : "rv32g");
 
   /* Add the RVC extension, regardless of -march, to support .option rvc.  */
+  riscv_set_rvc (FALSE);
   if (riscv_subset_supports ("c"))
     riscv_set_rvc (TRUE);
   else
-- 
2.10.2

             reply	other threads:[~2017-03-30 19:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 19:46 Palmer Dabbelt [this message]
2017-03-31  8:15 ` Alex Bradbury
2017-03-31  8:39   ` Alex Bradbury
2017-03-31  9:23     ` Nick Clifton
2017-03-31 16:46       ` Palmer Dabbelt
2017-03-31  9:09 ` Nick Clifton
2017-04-01 10:50 ` [BUILDROBOT] RISC-V: error: passing argument 1 of ‘free’ discards ‘const’ qualifier from pointer target type (was: [PATCH] RISC-V: Allow ISA subsets to be disabled) Jan-Benedict Glaw

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=20170330194542.10927-1-palmer@dabbelt.com \
    --to=palmer@dabbelt.com \
    --cc=asb@asbradbury.org \
    --cc=binutils@sourceware.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).