bb65a718b6
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.
57 lines
2.0 KiB
C
57 lines
2.0 KiB
C
/* BFD support for the ARC processor
|
|
Copyright (C) 1994-2016 Free Software Foundation, Inc.
|
|
Contributed by Doug Evans (dje@cygnus.com).
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
MA 02110-1301, USA. */
|
|
|
|
#include "sysdep.h"
|
|
#include "bfd.h"
|
|
#include "libbfd.h"
|
|
|
|
#define ARC(mach, print_name, default_p, next) \
|
|
{ \
|
|
32, /* 32 bits in a word */ \
|
|
32, /* 32 bits in an address */ \
|
|
8, /* 8 bits in a byte */ \
|
|
bfd_arch_arc, \
|
|
mach, \
|
|
"arc", \
|
|
print_name, \
|
|
4, /* section alignment power */ \
|
|
default_p, \
|
|
bfd_default_compatible, \
|
|
bfd_default_scan, \
|
|
bfd_arch_default_fill, \
|
|
next, \
|
|
}
|
|
|
|
static const bfd_arch_info_type arch_info_struct[] =
|
|
{
|
|
ARC (bfd_mach_arc_arc600, "ARC600", FALSE, &arch_info_struct[1]),
|
|
ARC (bfd_mach_arc_arc600, "A6" , FALSE, &arch_info_struct[2]),
|
|
ARC (bfd_mach_arc_arc601, "ARC601", FALSE, &arch_info_struct[3]),
|
|
ARC (bfd_mach_arc_arc700, "ARC700", FALSE, &arch_info_struct[4]),
|
|
ARC (bfd_mach_arc_arc700, "A7", FALSE, &arch_info_struct[5]),
|
|
ARC (bfd_mach_arc_arcv2, "ARCv2", FALSE, &arch_info_struct[6]),
|
|
ARC (bfd_mach_arc_arcv2, "EM", FALSE, &arch_info_struct[7]),
|
|
ARC (bfd_mach_arc_arcv2, "HS", FALSE, NULL),
|
|
};
|
|
|
|
const bfd_arch_info_type bfd_arc_arch =
|
|
ARC (bfd_mach_arc_arc600, "ARC600", TRUE, &arch_info_struct[0]);
|