From 9afbe55eb5aa95cacf394d53b785d78fd9beb49e Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Wed, 29 Mar 2017 16:05:40 -0700 Subject: [PATCH] Allow RVC to be disabled after it's been enabled --- gas/config/tc-riscv.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 649c3e8aefa5..6490b1a1ae08 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -120,6 +120,18 @@ riscv_subset_supports (const char *feature) return FALSE; } +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) { @@ -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