aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-05 22:51:24 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-08 01:57:25 +0200
commitea8cf0fef9300678da7cc80bd60e3f959465bd34 (patch)
treee39edc91ee59a65e82a8ccd1892a1a8a541a21c1
parentc9676a3b0349a1053c673243af52a2ef1b272bd7 (diff)
downloadsparse-ea8cf0fef9300678da7cc80bd60e3f959465bd34.tar.gz
arch: teach sparse about the '-march' option
The option '-march' is not one of the common option but is architecture specific. So, teach sparse to delegate the parsing of this option to the targets. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--options.c8
-rw-r--r--target.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/options.c b/options.c
index 9f05bdf9..1a3fee3c 100644
--- a/options.c
+++ b/options.c
@@ -609,6 +609,13 @@ static char **handle_switch_M(char *arg, char **next)
return next;
}
+static int handle_march(const char *opt, const char *arg, const struct flag *flag, int options)
+{
+ if (arch_target->parse_march)
+ arch_target->parse_march(arg);
+ return 1;
+}
+
static int handle_mcmodel(const char *opt, const char *arg, const struct flag *flag, int options)
{
static const struct val_map cmodels[] = {
@@ -650,6 +657,7 @@ static const struct flag mflags[] = {
{ "x32",&arch_m64, NULL, OPT_VAL, ARCH_X32 },
{ "size-llp64", &arch_m64, NULL, OPT_VAL, ARCH_LLP64 },
{ "size-long", &arch_msize_long },
+ { "arch=", NULL, handle_march },
{ "big-endian", &arch_big_endian, NULL },
{ "little-endian", &arch_big_endian, NULL, OPT_INVERSE },
{ "cmodel", &arch_cmodel, handle_mcmodel },
diff --git a/target.h b/target.h
index 8f79426c..54e97e83 100644
--- a/target.h
+++ b/target.h
@@ -76,6 +76,7 @@ struct target {
const struct builtin_fn *builtins;
void (*init)(const struct target *self);
+ void (*parse_march)(const char *arg);
void (*predefine)(const struct target *self);
const char *(*asm_constraint)(struct asm_operand *op, int c, const char *str);
};