diff options
author | Nelson Chu <nelson.chu@sifive.com> | 2020-11-21 11:19:58 +0800 |
---|---|---|
committer | Nelson Chu <nelson.chu@sifive.com> | 2020-12-01 15:09:26 +0800 |
commit | e8d4709e6a5f4e3fad8479b8069c52294be54488 (patch) | |
tree | 381e50836b9ebefc2c013651cdf8f68b69cbff7f /bfd/elfxx-riscv.c | |
parent | d541518bec90502134ea6b348cb2d4f3363d1c70 (diff) | |
download | gdb-e8d4709e6a5f4e3fad8479b8069c52294be54488.zip gdb-e8d4709e6a5f4e3fad8479b8069c52294be54488.tar.gz gdb-e8d4709e6a5f4e3fad8479b8069c52294be54488.tar.bz2 |
RISC-V: Don't allow any uppercase letter in the arch string.
Although I cannot find any RISC-V specs said that uppercases are not
allowed in the arhc string, but seems like it is an established fact
both for GNU and LLVM. Therefore, we shouldn't allow the uppercases
for the non-standard x extensions, too.
bfd/
* elfxx-riscv.c (riscv_parse_subset): ISA string cannot contain
any uppercase letter.
gas/
* testsuite/gas/riscv/march-fail-uppercase-base.d: Updated.
* testsuite/gas/riscv/march-fail-uppercase.l: Updated.
* testsuite/gas/riscv/march-fail-uppercase-x.d: New testcase.
Diffstat (limited to 'bfd/elfxx-riscv.c')
-rw-r--r-- | bfd/elfxx-riscv.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index 5ed8aa0..69f3a43 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1510,9 +1510,21 @@ bfd_boolean riscv_parse_subset (riscv_parse_subset_t *rps, const char *arch) { - const char *p = arch; + const char *p; size_t i; + for (p = arch; *p != '\0'; p++) + { + if (ISUPPER (*p)) + { + rps->error_handler + (_("-march=%s: ISA string cannot contain uppercase letters"), + arch); + return FALSE; + } + } + + p = arch; if (strncmp (p, "rv32", 4) == 0) { *rps->xlen = 32; |