aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@rivosinc.com>2022-04-01 22:00:36 -0700
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2022-06-05 22:07:14 +0200
commite31e645f5c29b6587404c1efe534c65b4691e023 (patch)
treed14510bf22917189140de439abdc72b56b82b80a
parent76d40fa9e54fdf790f9d1a4b97be93f94d26abfc (diff)
downloadsparse-e31e645f5c29b6587404c1efe534c65b4691e023.tar.gz
RISC-V: don't die() on -march errors, just warn
Parsing RISC-V ISA strings is extremely complicated: there are many extensions, versions of extensions, versions of the ISA string rules, and a bunch of unwritten rules to deal with all the bugs that fell out of that complexity. Rather than die()ing when the ISA string parsing fails, just stop parsing where we get lost and emit a warning. Changes tend to end up at the end of the ISA string, so that's probably going to work (and if it doesn't there's a warning to true and clue folks in). This does have the oddity in that "-Wsparse-error" is ignored for this warning but this option was never meant to be used at this stage of the processing.. [Luc Van Oostenryck: drop handling of "-Wsparse-error"] Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Based-on-patch-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--target-riscv.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/target-riscv.c b/target-riscv.c
index 3bba7c15..1707e6b9 100644
--- a/target-riscv.c
+++ b/target-riscv.c
@@ -3,6 +3,7 @@
#include "target.h"
#include "machine.h"
#include <string.h>
+#include <stdio.h>
#define RISCV_32BIT (1 << 0)
#define RISCV_64BIT (1 << 1)
@@ -64,7 +65,10 @@ static void parse_march_riscv(const char *arg)
goto ext;
}
}
- die("invalid argument to '-march': '%s'\n", arg);
+
+unknown:
+ fprintf(stderr, "WARNING: invalid argument to '-march': '%s'\n", arg);
+ return;
ext:
for (i = 0; i < ARRAY_SIZE(extensions); i++) {
@@ -77,7 +81,7 @@ ext:
}
}
if (arg[0])
- die("invalid argument to '-march': '%s'\n", arg);
+ goto unknown;
}
static void init_riscv(const struct target *self)