Skip to content

Commit b3cf30b

Browse files
committed
Merge branch 'riscv'
* riscv: small improvements of '-march' parsing
2 parents d9c17b4 + b296539 commit b3cf30b

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

‎target-riscv.c‎

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "target.h"
44
#include "machine.h"
55
#include <string.h>
6+
#include <stdio.h>
67

78
#define RISCV_32BIT (1 << 0)
89
#define RISCV_64BIT (1 << 1)
@@ -37,23 +38,15 @@ static void parse_march_riscv(const char *arg)
3738
{ "a", RISCV_ATOMIC },
3839
{ "f", RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR },
3940
{ "d", RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR },
40-
{ "g", RISCV_GENERIC },
41-
{ "q", 0 },
42-
{ "l", 0 },
4341
{ "c", RISCV_COMP },
44-
{ "b", 0 },
45-
{ "j", 0 },
46-
{ "t", 0 },
47-
{ "p", 0 },
48-
{ "v", 0 },
49-
{ "n", 0 },
50-
{ "h", 0 },
51-
{ "s", 0 },
5242
{ "_zicsr", RISCV_ZICSR },
5343
{ "_zifencei", RISCV_ZIFENCEI },
5444
};
5545
int i;
5646

47+
// Each -march=.. options entirely overrides previous ones
48+
riscv_flags = 0;
49+
5750
for (i = 0; i < ARRAY_SIZE(basic_sets); i++) {
5851
const char *pat = basic_sets[i].pattern;
5952
size_t len = strlen(pat);
@@ -64,7 +57,10 @@ static void parse_march_riscv(const char *arg)
6457
goto ext;
6558
}
6659
}
67-
die("invalid argument to '-march': '%s'\n", arg);
60+
61+
unknown:
62+
fprintf(stderr, "WARNING: invalid argument to '-march': '%s'\n", arg);
63+
return;
6864

6965
ext:
7066
for (i = 0; i < ARRAY_SIZE(extensions); i++) {
@@ -77,7 +73,7 @@ static void parse_march_riscv(const char *arg)
7773
}
7874
}
7975
if (arg[0])
80-
die("invalid argument to '-march': '%s'\n", arg);
76+
goto unknown;
8177
}
8278

8379
static void init_riscv(const struct target *self)

0 commit comments

Comments
 (0)