aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-09-20 20:49:16 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-09-20 20:53:42 -0700
commitae1cfb2aa6aec8078e107c26a817b04f3d08d269 (patch)
tree6f23b98e08decea75b01239f5be52bc358cdf333 /binutils
parentc96115a0e39471c990a80a5d9091382ebf056d86 (diff)
downloadriscv-gnu-toolchain-ae1cfb2aa6aec8078e107c26a817b04f3d08d269.zip
riscv-gnu-toolchain-ae1cfb2aa6aec8078e107c26a817b04f3d08d269.tar.gz
riscv-gnu-toolchain-ae1cfb2aa6aec8078e107c26a817b04f3d08d269.tar.bz2
binutils: clean up GAS arch string handling
Diffstat (limited to 'binutils')
-rw-r--r--binutils/gas/config/tc-riscv.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/binutils/gas/config/tc-riscv.c b/binutils/gas/config/tc-riscv.c
index e6851f6..df252b2 100644
--- a/binutils/gas/config/tc-riscv.c
+++ b/binutils/gas/config/tc-riscv.c
@@ -101,26 +101,23 @@ struct riscv_subset
static struct riscv_subset *riscv_subsets;
-static int
+static bfd_boolean
riscv_subset_supports (const char *feature)
{
struct riscv_subset *s;
- bfd_boolean rv64_insn = !strncmp (feature, "64", 2);
+ char *p;
+ unsigned xlen_required = strtoul (feature, &p, 10);
- if (rv64_insn || !strncmp (feature, "32", 2))
- {
- if ((xlen == 64) != rv64_insn)
- return 0;
- feature += 2;
- }
+ if (xlen_required && xlen != xlen_required)
+ return FALSE;
for (s = riscv_subsets; s != NULL; s = s->next)
- if (strcmp (s->name, feature) == 0)
+ if (strcmp (s->name, p) == 0)
/* FIXME: once we support version numbers:
return major == s->version_major && minor <= s->version_minor; */
- return 1;
+ return TRUE;
- return 0;
+ return FALSE;
}
static void
@@ -134,15 +131,13 @@ riscv_add_subset (const char *subset)
riscv_subsets = s;
}
+/* Set which ISA and extensions are available. Formally, ISA strings must
+ begin with RV32 or RV64, but we allow the prefix to be omitted.
+
+ FIXME: Version numbers are not supported yet. */
static void
riscv_set_arch (const char *arg)
{
- /* Formally, ISA subset names begin with RV, RV32, or RV64, but we allow the
- prefix to be omitted. We also allow all-lowercase names if version
- numbers and eXtensions are omitted (i.e. only some combination of imafd
- is supported in this case).
-
- FIXME: Version numbers are not supported yet. */
char *uppercase = xstrdup (arg);
char *p = uppercase;
const char *all_subsets = "IMAFDC";