aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@rivosinc.com>2022-04-01 22:00:37 -0700
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2022-06-05 22:07:23 +0200
commit90feaaa967227961fc9972a0a46bb4fa51eec7b2 (patch)
tree683ec0180b0b7853e118a39858a92ba9e8d30487
parente31e645f5c29b6587404c1efe534c65b4691e023 (diff)
downloadsparse-90feaaa967227961fc9972a0a46bb4fa51eec7b2.tar.gz
RISC-V: Match GCC's semantics for multiple -march instances
GCC's semantics for "-march=X -march=Y" are that Y entirely overrides X, but sparse takes the union of these two ISA strings. This fixes the behavior by setting, instead of oring, the flags whenever a base ISA is encountered. RISC-V ISA strings can only have a single base ISA, it's not like x86 where the 64-bit ISA is an extension of the 32-bit ISA. [Luc Van Oostenryck: reset the flags at the start of the parsing loop] Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--target-riscv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/target-riscv.c b/target-riscv.c
index 1707e6b9..80f2588f 100644
--- a/target-riscv.c
+++ b/target-riscv.c
@@ -55,6 +55,9 @@ static void parse_march_riscv(const char *arg)
};
int i;
+ // Each -march=.. options entirely overrides previous ones
+ riscv_flags = 0;
+
for (i = 0; i < ARRAY_SIZE(basic_sets); i++) {
const char *pat = basic_sets[i].pattern;
size_t len = strlen(pat);