aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfxx-riscv.h
diff options
context:
space:
mode:
authorNelson Chu <nelson.chu@sifive.com>2021-09-16 14:36:54 +0800
committerNelson Chu <nelson.chu@sifive.com>2021-09-17 16:33:54 +0800
commitc9f279910113d6a10cb64d81aba2c1af9f3c228c (patch)
treef6c97bc6b142ac2025b70fba59dd491251509310 /bfd/elfxx-riscv.h
parent648d5dc4e6032c66f76638604cd577c529f84bc5 (diff)
downloadgdb-c9f279910113d6a10cb64d81aba2c1af9f3c228c.zip
gdb-c9f279910113d6a10cb64d81aba2c1af9f3c228c.tar.gz
gdb-c9f279910113d6a10cb64d81aba2c1af9f3c228c.tar.bz2
RISC-V: Merged extension string tables and their version tables into one.
There are two main reasons for this patch, * In the past we had two extension tables, one is used to record all supported extensions in bfd/elfxx-riscv.c, another is used to get the default extension versions in gas/config/tc-riscv.c. It is hard to maintain lots of tables in different files, but in fact we can merge them into just one table. Therefore, we now define many riscv_supported_std* tables, which record names and versions for all supported extensions. We not only use these tables to initialize the riscv_ext_order, but also use them to get the default versions of extensions, and decide if the extensions should be enbaled by default. * We add a new filed `default_enable' for the riscv_supported_std* tables, to decide if the extension should be enabled by default. For now if the `default_enable' field of the extension is set to EXT_DEFAULT, then we should enable the extension when the -march and elf architecture attributes are not set. In the future, I suppose the `default_enable' can be set to lots of EXT_<VENDOR>, each vendor can decide to open which extensions, when the target triple of vendor is chosen. The elf/linux regression tests of riscv-gnu-toolchain are passed. bfd/ * elfnn-riscv.c (cpu-riscv.h): Removed sine it is included in bfd/elfxx-riscv.h. (riscv_merge_std_ext): Updated since the field of rpe is changed. * elfxx-riscv.c (cpu-riscv.h): Removed. (riscv_implicit_subsets): Added implicit extensions for g. (struct riscv_supported_ext): Used to be riscv_ext_version. Moved from gas/config/tc-riscv.c, and added new field `default_enable' to decide if the extension should be enabled by default. (EXT_DEFAULT): Defined for `default_enable' field. (riscv_supported_std_ext): It used to return the supported standard architecture string, but now we move ext_version_table from gas/config/tc-riscv.c to here, and rename it to riscv_supported_std_ext. Currently we not only use the table to initialize riscv_ext_order, but also get the default versions of extensions, and decide if the extensions should be enbaled by default. (riscv_supported_std_z_ext): Likewise, but is used for z* extensions. (riscv_supported_std_s_ext): Likewise, but is used for s* extensions. (riscv_supported_std_h_ext): Likewise, but is used for h* extensions. (riscv_supported_std_zxm_ext): Likewise, but is used for zxm* extensions. (riscv_all_supported_ext): Includes all supported extension tables. (riscv_known_prefixed_ext): Updated. (riscv_valid_prefixed_ext): Updated. (riscv_init_ext_order): Init the riscv_ext_order table according to riscv_supported_std_ext. (riscv_get_default_ext_version): Moved from gas/config/tc-riscv.c. Get the versions of extensions from riscv_supported_std* tables. (riscv_parse_add_subset): Updated. (riscv_parse_std_ext): Updated. (riscv_set_default_arch): Set the default subset list according to the default_enable field of riscv_supported_*ext tables. (riscv_parse_subset): If the input ARCH is NULL, then we call riscv_set_default_arch to set the default subset list. * elfxx-riscv.h (cpu-riscv.h): Included. (riscv_parse_subset_t): Removed get_default_version field, and added isa_spec field to replace it. (extern riscv_supported_std_ext): Removed. gas/ * (bfd/cpu-riscv.h): Removed. (struct riscv_ext_version): Renamed and moved to bfd/elfxx-riscv.c. (ext_version_table): Likewise. (riscv_get_default_ext_version): Likewise. (ext_version_hash): Removed. (init_ext_version_hash): Removed. (riscv_set_arch): Updated since the field of rps is changed. Besides, report error when the architecture string is empty. (riscv_after_parse_args): Updated.
Diffstat (limited to 'bfd/elfxx-riscv.h')
-rw-r--r--bfd/elfxx-riscv.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/bfd/elfxx-riscv.h b/bfd/elfxx-riscv.h
index 6a2501b..e691a97 100644
--- a/bfd/elfxx-riscv.h
+++ b/bfd/elfxx-riscv.h
@@ -23,6 +23,7 @@
#include "elf/common.h"
#include "elf/internal.h"
#include "opcode/riscv.h"
+#include "cpu-riscv.h"
#define RISCV_UNKNOWN_VERSION -1
@@ -71,9 +72,7 @@ typedef struct
void (*error_handler) (const char *,
...) ATTRIBUTE_PRINTF_1;
unsigned *xlen;
- void (*get_default_version) (const char *,
- int *,
- int *);
+ enum riscv_spec_class isa_spec;
bool check_unknown_prefixed_ext;
} riscv_parse_subset_t;
@@ -81,9 +80,6 @@ extern bool
riscv_parse_subset (riscv_parse_subset_t *,
const char *);
-extern const char *
-riscv_supported_std_ext (void);
-
extern void
riscv_release_subset_list (riscv_subset_list_t *);