aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-03-29 16:05:40 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-03-31 09:35:21 -0700
commitfecb9c46659c576e9e2c790eff2a25df8203a97f (patch)
treed1ab3b5ff86cb481740472d2b4a43fe5d7d014d7
parent858f82bf7e6531f4ad821285359c759c835f9dce (diff)
downloadgdb-fecb9c46659c576e9e2c790eff2a25df8203a97f.zip
gdb-fecb9c46659c576e9e2c790eff2a25df8203a97f.tar.gz
gdb-fecb9c46659c576e9e2c790eff2a25df8203a97f.tar.bz2
RISC-V: 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.
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-riscv.c15
2 files changed, 21 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 10785d4..169b2ff 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-31 Nick Clifton <nickc@redhat.com>
PR gas/21333
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