aboutsummaryrefslogtreecommitdiff
path: root/bfd/cpu-arc.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2016-07-08 18:01:00 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2016-10-27 12:28:20 +0100
commitbb65a718b601ecfebd1ebe5be71728d5c359c31f (patch)
treecbc4d9fb2c4e3c69d0353dabf9eb5f2966aa6ab2 /bfd/cpu-arc.c
parent2e492780e8c4736b456448369ccdf4460f6e2675 (diff)
downloadgdb-bb65a718b601ecfebd1ebe5be71728d5c359c31f.zip
gdb-bb65a718b601ecfebd1ebe5be71728d5c359c31f.tar.gz
gdb-bb65a718b601ecfebd1ebe5be71728d5c359c31f.tar.bz2
gas/arc: Don't rely on bfd list of cpu type for cpu selection
In the ARC assembler, when a cpu type is specified using the .cpu directive, we rely on the bfd list of arc machine types in order to validate the cpu name passed in. This validation is only used in order to check that the cpu type passed to the .cpu directive matches any machine type selected earlier on the command line. Once that initial check has passed a full check is performed using the assemblers internal list of know cpu types. The problem is that the assembler knows about more cpu types than bfd, some cpu types known by the assembler are actually aliases for a base cpu type plus a specific set of assembler extensions. One such example is NPS400, though more could be added later. This commit removes the need for the assembler to use the bfd list of machine types for validation. Instead the error checking, to ensure that any value passed to a '.cpu' directive matches any earlier command line selection, is moved into the function arc_select_cpu. I have taken the opportunity to bundle the 4 separate static globals that describe the currently selected machine type into a single structure (called selected_cpu). gas/ChangeLog: * config/tc-arc.c (arc_target): Delete. (arc_target_name): Delete. (arc_features): Delete. (arc_mach_type): Delete. (mach_type_specified_p): Delete. (enum mach_selection_type): New enum. (mach_selection_mode): New static global. (selected_cpu): New static global. (arc_eflag): Rename to ... (arc_initial_eflag): ...this, and make const. (arc_select_cpu): Update comment, new parameter, check how previous machine type selection was made, and record this selection. Use selected_cpu instead of old globals. (arc_option): Remove use of arc_get_mach, instead use arc_select_cpu to validate machine type selection. Use selected_cpu over old globals. (allocate_tok): Use selected_cpu over old globals. (find_opcode_match): Likewise. (assemble_tokens): Likewise. (arc_cons_fix_new): Likewise. (arc_extinsn): Likewise. (arc_extcorereg): Likewise. (md_begin): Update default machine type selection, use selected_cpu over old globals. (md_parse_option): Update machine type selection option handling, use selected_cpu over old globals. * testsuite/gas/arc/nps400-0.s: Add .cpu directive. bfd/ChangeLog: * cpu-arc.c (arc_get_mach): Delete.
Diffstat (limited to 'bfd/cpu-arc.c')
-rw-r--r--bfd/cpu-arc.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/bfd/cpu-arc.c b/bfd/cpu-arc.c
index 07a052b..e63f3c1 100644
--- a/bfd/cpu-arc.c
+++ b/bfd/cpu-arc.c
@@ -54,20 +54,3 @@ static const bfd_arch_info_type arch_info_struct[] =
const bfd_arch_info_type bfd_arc_arch =
ARC (bfd_mach_arc_arc600, "ARC600", TRUE, &arch_info_struct[0]);
-
-/* Utility routines. */
-
-/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
- Returns -1 if not found. */
-int arc_get_mach (char *name);
-
-int
-arc_get_mach (char *name)
-{
- const bfd_arch_info_type *p;
-
- for (p = &bfd_arc_arch; p != NULL; p = p->next)
- if (strcmp (name, p->printable_name) == 0)
- return p->mach;
- return -1;
-}