aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorClaudiu Zissulescu <claziss@synopsys.com>2017-05-10 14:42:22 +0200
committerclaziss <claziss@synopsys.com>2017-05-10 14:42:22 +0200
commit53a346d8236aec06f1d3c767716d3340fb0aa013 (patch)
tree4de962aabfa44a9640583f64e8af3e032be12947 /gas
parent21d1fbeed4b7c4d006e399437445519e6505088f (diff)
downloadgdb-53a346d8236aec06f1d3c767716d3340fb0aa013.zip
gdb-53a346d8236aec06f1d3c767716d3340fb0aa013.tar.gz
gdb-53a346d8236aec06f1d3c767716d3340fb0aa013.tar.bz2
[ARC] Object attributes.
gas/ 2017-05-10 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/gas/arc/attr-arc600.d: New file. * testsuite/gas/arc/attr-arc600_mul32x16.d: Likewise. * testsuite/gas/arc/attr-arc600_norm.d: Likewise. * testsuite/gas/arc/attr-arc601.d: Likewise. * testsuite/gas/arc/attr-arc601_mul32x16.d: Likewise. * testsuite/gas/arc/attr-arc601_mul64.d: Likewise. * testsuite/gas/arc/attr-arc601_norm.d: Likewise. * testsuite/gas/arc/attr-arc700.d: Likewise. * testsuite/gas/arc/attr-arcem.d: Likewise. * testsuite/gas/arc/attr-archs.d: Likewise. * testsuite/gas/arc/attr-autodetect-1.d: Likewise. * testsuite/gas/arc/attr-autodetect-1.s: Likewise. * testsuite/gas/arc/attr-cpu-a601.d: Likewise. * testsuite/gas/arc/attr-cpu-a601.s: Likewise. * testsuite/gas/arc/attr-cpu-a700.d: Likewise. * testsuite/gas/arc/attr-cpu-a700.s: Likewise. * testsuite/gas/arc/attr-cpu-em.d: Likewise. * testsuite/gas/arc/attr-cpu-em.s: Likewise. * testsuite/gas/arc/attr-cpu-hs.d: Likewise. * testsuite/gas/arc/attr-cpu-hs.s: Likewise. * testsuite/gas/arc/attr-em.d: Likewise. * testsuite/gas/arc/attr-em4.d: Likewise. * testsuite/gas/arc/attr-em4_dmips.d: Likewise. * testsuite/gas/arc/attr-em4_fpuda.d: Likewise. * testsuite/gas/arc/attr-em4_fpus.d: Likewise. * testsuite/gas/arc/attr-hs.d: Likewise. * testsuite/gas/arc/attr-hs34.d: Likewise. * testsuite/gas/arc/attr-hs38.d: Likewise. * testsuite/gas/arc/attr-hs38_linux.d: Likewise. * testsuite/gas/arc/attr-mul64.d: Likewise. * testsuite/gas/arc/attr-name.d: Likewise. * testsuite/gas/arc/attr-name.s: Likewise. * testsuite/gas/arc/attr-nps400.d: Likewise. * testsuite/gas/arc/attr-override-mcpu.d: Likewise. * testsuite/gas/arc/attr-override-mcpu.s * testsuite/gas/arc/attr-quarkse_em.d: Likewise. * testsuite/gas/arc/blank.s: Likewise. * testsuite/gas/elf/section2.e-arc: Likewise. * testsuite/gas/arc/cpu-pseudop-1.d: Update test. * testsuite/gas/arc/cpu-pseudop-2.d: Likewise. * testsuite/gas/arc/nps400-0.d: Likewise. * testsuite/gas/elf/elf.exp: Set target_machine for ARC. * config/tc-arc.c (opcode/arc-attrs.h): Include. (ARC_GET_FLAG, ARC_SET_FLAG, streq): Define. (arc_attribute): Declare new function. (md_pseudo_table): Add arc_attribute. (cpu_types): Rename default cpu features. (selected_cpu): Set the default OSABI flag. (mpy_option): New variable. (pic_option): Likewise. (sda_option): Likewise. (tls_option): Likewise. (feature_type, feature_list): Remove. (arc_initial_eflag): Likewise. (attributes_set_explicitly): New variable. (arc_check_feature): Check also for the conflicting features. (arc_select_cpu): Refactor assignment of selected_cpu.eflags. (arc_option): Remove setting of private flags and architecture. (check_cpu_feature): Refactor feature names. (autodetect_attributes): New function. (assemble_tokens): Use above function. (md_parse_option): Refactor feature names. (arc_attribute): New function. (arc_set_attribute_int): Likewise. (arc_set_attribute_string): Likewise. (arc_stralloc): Likewise. (arc_set_public_attributes): Likewise. (arc_md_end): Likewise. (arc_copy_symbol_attributes): Likewise. (rc_convert_symbolic_attribute): Likewise. * config/tc-arc.h (md_end): Define. (CONVERT_SYMBOLIC_ATTRIBUTE): Likewise. (TC_COPY_SYMBOL_ATTRIBUTES): Likewise. * doc/c-arc.texi: Document ARC object attributes. binutils/ 2017-05-10 Claudiu Zissulescu <claziss@synopsys.com> * readelf.c (decode_ARC_machine_flags): Recognize OSABI v4. (get_arc_section_type_name): New function. (get_section_type_name): Use the above function. (display_arc_attribute): New function. (process_arc_specific): Likewise. (process_arch_specific): Handle ARC specific information. * testsuite/binutils-all/strip-3.d: Consider ARC.attributes section. include/ 2017-05-10 Claudiu Zissulescu <claziss@synopsys.com> * elf/arc.h (SHT_ARC_ATTRIBUTES): Define. (Tag_ARC_*): Define. (E_ARC_OSABI_V4): Define. (E_ARC_OSABI_CURRENT): Reassign it. (TAG_CPU_*): Define. * opcode/arc-attrs.h: New file. * opcode/arc.h (insn_subclass_t): Assign enum values. (insn_subclass_t): Update enum with QUARKSE1, QUARKSE2, and LL64. (ARC_EA, ARC_CD, ARC_LLOCK, ARC_ATOMIC, ARC_MPY, ARC_MULT) (ARC_NPS400, ARC_DPFP, ARC_SPFP, ARC_FPU, ARC_FPUDA, ARC_SWAP) (ARC_NORM, ARC_BSCAN, ARC_UIX, ARC_TSTAMP, ARC_VBFDW) (ARC_BARREL, ARC_DSPA, ARC_SHIFT, ARC_INTR, ARC_DIV, ARC_XMAC) (ARC_CRC): Delete. bfd/ 2017-05-10 Claudiu Zissulescu <claziss@synopsys.com> * elf32-arc.c (FEATURE_LIST_NAME): Define. (CONFLICT_LIST): Likewise. (opcode/arc-attrs.h): Include. (arc_elf_print_private_bfd_data): Print OSABI v4 flag. (arc_extract_features): New file. (arc_stralloc): Likewise. (arc_elf_merge_attributes): Likewise. (arc_elf_merge_private_bfd_data): Use object attributes. (bfd_arc_get_mach_from_attributes): New function. (arc_elf_object_p): Use object attributes. (arc_elf_final_write_processing): Likewise. (elf32_arc_obj_attrs_arg_type): New function. (elf32_arc_obj_attrs_handle_unknown): Likewise. (elf32_arc_section_from_shdr): Likewise. (elf_backend_obj_attrs_vendor): Define. (elf_backend_obj_attrs_section): Likewise. (elf_backend_obj_attrs_arg_type): Likewise. (elf_backend_obj_attrs_section_type): Likewise. (elf_backend_obj_attrs_handle_unknown): Likewise. (elf_backend_section_from_shdr): Likewise. ld/ 2017-05-10 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/ld-arc/attr-merge-0.d: New file. * testsuite/ld-arc/attr-merge-0.s: Likewise. * testsuite/ld-arc/attr-merge-0e.s: Likewise. * testsuite/ld-arc/attr-merge-1.d: Likewise. * testsuite/ld-arc/attr-merge-1.s: Likewise. * testsuite/ld-arc/attr-merge-1e.s: Likewise. * testsuite/ld-arc/attr-merge-2.d: Likewise. * testsuite/ld-arc/attr-merge-2.s: Likewise. * testsuite/ld-arc/attr-merge-3.d: Likewise. * testsuite/ld-arc/attr-merge-3.s: Likewise. * testsuite/ld-arc/attr-merge-3e.s: Likewise. * testsuite/ld-arc/attr-merge-4.s: Likewise. * testsuite/ld-arc/attr-merge-5.d: Likewise. * testsuite/ld-arc/attr-merge-5a.s: Likewise. * testsuite/ld-arc/attr-merge-5b.s: Likewise. * testsuite/ld-arc/attr-merge-conflict-isa.d: Likewise. * testsuite/ld-arc/attr-merge-err-isa.d: Likewise. * testsuite/ld-arc/attr-merge-incompatible-cpu.d: Likewise. * testsuite/ld-arc/got-01.d: Update test. * testsuite/ld-arc/attr-merge-err-quarkse.d: New file. * testsuite/ld-arc/attr-quarkse.s: Likewise. * testsuite/ld-arc/attr-quarkse2.s: Likewise. opcodes/ 2017-05-10 Claudiu Zissulescu <claziss@synopsys.com> * arc-dis.c (parse_option): Update quarkse_em option.. * arc-ext-tbl.h (dsp_fp_flt2i, dsp_fp_i2flt): Change subclass to QUARKSE1. (dsp_fp_div, dsp_fp_cmp): Change subclass to QUARKSE2.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog77
-rw-r--r--gas/config/tc-arc.c375
-rw-r--r--gas/config/tc-arc.h11
-rw-r--r--gas/doc/c-arc.texi16
-rw-r--r--gas/testsuite/gas/arc/attr-arc600.d10
-rw-r--r--gas/testsuite/gas/arc/attr-arc600_mul32x16.d10
-rw-r--r--gas/testsuite/gas/arc/attr-arc600_norm.d10
-rw-r--r--gas/testsuite/gas/arc/attr-arc601.d10
-rw-r--r--gas/testsuite/gas/arc/attr-arc601_mul32x16.d10
-rw-r--r--gas/testsuite/gas/arc/attr-arc601_mul64.d10
-rw-r--r--gas/testsuite/gas/arc/attr-arc601_norm.d10
-rw-r--r--gas/testsuite/gas/arc/attr-arc700.d10
-rw-r--r--gas/testsuite/gas/arc/attr-arcem.d10
-rw-r--r--gas/testsuite/gas/arc/attr-archs.d11
-rw-r--r--gas/testsuite/gas/arc/attr-autodetect-1.d11
-rw-r--r--gas/testsuite/gas/arc/attr-autodetect-1.s4
-rw-r--r--gas/testsuite/gas/arc/attr-cpu-a601.d8
-rw-r--r--gas/testsuite/gas/arc/attr-cpu-a601.s1
-rw-r--r--gas/testsuite/gas/arc/attr-cpu-a700.d8
-rw-r--r--gas/testsuite/gas/arc/attr-cpu-a700.s1
-rw-r--r--gas/testsuite/gas/arc/attr-cpu-em.d8
-rw-r--r--gas/testsuite/gas/arc/attr-cpu-em.s1
-rw-r--r--gas/testsuite/gas/arc/attr-cpu-hs.d9
-rw-r--r--gas/testsuite/gas/arc/attr-cpu-hs.s1
-rw-r--r--gas/testsuite/gas/arc/attr-em.d10
-rw-r--r--gas/testsuite/gas/arc/attr-em4.d11
-rw-r--r--gas/testsuite/gas/arc/attr-em4_dmips.d11
-rw-r--r--gas/testsuite/gas/arc/attr-em4_fpuda.d11
-rw-r--r--gas/testsuite/gas/arc/attr-em4_fpus.d11
-rw-r--r--gas/testsuite/gas/arc/attr-hs.d11
-rw-r--r--gas/testsuite/gas/arc/attr-hs34.d11
-rw-r--r--gas/testsuite/gas/arc/attr-hs38.d11
-rw-r--r--gas/testsuite/gas/arc/attr-hs38_linux.d11
-rw-r--r--gas/testsuite/gas/arc/attr-mul64.d10
-rw-r--r--gas/testsuite/gas/arc/attr-name.d22
-rw-r--r--gas/testsuite/gas/arc/attr-name.s17
-rw-r--r--gas/testsuite/gas/arc/attr-nps400.d11
-rw-r--r--gas/testsuite/gas/arc/attr-override-mcpu.d10
-rw-r--r--gas/testsuite/gas/arc/attr-override-mcpu.s1
-rw-r--r--gas/testsuite/gas/arc/attr-quarkse_em.d11
-rw-r--r--gas/testsuite/gas/arc/blank.s1
-rw-r--r--gas/testsuite/gas/arc/cpu-pseudop-1.d2
-rw-r--r--gas/testsuite/gas/arc/cpu-pseudop-2.d2
-rw-r--r--gas/testsuite/gas/arc/nps400-0.d2
-rw-r--r--gas/testsuite/gas/elf/elf.exp3
-rw-r--r--gas/testsuite/gas/elf/section2.e-arc9
46 files changed, 762 insertions, 69 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 37a0b9b..fa4ab96 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,80 @@
+2017-05-10 Claudiu Zissulescu <claziss@synopsys.com>
+
+ * testsuite/gas/arc/attr-arc600.d: New file.
+ * testsuite/gas/arc/attr-arc600_mul32x16.d: Likewise.
+ * testsuite/gas/arc/attr-arc600_norm.d: Likewise.
+ * testsuite/gas/arc/attr-arc601.d: Likewise.
+ * testsuite/gas/arc/attr-arc601_mul32x16.d: Likewise.
+ * testsuite/gas/arc/attr-arc601_mul64.d: Likewise.
+ * testsuite/gas/arc/attr-arc601_norm.d: Likewise.
+ * testsuite/gas/arc/attr-arc700.d: Likewise.
+ * testsuite/gas/arc/attr-arcem.d: Likewise.
+ * testsuite/gas/arc/attr-archs.d: Likewise.
+ * testsuite/gas/arc/attr-autodetect-1.d: Likewise.
+ * testsuite/gas/arc/attr-autodetect-1.s: Likewise.
+ * testsuite/gas/arc/attr-cpu-a601.d: Likewise.
+ * testsuite/gas/arc/attr-cpu-a601.s: Likewise.
+ * testsuite/gas/arc/attr-cpu-a700.d: Likewise.
+ * testsuite/gas/arc/attr-cpu-a700.s: Likewise.
+ * testsuite/gas/arc/attr-cpu-em.d: Likewise.
+ * testsuite/gas/arc/attr-cpu-em.s: Likewise.
+ * testsuite/gas/arc/attr-cpu-hs.d: Likewise.
+ * testsuite/gas/arc/attr-cpu-hs.s: Likewise.
+ * testsuite/gas/arc/attr-em.d: Likewise.
+ * testsuite/gas/arc/attr-em4.d: Likewise.
+ * testsuite/gas/arc/attr-em4_dmips.d: Likewise.
+ * testsuite/gas/arc/attr-em4_fpuda.d: Likewise.
+ * testsuite/gas/arc/attr-em4_fpus.d: Likewise.
+ * testsuite/gas/arc/attr-hs.d: Likewise.
+ * testsuite/gas/arc/attr-hs34.d: Likewise.
+ * testsuite/gas/arc/attr-hs38.d: Likewise.
+ * testsuite/gas/arc/attr-hs38_linux.d: Likewise.
+ * testsuite/gas/arc/attr-mul64.d: Likewise.
+ * testsuite/gas/arc/attr-name.d: Likewise.
+ * testsuite/gas/arc/attr-name.s: Likewise.
+ * testsuite/gas/arc/attr-nps400.d: Likewise.
+ * testsuite/gas/arc/attr-override-mcpu.d: Likewise.
+ * testsuite/gas/arc/attr-override-mcpu.s
+ * testsuite/gas/arc/attr-quarkse_em.d: Likewise.
+ * testsuite/gas/arc/blank.s: Likewise.
+ * testsuite/gas/elf/section2.e-arc: Likewise.
+ * testsuite/gas/arc/cpu-pseudop-1.d: Update test.
+ * testsuite/gas/arc/cpu-pseudop-2.d: Likewise.
+ * testsuite/gas/arc/nps400-0.d: Likewise.
+ * testsuite/gas/elf/elf.exp: Set target_machine for ARC.
+ * config/tc-arc.c (opcode/arc-attrs.h): Include.
+ (ARC_GET_FLAG, ARC_SET_FLAG, streq): Define.
+ (arc_attribute): Declare new function.
+ (md_pseudo_table): Add arc_attribute.
+ (cpu_types): Rename default cpu features.
+ (selected_cpu): Set the default OSABI flag.
+ (mpy_option): New variable.
+ (pic_option): Likewise.
+ (sda_option): Likewise.
+ (tls_option): Likewise.
+ (feature_type, feature_list): Remove.
+ (arc_initial_eflag): Likewise.
+ (attributes_set_explicitly): New variable.
+ (arc_check_feature): Check also for the conflicting features.
+ (arc_select_cpu): Refactor assignment of selected_cpu.eflags.
+ (arc_option): Remove setting of private flags and architecture.
+ (check_cpu_feature): Refactor feature names.
+ (autodetect_attributes): New function.
+ (assemble_tokens): Use above function.
+ (md_parse_option): Refactor feature names.
+ (arc_attribute): New function.
+ (arc_set_attribute_int): Likewise.
+ (arc_set_attribute_string): Likewise.
+ (arc_stralloc): Likewise.
+ (arc_set_public_attributes): Likewise.
+ (arc_md_end): Likewise.
+ (arc_copy_symbol_attributes): Likewise.
+ (rc_convert_symbolic_attribute): Likewise.
+ * config/tc-arc.h (md_end): Define.
+ (CONVERT_SYMBOLIC_ATTRIBUTE): Likewise.
+ (TC_COPY_SYMBOL_ATTRIBUTES): Likewise.
+ * doc/c-arc.texi: Document ARC object attributes.
+
2017-05-03 Maciej W. Rozycki <macro@imgtec.com>
* config/tc-mips.c (RELAX_MIPS16_ENCODE): Add `pic', `sym32' and
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index f806ca3..a092892 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -28,6 +28,7 @@
#include "safe-ctype.h"
#include "opcode/arc.h"
+#include "opcode/arc-attrs.h"
#include "elf/arc.h"
#include "../opcodes/arc-ext.h"
@@ -55,6 +56,10 @@
#define TARGET_WITH_CPU "arc700"
#endif /* TARGET_WITH_CPU */
+#define ARC_GET_FLAG(s) (*symbol_get_tc (s))
+#define ARC_SET_FLAG(s,v) (*symbol_get_tc (s) |= (v))
+#define streq(a, b) (strcmp (a, b) == 0)
+
/* Enum used to enumerate the relaxable ins operands. */
enum rlx_operand_type
{
@@ -147,6 +152,7 @@ static void arc_option (int);
static void arc_extra_reloc (int);
static void arc_extinsn (int);
static void arc_extcorereg (int);
+static void arc_attribute (int);
const pseudo_typeS md_pseudo_table[] =
{
@@ -158,6 +164,7 @@ const pseudo_typeS md_pseudo_table[] =
{ "lcommon", arc_lcomm, 0 },
{ "cpu", arc_option, 0 },
+ { "arc_attribute", arc_attribute, 0 },
{ "extinstruction", arc_extinsn, 0 },
{ "extcoreregister", arc_extcorereg, EXT_CORE_REGISTER },
{ "extauxregister", arc_extcorereg, EXT_AUX_REGISTER },
@@ -451,21 +458,21 @@ static const struct cpu_type
cpu_types[] =
{
ARC_CPU_TYPE_A7xx (arc700, 0x00),
- ARC_CPU_TYPE_A7xx (nps400, ARC_NPS400),
+ ARC_CPU_TYPE_A7xx (nps400, NPS400),
ARC_CPU_TYPE_AV2EM (arcem, 0x00),
ARC_CPU_TYPE_AV2EM (em, 0x00),
- ARC_CPU_TYPE_AV2EM (em4, ARC_CD),
- ARC_CPU_TYPE_AV2EM (em4_dmips, ARC_CD),
- ARC_CPU_TYPE_AV2EM (em4_fpus, ARC_CD),
- ARC_CPU_TYPE_AV2EM (em4_fpuda, ARC_CD | ARC_FPUDA),
- ARC_CPU_TYPE_AV2EM (quarkse_em, ARC_CD | ARC_SPFP | ARC_DPFP),
-
- ARC_CPU_TYPE_AV2HS (archs, ARC_CD),
- ARC_CPU_TYPE_AV2HS (hs, ARC_CD),
- ARC_CPU_TYPE_AV2HS (hs34, ARC_CD),
- ARC_CPU_TYPE_AV2HS (hs38, ARC_CD),
- ARC_CPU_TYPE_AV2HS (hs38_linux, ARC_CD),
+ ARC_CPU_TYPE_AV2EM (em4, CD),
+ ARC_CPU_TYPE_AV2EM (em4_dmips, CD),
+ ARC_CPU_TYPE_AV2EM (em4_fpus, CD),
+ ARC_CPU_TYPE_AV2EM (em4_fpuda, CD | DPA),
+ ARC_CPU_TYPE_AV2EM (quarkse_em, CD | SPX | DPX),
+
+ ARC_CPU_TYPE_AV2HS (archs, CD),
+ ARC_CPU_TYPE_AV2HS (hs, CD),
+ ARC_CPU_TYPE_AV2HS (hs34, CD),
+ ARC_CPU_TYPE_AV2HS (hs38, CD),
+ ARC_CPU_TYPE_AV2HS (hs38_linux, CD),
ARC_CPU_TYPE_A6xx (arc600, 0x00),
ARC_CPU_TYPE_A6xx (arc600_norm, 0x00),
@@ -479,23 +486,19 @@ static const struct cpu_type
};
/* Information about the cpu/variant we're assembling for. */
-static struct cpu_type selected_cpu = { 0, 0, 0, 0, 0 };
+static struct cpu_type selected_cpu = { 0, 0, 0, E_ARC_OSABI_CURRENT, 0 };
-/* A table with options. */
-static const struct feature_type
-{
- unsigned feature;
- unsigned cpus;
- const char *name;
-}
- feature_list[] =
-{
- { ARC_CD, ARC_OPCODE_ARCV2, "code-density" },
- { ARC_NPS400, ARC_OPCODE_ARC700, "nps400" },
- { ARC_SPFP, ARC_OPCODE_ARCFPX, "single-precision FPX" },
- { ARC_DPFP, ARC_OPCODE_ARCFPX, "double-precision FPX" },
- { ARC_FPUDA, ARC_OPCODE_ARCv2EM, "double assist FP" }
-};
+/* MPY option. */
+static unsigned mpy_option = 0;
+
+/* Use PIC. */
+static unsigned pic_option = 0;
+
+/* Use small data. */
+static unsigned sda_option = 0;
+
+/* Use TLS. */
+static unsigned tls_option = 0;
/* Command line given features. */
static unsigned cl_features = 0;
@@ -695,15 +698,15 @@ const struct arc_relaxable_ins arc_relaxable_insns[] =
const unsigned arc_num_relaxable_ins = ARRAY_SIZE (arc_relaxable_insns);
-/* Flags to set in the elf header. */
-static const flagword arc_initial_eflag = 0x00;
-
/* Pre-defined "_GLOBAL_OFFSET_TABLE_". */
symbolS * GOT_symbol = 0;
/* Set to TRUE when we assemble instructions. */
static bfd_boolean assembling_insn = FALSE;
+/* List with attributes set explicitly. */
+static bfd_boolean attributes_set_explicitly[NUM_KNOWN_OBJ_ATTRIBUTES];
+
/* Functions implementation. */
/* Return a pointer to ARC_OPCODE_HASH_ENTRY that identifies all
@@ -832,15 +835,16 @@ arc_check_feature (void)
if (!selected_cpu.features
|| !selected_cpu.name)
return;
- for (i = 0; (i < ARRAY_SIZE (feature_list)); i++)
- {
- if ((selected_cpu.features & feature_list[i].feature)
- && !(selected_cpu.flags & feature_list[i].cpus))
- {
- as_bad (_("invalid %s option for %s cpu"), feature_list[i].name,
- selected_cpu.name);
- }
- }
+
+ for (i = 0; i < ARRAY_SIZE (feature_list); i++)
+ if ((selected_cpu.features & feature_list[i].feature)
+ && !(selected_cpu.flags & feature_list[i].cpus))
+ as_bad (_("invalid %s option for %s cpu"), feature_list[i].name,
+ selected_cpu.name);
+
+ for (i = 0; i < ARRAY_SIZE (conflict_list); i++)
+ if ((selected_cpu.features & conflict_list[i]) == conflict_list[i])
+ as_bad(_("conflicting ISA extension attributes."));
}
/* Select an appropriate entry from CPU_TYPES based on ARG and initialise
@@ -850,7 +854,6 @@ arc_check_feature (void)
static void
arc_select_cpu (const char *arg, enum mach_selection_type sel)
{
- int cpu_flags = 0;
int i;
/* We should only set a default if we've not made a selection from some
@@ -888,7 +891,8 @@ arc_select_cpu (const char *arg, enum mach_selection_type sel)
selected_cpu.name = cpu_types[i].name;
selected_cpu.features = cpu_types[i].features | cl_features;
selected_cpu.mach = cpu_types[i].mach;
- cpu_flags = cpu_types[i].eflags;
+ selected_cpu.eflags = ((selected_cpu.eflags & ~EF_ARC_MACH_MSK)
+ | cpu_types[i].eflags);
break;
}
}
@@ -898,8 +902,7 @@ arc_select_cpu (const char *arg, enum mach_selection_type sel)
/* Check if set features are compatible with the chosen CPU. */
arc_check_feature ();
- gas_assert (cpu_flags != 0);
- selected_cpu.eflags = (arc_initial_eflag & ~EF_ARC_MACH_MSK) | cpu_flags;
+
mach_selection_mode = sel;
}
@@ -1026,12 +1029,6 @@ arc_option (int ignore ATTRIBUTE_UNUSED)
arc_select_cpu (cpu_name, MACH_SELECTION_FROM_CPU_DIRECTIVE);
- if (!bfd_set_arch_mach (stdoutput, bfd_arch_arc, selected_cpu.mach))
- as_fatal (_("could not set architecture and machine"));
-
- /* Set elf header flags. */
- bfd_set_private_flags (stdoutput, selected_cpu.eflags);
-
restore_line_pointer (c);
demand_empty_rest_of_line ();
}
@@ -1626,19 +1623,19 @@ allocate_tok (expressionS *tok, int ntok, int cidx)
static bfd_boolean
check_cpu_feature (insn_subclass_t sc)
{
- if (is_code_density_p (sc) && !(selected_cpu.features & ARC_CD))
+ if (is_code_density_p (sc) && !(selected_cpu.features & CD))
return FALSE;
- if (is_spfp_p (sc) && !(selected_cpu.features & ARC_SPFP))
+ if (is_spfp_p (sc) && !(selected_cpu.features & SPX))
return FALSE;
- if (is_dpfp_p (sc) && !(selected_cpu.features & ARC_DPFP))
+ if (is_dpfp_p (sc) && !(selected_cpu.features & DPX))
return FALSE;
- if (is_fpuda_p (sc) && !(selected_cpu.features & ARC_FPUDA))
+ if (is_fpuda_p (sc) && !(selected_cpu.features & DPA))
return FALSE;
- if (is_nps400_p (sc) && !(selected_cpu.features & ARC_NPS400))
+ if (is_nps400_p (sc) && !(selected_cpu.features & NPS400))
return FALSE;
return TRUE;
@@ -2345,7 +2342,56 @@ find_special_case (const char *opname,
return entry;
}
-/* Given an opcode name, pre-tokenized set of arguments and the
+/* Autodetect cpu attribute list. */
+
+static void
+autodetect_attributes (const struct arc_opcode *opcode,
+ const expressionS *tok,
+ int ntok)
+{
+ unsigned i;
+ struct mpy_type
+ {
+ unsigned feature;
+ unsigned encoding;
+ } mpy_list[] = {{ MPY1E, 1 }, { MPY6E, 6 }, { MPY7E, 7 }, { MPY8E, 8 },
+ { MPY9E, 9 }};
+
+ for (i = 0; i < ARRAY_SIZE (feature_list); i++)
+ if (opcode->subclass == feature_list[i].feature)
+ selected_cpu.features |= feature_list[i].feature;
+
+ for (i = 0; i < ARRAY_SIZE (mpy_list); i++)
+ if (opcode->subclass == mpy_list[i].feature)
+ mpy_option = mpy_list[i].encoding;
+
+ for (i = 0; i < (unsigned) ntok; i++)
+ {
+ switch (tok[i].X_md)
+ {
+ case O_gotoff:
+ case O_gotpc:
+ case O_plt:
+ pic_option = 2;
+ break;
+ case O_sda:
+ sda_option = 2;
+ break;
+ case O_tlsgd:
+ case O_tlsie:
+ case O_tpoff9:
+ case O_tpoff:
+ case O_dtpoff9:
+ case O_dtpoff:
+ tls_option = 1;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+/* Given an opcode name, pre-tockenized set of argumenst and the
opcode flags, take it all the way through emission. */
static void
@@ -2380,6 +2426,7 @@ assemble_tokens (const char *opname,
{
struct arc_insn insn;
+ autodetect_attributes (opcode, tok, ntok);
assemble_insn (opcode, tok, ntok, pflags, nflgs, &insn);
emit_insn (&insn);
return;
@@ -3384,8 +3431,8 @@ md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
break;
case OPTION_CD:
- selected_cpu.features |= ARC_CD;
- cl_features |= ARC_CD;
+ selected_cpu.features |= CD;
+ cl_features |= CD;
arc_check_feature ();
break;
@@ -3394,26 +3441,26 @@ md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
break;
case OPTION_NPS400:
- selected_cpu.features |= ARC_NPS400;
- cl_features |= ARC_NPS400;
+ selected_cpu.features |= NPS400;
+ cl_features |= NPS400;
arc_check_feature ();
break;
case OPTION_SPFP:
- selected_cpu.features |= ARC_SPFP;
- cl_features |= ARC_SPFP;
+ selected_cpu.features |= SPX;
+ cl_features |= SPX;
arc_check_feature ();
break;
case OPTION_DPFP:
- selected_cpu.features |= ARC_DPFP;
- cl_features |= ARC_DPFP;
+ selected_cpu.features |= DPX;
+ cl_features |= DPX;
arc_check_feature ();
break;
case OPTION_FPUDA:
- selected_cpu.features |= ARC_FPUDA;
- cl_features |= ARC_FPUDA;
+ selected_cpu.features |= DPA;
+ cl_features |= DPA;
arc_check_feature ();
break;
@@ -4828,6 +4875,202 @@ arc_extcorereg (int opertype)
create_extcore_section (&ereg, opertype);
}
+/* Parse a .arc_attribute directive. */
+
+static void
+arc_attribute (int ignored ATTRIBUTE_UNUSED)
+{
+ int tag = obj_elf_vendor_attribute (OBJ_ATTR_PROC);
+
+ if (tag < NUM_KNOWN_OBJ_ATTRIBUTES)
+ attributes_set_explicitly[tag] = TRUE;
+}
+
+/* Set an attribute if it has not already been set by the user. */
+
+static void
+arc_set_attribute_int (int tag, int value)
+{
+ if (tag < 1
+ || tag >= NUM_KNOWN_OBJ_ATTRIBUTES
+ || !attributes_set_explicitly[tag])
+ bfd_elf_add_proc_attr_int (stdoutput, tag, value);
+}
+
+static void
+arc_set_attribute_string (int tag, const char *value)
+{
+ if (tag < 1
+ || tag >= NUM_KNOWN_OBJ_ATTRIBUTES
+ || !attributes_set_explicitly[tag])
+ bfd_elf_add_proc_attr_string (stdoutput, tag, value);
+}
+
+/* Allocate and concatenate two strings. s1 can be NULL but not
+ s2. s1 pointer is freed at end of this procedure. */
+
+static char *
+arc_stralloc (char * s1, const char * s2)
+{
+ char * p;
+ int len = 0;
+
+ if (s1)
+ len = strlen (s1) + 1;
+
+ /* Only s1 can be null. */
+ gas_assert (s2);
+ len += strlen (s2) + 1;
+
+ p = (char *) xmalloc (len);
+ if (p == NULL)
+ as_fatal (_("Virtual memory exhausted"));
+
+ if (s1)
+ {
+ strcpy (p, s1);
+ strcat (p, ",");
+ strcat (p, s2);
+ free (s1);
+ }
+ else
+ strcpy (p, s2);
+
+ return p;
+}
+
+/* Set the public ARC object attributes. */
+
+static void
+arc_set_public_attributes (void)
+{
+ int base = 0;
+ char *s = NULL;
+ unsigned int i;
+
+ /* Tag_ARC_CPU_name. */
+ arc_set_attribute_string (Tag_ARC_CPU_name, selected_cpu.name);
+
+ /* Tag_ARC_CPU_base. */
+ switch (selected_cpu.eflags & EF_ARC_MACH_MSK)
+ {
+ case E_ARC_MACH_ARC600:
+ case E_ARC_MACH_ARC601:
+ base = TAG_CPU_ARC6xx;
+ break;
+ case E_ARC_MACH_ARC700:
+ base = TAG_CPU_ARC7xx;
+ break;
+ case EF_ARC_CPU_ARCV2EM:
+ base = TAG_CPU_ARCEM;
+ break;
+ case EF_ARC_CPU_ARCV2HS:
+ base = TAG_CPU_ARCHS;
+ break;
+ default:
+ base = 0;
+ break;
+ }
+ if (attributes_set_explicitly[Tag_ARC_CPU_base]
+ && (base != bfd_elf_get_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_ARC_CPU_base)))
+ as_warn (_("Overwrite explicitly set Tag_ARC_CPU_base"));
+ bfd_elf_add_proc_attr_int (stdoutput, Tag_ARC_CPU_base, base);
+
+ /* Tag_ARC_ABI_osver. */
+ if (attributes_set_explicitly[Tag_ARC_ABI_osver])
+ {
+ int val = bfd_elf_get_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_ARC_ABI_osver);
+
+ selected_cpu.eflags = ((selected_cpu.eflags & ~EF_ARC_OSABI_MSK)
+ | (val & 0x0f << 8));
+ }
+ else
+ {
+ arc_set_attribute_int (Tag_ARC_ABI_osver, E_ARC_OSABI_CURRENT >> 8);
+ }
+
+ /* Tag_ARC_ISA_config. */
+ arc_check_feature();
+
+ for (i = 0; i < ARRAY_SIZE (feature_list); i++)
+ if (selected_cpu.features & feature_list[i].feature)
+ s = arc_stralloc (s, feature_list[i].attr);
+
+ if (s)
+ arc_set_attribute_string (Tag_ARC_ISA_config, s);
+
+ /* Tag_ARC_ISA_mpy_option. */
+ arc_set_attribute_int (Tag_ARC_ISA_mpy_option, mpy_option);
+
+ /* Tag_ARC_ABI_pic. */
+ arc_set_attribute_int (Tag_ARC_ABI_pic, pic_option);
+
+ /* Tag_ARC_ABI_sda. */
+ arc_set_attribute_int (Tag_ARC_ABI_sda, sda_option);
+
+ /* Tag_ARC_ABI_tls. */
+ arc_set_attribute_int (Tag_ARC_ABI_tls, tls_option);
+}
+
+/* Add the default contents for the .ARC.attributes section. */
+
+void
+arc_md_end (void)
+{
+ arc_set_public_attributes ();
+
+ if (!bfd_set_arch_mach (stdoutput, bfd_arch_arc, selected_cpu.mach))
+ as_fatal (_("could not set architecture and machine"));
+
+ bfd_set_private_flags (stdoutput, selected_cpu.eflags);
+}
+
+void arc_copy_symbol_attributes (symbolS *dest, symbolS *src)
+{
+ ARC_GET_FLAG (dest) = ARC_GET_FLAG (src);
+}
+
+int arc_convert_symbolic_attribute (const char *name)
+{
+ static const struct
+ {
+ const char * name;
+ const int tag;
+ }
+ attribute_table[] =
+ {
+#define T(tag) {#tag, tag}
+ T (Tag_ARC_PCS_config),
+ T (Tag_ARC_CPU_base),
+ T (Tag_ARC_CPU_variation),
+ T (Tag_ARC_CPU_name),
+ T (Tag_ARC_ABI_rf16),
+ T (Tag_ARC_ABI_osver),
+ T (Tag_ARC_ABI_sda),
+ T (Tag_ARC_ABI_pic),
+ T (Tag_ARC_ABI_tls),
+ T (Tag_ARC_ABI_enumsize),
+ T (Tag_ARC_ABI_exceptions),
+ T (Tag_ARC_ABI_double_size),
+ T (Tag_ARC_ISA_config),
+ T (Tag_ARC_ISA_apex),
+ T (Tag_ARC_ISA_mpy_option)
+#undef T
+ };
+ unsigned int i;
+
+ if (name == NULL)
+ return -1;
+
+ for (i = 0; i < ARRAY_SIZE (attribute_table); i++)
+ if (streq (name, attribute_table[i].name))
+ return attribute_table[i].tag;
+
+ return -1;
+}
+
/* Local variables:
eval: (c-set-style "gnu")
indent-tabs-mode: t
diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h
index 41d83d8..f4cafe9 100644
--- a/gas/config/tc-arc.h
+++ b/gas/config/tc-arc.h
@@ -190,6 +190,17 @@ extern long md_pcrel_from_section (struct fix *, segT);
/* Adjust symbol table. */
#define obj_adjust_symtab() arc_adjust_symtab ()
+/* Object attribute hooks. */
+#define md_end arc_md_end
+#define CONVERT_SYMBOLIC_ATTRIBUTE(name) arc_convert_symbolic_attribute (name)
+#ifndef TC_COPY_SYMBOL_ATTRIBUTES
+#define TC_COPY_SYMBOL_ATTRIBUTES(DEST, SRC) \
+ (arc_copy_symbol_attributes (DEST, SRC))
+#endif
+
+extern void arc_copy_symbol_attributes (symbolS *, symbolS *);
+extern int arc_convert_symbolic_attribute (const char *);
+extern void arc_md_end (void);
extern void arc_adjust_symtab (void);
extern int arc_pcrel_adjust (fragS *);
extern bfd_boolean arc_parse_name (const char *, struct expressionS *);
diff --git a/gas/doc/c-arc.texi b/gas/doc/c-arc.texi
index 1ff0b0f..14fe10f 100644
--- a/gas/doc/c-arc.texi
+++ b/gas/doc/c-arc.texi
@@ -658,6 +658,22 @@ A two operands instruction variant would be:
which describes a two operand instruction with an implicit first
immediate operand. The result of this operation would be discarded.
+@cindex @code{.arc_attribute} directive, ARC
+@item .arc_attribute @var{tag}, @var{value}
+Set the ARC object attribute @var{tag} to @var{value}.
+
+The @var{tag} is either an attribute number, or one of the following:
+@code{Tag_ARC_PCS_config}, @code{Tag_ARC_CPU_base},
+@code{Tag_ARC_CPU_variation}, @code{Tag_ARC_CPU_name},
+@code{Tag_ARC_ABI_rf16}, @code{Tag_ARC_ABI_osver}, @code{Tag_ARC_ABI_sda},
+@code{Tag_ARC_ABI_pic}, @code{Tag_ARC_ABI_tls}, @code{Tag_ARC_ABI_enumsize},
+@code{Tag_ARC_ABI_exceptions}, @code{Tag_ARC_ABI_double_size},
+@code{Tag_ARC_ISA_config}, @code{Tag_ARC_ISA_apex},
+@code{Tag_ARC_ISA_mpy_option}
+
+The @var{value} is either a @code{number}, @code{"string"}, or
+@code{number, "string"} depending on the tag.
+
@end table
@node ARC Modifiers
diff --git a/gas/testsuite/gas/arc/attr-arc600.d b/gas/testsuite/gas/arc/attr-arc600.d
new file mode 100644
index 0000000..07eecc6
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-arc600.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=arc600
+# source: blank.s
+# as: -mcpu=arc600
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC6xx
+ Tag_ARC_CPU_name: "arc600"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-arc600_mul32x16.d b/gas/testsuite/gas/arc/attr-arc600_mul32x16.d
new file mode 100644
index 0000000..6ca411d
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-arc600_mul32x16.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=arc600_mul32x16
+# source: blank.s
+# as: -mcpu=arc600_mul32x16
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC6xx
+ Tag_ARC_CPU_name: "arc600_mul32x16"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-arc600_norm.d b/gas/testsuite/gas/arc/attr-arc600_norm.d
new file mode 100644
index 0000000..2ff0a71
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-arc600_norm.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=arc600_norm
+# source: blank.s
+# as: -mcpu=arc600_norm
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC6xx
+ Tag_ARC_CPU_name: "arc600_norm"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-arc601.d b/gas/testsuite/gas/arc/attr-arc601.d
new file mode 100644
index 0000000..f8fb744
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-arc601.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=arc601
+# source: blank.s
+# as: -mcpu=arc601
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC6xx
+ Tag_ARC_CPU_name: "arc601"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-arc601_mul32x16.d b/gas/testsuite/gas/arc/attr-arc601_mul32x16.d
new file mode 100644
index 0000000..8104276
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-arc601_mul32x16.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=arc601_mul32x16
+# source: blank.s
+# as: -mcpu=arc601_mul32x16
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC6xx
+ Tag_ARC_CPU_name: "arc601_mul32x16"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-arc601_mul64.d b/gas/testsuite/gas/arc/attr-arc601_mul64.d
new file mode 100644
index 0000000..9985476
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-arc601_mul64.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=arc601_mul64
+# source: blank.s
+# as: -mcpu=arc601_mul64
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC6xx
+ Tag_ARC_CPU_name: "arc601_mul64"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-arc601_norm.d b/gas/testsuite/gas/arc/attr-arc601_norm.d
new file mode 100644
index 0000000..18131dc
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-arc601_norm.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=arc601_norm
+# source: blank.s
+# as: -mcpu=arc601_norm
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC6xx
+ Tag_ARC_CPU_name: "arc601_norm"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-arc700.d b/gas/testsuite/gas/arc/attr-arc700.d
new file mode 100644
index 0000000..cc4dc38
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-arc700.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=arc700
+# source: blank.s
+# as: -mcpu=arc700
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC7xx
+ Tag_ARC_CPU_name: "arc700"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-arcem.d b/gas/testsuite/gas/arc/attr-arcem.d
new file mode 100644
index 0000000..da97473
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-arcem.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=arcem
+# source: blank.s
+# as: -mcpu=arcem
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCEM
+ Tag_ARC_CPU_name: "arcem"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-archs.d b/gas/testsuite/gas/arc/attr-archs.d
new file mode 100644
index 0000000..c0d2e63
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-archs.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=archs
+# source: blank.s
+# as: -mcpu=archs
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCHS
+ Tag_ARC_CPU_name: "archs"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-autodetect-1.d b/gas/testsuite/gas/arc/attr-autodetect-1.d
new file mode 100644
index 0000000..bbe8525
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-autodetect-1.d
@@ -0,0 +1,11 @@
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCHS
+ Tag_ARC_CPU_name: "archs"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ABI_sda: GNU
+ Tag_ARC_ABI_pic: GNU
+ Tag_ARC_ABI_tls: r25
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-autodetect-1.s b/gas/testsuite/gas/arc/attr-autodetect-1.s
new file mode 100644
index 0000000..68f3e2b
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-autodetect-1.s
@@ -0,0 +1,4 @@
+ .cpu archs
+ add_s r0,gp,@a@sda
+ add r0,pcl,@var@tlsgd
+ bl @a@plt
diff --git a/gas/testsuite/gas/arc/attr-cpu-a601.d b/gas/testsuite/gas/arc/attr-cpu-a601.d
new file mode 100644
index 0000000..33a2f31
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-cpu-a601.d
@@ -0,0 +1,8 @@
+# as:
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC6xx
+ Tag_ARC_CPU_name: "arc601"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-cpu-a601.s b/gas/testsuite/gas/arc/attr-cpu-a601.s
new file mode 100644
index 0000000..b6ebd8c
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-cpu-a601.s
@@ -0,0 +1 @@
+ .cpu arc601
diff --git a/gas/testsuite/gas/arc/attr-cpu-a700.d b/gas/testsuite/gas/arc/attr-cpu-a700.d
new file mode 100644
index 0000000..db69ade
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-cpu-a700.d
@@ -0,0 +1,8 @@
+# as:
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC7xx
+ Tag_ARC_CPU_name: "arc700"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-cpu-a700.s b/gas/testsuite/gas/arc/attr-cpu-a700.s
new file mode 100644
index 0000000..b84a24c
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-cpu-a700.s
@@ -0,0 +1 @@
+ .cpu ARC700
diff --git a/gas/testsuite/gas/arc/attr-cpu-em.d b/gas/testsuite/gas/arc/attr-cpu-em.d
new file mode 100644
index 0000000..c635bd5
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-cpu-em.d
@@ -0,0 +1,8 @@
+# as:
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCEM
+ Tag_ARC_CPU_name: "em"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-cpu-em.s b/gas/testsuite/gas/arc/attr-cpu-em.s
new file mode 100644
index 0000000..0b033e9
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-cpu-em.s
@@ -0,0 +1 @@
+ .cpu em
diff --git a/gas/testsuite/gas/arc/attr-cpu-hs.d b/gas/testsuite/gas/arc/attr-cpu-hs.d
new file mode 100644
index 0000000..4de82ad
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-cpu-hs.d
@@ -0,0 +1,9 @@
+# as:
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCHS
+ Tag_ARC_CPU_name: "hs"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-cpu-hs.s b/gas/testsuite/gas/arc/attr-cpu-hs.s
new file mode 100644
index 0000000..d413612
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-cpu-hs.s
@@ -0,0 +1 @@
+ .cpu hs
diff --git a/gas/testsuite/gas/arc/attr-em.d b/gas/testsuite/gas/arc/attr-em.d
new file mode 100644
index 0000000..a322ff6
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-em.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=em
+# source: blank.s
+# as: -mcpu=em
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCEM
+ Tag_ARC_CPU_name: "em"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-em4.d b/gas/testsuite/gas/arc/attr-em4.d
new file mode 100644
index 0000000..bbc6e67
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-em4.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=em4
+# source: blank.s
+# as: -mcpu=em4
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCEM
+ Tag_ARC_CPU_name: "em4"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-em4_dmips.d b/gas/testsuite/gas/arc/attr-em4_dmips.d
new file mode 100644
index 0000000..4d923bd
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-em4_dmips.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=em4_dmips
+# source: blank.s
+# as: -mcpu=em4_dmips
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCEM
+ Tag_ARC_CPU_name: "em4_dmips"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-em4_fpuda.d b/gas/testsuite/gas/arc/attr-em4_fpuda.d
new file mode 100644
index 0000000..432315a
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-em4_fpuda.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=em4_fpuda
+# source: blank.s
+# as: -mcpu=em4_fpuda
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCEM
+ Tag_ARC_CPU_name: "em4_fpuda"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD,FPUDA"
diff --git a/gas/testsuite/gas/arc/attr-em4_fpus.d b/gas/testsuite/gas/arc/attr-em4_fpus.d
new file mode 100644
index 0000000..b658e2a
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-em4_fpus.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=em4_fpus
+# source: blank.s
+# as: -mcpu=em4_fpus
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCEM
+ Tag_ARC_CPU_name: "em4_fpus"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-hs.d b/gas/testsuite/gas/arc/attr-hs.d
new file mode 100644
index 0000000..8486214
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-hs.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=hs
+# source: blank.s
+# as: -mcpu=hs
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCHS
+ Tag_ARC_CPU_name: "hs"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-hs34.d b/gas/testsuite/gas/arc/attr-hs34.d
new file mode 100644
index 0000000..8b92ec6
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-hs34.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=hs34
+# source: blank.s
+# as: -mcpu=hs34
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCHS
+ Tag_ARC_CPU_name: "hs34"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-hs38.d b/gas/testsuite/gas/arc/attr-hs38.d
new file mode 100644
index 0000000..8972431
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-hs38.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=hs38
+# source: blank.s
+# as: -mcpu=hs38
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCHS
+ Tag_ARC_CPU_name: "hs38"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-hs38_linux.d b/gas/testsuite/gas/arc/attr-hs38_linux.d
new file mode 100644
index 0000000..a695f29
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-hs38_linux.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=hs38_linux
+# source: blank.s
+# as: -mcpu=hs38_linux
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCHS
+ Tag_ARC_CPU_name: "hs38_linux"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-mul64.d b/gas/testsuite/gas/arc/attr-mul64.d
new file mode 100644
index 0000000..5fc75ff
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-mul64.d
@@ -0,0 +1,10 @@
+# name: attributes for -mcpu=arc600_mul64
+# source: blank.s
+# as: -mcpu=arc600_mul64
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC6xx
+ Tag_ARC_CPU_name: "arc600_mul64"
+ Tag_ARC_ABI_osver: v4
diff --git a/gas/testsuite/gas/arc/attr-name.d b/gas/testsuite/gas/arc/attr-name.d
new file mode 100644
index 0000000..ff9a34b
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-name.d
@@ -0,0 +1,22 @@
+# name: ARC object attribute names
+# source: attr-name.s
+# as:
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_PCS_config: Bare metal/mwdt
+ Tag_ARC_CPU_base: ARC6xx
+ Tag_ARC_CPU_variation: Core1
+ Tag_ARC_CPU_name: "random-cpu"
+ Tag_ARC_ABI_rf16: yes
+ Tag_ARC_ABI_osver: v3
+ Tag_ARC_ABI_sda: GNU
+ Tag_ARC_ABI_pic: GNU
+ Tag_ARC_ABI_tls: r25
+ Tag_ARC_ABI_enumsize: default
+ Tag_ARC_ABI_exceptions: OPTFP
+ Tag_ARC_ABI_double_size: 8
+ Tag_ARC_ISA_config: "CD,FPUDA"
+ Tag_ARC_ISA_apex: "QUARKSE"
+ Tag_ARC_ISA_mpy_option: 6
diff --git a/gas/testsuite/gas/arc/attr-name.s b/gas/testsuite/gas/arc/attr-name.s
new file mode 100644
index 0000000..cddc850
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-name.s
@@ -0,0 +1,17 @@
+;;; Set the cpu to avoid the eventual warning when setting Tag_ARC_CPU_base.
+ .cpu ARC600
+ .arc_attribute Tag_ARC_PCS_config,1
+ .arc_attribute Tag_ARC_CPU_base, 1
+ .arc_attribute Tag_ARC_CPU_variation, 1
+ .arc_attribute Tag_ARC_CPU_name, "random-cpu"
+ .arc_attribute Tag_ARC_ABI_rf16, 1
+ .arc_attribute Tag_ARC_ABI_osver, 3
+ .arc_attribute Tag_ARC_ABI_sda, 2
+ .arc_attribute Tag_ARC_ABI_pic, 2
+ .arc_attribute Tag_ARC_ABI_tls, 25
+ .arc_attribute Tag_ARC_ABI_enumsize, 1
+ .arc_attribute Tag_ARC_ABI_exceptions, 1
+ .arc_attribute Tag_ARC_ABI_double_size, 8
+ .arc_attribute Tag_ARC_ISA_config, "CD,FPUDA"
+ .arc_attribute Tag_ARC_ISA_apex, "QUARKSE"
+ .arc_attribute Tag_ARC_ISA_mpy_option, 6
diff --git a/gas/testsuite/gas/arc/attr-nps400.d b/gas/testsuite/gas/arc/attr-nps400.d
new file mode 100644
index 0000000..15009ce
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-nps400.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=nps400
+# source: blank.s
+# as: -mcpu=nps400
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARC7xx
+ Tag_ARC_CPU_name: "nps400"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "NPS400"
diff --git a/gas/testsuite/gas/arc/attr-override-mcpu.d b/gas/testsuite/gas/arc/attr-override-mcpu.d
new file mode 100644
index 0000000..67241e9
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-override-mcpu.d
@@ -0,0 +1,10 @@
+# source: attr-override-mcpu.s
+# as: -mcpu=archs
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCHS
+ Tag_ARC_CPU_name: "archs"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD"
diff --git a/gas/testsuite/gas/arc/attr-override-mcpu.s b/gas/testsuite/gas/arc/attr-override-mcpu.s
new file mode 100644
index 0000000..f68af58
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-override-mcpu.s
@@ -0,0 +1 @@
+ .cpu EM
diff --git a/gas/testsuite/gas/arc/attr-quarkse_em.d b/gas/testsuite/gas/arc/attr-quarkse_em.d
new file mode 100644
index 0000000..64c85c3
--- /dev/null
+++ b/gas/testsuite/gas/arc/attr-quarkse_em.d
@@ -0,0 +1,11 @@
+# name: attributes for -mcpu=quarkse_em
+# source: blank.s
+# as: -mcpu=quarkse_em
+# readelf: -A
+
+Attribute Section: ARC
+File Attributes
+ Tag_ARC_CPU_base: ARCEM
+ Tag_ARC_CPU_name: "quarkse_em"
+ Tag_ARC_ABI_osver: v4
+ Tag_ARC_ISA_config: "CD,DPFP,SPFP"
diff --git a/gas/testsuite/gas/arc/blank.s b/gas/testsuite/gas/arc/blank.s
new file mode 100644
index 0000000..46641c4
--- /dev/null
+++ b/gas/testsuite/gas/arc/blank.s
@@ -0,0 +1 @@
+# this file left intentionally blank
diff --git a/gas/testsuite/gas/arc/cpu-pseudop-1.d b/gas/testsuite/gas/arc/cpu-pseudop-1.d
index 09c47c9..8aeb13a 100644
--- a/gas/testsuite/gas/arc/cpu-pseudop-1.d
+++ b/gas/testsuite/gas/arc/cpu-pseudop-1.d
@@ -2,7 +2,7 @@
#objdump: -dp -M dpfp
.*: +file format .*arc.*
-private flags = 0x305: -mcpu=ARCv2EM .*
+private flags = 0x\d05: -mcpu=ARCv2EM .*
Disassembly of section .text:
diff --git a/gas/testsuite/gas/arc/cpu-pseudop-2.d b/gas/testsuite/gas/arc/cpu-pseudop-2.d
index 3bde329..6ad0d26 100644
--- a/gas/testsuite/gas/arc/cpu-pseudop-2.d
+++ b/gas/testsuite/gas/arc/cpu-pseudop-2.d
@@ -2,7 +2,7 @@
#objdump: -dp
.*: +file format .*arc.*
-private flags = 0x306: -mcpu=ARCv2HS .*
+private flags = 0x\d06: -mcpu=ARCv2HS .*
Disassembly of section .text:
diff --git a/gas/testsuite/gas/arc/nps400-0.d b/gas/testsuite/gas/arc/nps400-0.d
index e5920c8..bcb2b51 100644
--- a/gas/testsuite/gas/arc/nps400-0.d
+++ b/gas/testsuite/gas/arc/nps400-0.d
@@ -11,5 +11,5 @@
Machine: ARCompact
Version: 0x1
#...
- Flags: 0x303, ARC700, v3 no-legacy-syscalls ABI
+ Flags: 0x\d03, ARC700, .*
#...
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 2a1bb27..ad38d66 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -85,6 +85,9 @@ if { [is_elf_format] } then {
if {[istarget "arm*-*-*"]} {
set target_machine -arm
}
+ if {[istarget "arc*-*-*"]} {
+ set target_machine -arc
+ }
# The MN10300 and Xtensa ports disable the assembler's call frame
# optimization because it interfers with link-time relaxation of
diff --git a/gas/testsuite/gas/elf/section2.e-arc b/gas/testsuite/gas/elf/section2.e-arc
new file mode 100644
index 0000000..115bae2
--- /dev/null
+++ b/gas/testsuite/gas/elf/section2.e-arc
@@ -0,0 +1,9 @@
+
+Symbol table '.symtab' contains 6 entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+ +0: 0+0 +0 +NOTYPE +LOCAL +DEFAULT +UND
+ +1: 0+0 +0 +SECTION +LOCAL +DEFAULT +1
+ +2: 0+0 +0 +SECTION +LOCAL +DEFAULT +2
+ +3: 0+0 +0 +SECTION +LOCAL +DEFAULT +3
+ +4: 0+0 +0 +SECTION +LOCAL +DEFAULT +4
+ +5: 0+0 +0 +SECTION +LOCAL +DEFAULT +5