This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb/binutils-2_28-branch] Allow ISA subsets to be disabled
- From: Palmer Dabbelt <palmer at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 4 Apr 2017 15:26:59 -0000
- Subject: [binutils-gdb/binutils-2_28-branch] Allow ISA subsets to be disabled
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e101f93030828e5d743ef7f13fb101dc018515a3
commit e101f93030828e5d743ef7f13fb101dc018515a3
Author: Palmer Dabbelt <palmer@dabbelt.com>
Date: Wed Mar 29 16:05:40 2017 -0700
Allow ISA subsets to be disabled
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.
Diff:
---
gas/ChangeLog | 6 ++++++
gas/config/tc-riscv.c | 15 +++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 904e0b9..795c7dc 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-21 Palmer Dabbbelt <palmer@dabbelt.com>
* config/tc-riscv.c (md_show_usage): Remove defuct -m32, -m64,
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 649c3e8..6490b1a 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;
@@ -1802,6 +1816,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