Commit Graph

7663 Commits

Author SHA1 Message Date
Trevor Saunders e5e27b0769 ia64: use XOBNEW and XOBNEWVEC
gas/ChangeLog:

2016-05-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-ia64.c (dot_rot): simplify allocations from obstacks.
	(ia64_frob_label): Likewise.
2016-05-24 08:47:02 -04:00
Trevor Saunders 6610dc6daa change some variable's type to op_err
They only hold values from the op_err enum, so it should be clearer to give
them the enum type.

gas/ChangeLog:

2016-05-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-cr16.c (check_range): Make type of retval op_err.
	* config/tc-crx.c: Likewise.
2016-05-24 08:44:19 -04:00
Claudiu Zissulescu 87789e08e5 [ARC] Add XY registers, update neg instruction.
gas/
2016-05-23  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (md_begin): Add XY registers.
	(cpu_types): Code density is default off for ARC EM.

opcodes/
2016-05-23  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-tbl.h (neg): New instruction variant.
2016-05-23 17:32:13 +02:00
Claudiu Zissulescu c810e0b87a [ARC] Rename "class" named attributes.
gas/
2016-05-23  Cupertino Miranda  <cmiranda@synopsys.com>

	* config/tc-arc.c (attributes_t): Renamed attribute class to
	attr_class.
	(find_opcode_match, assemble_insn, tokenize_extinsn): Changed.

opcode/
2016-05-23  Cupertino Miranda  <cmiranda@synopsys.com>

	* arc-dis.c (find_format, find_format, get_auxreg)
	(print_insn_arc): Changed.
	* arc-ext.h (INSERT_XOP): Likewise.

include/
2016-05-23  Cupertino Miranda  <cmiranda@synopsys.com>

	* opcode/arc.h (struct arc_opcode): Renamed attribute class to
	insn_class.
	(struct arc_flag_class): Renamed attribute class to flag_class.
2016-05-23 17:25:46 +02:00
Nick Clifton d26a14db86 oops - omitted from previous delta 2016-05-23 13:56:46 +01:00
Kuba Sejdak a2bea3245e Add support for configuring for the ARM Phoenix target.
bfd	* config.bfd: Add entry for arm-phoenix.

gas	* configuse.tgt: Add entry for arm-phoenix.

ld	* Makefile.am: Add earmelf_phoenix.c.
	* Makefile.in: Regenerate.
	* configure.tgt: Add entry for arm-phoenix.
	* emulparams/armelf_phoenix.sh: New file.
2016-05-23 13:53:07 +01:00
Trevor Saunders f10e0aef4f tic54x: use concat more
gas/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-tic54x.c (tic54x_sect): simplify string creation.
2016-05-23 01:21:07 -04:00
Trevor Saunders 2900e701e0 spu: make some constants unsigned
The field in spu_opcode is unsigned, and for some values of opcode we can end
up shifting into the high bit.  So avoid possibly creating a negative number
and then assigning it to a unsigned field by shifting an unsigned constant.

gas/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-spu.c (APUOP): Use OPCODE as an unsigned constant.
2016-05-23 01:20:09 -04:00
Trevor Saunders 3d207518c1 tic54x: rename typedef of struct symbol_
generic gas code has a struct symbol, and tic54x typedefs a struct to symbol.
This seems at least rather confusing, and it seems like target specific headers
shouldn't  put such generic names in the global namespace preventing other
generic code from using them.

opcodes/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* tic54x-dis.c (sprint_mmr): Adjust.
	* tic54x-opc.c: Likewise.

gas/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-tic54x.c (tic54x_mmregs): Adjust.
	(md_begin): Likewise.
	(encode_condition): Likewise.
	(encode_cc3): Likewise.
	(encode_cc2): Likewise.
	(encode_operand): Likewise.
	(tic54x_undefined_symbol): Likewise.

include/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* opcode/tic54x.h (struct symbol_): typedef to tic54x_symbol instead of
	plain symbol.
2016-05-23 01:17:12 -04:00
Matthew Fortune a4968f42e7 MIPS: Add support for P6600
gas/
	* config/tc-mips.c (mips_cpu_info_table): Update comment. Add
	p6600 entry.
	* doc/c-mips.texi: Document p6600 -march option.
2016-05-20 15:21:10 +01:00
H.J. Lu 4e21640f67 Preserve addend for R_386_GOT32 and R_X86_64_GOT32
We should preserve addend for R_386_GOT32 and R_X86_64_GOT32 as in
"movl $foo@GOT + 4, %eax" and "movq $foo@GOT + 4, %rax".

	PR gas/19600
	* config/tc-i386.c (md_apply_fix): Preserve addend for
	BFD_RELOC_386_GOT32 and BFD_RELOC_X86_64_GOT32.
	* testsuite/gas/i386/addend.d: New file.
	* testsuite/gas/i386/addend.s: Likewise.
	* testsuite/gas/i386/x86-64-addend.d: Likewise.
	* testsuite/gas/i386/x86-64-addend.s: Likewise.
	* testsuite/gas/i386/i386.exp: Run addend and x86-64-addend.
	* testsuite/gas/i386/reloc32.d: Updated.
2016-05-20 06:01:28 -07:00
Maciej W. Rozycki 17c6c9d9f3 MIPS: Fix the encoding of immediates with microMIPS JALX
The microMIPS JALX instruction shares the R_MICROMIPS_26_S1 relocation
with microMIPS J/JAL/JALS instructions, however unlike the latters its
encoded immediate argument is unusually shifted left by 2 rather than 1
in calculating the value used for the operation requested.

We already handle this exception in `mips_elf_calculate_relocation' in
LD, in a scenario where JALX is produced as a result of relaxing JAL for
the purpose of making a cross-mode jump.  We also get it right in the
disassembler in `decode_micromips_operand'.

What we don't correctly do however is processing microMIPS JALX produced
by GAS from an assembly source, where a non-zero constant argument or a
symbol reference with a non-zero in-place addend has been used.  In this
case the same calculation is made as for microMIPS J/JAL/JALS, causing
the wrong encoding to be produced by GAS on making an object file, and
then again by LD in the final link.  The latter in particular causes the
calculation, where the addend fits in the relocatable field, to produce
different final addresses for the same source code depending on whether
REL or RELA relocations are used.

Correct these issues by special-casing microMIPS JALX in the places that
have been previously missed.

	bfd/
	* elfxx-mips.c (mips_elf_read_rel_addend): Adjust the addend for
	microMIPS JALX.

	gas/
	* config/tc-mips.c (append_insn): Correct the encoding of a
	constant argument for microMIPS JALX.
	(tc_gen_reloc): Correct the encoding of an in-place addend for
	microMIPS JALX.
	* testsuite/gas/mips/jalx-addend.d: New test.
	* testsuite/gas/mips/jalx-addend-n32.d: New test.
	* testsuite/gas/mips/jalx-addend-n64.d: New test.
	* testsuite/gas/mips/jalx-imm.d: New test.
	* testsuite/gas/mips/jalx-imm-n32.d: New test.
	* testsuite/gas/mips/jalx-imm-n64.d: New test.
	* testsuite/gas/mips/jalx-addend.s: New test source.
	* testsuite/gas/mips/jalx-imm.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	ld/
	* testsuite/ld-mips-elf/jalx-addend.d: New test.
	* testsuite/ld-mips-elf/jalx-addend-n32.d: New test.
	* testsuite/ld-mips-elf/jalx-addend-n64.d: New test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2016-05-20 13:38:48 +01:00
Maciej W. Rozycki 134c0c8bf4 MIPS/GAS: Correct tab-after-space formatting mistakes
* config/tc-mips.c: Correct tab-after-space formatting mistakes
	throughout.
2016-05-20 12:41:50 +01:00
Andrew Burgess 38cd8a0de8 gas/arc: Make member of arc_flags const
By making the flgp field of struct arc_flags constant we can remove a
place where we cast away the const-ness of a variable.  Also, given that
the value assigned to this field almost always comes from compile-time
constant data, having the field non-constant is probably a bad thing.

gas/ChangeLog:

	* config/tc-arc.c (find_opcode_match): Remove casting away of
	const.
	* config/tc-arc.h (struct arc_flags): Make flgp field const.
2016-05-18 22:24:51 +01:00
Andrew Burgess 9e32d9ae97 gas/arc: Use BFD_VMA_FMT for printf format specifier
Some debug code has the wrong printf format specifier for some types
that are (ultimately) bfd_vma.  Fixed by using BFD_VMA_FMT string.  This
only becomes an issue when building the tc-arc.c file with -DDEBUG=1 to
build in the debug code.

gas/ChangeLog:

	* config/tc-arc.c (md_pcrel_from_section): Use BFD_VMA_FMT where
	appropriate.
	(md_convert_frag): Likewise.
2016-05-18 22:24:25 +01:00
Andrew Burgess fe779266b3 gas/arc: Fix array overrun when checking opcode array
The opcode array iterator mechanism can, in some situations, result in
reading memory outside of the opcode array.  When using the
iterator-next mechanism to find the next possible arc_opcode, if we find
an opcode where the name field is NULL, or the name does not match, then
the cached opcode pointer is not set to NULL.  The result is that
another call to iterator-next will again increment the opcode
pointer (which might now point outside the opcode array) and attempt to
access the name field of this undefined opcode.

Fixed in this commit by clearing the cached opcode pointer.

I've added a test case, which currently shows the bug, however, this
will only expose this bug while the opcode used (dsp_fp_cmp) is the last
opcode in the table.

gas/ChangeLog:

	* config/tc-arc.c (arc_opcode_hash_entry_iterator_next): Set
	cached opcode to NULL when we reach a non-matching opcode.
	* testsuite/gas/arc/asm-errors-2.d: New file.
	* testsuite/gas/arc/asm-errors-2.err: New file.
	* testsuite/gas/arc/asm-errors-2.s: New file.
2016-05-18 22:23:40 +01:00
Andrew Burgess 3b889a7878 gas/arc: Add guard against operand array overflow.
Currently supplying an input file with too many operands to an
instruction will cause the assembler to overflow and array and trigger
undefined behaviour.

This change checks that we don't access outside the limits of the
operand array.

gas/ChangeLog:

	* config/tc-arc.c (tokenize_arguments): Add checks for array
	overflow.
	* testsuite/gas/arc/asm-errors.s: Addition test line added.
	* testsuite/gas/arc/asm-errors.err: Update expected results.
2016-05-18 22:22:49 +01:00
Trevor Saunders 42e58860e2 rx: make field type enum
gas/ChangeLog:

2016-05-18  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-rx.c (struct cpu_type): Change the type of a field from
	int to enum rx_cpu_types.
2016-05-18 06:26:27 -04:00
Trevor Saunders 4bfaa1cae7 change the type of some fields to bfd_reloc_code_real_type
gas/ChangeLog:

2016-05-18  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-dlx.c (struct machine_it): change the type of a field from
	int to bfd_reloc_code_real_type.
	* config/tc-tic4x.c: Likewise.
2016-05-18 06:26:07 -04:00
Trevor Saunders eb408eaac9 commit ChangeLog for previous commit 2016-05-18 06:17:33 -04:00
Trevor Saunders b42e9fa8cc Change type of v850_target_arch to enum bfd_architecture
gas/ChangeLog:

2016-05-18  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-v850.c (v850_target_arch): change type to enum
	bfd_architecture.
	* config/tc-v850.h (v850_target_arch): Likewise.
2016-05-18 06:09:44 -04:00
Alan Modra a255f00a28 PPC_OPERAND_SIGNOPT range.
Commit b84bf58a accidentally extended the range of allowed negative
numbers.

	* config/tc-ppc.c (ppc_insert_operand): Trim PPC_OPERAND_SIGNOPT
	allowed negative range.
	* testsuite/gas/ppc/power9.s: Test xxspltib of -128, not -256.
	* testsuite/gas/ppc/power9.d: Update.
2016-05-18 12:43:21 +09:30
Thomas Preud'homme 659f032c0a Make ARMv8-M GAS tests pass on non ELF targets
2016-05-17  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* testsuite/gas/arm/archv8m-cmse-msr-base.d: Force Thumb when
	disassembling and stop skipping targets.
	* testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
	* testsuite/gas/arm/archv8m-base.d: Also allow nops after the last
	instruction for targets that have stronger alignment requirement.
	* testsuite/gas/arm/archv8m-cmse-base.d: Likewise.
	* testsuite/gas/arm/archv8m-cmse-main-1.d: Likewise.
	* testsuite/gas/arm/archv8m-cmse-main-2.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
	* testsuite/gas/arm/archv8m-main.d: Likewise.
	* testsuite/gas/arm/archv8m.s: Add label.
	* testsuite/gas/arm/archv8m-cmse.s: Likewise.
	* testsuite/gas/arm/archv8m-cmse-msr.s: Likewise.
	* testsuite/gas/arm/archv8m-cmse-main.s: Likewise.
2016-05-17 16:38:11 +01:00
Trevor Saunders 7b14583ef0 m32r: make mach_table static and const
It is only read in tc-m32r.c, so it might as well be static and const, and
that should help the compiler slightly.

gas/ChangeLog:

2016-05-16  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-m32r.c (mach_table): Make static and const.
2016-05-16 05:06:48 -04:00
Trevor Saunders 0591130a7c tc-vax.c: make prototype of flonum_gen2vax match its definition
gas/ChangeLog:

2016-05-16  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-vax.c (flonum_gen2vax): Adjust prototype to match
	definition.
2016-05-16 05:04:01 -04:00
Trevor Saunders 9117cd3e10 stop defining linkrelax in multiple places
Defining linkrelax to have different values in as.c and tc-msp430.c /
tc-mn10300.c is at least rather tricky, and seems fragile, when we can just set
it in md_begin instead.

gas/ChangeLog:

2016-05-16  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-mn10300.c (md_begin): set linkrelax here instead of
	defining it.
	* config/tc-msp430.c (md_begin): Likewise.
2016-05-16 05:01:52 -04:00
Trevor Saunders e18382406c m68hc11: make some vars type bfd_reloc_code_real_type
These variables only hold values from the bfd_reloc_code_real_type enum, and
are passed to functions that expect the argument to be of type
bfd_reloc_code_real_type, so it seems to make sense that there type is
bfd_reloc_code_real_type rather than int.

gas/ChangeLog:

2016-05-16  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-m68hc11.c (fixup8): Change variables type from int to
	bfd_reloc_code_real_type where appropriate.
	(fixup16): Likewise.
	(fixup8_xg): Likewise.
2016-05-16 04:55:31 -04:00
Maciej W. Rozycki 9dfa3e6347 SH64/GAS: Fix a -Wwrite-strings build failure
Fix a commit 6757cf5769 ("enable -Wwrite-strings for gas") regression.

	gas/
	* config/tc-sh64.c (shmedia_check_limits): Constify `msg'.
2016-05-15 23:23:47 +01:00
Peter Bergner 1178da445a Accept valid one byte signed and unsigned values for the IMM8 operand.
opcodes/
	* ppc-opc.c (IMM8): Use PPC_OPERAND_SIGNOPT.

gas/
	* testsuite/gas/ppc/power9.d <xxspltib>: Add additional operand tests.
	* testsuite/gas/ppc/power9.s: Likewise.
2016-05-13 15:15:00 -05:00
Alan Modra d2edc834f7 Fix build breakage
* config/obj-coff.c (weak_uniquify): Delete unused var.
2016-05-13 15:58:07 +09:30
Trevor Saunders add39d2344 use XNEW and related macros more
Its a bit shorter and simpler than raw xmalloc.

gas/ChangeLog:

2016-05-13  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* app.c (app_push): Use XNEW and related macros.
	* as.c (parse_args): Likewise.
	* cgen.c (make_right_shifted_expr): Likewise.
	(gas_cgen_tc_gen_reloc): Likewise.
	* config/bfin-defs.h: Likewise.
	* config/bfin-parse.y: Likewise.
	* config/obj-coff.c (stack_init): Likewise.
	(stack_push): Likewise.
	(coff_obj_symbol_new_hook): Likewise.
	(coff_obj_symbol_clone_hook): Likewise.
	(add_lineno): Likewise.
	(coff_frob_symbol): Likewise.
	* config/obj-elf.c (obj_elf_section_name): Likewise.
	(build_group_lists): Likewise.
	* config/obj-evax.c (evax_symbol_new_hook): Likewise.
	* config/obj-macho.c (obj_mach_o_indirect_symbol): Likewise.
	* config/tc-aarch64.c (insert_reg_alias): Likewise.
	(find_or_make_literal_pool): Likewise.
	(add_to_lit_pool): Likewise.
	(fill_instruction_hash_table): Likewise.
	* config/tc-alpha.c (load_expression): Likewise.
	(emit_jsrjmp): Likewise.
	(s_alpha_ent): Likewise.
	(s_alpha_end): Likewise.
	(s_alpha_linkage): Likewise.
	(md_begin): Likewise.
	(tc_gen_reloc): Likewise.
	* config/tc-arc.c (arc_insert_opcode): Likewise.
	(arc_extcorereg): Likewise.
	* config/tc-bfin.c: Likewise.
	* config/tc-cr16.c: Likewise.
	* config/tc-cris.c: Likewise.
	* config/tc-crx.c (preprocess_reglist): Likewise.
	* config/tc-d10v.c: Likewise.
	* config/tc-frv.c (frv_insert_vliw_insn): Likewise.
	(frv_tomcat_shuffle): Likewise.
	* config/tc-h8300.c: Likewise.
	* config/tc-i370.c (i370_macro): Likewise.
	* config/tc-i386.c (lex_got): Likewise.
	(md_parse_option): Likewise.
	* config/tc-ia64.c (alloc_record): Likewise.
	(set_imask): Likewise.
	(save_prologue_count): Likewise.
	(dot_proc): Likewise.
	(dot_endp): Likewise.
	(ia64_frob_label): Likewise.
	(add_qp_imply): Likewise.
	(add_qp_mutex): Likewise.
	(mark_resource): Likewise.
	(dot_alias): Likewise.
	* config/tc-m68hc11.c: Likewise.
	* config/tc-m68k.c (m68k_frob_label): Likewise.
	(s_save): Likewise.
	(mri_control_label): Likewise.
	(push_mri_control): Likewise.
	(build_mri_control_operand): Likewise.
	(s_mri_else): Likewise.
	(s_mri_break): Likewise.
	(s_mri_next): Likewise.
	(s_mri_for): Likewise.
	(s_mri_endw): Likewise.
	* config/tc-metag.c (create_mnemonic_htab): Likewise.
	* config/tc-microblaze.c: Likewise.
	* config/tc-mmix.c (s_loc): Likewise.
	* config/tc-nds32.c (nds32_relax_hint): Likewise.
	* config/tc-nios2.c (nios2_insn_reloc_new): Likewise.
	* config/tc-rl78.c: Likewise.
	* config/tc-rx.c (rx_include): Likewise.
	* config/tc-sh.c: Likewise.
	* config/tc-sh64.c (shmedia_frob_section_type): Likewise.
	* config/tc-sparc.c: Likewise.
	* config/tc-spu.c: Likewise.
	* config/tc-tic6x.c (static tic6x_unwind_info *tic6x_get_unwind): Likewise.
	(tic6x_start_unwind_section): Likewise.
	* config/tc-tilegx.c: Likewise.
	* config/tc-tilepro.c: Likewise.
	* config/tc-v850.c: Likewise.
	* config/tc-visium.c: Likewise.
	* config/tc-xgate.c: Likewise.
	* config/tc-xtensa.c (xtensa_translate_old_userreg_ops): Likewise.
	(new_resource_table): Likewise.
	(resize_resource_table): Likewise.
	(xtensa_create_trampoline_frag): Likewise.
	(xtensa_maybe_create_literal_pool_frag): Likewise.
	(cache_literal_section): Likewise.
	* config/xtensa-relax.c (append_transition): Likewise.
	(append_condition): Likewise.
	(append_value_condition): Likewise.
	(append_constant_value_condition): Likewise.
	(append_literal_op): Likewise.
	(append_label_op): Likewise.
	(append_constant_op): Likewise.
	(append_field_op): Likewise.
	(append_user_fn_field_op): Likewise.
	(enter_opname_n): Likewise.
	(enter_opname): Likewise.
	(split_string): Likewise.
	(parse_insn_templ): Likewise.
	(clone_req_or_option_list): Likewise.
	(clone_req_option_list): Likewise.
	(parse_option_cond): Likewise.
	(parse_insn_pattern): Likewise.
	(parse_insn_repl): Likewise.
	(build_transition): Likewise.
	(build_transition_table): Likewise.
	* dw2gencfi.c (alloc_fde_entry): Likewise.
	(alloc_cfi_insn_data): Likewise.
	(cfi_add_CFA_remember_state): Likewise.
	(dot_cfi_escape): Likewise.
	(dot_cfi_fde_data): Likewise.
	(select_cie_for_fde): Likewise.
	* dwarf2dbg.c (dwarf2_directive_loc): Likewise.
	* ecoff.c (ecoff_add_bytes): Likewise.
	(ecoff_build_debug): Likewise.
	* input-scrub.c (input_scrub_push): Likewise.
	(input_scrub_begin): Likewise.
	(input_scrub_next_buffer): Likewise.
	* itbl-ops.c (append_insns_as_macros): Likewise.
	(alloc_entry): Likewise.
	(alloc_field): Likewise.
	* listing.c (listing_newline): Likewise.
	(listing_listing): Likewise.
	* macro.c (get_any_string): Likewise.
	(delete_macro): Likewise.
	* stabs.c (generate_asm_file): Likewise.
	(stabs_generate_asm_lineno): Likewise.
	* subsegs.c (subseg_change): Likewise.
	(subseg_get): Likewise.
	* symbols.c (define_dollar_label): Likewise.
	(symbol_relc_make_sym): Likewise.
	* write.c (write_relocs): Likewise.
2016-05-13 00:35:51 -04:00
Trevor Saunders 29a2809e42 use xstrdup, xmemdup0 and concat more
gas/ChangeLog:

2016-05-13  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/obj-coff.c (obj_coff_def): Simplify string copying.
	(weak_name2altname): Likewise.
	(weak_uniquify): Likewise.
	(obj_coff_section): Likewise.
	(obj_coff_init_stab_section): Likewise.
	* config/obj-elf.c (obj_elf_section_name): Likewise.
	(obj_elf_init_stab_section): Likewise.
	* config/obj-evax.c (evax_shorten_name): Likewise.
	* config/obj-macho.c (obj_mach_o_make_or_get_sect): Likewise.
	* config/tc-aarch64.c (create_register_alias): Likewise.
	* config/tc-alpha.c (load_expression): Likewise.
	(s_alpha_file): Likewise.
	(s_alpha_section_name): Likewise.
	(tc_gen_reloc): Likewise.
	* config/tc-arc.c (md_assemble): Likewise.
	* config/tc-arm.c (create_neon_reg_alias): Likewise.
	(start_unwind_section): Likewise.
	* config/tc-hppa.c (pa_build_unwind_subspace): Likewise.
	(hppa_elf_mark_end_of_function): Likewise.
	* config/tc-nios2.c (nios2_modify_arg): Likewise.
	(nios2_negate_arg): Likewise.
	* config/tc-rx.c (rx_section): Likewise.
	* config/tc-sh64.c (sh64_consume_datalabel): Likewise.
	* config/tc-tic30.c (tic30_find_parallel_insn): Likewise.
	* config/tc-tic54x.c (tic54x_include): Likewise.
	(tic54x_macro_info): Likewise.
	(subsym_get_arg): Likewise.
	(subsym_substitute): Likewise.
	(tic54x_start_line_hook): Likewise.
	* config/tc-xtensa.c (xtensa_literal_prefix): Likewise.
	(xg_reverse_shift_count): Likewise.
	* config/xtensa-relax.c (enter_opname_n): Likewise.
	(split_string): Likewise.
	* dwarf2dbg.c (get_filenum): Likewise.
	(process_entries): Likewise.
	* expr.c (operand): Likewise.
	* itbl-ops.c (alloc_entry): Likewise.
	* listing.c (listing_message): Likewise.
	(listing_title): Likewise.
	* macro.c (check_macro): Likewise.
	* stabs.c (s_xstab): Likewise.
	* symbols.c (symbol_relc_make_expr): Likewise.
	* write.c (compress_debug): Likewise.
2016-05-13 00:35:51 -04:00
Nick Clifton 58c7f094c0 Use correct regexp syntax in ARM PR20068 test 2016-05-12 17:19:44 +01:00
Nick Clifton d5e74e8d3e Update pr20068 test to allow for big endian ARM configuration 2016-05-11 18:04:03 +01:00
Matthew Fortune 8f4f9071ad Add MIPS32 DSPr3 support.
bfd/

	* elfxx-mips.c (print_mips_ases): Add DSPR3.

binutils/

	* readelf.c (print_mips_ases): Add DSPR3.

gas/

	* config/tc-mips.c (options): Add OPTION_DSPR3 and
	OPTION_NO_DSPR3.
	(md_longopts): Likewise.
	(md_show_usage): Add help for -mdspr3 and -mno-dspr3.
	(mips_ases): Define availability for DSPr3.
	(mips_ase_groups): Add ASE_DSPR3 to the DSP group.
	(mips_convert_ase_flags): Map ASE_DSPR3 to AFL_ASE_DSPR3.
	* doc/as.texinfo: Document -mdspr3, -mno-dspr3.  Fix -mdspr2
	formatting.
	* doc/c-mips.texi: Document -mdspr3, -mno-dspr3, .set dspr3 and
	.set nodspr3.  Fix -mdspr2 formatting.
	* testsuite/gas/mips/mips32-dspr3.d: New file.
	* testsuite/gas/mips/mips32-dspr3.s: Likewise.
	* testsuite/gas/mips/mips.exp: Run mips32-dspr3 test.

include/

	* elf/mips.h (AFL_ASE_DSPR3): New macro.
	(AFL_ASE_MASK): Update to include AFL_ASE_DSPR3.
	* opcode/mips.h (ASE_DSPR3): New macro.

opcodes/

	* mips-dis.c (mips_arch_choices): Add ASE_DSPR3 to mips32r6 and
	mips64r6.
	* mips-opc.c (D34): New macro.
	(mips_builtin_opcodes): Define bposge32c for DSPr3.
2016-05-11 17:06:13 +01:00
Nick Clifton a6684f0ddd Ensure that padding in the constant pool uses constant values.
PR target/20068
	* config/tc-arm.c (add_to_lit_pool): Ensure that the padding added
	to the pool uses O_constant.
	* testsuite/gas/arm/pr20068.s: New test.
	* testsuite/gas/arm/pr20068.d: Test driver.
2016-05-11 12:53:12 +01:00
Nick Clifton 4179a6a209 oops - fix up changelog entry 2016-05-11 09:06:58 +01:00
Nick Clifton be5c445b69 Skip new ARM security extension tests on non-ELF based targets.
* testsuite/gas/arm/archv8m-cmse-base.d: Skip for non-ELF ARM targets.
	* testsuite/gas/arm/archv8m-cmse-main-1.d: Likewise.
	* testsuite/gas/arm/archv8m-cmse-main-2.d: Likewise.
	* testsuite/gas/arm/archv8m-cmse-msr-base.d: Likewise.
	* testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
2016-05-11 09:04:17 +01:00
Alexander Fomin 8bc526963e Enable Intel RDPID instruction.
This patch enables Intel RDPID instruction described in Intel64 and
IA-32 Architectures Software Developer's Manual, April 2016.

gas/

	* config/tc-i386.c (cpu_arch): Add RDPID.
	* doc/c-i386.texi: Document RDPID.

gas/testsuite/

	* gas/i386/i386.exp: Run RDPID tests.
	* gas/i386/prefix.d: Adjust.
	* gas/i386/rdpid.s: New test.
	* gas/i386/rdpid.d: Ditto.
	* gas/i386/rdpid-intel.d: Ditto.
	* gas/i386/x86-64-rdpid.s: Ditto.
	* gas/i386/x86-64-rdpid.d: Ditto.
	* gas/i386/x86-64-rdpid-intel.d: Ditto.

opcodes/

	* i386-dis.c (prefix_table): Add RDPID instruction.
	* i386-gen.c (cpu_flag_init): Add RDPID flag.
	(cpu_flags): Add RDPID bitfield.
	* i386-opc.h (enum): Add RDPID element.
	(i386_cpu_flags): Add RDPID field.
	* i386-opc.tbl: Add RDPID instruction.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Regenerate.
2016-05-10 21:38:39 +03:00
Thomas Preud'homme 39d911fc3c Use getters/setters to access ARM branch type
2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
	* elf32-arm.c (elf32_arm_size_stubs): Use new macros
	ARM_GET_SYM_BRANCH_TYPE and ARM_SET_SYM_BRANCH_TYPE to respectively get
	and set branch type of a symbol.
	(bfd_elf32_arm_process_before_allocation): Likewise.
	(elf32_arm_relocate_section): Likewise and fix identation along the
	way.
	(allocate_dynrelocs_for_symbol): Likewise.
	(elf32_arm_finish_dynamic_symbol): Likewise.
	(elf32_arm_swap_symbol_in): Likewise.
	(elf32_arm_swap_symbol_out): Likewise.

gas/
	* config/tc-arm.c (arm_adjust_symtab): Use ARM_SET_SYM_BRANCH_TYPE to
	set branch type of a symbol.

gdb/
	* arm-tdep.c (arm_elf_make_msymbol_special): Use
	ARM_GET_SYM_BRANCH_TYPE to get branch type of a symbol.

include/
	* arm.h (enum arm_st_branch_type): Add new ST_BRANCH_ENUM_SIZE
	enumerator.
	(NUM_ENUM_ARM_ST_BRANCH_TYPE_BITS): New macro.
	(ENUM_ARM_ST_BRANCH_TYPE_BITMASK): Likewise.
	(ARM_SYM_BRANCH_TYPE): Replace by ...
	(ARM_GET_SYM_BRANCH_TYPE): This and ...
	(ARM_SET_SYM_BRANCH_TYPE): This in two versions depending on whether
	BFD_ASSERT is defined or not.

ld/
	* emultempl/armelf.em (gld${EMULATION_NAME}_finish): Use
	ARM_GET_SYM_BRANCH_TYPE to get branch type of a symbol.

opcodes/
	* arm-dis.c (get_sym_code_type): Use ARM_GET_SYM_BRANCH_TYPE to get
	branch type of a symbol.
	(print_insn): Likewise.
2016-05-10 16:17:04 +01:00
Thomas Preud'homme 15afaa63f3 Add support for ARMv8-M Mainline with DSP extension
2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
	(elf32_arm_merge_eabi_attributes): Add merging logic for
	Tag_DSP_extension.

binutils/
	* readelf.c (display_arm_attribute): Add output for Tag_DSP_extension.
	(arm_attr_public_tags): Define DSP_extension attribute.

gas/
	* NEWS: Document ARMv8-M and ARMv8-M Security and DSP Extensions.
	* config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
	instructions.
	(arm_extensions): Add dsp extension for ARMv8-M Mainline.
	(aeabi_set_public_attributes): Memorize the feature bits of the
	architecture selected for Tag_CPU_arch.  Use it to set
	Tag_DSP_extension to 1 for ARMv8-M Mainline with DSP extension.
	(arm_convert_symbolic_attribute): Define Tag_DSP_extension.
	* testsuite/gas/arm/arch7em-bad.d: Rename to ...
	* testsuite/gas/arm/arch7em-bad-1.d: This.
	* testsuite/gas/arm/arch7em-bad-2.d: New file.
	* testsuite/gas/arm/arch7em-bad-3.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
	* testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.

include/
	* elf/arm.h (Tag_DSP_extension): Define.

ld/
	* testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)): New
	test.
	* testsuite/ld-arm/attr-merge-10b-dsp.s: New file.
	* testsuite/ld-arm/attr-merge-10-dsp.attr: Likewise.
2016-05-10 15:24:10 +01:00
Thomas Preud'homme d942732e82 Allow extension availability to depend on several architecture bits
2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (struct arm_option_extension_value_table): Make
	allowed_archs an array with 2 entries.
	(ARM_EXT_OPT): Adapt to only fill the first entry of allowed_archs.
	(ARM_EXT_OPT2): New macro filling the two entries of allowed_archs.
	(arm_extensions): Use separate entries in allowed_archs when several
	archs are allowed to use an extension and change ARCH_ANY in
	ARM_ARCH_NONE in allowed_archs.
	(arm_parse_extension): Check that, for each allowed_archs entry, all
	bits are set in the current architecture, ignoring ARM_ANY entries.
	(s_arm_arch_extension): Likewise.

include/
	* arm.h (ARM_FSET_CPU_SUBSET): Define macro.
2016-05-10 15:12:11 +01:00
Thomas Preud'homme 16a1fa25be Add support for ARMv8-M security extensions instructions
2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (arm_ext_m): Add feature bit ARM_EXT2_V8M_MAIN.
	(arm_ext_v8m_main): New feature set for bit ARM_EXT2_V8M_MAIN.
	(arm_ext_v8m_m_only): New feature set for instructions in ARMv8-M not
	shared with a non M profile architecture.
	(do_rn): New function.
	(known_t32_only_insn): Check opcode against arm_ext_v8m_m_only rather
	than arm_ext_v8m.
	(v7m_psrs): Add ARMv8-M security extensions new special registers.
	(insns): Add ARMv8-M Security Extensions instructions.
	(aeabi_set_public_attributes): Use arm_ext_v8m_m_only instead of
	arm_ext_v8m_m to decide the profile and the Thumb ISA.
	* testsuite/gas/arm/archv8m-cmse.s: New file.
	* testsuite/gas/arm/archv8m-cmse-main.s: Likewise..
	* testsuite/gas/arm/archv8m-cmse-msr.s: Likewise.
	* testsuite/gas/arm/any-cmse.d: Likewise.
	* testsuite/gas/arm/any-cmse-main.d: Likewise.
	* testsuite/gas/arm/archv8m-cmse-base.d: Likewise.
	* testsuite/gas/arm/archv8m-cmse-msr-base.d: Likewise.
	* testsuite/gas/arm/archv8m-cmse-main-1.d: Likewise.
	* testsuite/gas/arm/archv8m-cmse-main-2.d: Likewise.
	* testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise.

include/
	* opcode/arm.h (ARM_EXT2_V8M_MAIN): new feature bit.
	(ARM_AEXT2_V8M_MAIN): New architecture extension feature set.
	(ARM_ARCH_V8M_MAIN): Use ARM_AEXT2_V8M_MAIN instead of ARM_AEXT2_V8M
	for the high core bits.

opcodes/
	* arm-dis.c (coprocessor_opcodes): Add entries for VFP ARMv8-M
	Mainline Security Extensions instructions.
	(thumb_opcodes): Add entries for narrow ARMv8-M Security
	Extensions instructions.
	(thumb32_opcodes): Add entries for wide ARMv8-M Security Extensions
	instructions.
	(psr_name): Add new MSP_NS and PSP_NS ARMv8-M Security Extensions
	special registers.
2016-05-10 15:03:38 +01:00
Jose E. Marchesi d751b79ea6 opcodes,gas: sparc: fix mnemonic of faligndatai
opcodes/ChangeLog:

2016-05-09  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* sparc-opc.c (sparc_opcodes): Fix mnemonic of faligndatai.

gas/ChangeLog:

2016-05-09  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* testsuite/gas/sparc/sparc5vis4.s: Fix mnemonic of faligndatai.
	* testsuite/gas/sparc/sparc5vis4.d: Likewise.
2016-05-09 04:09:53 -07:00
Alan Modra 6eb7d83039 Regenerate configure 2016-05-09 17:24:30 +09:30
Kyrylo Tkachov f85d59c306 [ARM][gas] Fix warnings about uninitialised uses and unused const variables
* config/tc-arm.c (fpu_arch_vfp_v1): Mark with ATTRIBUTE_UNUSED.
	(fpu_arch_vfp_v3): Likewise.
	(fpu_arch_neon_v1): Likewise.
	(arm_arch_full): Likewise.
	(parse_neon_el_struct_list): Initialize fields of firsttype.
2016-05-06 13:36:07 +01:00
Claudiu Zissulescu 945e0f82da [ARC] Add SYNTAX_NOP and SYNTAX_1OP for extension instructions
gas/
2016-05-03  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (syntaxclass): Add SYNTAX_NOP and SYNTAX_1OP.
	(arc_extinsn): Handle new introduced syntax.
	* testsuite/gas/arc/textinsn1op.d: New file.
	* testsuite/gas/arc/textinsn1op.s: Likewise.
	* doc/c-arc.texi: Document SYNTAX_NOP and SYNTAX_1OP.

opcodes/
2016-05-03  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-ext.c (dump_ARC_extmap): Handle SYNATX_NOP and SYNTAX_1OP.
	(arcExtMap_genOpcode): Likewise.
	* arc-opc.c (arg_32bit_rc): Define new variable.
	(arg_32bit_u6): Likewise.
	(arg_32bit_limm): Likewise.

include/
2016-05-03  Claudiu Zissulescu  <claziss@synopsys.com>

	* opcode/arc.h (ARC_SYNTAX_1OP): Declare
	(ARC_SYNTAX_NOP): Likewsie.
	(ARC_OP1_MUST_BE_IMM): Update defined value.
	(ARC_OP1_IMM_IMPLIED): Likewise.
	(arg_32bit_rc, arg_32bit_u6, arg_32bit_limm): Declare.
2016-05-04 16:18:32 +02:00
Pitchumani Sivanupandi b782c63d52 Assume that the GAS testsuite for the AVR is being run without -mlink-relax specified.
* testsuite/gas/lns/lns.exp: Add avr to list of targets using
	DW_LNS_fixed_advance_pc.
2016-05-03 10:56:30 +01:00
Alan Modra 25771140e2 Provide xmemdup0
and some tidies in as.h

	* as.h (inline, __PTR_TO_INT, __INT_TO_PTR): Don't define.
	(xmemdup0): New inline function.
2016-04-27 17:07:17 +09:30
Maciej W. Rozycki 22522f880a MIPS/GAS: Fix an ISA override not lifting ABI restrictions
Correct a regression introduced with commit 919731affb ("Add MIPS
.module directive") causing code like:

	.set	mips3
	dli	$2, 0x9000000080000000

to fail assembly with the following error message produced:

Error: number (0x9000000080000000) larger than 32 bits

if built with `mips3' selected as the global ISA (e.g. `-march=mips3').
This is because a `.set' directive doing an ISA override does not lift
the ABI restriction on register sizes if the ISA remains unchanged.
Previously the directive always set register sizes from the ISA chosen,
which is what some code expects.  Restore the old semantics then.

	gas/
	* config/tc-mips.c (code_option_type): New enum.
	(parse_code_option): Return status indicating option type.
	(s_mipsset): Update `parse_code_option' call site accordingly.
	Always set register sizes from the ISA with ISA overrides.
	(s_module): Update `parse_code_option' call site.
	* testsuite/gas/mips/isa-override-1.d: New test.
	* testsuite/gas/mips/micromips@isa-override-1.d: New test.
	* testsuite/gas/mips/mips1@isa-override-1.d: New test.
	* testsuite/gas/mips/mips2@isa-override-1.d: New test.
	* testsuite/gas/mips/mips32@isa-override-1.d: New test.
	* testsuite/gas/mips/mips32r2@isa-override-1.d: New test.
	* testsuite/gas/mips/mips32r3@isa-override-1.d: New test.
	* testsuite/gas/mips/mips32r5@isa-override-1.d: New test.
	* testsuite/gas/mips/mips32r6@isa-override-1.d: New test.
	* testsuite/gas/mips/mips64r2@isa-override-1.d: New test.
	* testsuite/gas/mips/mips64r3@isa-override-1.d: New test.
	* testsuite/gas/mips/mips64r5@isa-override-1.d: New test.
	* testsuite/gas/mips/mips64r6@isa-override-1.d: New test.
	* testsuite/gas/mips/r3000@isa-override-1.d: New test.
	* testsuite/gas/mips/r3900@isa-override-1.d: New test.
	* testsuite/gas/mips/r5900@isa-override-1.d: New test.
	* testsuite/gas/mips/octeon@isa-override-1.d: New test.
	* testsuite/gas/mips/octeon3@isa-override-1.d: New test.
	* testsuite/gas/mips/isa-override-2.l: New list test.
	* testsuite/gas/mips/mips1@isa-override-2.l: New list test.
	* testsuite/gas/mips/mips2@isa-override-2.l: New list test.
	* testsuite/gas/mips/mips32@isa-override-2.l: New list test.
	* testsuite/gas/mips/mips32r2@isa-override-2.l: New list test.
	* testsuite/gas/mips/mips32r3@isa-override-2.l: New list test.
	* testsuite/gas/mips/mips32r5@isa-override-2.l: New list test.
	* testsuite/gas/mips/mips32r6@isa-override-2.l: New list test.
	* testsuite/gas/mips/r3000@isa-override-2.l: New list test.
	* testsuite/gas/mips/r3900@isa-override-2.l: New list test.
	* testsuite/gas/mips/octeon3@isa-override-2.l: New list test.
	* testsuite/gas/mips/octeon3@isa-override-1.l: New stderr
	output.
	* testsuite/gas/mips/isa-override-1.s: New test source.
	* testsuite/gas/mips/r5900@isa-override-1.s: New test source.
	* testsuite/gas/mips/isa-override-2.s: New test source.
	* testsuite/gas/mips/mips1@isa-override-2.s: New test source.
	* testsuite/gas/mips/mips2@isa-override-2.s: New test source.
	* testsuite/gas/mips/mips32@isa-override-2.s: New test source.
	* testsuite/gas/mips/mips32r2@isa-override-2.s: New test source.
	* testsuite/gas/mips/mips32r3@isa-override-2.s: New test source.
	* testsuite/gas/mips/mips32r5@isa-override-2.s: New test source.
	* testsuite/gas/mips/mips32r6@isa-override-2.s: New test source.
	* testsuite/gas/mips/r3000@isa-override-2.s: New test source.
	* testsuite/gas/mips/r3900@isa-override-2.s: New test source.
	* testsuite/gas/mips/octeon3@isa-override-2.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2016-04-22 01:22:29 +01:00
Trevor Saunders e6c7cdec06 update many old style function definitions
This includes regenerating a bunch of files in opcodes/ with trunk cgen.

gprof/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* basic_blocks.c: Update old style function definitions.
	* cg_arcs.c: Likewise.
	* cg_print.c: Likewise.
	* gen-c-prog.awk: Likewise.
	* gmon_io.c: Likewise.
	* hertz.c: Likewise.
	* hist.c: Likewise.
	* sym_ids.c: Likewise.

bfd/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* cache.c: Update old style function definitions.
	* elf32-m68k.c: Likewise.
	* elf64-mmix.c: Likewise.
	* stab-syms.c: Likewise.

opcodes/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* alpha-dis.c: Regenerate.
	* crx-dis.c: Likewise.
	* disassemble.c: Likewise.
	* epiphany-opc.c: Likewise.
	* fr30-opc.c: Likewise.
	* frv-opc.c: Likewise.
	* ip2k-opc.c: Likewise.
	* iq2000-opc.c: Likewise.
	* lm32-opc.c: Likewise.
	* lm32-opinst.c: Likewise.
	* m32c-opc.c: Likewise.
	* m32r-opc.c: Likewise.
	* m32r-opinst.c: Likewise.
	* mep-opc.c: Likewise.
	* mt-opc.c: Likewise.
	* or1k-opc.c: Likewise.
	* or1k-opinst.c: Likewise.
	* tic80-opc.c: Likewise.
	* xc16x-opc.c: Likewise.
	* xstormy16-opc.c: Likewise.

ld/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* emultempl/scoreelf.em: Likewise.

binutils/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* resres.c: Likewise.

gas/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* cgen.c: Likewise.
	* config/tc-bfin.c: Likewise.
	* config/tc-ia64.c: Likewise.
	* config/tc-mep.c: Likewise.
	* config/tc-metag.c: Likewise.
	* config/tc-nios2.c: Likewise.
	* config/tc-rl78.c: Likewise.
2016-04-20 07:04:49 -04:00
Andrew Burgess 2533af11ba gas/doc/arc: Add nps400 references into the documentation
Add nps400 to the list of acceptable values for the -mcpu command line
switch, and to the .cpu directive.

I've added an extra cross reference from -mcpu to .cpu to improve
navigation of the documentation.

gas/ChangeLog:

	* doc/c-arc.texi (ARC Options): Add nps400 to list of valus for
	-mcpu.  Add cross reference to .cpu directive from -mcpu option.
	(ARC Directives): Add NPS400 to .cpu directive list.
2016-04-20 11:49:18 +01:00
Matthew Wahab 50cc854c48 [AArch64] Support RAS extension for ARMv8 onwards.
The RAS extension was introduced as part of the ARMv8.2 architecture
where it is a required feature. It is also available as an optional
feature for ARMv8 and ARMv8.1. In binutils, the RAS extension is
currently enabled by default for -march=armv8.2-a but is not available
for -march=armv8 or -march=armv8.1-a.

This patch adds the feature extension '+ras' to enable the RAS extension
for ARMv8 and ARMv8.1, it is disabled by default.

gas/
2016-04-20  Matthew Wahab  <matthew.wahab@arm.com>

	* config/tc-aarch64.c (aarch64_features): Add "ras".
	* doc/c-aarch64.texi (AArch64 Extensions): Add "ras".
	* testsuite/gas/aarch64/armv8-ras-1.d: New.
	* testsuite/gas/aarch64/armv8-ras-1.s: New.
	* testsuite/gas/aarch64/illegal-ras-1.d: New.
	* testsuite/gas/aarch64/illegal-ras-1.s: New.

Change-Id: I824fb9bc8cf846bcc03aa17a726efb1350d78b9d
2016-04-20 09:31:49 +01:00
Andrew Burgess 537aefaf18 opcodes/arc: Add yet more nps instructions
Add some more arc/nps400 instructions and the associated operands.
There's also a test added into the assembler.

gas/ChangeLog:

	* testsuite/gas/arc/nps400-6.d: New file.
	* testsuite/gas/arc/nps400-6.s: New file.

include/ChangeLog:

	* opcode/arc.h (MAX_INSN_ARGS): Increase 6 to 8.

opcodes/ChangeLog:

	* arc-nps400-tbl.h: Add addb, subb, adcb, sbcb, andb, xorb, orb,
	fxorb, wxorb, shlb, shrb, notb, cntbb, div, mod, divm, and qcmp
	instructions.
	* arc-opc.c (insert_nps_bitop_size): Delete.
	(extract_nps_bitop_size): Delete.
	(MAKE_SRC_POS_INSERT_EXTRACT_FUNCS): Define, and use.
	(extract_nps_qcmp_m3): Define.
	(extract_nps_qcmp_m2): Define.
	(extract_nps_qcmp_m1): Define.
	(arc_flag_operands): Add F_NPS_SX, F_NPS_AR, F_NPS_AL.
	(arc_flag_classes): Add C_NPS_SX, C_NPS_AR_AL
	(arc_operands): Add NPS_SRC2_POS, NPS_SRC1_POS, NPS_ADDB_SIZE,
	NPS_ANDB_SIZE, NPS_FXORB_SIZ, NPS_WXORB_SIZ, NPS_R_XLDST,
	NPS_DIV_UIMM4, NPS_QCMP_SIZE, NPS_QCMP_M1, NPS_QCMP_M2, and
	NPS_QCMP_M3.
2016-04-19 22:51:27 +01:00
Andrew Burgess c8f785f220 opcodes/arc: Add more nps instructions
Add dctcp, dcip, dcet, and dcacl instructions.

gas/ChangeLog:

	* testsuite/gas/arc/nps400-4.d: New file.
	* testsuite/gas/arc/nps400-4.s: New file.
	* testsuite/gas/arc/nps400-5.d: New file.
	* testsuite/gas/arc/nps400-5.s: New file.

include/ChangeLog:

	* opcode/arc.h (insn_class_t): Add NET and ACL class.

opcodes/ChangeLog:

	* arc-nps400-tbl.h: Add dctcp, dcip, dcet, and dcacl instructions.
2016-04-19 22:50:33 +01:00
Martin Galvan 48eac74cb7 .cfi_remember_state/.cfi_restore_state documentation
* doc/as.texinfo (.cfi_remember_state, .cfi_restore_state): Improve
	documentation.
2016-04-19 14:39:53 +09:30
Andrew Burgess 644aca26b5 Revert "gas/arc: Make .cpu directive case-insensitive"
This reverts commit 9a452709fe.

This change was committed as obvious, but it has been rightly been
pointed out to me that this change is not obvious, and as such I am
reverting it.

gas/ChangeLog:

	Revert prevous change.
	* config/tc-arc.c (arc_option): Make .cpu directive
	case-sensitive again.
2016-04-17 23:22:15 +01:00
Andrew Burgess 9a452709fe gas/arc: Make .cpu directive case-insensitive
gas/ChangeLog:

	* config/tc-arc.c (arc_option): Make .cpu directive
	case-insensitive.
2016-04-16 16:21:32 +01:00
Andrew Burgess 5e001f26ad gas/arc: Support NPS400 in .cpu directive
gas/ChangeLog:

	* config/tc-arc.c (arc_option): Allow NPS400 in .cpu directive.
2016-04-16 16:19:40 +01:00
Trevor Saunders 92fce9bd7a remove pointless assignment
Presumably this was supposed to be regname[sizeof (regname) - 1] but was typoed
to regname[sizeof (rename) - 1].  However that should be unnecessary because
sprintf should null terminate.  As is this assignment is invalid ISO C because
rename refers to the function rename (), and sizeof on functions is undefined.
In GNU C C the size of functions is 1 so the expression is the same as
regname[0].  The following call to sprintf () clearly will over right that, so
the statement either has no effect or is invalid.  Given that it seems safe to
just remove it.  While we are there correct the size of regname, and switch
from snprintf to sprintf since we know the exact length of the result.

gas/ChangeLog:

2016-04-15  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-mips.c (md_begin): Remove useless assignment.
2016-04-15 21:20:36 -04:00
H.J. Lu 6fd8e7c249 Regenerate Makefile.in/aclocal.m4 automake 1.11.6
bfd/

	* Makefile.in: Regenerated with automake 1.11.6.
	* aclocal.m4: Likewise.
	* doc/Makefile.in: Likewise.

binutils/

	* Makefile.in: Regenerated with automake 1.11.6.
	* aclocal.m4: Likewise.
	* doc/Makefile.in: Likewise.

gas/

	* Makefile.in: Regenerated with automake 1.11.6.
	* aclocal.m4: Likewise.
	* doc/Makefile.in: Likewise.

gold/

	* Makefile.in: Regenerated with automake 1.11.6.
	* aclocal.m4: Likewise.
	* testsuite/Makefile.in: Likewise.

gprof/

	* Makefile.in: Regenerated with automake 1.11.6.
	* aclocal.m4: Likewise.

ld/

	* Makefile.in: Regenerated with automake 1.11.6.
	* aclocal.m4: Likewise.

opcodes/

	* Makefile.in: Regenerated with automake 1.11.6.
	* aclocal.m4: Likewise.
2016-04-15 16:20:55 -07:00
Alan Modra 05f7541ea7 Fix non-ELF powerpc build breakage
* config/tc-ppc.c (toc_reloc_types): Wrap in #ifdef OBJ_ELF
2016-04-15 23:43:20 +09:30
H.J. Lu 0796a6293f Add missing ChangeLog entry for PR gas/19909 fix 2016-04-15 05:59:16 -07:00
Trevor Saunders 4f2a7b5121 make a few variables static
They are only used in one file, so we might as well restrict there scope to
that file, and theoretically this might slightly improve compilers ability to
optimize usage of these variables.

gas/ChangeLog:

2016-04-14  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-nios2.c (nios2_as_options): Make file static.
	* config/tc-ppc.c (toc_reloc_ypes): Likewise.
	* config/tc-sparc.c (native_op_table): Likewise.
2016-04-14 17:06:26 -04:00
Trevor Saunders 85e53f6272 remove some unused globals
gas/ChangeLog:

2016-04-14  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-m32c.c (M32C_Macros): Remove.
	* config/tc-msp430.c (option_numbers): Likewise.
2016-04-14 16:58:01 -04:00
Andrew Burgess 4b0c052e45 arc/nps400 : New cmem instructions and associated relocation
Add support for arc/nps400 cmem instructions, these load and store
instructions are hard-wired to access "0x57f00000 + 16-bit-offset".

Supporting this relocation required some additions to the arc relocation
handling in the bfd library, as well as the standard changes required to
add a new relocation type.

There's a test of the new instructions in the assembler, and a test of
the relocation in the linker.

bfd/ChangeLog:

	* reloc.c: Add BFD_RELOC_ARC_NPS_CMEM16 entry.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* elf32-arc.c: Add 'opcode/arc.h' include.
	(struct arc_relocation_data): Add symbol_name.
	(arc_special_overflow_checks): New function.
	(arc_do_relocation): Use arc_special_overflow_checks, reindent as
	required, add an extra comment.
	(elf_arc_relocate_section): Setup symbol_name in reloc_data.

gas/ChangeLog:

	* testsuite/gas/arc/nps400-3.d: New file.
	* testsuite/gas/arc/nps400-3.s: New file.

include/ChangeLog:

	* elf/arc-reloc.def: Add ARC_NPS_CMEM16 reloc.
	* opcode/arc.h (NPS_CMEM_HIGH_VALUE): Define.

ld/ChangeLog:

	* testsuite/ld-arc/arc.exp: New file.
	* testsuite/ld-arc/nps-1.s: New file.
	* testsuite/ld-arc/nps-1a.d: New file.
	* testsuite/ld-arc/nps-1b.d: New file.
	* testsuite/ld-arc/nps-1b.err: New file.

opcodes/ChangeLog:

	* arc-nps400-tbl.h: Add xldb, xldw, xld, xstb, xstw, and xst
	instructions.
	* arc-opc.c (insert_nps_cmem_uimm16): New function.
	(extract_nps_cmem_uimm16): New function.
	(arc_operands): Add NPS_XLDST_UIMM16 operand.
2016-04-14 17:16:46 +01:00
Andrew Burgess d105775eea gas/arc: Unify tests run on big/little endian arc assembler
We were running a slightly different set of assembler tests on big and
little endian arc targets.  This commit unifies the set of tests run.

gas/ChangeLog:

	* testsuite/gas/arc/add_s-err.s: Update target pattern.
	* testsuite/gas/arc/warn.s: Likewise.
	* testsuite/gas/elf/elf.exp: Run test for arc.
2016-04-14 13:43:27 +01:00
Nick Clifton 8486501545 Fix copying Solaris binaries with objcopy.
PR target/19938
bfd	* elf-bbfd.h (struct elf_backend_data): New field:
	elf_strtab_flags.
	New field: elf_backend_set_special_section_info_and_link
	* elfxx-target.h (elf_backend_strtab_flags): Define if not already
	defined.
	(elf_backend_set_special_section_info_and_link): Define if not
	already defined.
	(elfNN_bed): Use elf_backend_set_special_section_info_and_link and
	elf_backend_strtab_flags macros to initialise fields in structure.
	* elf.c (_bfd_elf_make_section_from_shdr): Check for SHF_STRINGS
	being set even if SHF_MERGE is not set.
	(elf_fake_sections): Likewise.
	(section_match): New function.  Matches two ELF sections based
	upon fixed characteristics.
	(find_link): New function.  Locates a section in a BFD that
	matches a section in a different BFD.
	(_bfd_elf_copy_private_bfd_data): Copy the sh_info and sh_link
	fields of reserved sections.
	(bfd_elf_compute_section_file_positions): Set the flags for the
	.shstrtab section based upon the elf_strtab_flags field in the
	elf_backend_data structure.
	(swap_out_syms): Likewise for the .strtab section.
	* elflink.c (bfd_elf_final_link): Set the flags for the
	.strtab section based upon the elf_strtab_flags field in the
	elf_backend_data structure.
	* elf32-i386.c (elf32_i386_set_special_info_link): New function.
	(elf_backend_strtab_flags): Set to SHF_STRINGS for Solaris
	targets.
	(elf_backend_set_special_section_info_and_link): Define for
	Solaris targets.
	* elf32-sparc.c: Likewise.
	* elf64-x86-64.c: Likewise.

binutils* testsuite/binutils-all/i386/compressed-1b.d: Allow for the
	string sections possibly having the SHF_STRINGS flag bit set.
	* testsuite/binutils-all/i386/compressed-1c.d: Likewise.
	* testsuite/binutils-all/readelf.s: Likewise.
	* testsuite/binutils-all/readelf.s-64: Likewise.
	* testsuite/binutils-all/x86-64/compressed-1b.d: Likewise.
	* testsuite/binutils-all/x86-64/compressed-1c.d: Likewise.

gas	* testsuite/gas/i386/ilp32/x86-64-unwind.d: Allow for the string
	sections possibly having the SHF_STRINGS flag bit set.
	* testsuite/gas/i386/x86-64-unwind.d: Likewise.
2016-04-14 12:04:09 +01:00
Claudiu Zissulescu 1adc8a9a7f [ARC] Fix setting private elf flags when parsing .cpu.
gas/
2016-04-12  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (mach_type_specified_p): Change type to
	bfd_boolean.
	(arc_option): Set private flags when parsing cpu pseudo-op.
	(md_parse_option): Set mach_type_specified_p to TRUE.
2016-04-13 16:48:11 +02:00
Nick Clifton e4449be885 oops - omitted from previous delta. 2016-04-13 15:10:48 +01:00
Nick Clifton accc018020 Fix disassembly of the V850's LD.BU instruction.
PR target/19937
opcode	* v850-opc.c (v850_opcodes): Correct masks for long versions of
	the LD.B and LD.BU instructions.

gas	* testsuite/gas/v850/pr19937.s: New test.
	* testsuite/gas/v850/pr19937.d: New test control file.
	* testsuite/gas/v850/basic.exp: Run the new test.
2016-04-13 15:09:25 +01:00
Maciej W. Rozycki 991f40a9fa MIPS/GAS: Correct branch relaxation for weak symbols
Weak symbols can be preempted at link time so always choose the longer
sequence in branch relaxation, according to the relaxation level chosen,
so that any symbol finally used as the branch target is reachable.

2016-04-13  Maciej W. Rozycki  <macro@imgtec.com>
            Andrew Bennett  <andrew.bennett@imgtec.com>

	gas/
	* config/tc-mips.c (relaxed_branch_length): Use the long
	sequence where the target is a weak symbol.
	(relaxed_micromips_32bit_branch_length): Likewise.
	(relaxed_micromips_16bit_branch_length): Likewise.
	* testsuite/gas/mips/branch-weak-1.d: New test.
	* testsuite/gas/mips/branch-weak-2.d: New test.
	* testsuite/gas/mips/branch-weak-3.d: New test.
	* testsuite/gas/mips/branch-weak-4.d: New test.
	* testsuite/gas/mips/branch-weak-5.d: New test.
	* testsuite/gas/mips/branch-weak.l: New stderr output.
	* testsuite/gas/mips/branch-weak.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2016-04-13 13:38:50 +01:00
Maciej W. Rozycki c1f61bd2b0 MIPS/GAS: Relax branches to symbols resolved at link time
Where branch relaxation is enabled emit the long sequence for branches
whose distance cannot be determined, i.e. to symbols that are undefined
or in a different segment.  These symbols are only resolved at link time
and therefore the longer sequence ensures the branch target is in range,
which cannot be guaranteed with a direct branch.

This is the opposite to the current implementation, originally proposed
here: <https://sourceware.org/ml/binutils/2002-09/msg00218.html>.  The
proposal was then extensively discussed before the final version was
posted here: <https://sourceware.org/ml/binutils/2002-10/msg00191.html>
and eventually committed:

commit 4a6a3df43d
Author: Alexandre Oliva <aoliva@redhat.com>
Date:   Sat Oct 12 05:23:33 2002 +0000

The case considered here was not commented in the review however and the
original version remains.  With branch relaxation enabled it makes more
sense to do it consistently, so that all code impure with respect to
branch distances can be linked.  Direct branches are still produced for
the cases concerned where branch relaxation is disabled, which is the
default.

	gas/
	* config/tc-mips.c (relaxed_branch_length): Use the long
	sequence where the distance cannot be determined.
	(relaxed_micromips_32bit_branch_length): Likewise.
	* testsuite/gas/mips/branch-extern-1.d: New test.
	* testsuite/gas/mips/branch-extern-2.d: New test.
	* testsuite/gas/mips/branch-extern-3.d: New test.
	* testsuite/gas/mips/branch-extern-4.d: New test.
	* testsuite/gas/mips/branch-extern.l: New stderr output.
	* testsuite/gas/mips/branch-extern.s: New test source.
	* testsuite/gas/mips/branch-section-1.d: New test.
	* testsuite/gas/mips/branch-section-2.d: New test.
	* testsuite/gas/mips/branch-section-3.d: New test.
	* testsuite/gas/mips/branch-section-4.d: New test.
	* testsuite/gas/mips/branch-section.l: New stderr output.
	* testsuite/gas/mips/branch-section.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2016-04-13 13:32:41 +01:00
Claudiu Zissulescu f36e33dac1 Add support for .extCondCode, .extCoreRegister and .extAuxRegister.
gas/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/textauxregister.d: New file.
	* testsuite/gas/arc/textauxregister.s: Likewise.
	* testsuite/gas/arc/textcondcode.d: Likewise.
	* testsuite/gas/arc/textcondcode.s: Likewise.
	* testsuite/gas/arc/textcoreregister.d: Likewise.
	* testsuite/gas/arc/textcoreregister.s: Likewise.
	* testsuite/gas/arc/textpseudoop.d: Likewise.
	* testsuite/gas/arc/textpseudoop.s: Likewise.
	* testsuite/gas/arc/ld2.d: Update test.
	* testsuite/gas/arc/st.d: Likewise.
	* testsuite/gas/arc/taux.d: Likewise.
	* doc/c-arc.texi (ARC Directives): Add .extCondCode,
	.extCoreRegister and .extAuxRegister documentation.
	* config/tc-arc.c (arc_extcorereg): New function.
	(md_pseudo_table): Add .extCondCode, .extCoreRegister and
	.extAuxRegister pseudo-ops.
	(extRegister_t): New type.
	(ext_condcode, arc_aux_hash): New global variable.
	(find_opcode_match): Check for extensions.
	(preprocess_operands): Likewise.
	(md_begin): Add aux registers in a hash.
	(assemble_insn): Update use arc_flags member.
	(tokenize_extregister): New function.
	(create_extcore_section): Likewise.
	* config/tc-arc.h (MAX_FLAG_NAME_LENGHT): Increase to 10.
	(arc_flags): Delete code, add flgp.

include/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

	* opcode/arc.h (flag_class_t): Update.
	(ARC_OPCODE_NONE): Define.
	(ARC_OPCODE_ARCALL): Likewise.
	(ARC_OPCODE_ARCFPX): Likewise.
	(ARC_REGISTER_READONLY): Likewise.
	(ARC_REGISTER_WRITEONLY): Likewise.
	(ARC_REGISTER_NOSHORT_CUT): Likewise.
	(arc_aux_reg): Add cpu.

opcodes/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-dis.c (find_format): Check for extension flags.
	(print_flags): New function.
	(print_insn_arc): Update for .extCondCode, .extCoreRegister and
	.extAuxRegister.
	* arc-ext.c (arcExtMap_coreRegName): Use
	LAST_EXTENSION_CORE_REGISTER.
	(arcExtMap_coreReadWrite): Likewise.
	(dump_ARC_extmap): Update printing.
	* arc-opc.c (arc_flag_classes): Add F_CLASS_EXTEND flag.
	(arc_aux_regs): Add cpu field.
	* arc-regs.h: Add cpu field, lower case name aux registers.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2016-04-12 10:21:06 +02:00
Claudiu Zissulescu 1c2e355e48 Update ARC instruction data-base.
gas/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/noargs_a7.d: New file.
	* testsuite/gas/arc/noargs_a7.s: Likewise.
	* testsuite/gas/arc/noargs_hs.d: Likewise.
	* testsuite/gas/arc/noargs_hs.s: Likewise.

opcode/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-tbl.h: Add rtsc, sleep with no arguments.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2016-04-12 10:08:37 +02:00
Claudiu Zissulescu b99747aeed Add support for .extInstruction pseudo-op.
gas/
2016-04-04  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/textinsn-errors.d: New File.
	* testsuite/gas/arc/textinsn-errors.err: Likewise.
	* testsuite/gas/arc/textinsn-errors.s: Likewise.
	* testsuite/gas/arc/textinsn2op.d: Likewise.
	* testsuite/gas/arc/textinsn2op.s: Likewise.
	* testsuite/gas/arc/textinsn2op01.d: Likewise.
	* testsuite/gas/arc/textinsn2op01.s: Likewise.
	* testsuite/gas/arc/textinsn3op.d: Likewise.
	* testsuite/gas/arc/textinsn3op.s: Likewise.
	* doc/c-arc.texi (ARC Directives): Add .extInstruction
	documentation.
	* config/tc-arc.c (arcext_section): New variable.
	(arc_extinsn): New function.
	(md_pseudo_table): Add .extInstruction pseudo op.
	(attributes_t): New type.
	(suffixclass, syntaxclass, syntaxclassmod): New constant
	structures.
	(find_opcode_match): Remove arc_num_opcodes.
	(md_begin): Likewise.
	(tokenize_extinsn): New function.
	(arc_set_ext_seg): Likewise.
	(create_extinst_section): Likewise.

include/
2016-04-04  Claudiu Zissulescu  <claziss@synopsys.com>

	* opcode/arc.h (arc_num_opcodes): Remove.
	(ARC_SYNTAX_3OP, ARC_SYNTAX_2OP, ARC_OP1_MUST_BE_IMM)
	(ARC_OP1_IMM_IMPLIED, ARC_SUFFIX_NONE, ARC_SUFFIX_COND)
	(ARC_SUFFIX_FLAG): Define.
	(flags_none, flags_f, flags_cc, flags_ccf): Declare.
	(arg_none, arg_32bit_rarbrc, arg_32bit_zarbrc, arg_32bit_rbrbrc)
	(arg_32bit_rarbu6, arg_32bit_zarbu6, arg_32bit_rbrbu6)
	(arg_32bit_rbrbs12, arg_32bit_ralimmrc, arg_32bit_rarblimm)
	(arg_32bit_zalimmrc, arg_32bit_zarblimm, arg_32bit_rbrblimm)
	(arg_32bit_ralimmu6, arg_32bit_zalimmu6, arg_32bit_zalimms12)
	(arg_32bit_ralimmlimm, arg_32bit_zalimmlimm, arg_32bit_rbrc)
	(arg_32bit_zarc, arg_32bit_rbu6, arg_32bit_zau6, arg_32bit_rblimm)
	(arg_32bit_zalimm, arg_32bit_limmrc, arg_32bit_limmu6)
	(arg_32bit_limms12, arg_32bit_limmlimm): Likewise.

opcodes/
2016-04-04  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-opc.c (flags_none, flags_f, flags_cc, flags_ccf):
	Initialize.
	(arg_none, arg_32bit_rarbrc, arg_32bit_zarbrc, arg_32bit_rbrbrc)
	(arg_32bit_rarbu6, arg_32bit_zarbu6, arg_32bit_rbrbu6)
	(arg_32bit_rbrbs12, arg_32bit_ralimmrc, arg_32bit_rarblimm)
	(arg_32bit_zalimmrc, arg_32bit_zarblimm, arg_32bit_rbrblimm)
	(arg_32bit_ralimmu6, arg_32bit_zalimmu6, arg_32bit_zalimms12)
	(arg_32bit_ralimmlimm, arg_32bit_zalimmlimm, arg_32bit_rbrc)
	(arg_32bit_zarc, arg_32bit_rbu6, arg_32bit_zau6, arg_32bit_rblimm)
	(arg_32bit_zalimm, arg_32bit_limmrc, arg_32bit_limmu6)
	(arg_32bit_limms12, arg_32bit_limmlimm): Likewise.
	(arc_opcode arc_opcodes): Null terminate the array.
	(arc_num_opcodes): Remove.
	* arc-ext.h (INSERT_XOP): Define.
	(extInstruction_t): Likewise.
	(arcExtMap_instName): Delete.
	(arcExtMap_insn): New function.
	(arcExtMap_genOpcode): Likewise.
	* arc-ext.c (ExtInstruction): Remove.
	(create_map): Zero initialize instruction fields.
	(arcExtMap_instName): Remove.
	(arcExtMap_insn): New function.
	(dump_ARC_extmap): More info while debuging.
	(arcExtMap_genOpcode): New function.
	* arc-dis.c (find_format): New function.
	(print_insn_arc): Use find_format.
	(arc_get_disassembler): Enable dump_ARC_extmap only when
	debugging.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2016-04-12 10:06:07 +02:00
Claudiu Zissulescu 37ab977937 Remove unneeded AUX register symbols.
gas/
2016-03-31  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (preprocess_operands): Mark AUX symbol.
	(arc_adjust_symtab): New function.
	* config/tc-arc.h (ARC_FLAG_AUX): Define.
	(obj_adjust_symtab): Likewise.
	* testsuite/gas/arc/taux.d: New file.
	* testsuite/gas/arc/taux.s: Likewise.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2016-04-12 09:57:03 +02:00
Maciej W. Rozycki 41a1578ed1 MIPS/GAS: Sanitize `.option picX' pseudo-op
gas/
	* config/tc-mips.c (s_option): Sanitize `.option picX'
	pseudo-op.
	* testsuite/gas/mips/option-pic-1.d: New test.
	* testsuite/gas/mips/option-pic-2.l: New list test.
	* testsuite/gas/mips/option-pic-1.s: New test source.
	* testsuite/gas/mips/option-pic-2.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2016-04-09 21:35:50 +01:00
Maciej W. Rozycki 668c5ebc09 MIPS/GAS: Disallow `.option picX' with VxWorks PIC
gas/
	* config/tc-mips.c (s_option): Reject `.option picX' if VxWorks
	PIC.
	* testsuite/gas/mips/option-pic-vxworks-1.l: New list test.
	* testsuite/gas/mips/option-pic-vxworks-2.l: New list test.
	* testsuite/gas/mips/option-pic-vxworks-1.s: New test source.
	* testsuite/gas/mips/option-pic-vxworks-2.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2016-04-09 21:23:40 +01:00
Maciej W. Rozycki 41065f5e08 MIPS/GAS: Correct call formatting in `can_swap_branch_p'
gas/
	* config/tc-mips.c (can_swap_branch_p): Correct call formatting.
2016-04-09 13:27:30 +01:00
Maciej W. Rozycki 08918cc8c5 GAS: Fix a typo in `as_bad' description
gas/
	* messages.c (as_bad): Fix a typo in description.
2016-04-09 13:22:54 +01:00
Maciej W. Rozycki 1357373c1d MIPS/GAS: Unify messages in `mips_check_options'
gas/
	* config/tc-mips.c (mips_check_options): Unify messages.
2016-04-09 13:19:00 +01:00
Maciej W. Rozycki 5f4678bb69 MIPS/GAS: Use `opts->isa' consistently in `mips_check_options'
gas/
	* config/tc-mips.c (mips_check_options): Use `opts->isa'
	consistently.
2016-04-09 12:55:09 +01:00
Nick Clifton 992dc2c470 Fix regexps in PR19910 test to cope with COFF and AOUT sparc targets.
PR target/19910
	* testsuite/gas/sparc/pr19910-1.d: Adjust regexps to work with
	COFF and AOUT sparc targets.
2016-04-08 10:36:49 +01:00
Andrew Burgess a42a4f8400 arc/nps400: Add new instructions
Add some new control instructions to the opcodes library, and a new test
for these new instructions to the assembler.  The new instructions use
an instruction flag longer than any seen before (on arc), and so the max
flag length is extended to accommodate this.

gas/ChangeLog:

	* config/tc-arc.h (MAX_FLAG_NAME_LENGTH): Increase to 7.
	* testsuite/gas/arc/nps400-2.d: New file.
	* testsuite/gas/arc/nps400-2.s: New file.

opcodes/ChangeLog:

	* arc-nps400-tbl.h: Add schd, sync, and hwschd instructions.
	* arc-opc.c (arc_flag_operands): Add new flags.
	(arc_flag_classes): Add new classes.
2016-04-07 18:36:40 +01:00
Andrew Burgess 1328504b28 gas/arc: Handle multiple arc_opcode chains for same mnemonic
This commit completes support for having multiple instructions with the
same mnemonic in non-contiguous blocks within the arc_opcodes table.

The commit adds an iterator mechanism for the arc_opcode_hash_entry
structure, which is then used in find_opcode_match to consider all
arc_opcode entries with the same mnemonic, even when these instructions
are stored in non-contiguous blocks.

I extend the comment on the arc_opcodes table to discuss how entries
within the table are organised, and to mention how instructions can be
split into multiple groups if needed, but that the table is still
searched in table order.

There should be no user visible changes after this commit.

gas/ChangeLog:

	* config/tc-arc.c (struct arc_opcode_hash_entry_iterator): New
	structure.
	(arc_opcode_hash_entry_iterator_init): New function.
	(arc_opcode_hash_entry_iterator_next): New function.
	(find_opcode_match): Iterate over all arc_opcode entries
	referenced by the arc_opcode_hash_entry passed in as a parameter.

opcodes/ChangeLog:

	* arc-opc.c (arc_opcodes): Extend comment to discus table layout.
2016-04-07 18:36:09 +01:00
Andrew Burgess b9b47ab79f gas/arc: Additional work to support multiple arc_opcode chains
Building on earlier commits, this commit moves along support for having
multiple arc_opcode entries in the arc_opcodes table that have the same
mnemonic (name) field, but are not stored in a contiguous block in the
table.

In this commit we support looking up the arc_opcode_hash_entry from the
hash table, and passing this along to the find_opcode_match function,
which then finds the specific arc_opcode that we're assembling.  We
still don't actually support the multiple chains of arc_opcode entries
in this commit, but the limitation is now isolated to the
find_opcode_match function.

There is no user visible change after this commit.

gas/ChangeLog:

	* config/tc-arc.c (arc_find_opcode): Now returns
	arc_opcode_hash_entry pointer.
	(find_opcode_match): Update argument type, extract arc_opcode from
	incoming arc_opcode_hash_entry.
	(find_special_case_pseudo): Update return type.
	(find_special_case_flag): Update return type.
	(find_special_case): Update return type.
	(assemble_tokens): Lookup arc_opcode_hash_entry based on
	instruction mnemonic, then use find_opcode_match to identify
	specific arc_opcode.
2016-04-07 18:35:31 +01:00
Andrew Burgess da5be03929 gas/arc: Modify structure used to hold opcodes
The arc assembler builds a hash table to hold references to arc_opcode
entries in the arc_opcodes table.  This hash assumes that each mnemonic
will always appear in a contiguous blocks within the arc_opcodes table;
all ADD instruction will be together, all AND instructions will likewise
be together and so on.

The problem with this is that as different variations of arc are added,
then it is often more convenient to split instructions apart, so all the
base ADD instructions are together, but, variants of ADD specific to one
variation of arc are grouped with other instructions specific to that
arc variant.  The current data structures don't support splitting the
instructions in this way.

This commit is a first step towards addressing this limitation.  In this
commit the hash table that currently holds arc_opcode pointers directly,
instead holds a pointer to a new, intermediate, data structure.  This
new data structure holds the pointer to the arc_opcode.  In this way, we
can, in the future support having the intermediate structure hold
multiple pointers to different arc_opcode groups.

There should be no visible functional change after this commit.

gas/ChangeLog:

	* config/tc-arc.c (struct arc_opcode_hash_entry): New structure.
	(arc_find_opcode): New function.
	(find_special_case_pseudo): Use arc_find_opcode.
	(find_special_case_flag): Likewise.
	(assemble_tokens): Likewise.
	(md_begin): Build hash using struct arc_opcode_hash_entry.
2016-04-07 18:35:08 +01:00
Alan Modra abe051ba82 Fix gas/ChangeLog 2016-04-07 23:13:56 +09:30
Claudiu Zissulescu e6ba1cbaf8 [ARC] Prepare strings for automatic translation.
gas/
2016-04-07  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (arc_option): Prepare string for automatic
	translation.
	(declare_register): Likewise.
2016-04-07 15:11:52 +02:00
James Greenhalgh b607cde1aa Update AArch64 documentation regarding architecture extensions.
* doc/c-aarch64.texi (Architecture Extensions): Add entry for LSE.
	Correct entry for RDMA.  Alpha sort entries.
2016-04-07 13:29:50 +01:00
Andrew Burgess 692166c244 gas/arc: Allow greater range of characters into flag names
An upcoming commit will add a new arc instruction flag that uses
characters that have never appeared in an arc instruction flag before.
Currently the assembler is very conservative about which characters can
or cannot appear in an instruction flag.

This commit relaxes these constraints a little.  After this commit all
alpha-numeric characters are now allowed into instruction flags.  This
complete set is not required for the upcoming change, however, having
this slightly larger set does not impact the assemblers ability to
correctly parse input, but does make it easier to add new flag to the
instruction table.

gas/ChangeLog:

	* config/tc-arc.c (tokenize_flags): Allow greater range of
	characters into flag names.
2016-04-07 12:42:58 +01:00
Andrew Burgess 22b92fc42c gas/arc: Remove preprocess_operands function
The preprocess_operands function changes the incoming list of assembler
tokens based on the assumption that the first arc_operand found will be
the same instruction class as all of the arc_operands for the same
mnemonic.

Though this assumption is probably fine, removing this assumption, and
pushing the token change down into assemble_tokens makes the code no
more complex, and might even be easier to follow.

There should be no user visible changes after this commit.

gas/ChangeLog:

	* config/tc-arc.c (find_opcode_match): Handle O_symbol case, add
	new de_fault label.
	(preprocess_operands): Delete.
	(assemble_tokens): Remove call to preprocess_operands.
2016-04-07 12:42:58 +01:00
Nick Clifton e140100a5d Allow integer contants to have a U suffix. Improve error reporting for missing closing parentheses.
PR gas/19910
	* config/tc-sparc.c (sparc_ip): Report an error if the expression
	inside a %-macro could not be fully parsed.
	* expr.c (integer_constant): Accept and ignore U suffixes to
	integers.
	(operand): When a missing closing parenthesis is encountered,
	report the character that was found instead.
	* testsuite/gas/mips/tls-ill.l: Update expected error message.
	* testsuite/gas/sparc/pr19910-1.d: New test driver.
	* testsuite/gas/sparc/pr19910-1.s: New test.
	* testsuite/gas/sparc/pr19910-2.l: Expected error output.
	* testsuite/gas/sparc/pr19910-2.s: New test.
	* testsuite/gas/sparc/sparc.exp: Run the new tests.
2016-04-07 12:34:06 +01:00
Nick Clifton 927f2d25ef Fix MSP430 assembler's detection of NOP and EINT.
* config/tc-msp430.c (msp430_operands): Check for a NOP preceding
	an EINT instruction.  Warn/fix as necessary.
	* testsuite/gas/msp430/bad.s: Add test of EINT without preceding NOP.
	* testsuite/gas/msp430/bad.l: Update expected messages.
2016-04-06 15:58:30 +01:00
Andrew Burgess 820f03ffe0 arc/nps400: Add additional instructions
Adds the movbi, decode1, fbset, fbclear, encode0, encode1, rflt, crc16,
and crc32 instructions for the nps400 arc machine type.

gas/ChangeLog:

	* testsuite/gas/arc/nps400-1.d: Update expected results.
	* testsuite/gas/arc/nps400-1.s: Additional test cases.

opcodes/ChangeLog:

	* arc-nps400-tbl.h: Add movbi, decode1, fbset, fbclear, encode0,
	encode1, rflt, crc16, and crc32 instructions.
	* arc-opc.c (arc_flag_operands): Add F_NPS_R.
	(arc_flag_classes): Add C_NPS_R.
	(insert_nps_bitop_size_2b): New function.
	(extract_nps_bitop_size_2b): Likewise.
	(insert_nps_bitop_uimm8): Likewise.
	(extract_nps_bitop_uimm8): Likewise.
	(arc_operands): Add new operand entries.
2016-04-05 22:45:55 +01:00
Claudiu Zissulescu 8ddf6b2a13 [ARC] Fix support for double assist instructions.
opcodes/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-regs.h: Add a new subclass field.  Add double assist
        accumulator register values.
        * arc-tbl.h: Use DPA subclass to mark the double assist
        instructions.  Use DPX/SPX subclas to mark the FPX instructions.
        * arc-opc.c (RSP): Define instead of SP.
        (arc_aux_regs): Add the subclass field.

include/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * opcode/arc.h (DPA, DPX, SPX): New subclass enums.
        (ARC_FPUDA): Define.
        (arc_aux_reg): Add new field.

gas/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * config/tc-arc.c (is_code_density_p): Compare directly the
        subclass field.
        (is_spfp_p, is_dpfp_p, is_spfp_p): Define.
        (check_cpu_feature): New function.
        (find_opcode_match): Use check_cpu_feature function.
        (preprocess_operands): Likewise.
        (md_parse_option): Use mfpuda, mdpfp, mspfp options.
        * testsuite/gas/arc/tdpfp.d: New file.
        * testsuite/gas/arc/tfpuda.d: Likewise.
        * testsuite/gas/arc/tfpx.s: Likewise.
2016-04-05 17:37:45 +02:00
Jiong Wang 589a7d8830 [ARM] Add ARMv8.2 FP16 vmul/vmla/vmls (by scalar)
gas/
  * config/tc-arm.c (do_neon_mac_maybe_scalar): Allow F16.
  * testsuite/gas/arm/armv8-2-fp16-simd.s: New tests.
  * testsuite/gas/arm/armv8-2-fp16-simd.d: New expected results.
  * testsuite/gas/arm/armv8-2-fp16-simd-thum.d: Likewise for Thumb.
  * testsuite/gas/arm/armv8-2-fp16-simd-warning.l: New warning results.
  * testsuite/gas/arm/simd_by_scalar_low_regbank.s: New test source.
  * testsuite/gas/arm/simd_by_scalar_low_regbank.d: New testcase.
  * testsuite/gas/arm/simd_by_scalar_low_regbank_thumb.d: Likewise for Thumb.
  * testsuite/gas/arm/simd_by_scalar_low_regbank.l: New warning results.

opcodes/
  * arm-dis.c: Support FP16 vmul, vmla, vmls (by scalar).
2016-04-05 15:54:00 +01:00
Claudiu Zissulescu 6ec1f28285 [ARC] Don't allow pc-rel relocations for J* instructions.
gas/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * config/tc-arc.c (assemble_insn): Prohibit pc-rel relocations for
        JUMP instructions type.
        * testsuite/gas/arc/relocs-errors.d: New file.
        * testsuite/gas/arc/relocs-errors.err: Likewise.
        * testsuite/gas/arc/relocs-errors.s: Likewise.
2016-04-05 16:23:02 +02:00
H.J. Lu 5be33403c3 Don't use vec_disp8 encoding with the .d32 suffix
Since the .d32 suffix prefers 32-bit displacement in encoding, try
vec_disp8 encoding only if i.disp_encoding != disp_encoding_32bit.

	PR gas/19909
	* config/tc-i386.c (check_VecOperands): Try vec_disp8 encoding
	only if i.disp_encoding != disp_encoding_32bit.
	* gas/testsuite/gas/i386/disp32.s: Add tests for vmovdqu64.d32.
	* gas/testsuite/gas/i386/x86-64-disp32.s: Likewise.
	* gas/testsuite/gas/i386/disp32.d: Updated.
	* gas/testsuite/gas/i386/x86-64-disp32.d: Likewise.
2016-04-04 21:19:27 -07:00
H.J. Lu df41fdf4bd Add a testcase for PR gas/19498
PR gas/19498
	* testsuite/gas/i386/i386.exp: Run pr19498.
	* testsuite/gas/i386/pr19498.d: New file.
	* testsuite/gas/i386/pr19498.s: Likewise.
2016-04-04 20:45:30 -07:00
Andrew Burgess 26cdfd9205 gas/arc: Use #define from include/opcode/arc.h
In tc-arc.h we redefine constants that are also defined in the
include/opcode/arc.h header file.  The problem is that changing one
without changing the other resulting in strange crashes.

We could comment both locations to stress the importance of remembering
to update the other location too, or we could just include the
opcode/arc.h header file into the assembler.

Given that other targets include their opcode/ARCH.h header file, and
only having a single definition, where possible, is usually the safest
solution, that's what I switch too with this commit.

gas/ChangeLog:

	* config/tc-arc.h: Include 'opcode/arc.h'.
	(MAX_INSN_ARGS): Delete.
	(MAX_INSN_FLGS): Delete.
2016-04-04 09:09:53 +01:00
Alan Modra 22987cec62 PR19498, Invalid "symbol definition loop"
PR 19498
	* symbols.c (resolve_symbol_value): Clear sy_resolving on exit
	from function on all paths that set sy_resolving.
2016-04-04 16:20:58 +09:30
Trevor Saunders 325801bda4 use XNEW and related macros more
gas/ChangeLog:

2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* app.c (app_push): use XNEW macro.
	* as.c: Likewise.
	* config/obj-elf.c (obj_elf_change_section): Likewise.
	(elf_copy_symbol_attributes): Likewise.
	(obj_elf_size): Likewise.
	(build_group_lists): Likewise.
	* config/tc-aarch64.c (add_operand_error_record): Likewise.
	(md_assemble): Likewise.
	(tc_gen_reloc): Likewise.
	(get_upper_str): Likewise.
	(aarch64_parse_features): Likewise.
	* config/tc-arm.c (insert_reg_alias): Likewise.
	(insert_neon_reg_alias): Likewise.
	(find_or_make_literal_pool): Likewise.
	(s_arm_elf_cons): Likewise.
	(add_unwind_opcode): Likewise.
	(arm_parse_extension): Likewise.
	* config/tc-avr.c (create_record_for_frag): Likewise.
	* config/tc-crx.c: Likewise.
	* config/tc-d30v.c: Likewise.
	* config/tc-dlx.c (s_proc): Likewise.
	* config/tc-ft32.c: Likewise.
	* config/tc-h8300.c: Likewise.
	* config/tc-hppa.c (pa_proc): Likewise.
	(create_new_space): Likewise.
	(create_new_subspace): Likewise.
	* config/tc-i860.c: Likewise.
	* config/tc-i960.c: Likewise.
	* config/tc-ia64.c: Likewise.
	* config/tc-iq2000.c (iq2000_add_macro): Likewise.
	(iq2000_record_hi16): Likewise.
	* config/tc-m32c.c (m32c_indirect_operand): Likewise.
	* config/tc-m32r.c (debug_sym): Likewise.
	(m32r_record_hi16): Likewise.
	* config/tc-m68k.c (m68k_ip): Likewise.
	(md_begin): Likewise.
	* config/tc-mcore.c: Likewise.
	* config/tc-microblaze.c (check_got): Likewise.
	* config/tc-mips.c (append_insn): Likewise.
	(s_mipsset): Likewise.
	(mips_record_label): Likewise.
	(s_mips_end): Likewise.
	* config/tc-mmix.c (mmix_frob_file): Likewise.
	* config/tc-mn10200.c: Likewise.
	* config/tc-mn10300.c: Likewise.
	* config/tc-moxie.c: Likewise.
	* config/tc-msp430.c: Likewise.
	* config/tc-nds32.c (nds32_elf_save_pseudo_pattern): Likewise.
	* config/tc-ns32k.c: Likewise.
	* config/tc-or1k.c: Likewise.
	* config/tc-pdp11.c: Likewise.
	* config/tc-pj.c (fake_opcode): Likewise.
	* config/tc-ppc.c (ppc_apuinfo_section_add): Likewise.
	(ppc_macro): Likewise.
	(ppc_dwsect): Likewise.
	(ppc_machine): Likewise.
	* config/tc-rl78.c (rl78_frag_init): Likewise.
	* config/tc-rx.c (rx_frag_init): Likewise.
	* config/tc-s390.c (s390_lit_suffix): Likewise.
	(s390_machine): Likewise.
	(s390_machinemode): Likewise.
	* config/tc-score.c (s3_insert_reg): Likewise.
	(s3_gen_reloc): Likewise.
	* config/tc-score7.c (s7_insert_reg): Likewise.
	(s7_gen_reloc): Likewise.
	* config/tc-tic30.c (tic30_operand): Likewise.
	* config/tc-tic4x.c (tic4x_inst_make): Likewise.
	* config/tc-tic54x.c (stag_add_field): Likewise.
	(tic54x_struct): Likewise.
	(tic54x_space): Likewise.
	(tic54x_field): Likewise.
	(tic54x_mlib): Likewise.
	(subsym_substitute): Likewise.
	* config/tc-tic6x.c (tic6x_frob_label): Likewise.
	* config/tc-vax.c: Likewise.
	* config/tc-xc16x.c: Likewise.
	* config/tc-xtensa.c (xtensa_add_insn_label): Likewise.
	(directive_push): Likewise.
	(xtensa_begin_directive): Likewise.
	(tokenize_arguments): Likewise.
	(xtensa_add_literal_sym): Likewise.
	(new_resource_table): Likewise.
	(resize_resource_table): Likewise.
	(emit_single_op): Likewise.
	(xtensa_create_trampoline_frag): Likewise.
	(xtensa_maybe_create_literal_pool_frag): Likewise.
	(xtensa_add_config_info): Likewise.
	(xtensa_realloc_fixup_cache): Likewise.
	(add_subseg_info): Likewise.
	(cache_literal_section): Likewise.
	(add_xt_block_frags): Likewise.
	(add_xt_prop_frags): Likewise.
	(init_op_placement_info_table): Likewise.
	(build_section_rename): Likewise.
	* config/tc-z80.c: Likewise.
	* config/tc-z8k.c: Likewise.
	* depend.c (register_dependency): Likewise.
	* dwarf2dbg.c (get_line_subseg): Likewise.
	(dwarf2_gen_line_info_1): Likewise.
	(get_filenum): Likewise.
	* ecoff.c (allocate_scope): Likewise.
	(allocate_vlinks): Likewise.
	(allocate_shash): Likewise.
	(allocate_thash): Likewise.
	(allocate_tag): Likewise.
	(allocate_forward): Likewise.
	(allocate_thead): Likewise.
	(allocate_lineno_list): Likewise.
	* expr.c (make_expr_symbol): Likewise.
	* hash.c (hash_new_sized): Likewise.
	* input-file.c (input_file_push): Likewise.
	* listing.c (file_info): Likewise.
	(listing_newline): Likewise.
	* macro.c (new_formal): Likewise.
	(define_macro): Likewise.
	* remap.c (add_debug_prefix_map): Likewise.
	* symbols.c (symbol_find_noref): Likewise.
	(define_dollar_label): Likewise.
	(fb_label_instance_inc): Likewise.
	(symbol_relc_make_value): Likewise.
2016-04-03 20:43:23 -04:00
Trevor Saunders a44e2901c7 use xstrdup and friends more
gas/ChangeLog:

2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/obj-elf.c (obj_elf_vendor_attribute): Use xstrdup.
	* config/tc-ppc.c (ppc_frob_file_before_adjust): Likewise.
	(ppc_znop): Likewise.
	(ppc_pe_section): Likewise.
	(ppc_frob_symbol): Likewise.
	* config/tc-tic30.c (tic30_operand): Likewise.
	* config/tc-tic4x.c (tic4x_sect): Likewise.
	(tic4x_usect): Likewise.
2016-04-03 19:52:25 -04:00
Trevor Saunders ae2689b09f cleanup FLT_CHARS and EXP_CHARS
Providing declarations in tc.h points out that alpha wasn't properly marking
FLT_CHARS as const.  We can also get rid of the confusing redefinition of
X_CHARS to mmix_x_chars.  Finally we can get rid of some now redundant
declarations of these constants.

gas/ChangeLog:

2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-alpha.c: Const qualify FLT_CHARS.
	* config/atof-ieee.c: Remove declarations of FLT_CHARS and EXP_CHARS.
	* config/tc-cris.h: Likewise.
	* expr.c: Likewise.
	* config/tc-mmix.c (md_atof): Adjust comment.
	* config/tc-mmix.h: Stop defining FLT_CHARS and EXP_CHARS as macros.
	* tc.h: Declare FLT_CHARS and EXP_CHARS.
2016-04-03 19:50:02 -04:00
Trevor Saunders a51ef39291 update ChangeLog for previous commit 2016-04-03 19:49:05 -04:00
Trevor Saunders 585ba04089 make score build again
It needs a few more things to be const now.

gas/ChangeLog:

2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-score.c (s3_gen_reloc): Add const qualifiers.
	* config/tc-score7.c (s7_gen_reloc): Likewise.
2016-04-03 19:46:09 -04:00
Trevor Saunders 2fe882148c arm: change the type of a variable to bfd_reloc_code_real_type
It is only ever assigned values in the enum, and it is passed to functions that
expect the argument's type to be the enum.

gas/ChangeLog:

2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-arm.c (do_t_branch): Change the type of reloc to
	bfd_reloc_code_real_type.
2016-04-03 19:15:39 -04:00
Trevor Saunders e1ec8109ab bfin: simplify current_inputline
Its not used for anything outside of md_assemble () so it doesn't need to be
extern.  While we are there we can replace free () and xmalloc () with
XRESIZEVEC which should be faster.

gas/ChangeLog:

2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/bfin-parse.y (current_inputline): Remove definition.
	* config/tc-bfin.c (md_assemble): Simplify use of current_inputline.
2016-04-03 19:13:42 -04:00
Trevor Saunders f73e41ef37 avr: simplify some option parsing with strcasecmp ()
Instead of canonicalizing the argument we can just use a case insensitive
     compare.

gas/ChangeLog:

2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-avr.c (md_parse_option): Use strcasecmp () to compare
	strings.
2016-04-03 19:10:33 -04:00
Alan Modra 62bd6b5fa4 PR19896, Segmentation fault on bad input
PR 19896
	* read.c (assign_symbol): Consume rest of line after an error
	rather than continuing to process the line.
2016-04-02 17:31:36 +10:30
Andrew Burgess 83cda17b6f gas/arc: Change 'LENGHT' to 'LENGTH'
Small spelling mistake in a #define, fixed in this commit.

gas/ChangeLog:

	* config/tc-arc.h (MAX_FLAG_NAME_LENGHT): Rename to...
	(MAX_FLAG_NAME_LENGTH): ...this.
	(struct arc_flags): Update to use MAX_FLAG_NAME_LENGTH.
	* config/tc-arc.c (tokenize_flags): Likewise.
2016-04-01 15:47:08 +01:00
Alan Modra 6d4af3c269 Constify more
* cgen.c (weak_operand_overflow_check): Return const char*.
	* messages.c (as_internal_value_out_of_range): Formatting.
	(as_warn_value_out_of_range): Consify prefix param.
	(as_bad_value_out_of_range): Likewise.
	* read.c (s_errwarn): Constify msg..
	(s_float_space, float_cons): ..and err.
	* as.h (as_warn_value_out_of_range, as_bad_value_out_of_range,
	ieee_md_atof, vax_md_atof): Update prototypes.
	* tc.h (md_atof): Update prototype.
	* config/atof-ieee.c (ieee_md_atof): Return const char*.
	* config/atof-vax.c (vax_md_atof): Likewise.
	* config/obj-elf.c (obj_elf_parse_section_letters): Constify bad_msg.
	* config/tc-aarch64.c (md_atof): Return const char*.
	* config/tc-alpha.c (s_alpha_section_name): Likewise.
	(s_alpha_comm): Constify sec_name.
	(section_name): Constify.
	(s_alpha_section): Consify name..
	(alpha_elf_section_letter): ..and ptr_msg param..
	(md_atof): ..and return.
	* config/tc-alpha.h (alpha_elf_section_letter): Update prototype.
	* config/tc-arc.c (md_atof): Return const char*.
	* config/tc-arm.c (md_atof): Likewise.
	* config/tc-avr.c (md_atof): Likewise.
	* config/tc-bfin.c (md_atof): Likewise.
	* config/tc-cr16.c (md_atof): Likewise.
	* config/tc-cris.c (md_atof): Likewise.
	* config/tc-crx.c (md_atof): Likewise.
	* config/tc-d10v.c (md_atof): Likewise.
	* config/tc-d30v.c (md_atof): Likewise.
	* config/tc-dlx.c (md_atof): Likewise.
	* config/tc-epiphany.c (md_atof): Likewise.
	* config/tc-fr30.c (md_atof): Likewise.
	* config/tc-frv.c (md_atof): Likewise.
	* config/tc-ft32.c (md_atof): Likewise.
	* config/tc-h8300.c (md_atof): Likewise.
	* config/tc-hppa.c (struct default_subspace_dict): Constify name.
	(struct default_space_dict): Likewise.
	(create_new_space): Constify name param.
	(create_new_subspace): Likewise.
	(is_defined_space, is_defined_subspace): Likewise.
	(pa_parse_space_stmt): Constify space_name param.
	(md_atof): Return const char*.
	(pa_spaces_begin): Constify name.
	* config/tc-i370.c (md_atof): Return const char*.
	* config/tc-i386.c (md_atof): Likewise.
	(x86_64_section_letter): Constify ptr_msg param.
	* config/tc-i386.h (x86_64_section_letter): Update prototype.
	* config/tc-i860.c (struct i860_it): Constify error.
	(md_atof): Return const char*.
	* config/tc-i960.c (md_atof): Likewise.
	* config/tc-ia64.c (md_atof): Likewise.
	(ia64_elf_section_letter): Constify ptr_msg param.
	* config/tc-ia64.h (ia64_elf_section_letter): Update prototype.
	* config/tc-ip2k.c (md_atof): Return const char*.
	* config/tc-iq2000.c (md_atof): Likewise.
	* config/tc-lm32.c (md_atof): Likewise.
	* config/tc-m32c.c (md_atof): Likewise.
	* config/tc-m32r.c (md_atof): Likewise.
	* config/tc-m68hc11.c (md_atof): Likewise.
	* config/tc-m68k.c (md_atof): Likewise.
	* config/tc-mcore.c (md_atof): Likewise.
	* config/tc-mep.c (md_atof): Likewise.
	(mep_elf_section_letter): Constify ptr_msg param.
	* config/tc-mep.h (mep_elf_section_letter): Update prototype.
	* config/tc-metag.c (md_atof): Return const char*.
	* config/tc-microblaze.c (md_atof): Likewise.
	* config/tc-microblaze.h (md_atof): Delete prototype.
	* config/tc-mips.c (mips_parse_argument_token): Constify err.
	(md_atof): Return const char*.
	* config/tc-mmix.c (md_atof): Likewise.
	* config/tc-mn10200.c (md_atof): Likewise.
	* config/tc-mn10300.c (md_atof): Likewise.
	* config/tc-moxie.c (md_atof): Likewise.
	* config/tc-msp430.c (md_atof): Likewise.
	* config/tc-mt.c (md_atof): Likewise.
	* config/tc-nds32.c (md_atof): Likewise.
	* config/tc-nios2.c (md_atof): Likewise.
	(nios2_elf_section_letter): Constify ptr_msg param.
	* config/tc-nios2.h (nios2_elf_section_letter): Update prototype.
	* config/tc-ns32k.c (md_atof): Return const char*.
	* config/tc-or1k.c (md_atof): Likewise.
	* config/tc-pdp11.c (struct pdp11_code): Constify error.
	(md_atof): Return const char*.
	* config/tc-pj.c (md_atof): Likewise.
	* config/tc-ppc.c (md_atof): Likewise.
	* config/tc-rl78.c (md_atof): Likewise.
	* config/tc-rx.c (md_atof): Likewise.
	* config/tc-s390.c (md_atof): Likewise.
	* config/tc-score.c (s3_atof, md_atof): Likewise.
	* config/tc-sh.c (md_atof): Likewise.
	* config/tc-sparc.c (struct sparc_it): Constify error.
	(md_atof): Return const char*.
	* config/tc-spu.c (md_atof): Likewise.
	* config/tc-tic30.c (md_atof): Likewise.
	* config/tc-tic4x.c (md_atof): Likewise.
	* config/tc-tic54x.c (md_atof): Likewise.
	* config/tc-tic6x.c (md_atof): Likewise.
	* config/tc-tilegx.c (md_atof): Likewise.
	* config/tc-tilepro.c (md_atof): Likewise.
	* config/tc-v850.c (parse_register_list, md_atof): Likewise.
	* config/tc-vax.c (md_atof): Likewise.
	* config/tc-visium.c (md_atof): Likewise.
	* config/tc-xc16x.c (md_atof): Likewise.
	* config/tc-xgate.c (md_atof): Likewise.
	* config/tc-xstormy16.c (md_atof): Likewise.
	* config/tc-xtensa.c (md_atof): Likewise.
	* config/tc-z80.c (md_atof): Likewise.
	* config/tc-z8k.c (md_atof): Likewise.
2016-04-01 23:10:50 +10:30
Trevor Saunders 6757cf5769 enable -Wwrite-strings for gas
We add a new AC_SUBST to warning.m4 so that the test if the warning is
supported is centralized, but the warning can be enabled per directory.

binutils/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* configure: Regenerate.

gprof/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* configure: Regenerate.

ld/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* configure: Regenerate.

opcodes/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* configure: Regenerate.

bfd/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* configure: Regenerate.
	* warning.m4: Add WARN_WRITE_STRINGS AC_SUBST.

gold/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* configure: Regenerate.

gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* Makefile.am: Add WARN_WRITE_STRINGS to WARN_CFLAGS.
	* Makefile.in: Regenerate.
	* configure: Likewise.
2016-03-31 07:30:56 -04:00
Trevor Saunders e4a0c70877 make xtensa_section_rename () take const char *
Xtensa uses it in several macros passing it a literal string, so its convenient
for the argument type to be const char *.  However some of the code in
symbols.c seems to assume tc_canonicalize_symbol_name () will return a non
const pointer, and some other target's implementations even modify the
argument, so it seems best to return a char * which means casting away const on
the argument when we return it instead of another string.

gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-xtensa.c (struct rename_section_struct): Make old_name
	const.
	(xtensa_section_rename): Make argument type const char *.
	* config/tc-xtensa.h (xtensa_section_rename): Adjust.
2016-03-31 07:30:41 -04:00
Trevor Saunders e2c7dcae81 tc-i960.c: add some casts when assigning literals to args[i]
parse_ldconst () takes a char ** as a in / out argument, and sometimes points
args[0] to a constant string.  Then in some cases after parse_ldconst ()
     returns md_assemble () twiddles the contents of arg[0].  So it seems like
     it would take some work to avoid these casts, and its not really clear
     that work is worth it.

gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-i960.c (parse_ldconst): Cast to char * when assigning to
	args[0].
2016-03-31 07:29:51 -04:00
Trevor Saunders f854977c23 cast the arg to md_assemble () to char *
For these targets its not clear how md_assemble can usefully be split up so
that part can take const char *.  There is also a fair number of targets that
need md_assemble () to take a char *, so we can't easily make the argument
const.  So since there isn't many callers it seems easiest to just add a couple
of casts.

gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-m32c.c (m32c_md_end): cast the argument to md_assemble to
	char *.
	(m32c_indirect_operand): Likewise.
	* config/tc-nds32.c (do_pseudo_b): Likewise.
	(do_pseudo_bal): Likewise.
	(do_pseudo_ls_bhw): Likewise.
2016-03-31 07:29:00 -04:00
Trevor Saunders 97830986a1 cast to char * when assigning to optarg
gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* as.c (parse_args): Cast literal to char * when assigning to optarg.
2016-03-31 07:28:08 -04:00
Trevor Saunders e87de5136e work around get_symbol_name () in sparc and ia64
get_symbol_name () returns a char * in a out arg, which means we need to cast
to assign a literal to the variable passed to get_symbol_name ().  It seems
like better APIs than get_symbol_name () could be provided, but that seems like
a fair amount of work so just casting seems to be the betterthing to do for
now.

gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-ia64.c (md_assemble): Add temporary variable to pass to
	get_symbol_name ().
	* config/tc-sparc.c (s_register): Cast a literal to char * in
	assignment.
2016-03-31 07:27:36 -04:00
Trevor Saunders 47990a6ab5 cast literal to char * when assigning to input_line_ptr
various places either directly or indirectly set input_line_pointer to point at
a literal.  Currently lots of places modify the string input_line_pointer
points at, so making it const isn't easy.  Since most if not all of these
places assign to input_line_pointer to parse an expression it would probably be
best to add ways to generate and deal with expressions that doesn't involve
parsing strings, but for now adding some casts seems easiest.

gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-i960.c (parse_expr): Cast to char * when assigning to
	input_line_pointer.
	* config/tc-m32r.c (expand_debug_syms): Likewise.
	* config/tc-msp430.c (msp430_dstoperand): Likewise.
	* config/tc-z80.c (md_begin): Likewise.
	* stabs.c (stabs_generate_asm_func): Likewise.
2016-03-31 07:23:31 -04:00
Trevor Saunders e046cf801d get rid of K&R style args
gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* cgen.c: Modernize the way functions declare arguments.
	* config/tc-bfin.c: Likewise.
	* config/tc-pdp11.c: Likewise.
	* literal.c: Likewise.
	* read.c: Likewise.
	* stabs.c: Likewise.
2016-03-31 01:04:00 -04:00
Trevor Saunders d923501116 make some variables unsigned
these places define char arrays containing values greater than 0x80 which
doesn't fit in an 8 bit signed char, but does fit in an unsigned one.

gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-aarch64.c (aarch64_handle_align): Make the type of some
	variables unsigned char[].
	* config/tc-alpha.c (alpha_handle_align): Likewise.
	* config/tc-arm.c (arm_handle_align): Likewise.
	* config/tc-z80.c: Likewise.
2016-03-31 00:57:11 -04:00
Nick Clifton c6025a80cc Fix compile time warning about comparison between signed and unsigned values.
PR target/19880
	* config/tc-arm.c (do_t_push_pop): Cast bitmask to unsigned before
	shifting.
2016-03-30 16:18:04 +01:00
Claudiu Zissulescu f89a23cfc9 [ARC] Allow equ redefintion tests for ARC.
gas/
2016-03-30  Claudiu Zissulescu  <claziss@synopsys.com>

        * testsuite/gas/all/gas.exp: Don't xfail on ARC.
        * testsuite/gas/elf/elf.exp: Likewise.
        * testsuite/gas/all/redef3.d: Allow execution for ARC.
2016-03-30 16:21:25 +02:00
Claudiu Zissulescu f621ad3c4b [ARC] Fix warn.exp test error.
gas/
2016-03-30  Claudiu Zissulescu  <claziss@synopsys.com>

        * testsuite/gas/arc/warn.exp: Fix matching pattern.
2016-03-30 16:09:56 +02:00
Trevor Saunders 4ec9d7d564 use xstrdup and friends more
gas/ChangeLog:

2016-03-29  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-hppa.c (pa_space): Use xstrdup where appropriate.
	(pa_subspace): Likewise.
	(create_new_space): Likewise.
	(create_new_subspace): Likewise.
	* config/tc-mips.c (mips_lookup_insn): Likewise.
	* config/tc-tic4x.c (tic4x_asg): Likewise.
	* config/tc-tic54x.c (tic54x_eval): Likewise.
	(stag_add_field): Likewise.
	(tic54x_usect): Likewise.
	(tic54x_clink): Likewise.
	(tic54x_set_default_include): Likewise.
	(tic54x_include): Likewise.
	(tic54x_message): Likewise.
	(tic54x_sblock): Likewise.
	(tic54x_var): Likewise.
	(subsym_ismember): Likewise.
	(subsym_substitute): Likewise.
	* config/tc-xtensa.c (xg_replace_opname): Likewise.
	(xg_translate_sysreg_op): Likewise.
	(xg_translate_idioms): Likewise.
	(md_assemble): Likewise.
	(cache_literal_section): Likewise.
2016-03-29 21:48:26 -04:00
Claudiu Zissulescu f2dd88387a [ARC] Add support for Quarkse opcodes.
gas/
2016-03-29  Claudiu Zissulescu  <claziss@synopsys.com>

        * testsuite/gas/arc/ext2op.d: New file.
        * testsuite/gas/arc/ext2op.s: Likewise.
        * testsuite/gas/arc/ext3op.d: Likewise.
        * testsuite/gas/arc/ext3op.s: Likewise.

opcodes/
2016-03-29  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-tbl.h (invld07): Remove.
        * arc-ext-tbl.h: New file.
        * arc-dis.c (FIELDA, FIELDB, FIELDC): Remove.
        * arc-opc.c (arc_opcodes): Add ext-tbl include.

include/
2016-03-29  Claudiu Zissulescu  <claziss@synopsys.com>

        * opcode/arc.h (insn_subclass_t): Add QUARKSE subclass.
        (FIELDA, FIELDB, FIELDC, FIELDF, FIELDQ, INSN3OP, INSN2OP)
        (INSN2OP, INSN3OP_ABC, INSN3OP_ALC, INSN3OP_ABL, INSN3OP_ALL)
        (INSN3OP_0BC, INSN3OP_0LC, INSN3OP_0BL, INSN3OP_0LL, INSN3OP_ABU)
        (INSN3OP_ALU, INSN3OP_0BU, INSN3OP_0LU, INSN3OP_BBS, INSN3OP_0LS)
        (INSN3OP_CBBC, INSN3OP_CBBL, INSN3OP_C0LC, INSN3OP_C0LL)
        (INSN3OP_CBBU, INSN3OP_C0LU, MINSN3OP_ABC, MINSN3OP_ALC)
        (MINSN3OP_ABL, MINSN3OP_ALL, MINSN3OP_0BC, MINSN3OP_0LC)
        (MINSN3OP_0BL, MINSN3OP_0LL, MINSN3OP_ABU, MINSN3OP_ALU)
        (MINSN3OP_0BU, MINSN3OP_0LU, MINSN3OP_BBS, MINSN3OP_0LS)
        (MINSN3OP_CBBC, MINSN3OP_CBBL, MINSN3OP_C0LC, MINSN3OP_C0LL)
        (MINSN3OP_CBBU, MINSN3OP_C0LU, INSN2OP_BC, INSN2OP_BL, INSN2OP_0C)
        (INSN2OP_0L INSN2OP_BU, INSN2OP_0U, MINSN2OP_BC, MINSN2OP_BL)
        (MINSN2OP_0C, MINSN2OP_0L, MINSN2OP_BU, MINSN2OP_0U): Define.
2016-03-29 14:49:22 +02:00
Trevor Saunders 17b9d67d4e make md_parse_option () take a const char *
This is mostly just adding const in many places, however there are a couple
interesting things.  We need to add casts in tc-s390.c and tc-cris.c because
they have functions that assign to input_line_pointer an argument that
sometimes comes from md_parse_option.  Presumably this is safe because those
targets never pass literals to md_parse_option (), but this code should
probably be improved in the future.  Also xtensa passes the argument to strtoll
which is a rather odd function, it takes a const char * as argument and returns
a pointer into that string as a char * through an out argument, but we can work
around that by adding more variables.

gas/ChangeLog:

2016-03-29  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-aarch64.c (struct aarch64_long_option_table): Ad const
	qualifier.
	* config/tc-alpha.c (md_parse_option): Likewise.
	* config/tc-arc.c (md_parse_option): Likewise.
	* config/tc-arm.c (struct arm_long_option_table): Likewise.
	(md_parse_option): Likewise.
	* config/tc-avr.c (md_parse_option): Likewise.
	* config/tc-bfin.c (md_parse_option): Likewise.
	* config/tc-cr16.c (md_parse_option): Likewise.
	* config/tc-cris.c (s_cris_arch): Likewise.
	(md_parse_option): Likewise.
	* config/tc-crx.c (md_parse_option): Likewise.
	* config/tc-d10v.c (md_parse_option): Likewise.
	* config/tc-d30v.c (md_parse_option): Likewise.
	* config/tc-dlx.c (md_parse_option): Likewise.
	* config/tc-epiphany.c (md_parse_option): Likewise.
	* config/tc-fr30.c (md_parse_option): Likewise.
	* config/tc-frv.c (md_parse_option): Likewise.
	* config/tc-ft32.c (md_parse_option): Likewise.
	* config/tc-h8300.c (md_parse_option): Likewise.
	* config/tc-hppa.c (md_parse_option): Likewise.
	* config/tc-i370.c (md_parse_option): Likewise.
	* config/tc-i386.c (md_parse_option): Likewise.
	* config/tc-i860.c (md_parse_option): Likewise.
	* config/tc-i960.c (md_parse_option): Likewise.
	* config/tc-ia64.c (md_parse_option): Likewise.
	* config/tc-ip2k.c (md_parse_option): Likewise.
	* config/tc-iq2000.c (md_parse_option): Likewise.
	* config/tc-lm32.c (md_parse_option): Likewise.
	* config/tc-m32c.c (md_parse_option): Likewise.
	* config/tc-m32r.c (md_parse_option): Likewise.
	* config/tc-m68hc11.c (md_parse_option): Likewise.
	* config/tc-m68k.c (md_parse_option): Likewise.
	* config/tc-mcore.c (md_parse_option): Likewise.
	* config/tc-mep.c (md_parse_option): Likewise.
	* config/tc-metag.c (struct metag_long_option): Likewise.
	(md_parse_option): Likewise.
	* config/tc-microblaze.c (md_parse_option): Likewise.
	* config/tc-microblaze.h (md_parse_option): Remove prototype.
	* config/tc-mips.c (md_parse_option): Adjust.
	* config/tc-mmix.c (md_parse_option): Likewise.
	* config/tc-mn10200.c (md_parse_option): Likewise.
	* config/tc-mn10300.c (md_parse_option): Likewise.
	* config/tc-moxie.c (md_parse_option): Likewise.
	* config/tc-msp430.c (md_parse_option): Likewise.
	* config/tc-mt.c (md_parse_option): Likewise.
		* config/tc-nds32.c (md_parse_option): Likewise.
		* config/tc-nds32.h (nds32_parse_option): Likewise.
	* config/tc-nios2.c (md_parse_option): Likewise.
	* config/tc-ns32k.c (md_parse_option): Likewise.
	* config/tc-or1k.c (md_parse_option): Likewise.
	* config/tc-pdp11.c (md_parse_option): Likewise.
	* config/tc-pj.c (md_parse_option): Likewise.
	* config/tc-ppc.c (md_parse_option): Likewise.
	* config/tc-rl78.c (md_parse_option): Likewise.
	* config/tc-rx.c (md_parse_option): Likewise.
	* config/tc-s390.c (s390_parse_cpu): Likewise.
	* config/tc-score.c (md_parse_option): Likewise.
	* config/tc-sh.c (md_parse_option): Likewise.
	* config/tc-sparc.c (md_parse_option): Likewise.
	* config/tc-spu.c (md_parse_option): Likewise.
	* config/tc-tic30.c (md_parse_option): Likewise.
	* config/tc-tic4x.c (md_parse_option): Likewise.
	* config/tc-tic54x.c (md_parse_option): Likewise.
	* config/tc-tic6x.c (md_parse_option): Likewise.
	* config/tc-tilegx.c (md_parse_option): Likewise.
	* config/tc-tilepro.c (md_parse_option): Likewise.
	* config/tc-v850.c (md_parse_option): Likewise.
	* config/tc-vax.c (md_parse_option): Likewise.
	* config/tc-visium.c (struct visium_long_option_table): Likewise.
	* config/tc-xc16x.c (md_parse_option): Likewise.
	* config/tc-xgate.c (md_parse_option): Likewise.
	* config/tc-xstormy16.c (md_parse_option): Likewise.
	* config/tc-xtensa.c (md_parse_option): Likewise.
	* config/tc-z80.c (md_parse_option): Likewise.
	* config/tc-z8k.c (md_parse_option): Likewise.
	* tc.h (md_parse_option): Likewise.
2016-03-29 07:43:25 -04:00
Trevor Saunders 30bd735cb0 apply ChangeLog for previous commit 2016-03-29 07:40:22 -04:00
Trevor Saunders aff7ae12a6 replace some obstack_alloc () calls with the XOBNEW wrapper
gas/ChangeLog:

2016-03-29  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-bfin.c (gencode): Use XOBNEW obstack_alloc () wrapper.
	* config/tc-hppa.c (fix_new_hppa): Likewise.
	(pa_vtable_entry): Likewise.
	(pa_vtable_inherit): Likewise.
	* config/tc-m68k.c (md_begin): Likewise.
2016-03-29 07:33:25 -04:00
Trevor Saunders 82b8a7851f add more const qualifiers
gas/ChangeLog:

2016-03-28  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/obj-elf.c (obj_elf_section_name): Return const char *.
	* config/obj-elf.h (obj_elf_section_name): Adjust.
	* config/tc-aarch64.c (aarch64_parse_features): Likewise.
	(aarch64_parse_cpu): Likewise.
	(aarch64_parse_arch): Likewise.
	* config/tc-arm.c (arm_parse_extension): Likewise.
	(arm_parse_cpu): Likewise.
	(arm_parse_arch): Likewise.
	* config/tc-nds32.c: Likewise.
	* config/xtensa-relax.c (parse_special_fn): Likewise.
	* stabs.c (generate_asm_file): Likewise.
2016-03-28 20:38:24 -04:00
Trevor Saunders 9202e88a2a split up cr16s md_assemble ()
gas/ChangeLog:

2016-03-25  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-cr16.c (cr16_assemble): New function.
	(md_assemble): Call cr16_assemble.
2016-03-25 20:26:56 -04:00
Trevor Saunders a90fb5e33b rename flag_size_check to flag_allow_nonconst_size and make it a bool
This name describes what the variable means slightly better, and the enum with
two values that is only used for this one variable is kind of silly.

gas/ChangeLog:

2016-03-25  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* as.c (parse_args): Adjust.
	* as.h (flag_size_check): Rename to flag_allow_nonconst_size.
	* config/obj-elf.c (elf_frob_symbol): Adjust.
2016-03-25 20:24:57 -04:00
Jose E. Marchesi f65c3d1b26 gas: sparc: allow ASR registers in the 0..31 range in V9 and later
In the SPARC V9 (and later) versions of the SPARC specification, the
section C.1.1 "Register Names" specifies that:

"asr_reg.  An asr_reg is an Ancillary State Register name.  It may have
 one of the following values:

  %asr16-%asr31"

The rationale of having this restriction was that the registers from 16
to 31 are reserved to implementations, and are therefore "non-V9".  It
also assumes that the existing ASR registers in the range 0..31 will
have their own names such as %y, that can be used to access such
registers.

However, this is problematic.  When a new ASR register is introduced,
such as %mcdper a.k.a. %asr14, it is useful to be able to use %asr14 in
order to not depend on the latest version of the assembler.

The Solaris assembler is lax and allows to assembly instructions
referring to %asr0 to %asr31.  This patch makes the GNU assembler to
mimic that behavior.

gas/ChangeLog:

  2016-03-24  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-sparc.c (sparc_ip): Remove the V9 restriction on ASR
	registers to be in the 16..31 range.
2016-03-24 10:28:41 -07:00
Trevor Saunders e742e119e1 make microblaze build with -Wwrite-strings
frag_var () assigns its last argument to frag::fr_opcode, and it turns out
some targets modify the string that points to.  However it appears niether the
generic code or the microblaze code modifies what fr_opcode points to, so this
code should be safe.  So we unfortunately need to cast to char * when passing
an argument to frag_var () but otherwise microblaze can itself point to these
strings with const char *.

gas/ChangeLog:

2016-03-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-microblaze.c (md_assemble): Cast opc to char * when calling
	frag_var ().
2016-03-24 08:00:44 -04:00
Trevor Saunders eda6e9a4a2 localize string returned from visium's md_atof ()
I'm not sure the string it returns is particularly useful, or better than the
string returned by other atof implementations on failure, but given the others
return a localized string it seems like this one should too.

gas/ChangeLog:

2016-03-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-visium.c (md_atof): Localize the string returned on
	failure.
2016-03-24 07:58:43 -04:00
Trevor Saunders b9bb4a9356 make more variables const
gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-h8300.c (h8300_elf_section): Add const qualifiers.
	* config/tc-ia64.c (obj_elf_vms_common): Likewise.
	* config/tc-m68hc11.c (md_begin): Likewise.
	(print_opcode_list): Likewise.
	* config/tc-msp430.c (msp430_section): Likewise.
	* config/tc-score.c (struct s3_insn_to_dependency): Likewise.
	(s3_build_dependency_insn_hsh): Likewise.
	* config/tc-score7.c (struct s7_insn_to_dependency): Likewise.
	(s7_build_dependency_insn_hsh): Likewise.
	* config/tc-tic4x.c: Likewise.
	* config/tc-tic54x.c (tic54x_set_default_include): Likewise.
	(subsym_get_arg): Likewise.
	* config/tc-xtensa.c (struct suffix_reloc_map): Likewise.
	(get_directive): Likewise.
	(cache_literal_section): Likewise.
	* config/xtensa-relax.c: Likewise.
	* symbols.c (symbol_create): Likewise.
	(local_symbol_make): Likewise.
	(symbol_relc_make_expr): Likewise.

include/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* opcode/i960.h: Add const qualifiers.
	* opcode/tic4x.h (struct tic4x_inst): Likewise.
2016-03-22 19:16:06 -04:00
Trevor Saunders 986d894b2a tc-pdp11.c: remove useless code
if the condition is true then we know that str already points to a'\0' in the
string passed to the function.  Since we know the latter part of the function
doesn't modify that string, and str already points to a null byte there's no
point in changing str to point to a literal empty string.

gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-pdp11.c (md_assemble): Remove useless if and assignment to
	str.
2016-03-22 19:14:17 -04:00
Trevor Saunders 74b4e47aa6 tc-sparc.c: get rid of wierd usage of strchr ()
This lets us avoid assigning a literal to a char *, and perhaps more
importantly makes it clearer what is going on here.

gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-sparc.c (sparc_regname_to_dw2regnum): Replace strchr ()
	call with a switch.
2016-03-22 19:12:00 -04:00
Trevor Saunders 0a433ebc90 use do_align () directly in tc-ia64.c
gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-ia64.c (ia64_do_align): Remove.
	(ia64_cons_align): Call do_align () directly.
	(dot_proc): Likewise.
	(stmt_float_cons): Likewise.
2016-03-22 19:08:50 -04:00
Trevor Saunders 8860a416a2 replace some raw xmalloc / xrealloc with the XNEW* macros
This increases consistancy of how we allocate memory, and always casting the
result to the proper type.  It also helps make sure we get any use of sizeof on
the result type correct.

gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* listing.c (listing_message): Use XNEW style allocation macros.
	* read.c (read_a_source_file): Likewise.
	(read_symbol_name): Likewise.
	(s_mri_common): Likewise.
	(assign_symbol): Likewise.
	(s_reloc): Likewise.
	(emit_expr_with_reloc): Likewise.
	(s_incbin): Likewise.
	(s_include): Likewise.
	* sb.c (sb_build): Likewise.
	(sb_check): Likewise.
2016-03-22 19:06:39 -04:00
Alan Modra 49636823b0 Fix tic54x regression
One of the tic54x testcases looks for a section alignment of 1.  After
9136aa49 the alignment became 0.  While it happens that an alignment
of 0 is treated as an alignment of 1, there is no reason to not apply
the explicit alignment.

	* write.c (record_alignment): Revert 2016-02-18 change.
2016-03-22 22:48:37 +10:30
Alan Modra 39a0d071ae Remove more alloca calls
* config/tc-alpha.c (load_expression): Replace alloca with xmalloc.
	(emit_jsrjmp, tc_gen_reloc): Likewise.
	* config/tc-i370.c (i370_macro): Likewise.
2016-03-22 22:47:05 +10:30
Nick Clifton 9780e04507 Add -Wstack-usage to the gcc warning flags list, but only if using a sufficiently recent version of gcc.
bfd	* warning.m4 (GCC_WARN_CFLAGS): Only add -Wstack-usage if using a
	sufficiently recent version of GCC.
	* configure: Regenerate.

others	* configure: Regenerate.
2016-03-22 09:41:16 +00:00
Andrew Burgess e23e8ebee3 arc/nps400: Add first nps400 instructions
Adds the first few nps400 instructions.

gas/ChangeLog:

	* testsuite/gas/arc/nps400-0.d: New file.
	* testsuite/gas/arc/nps400-0.s: New file.
	* testsuite/gas/arc/nps400-1.d: New file.
	* testsuite/gas/arc/nps400-1.s: New file.

include/ChangeLog:

	* opcodes/arc.h (insn_class_t): Add BITOP type.

opcodes/ChangeLog:

	* arc-nps400-tbl.h: New file.
	* arc-opc.c: Add top level comment.
	(insert_nps_3bit_dst): New function.
	(extract_nps_3bit_dst): New function.
	(insert_nps_3bit_src2): New function.
	(extract_nps_3bit_src2): New function.
	(insert_nps_bitop_size): New function.
	(extract_nps_bitop_size): New function.
	(arc_flag_operands): Add nps400 entries.
	(arc_flag_classes): Add nps400 entries.
	(arc_operands): Add nps400 entries.
	(arc_opcodes): Add nps400 include.
2016-03-21 16:44:50 +00:00
Andrew Burgess 1ae8ab4714 arc/opcodes: Use flag operand class to handle multiple flag matches
When parsing the operand instruction flags we don't currently detect the
case where multiple flags are provided from the same class set, these
will be accepted and the bit values merged together, resulting in the
wrong instruction being assembled.  For example:

    adc.n.eq r0,r0,r2

Will assemble without error, yet, upon disassembly, the instruction will
actually be:

    adc.c r0,r0,r2

In a later commit the concept of required flags will be introduced.
Required flags are just like normal instruction flags, except that they
must be present for the instruction to match.  Adding this will allow
for simpler instructions in the instruction table, and allow for more
sharing of operand extraction and insertion functions.

To solve both of the above issues (multiple flags being invalid, and
required flags), this commit reworks the flag class mechanism.
Currently the flag class is never used.  Each instruction can reference
multiple flag classes, each flag class has a class type and a set of
flags.  However, at present, the class type is never used.  The current
values identify the type of instruction that the flag will be used in,
but this is not required information.

Instead, this commit discards the old flag classes, and introduces 3 new
classes.  The first F_CLASS_NONE, is just a NULL marker value, and is
only used in the NULL marker flag class.  The other two flag classes are
F_FLAG_OPTIONAL, and F_FLAG_REQUIRED.

The class F_FLAG_OPTIONAL has the property that at most one of the flags
in the flag set for that class must be present in the instruction.  The
"at most" one means that no flags being present is fine.

The class F_FLAG_REQUIRED is not currently used, but will be soon.  With
this class, exactly one of the flags from this class must be present in
the instruction.  If the flag class contains a single flag, then of
course that flag must be present.  However, if the flag class contained
two or more, then one, and only one of them must be present.

gas/ChangeLog:

	* config/tc-arc.c (find_opcode_match): Move lnflg, and i
	declarations to start of block.  Reset code on all flags before
	attempting to match them.  Handle multiple hits on the same flag.
	Handle flag class.
	* testsuite/gas/arc/asm-errors.d: New file.
	* testsuite/gas/arc/asm-errors.err: New file.
	* testsuite/gas/arc/asm-errors.s: New file.

include/ChangeLog:

	* opcode/arc.h (flag_class_t): Remove all old flag classes, add 3
	new classes instead.

opcodes/ChangeLog:

	* arc-opc.c (arc_flag_classes): Convert all flag classes to use
	the new class enum values.
2016-03-21 16:44:50 +00:00
Andrew Burgess 8699fc3e88 arc: Add nps400 machine type, and assembler flag.
This commit introduces the nps400 machine type as a variant of arc.
There's a new flag in the assembler to select this machine type.  All
other changes are just adding handling of the new machine type into the
relevant places.

The nps400 is an arc700 variant with some vendor specific instructions
added into the instruction set.  This commit does not add any of the new
instructions, this is just laying the groundwork for future commits.
However, in preparation for these new instructions a new opcode define for
nps400 has been added to include/opcode/arc.h, this new opcode define is
used in the assembler and disassembler along with the existing define
for arc700 such that when assembling and disassembling for nps400 the
user will have access to all arc700 instructions and all the nps400
vendor extension instructions.

bfd/ChangeLog:

	* archures.c (bfd_mach_arc_nps400): Define.
	* bfd-in2.h: Regenerate.
	* cpu-arc.c (arch_info_struct): New entry for nps400, renumber
	some existing entries to make space.
	* elf32-arc.c (arc_elf_object_p): Add nps400 case.
	(arc_elf_final_write_processing): Likewise.

binutils/ChangeLog:

	* readelf.c (decode_ARC_machine_flags): Handle nps400.

gas/ChangeLog:

	* config/tc-arc.c (cpu_types): Add nps400 entry.
	(check_zol): Handle nps400.

include/ChangeLog:

	* elf/arc.h (E_ARC_MACH_NPS400): Define.
	* opcode/arc.h (ARC_OPCODE_NPS400): Define.

opcodes/ChangeLog:

	* arc-dis.c (print_insn_arc): Handle nps400.
2016-03-21 16:44:49 +00:00
Andrew Burgess a9522a2168 arc: Remove EF_ARC_CPU_GENERIC constant.
The constant EF_ARC_CPU_GENERIC is defined in the include/elf/arc.h
file, and is used in a few places in binutils, however, this constant
should never make it into the elf header flags; we always set a valid
cpu type in the assembler, which should then be copied over during
linking.

There are some non-gnu arc compilers that don't write an architecture
type into the e_flags field, instead leaving the field as 0, which is
the EF_ARC_CPU_GENERIC value.  This non-gnu compiler uses the machine
type to distinguish between the old and newer arc architectures, setting
the machine type to EM_ARC_COMPACT for old arc600, arc601, and arc700
architectures, while using EM_ARC_COMPACT2 for newer arcem and archs
architectures.

Previously when displaying the machine flags for an older EM_ARC_COMPACT
machine, if the e_flags had not been filled in, then we relied on the
default case statement to display the message "Generic ARCompact", while
in the EM_ARC_COMPACT2 case we specifically handled EF_ARC_CPU_GENERIC
to print "ARC Generic", leaving the default case to print a message
about unrecognised cpu flag.

After this commit EF_ARC_CPU_GENERIC has been removed, for both machine
types EM_ARC_COMPACT and EM_ARC_COMPACT2 we now rely on the default case
statement to handle the situation where the e_flags has not been filled
in.  The message displayed is now "Unknown ARCompact" (for older arc
architectures) and "Unknown ARC" (for the newer architectures).  The
switch from "Generic" to "Unknown" in the message string is for clarity,
calling the file "Generic" can give the impression that the file is
compiled for a common sub-set of the architectures, and would therefore
run on any type of machine (or at least any type of new or old machine
depending on if the machine type is ARC or ARCv2).  However, this was
not what "Generic" meant, it really meant "Unknown", so that's what we
now say.

As part of the merging of the readelf flag reading code, I have unified
the strings used in displaying the ELF ABI.  This means that for older
arc machines (arc600, arc601, and arc700) the string used for the
original ABI, and ABIv2 have changed, the current ABIv3 remains the
same.  For the newer architectures (arcem and archs) the abi strings
remain unchanged in all cases.

bfd/ChangeLog:

	* elf32-arc.c (arc_elf_print_private_bfd_data): Remove use of
	EF_ARC_CPU_GENERIC.
	(arc_elf_final_write_processing): Don't bother setting cpu field
	in e_flags, this will have been set elsewhere.

binutils/ChangeLog:

	* readelf.c (get_machine_flags): Move arc processing into...
	(decode_ARC_machine_flags): ... new function.  Remove use of
	EF_ARC_CPU_GENERIC, change default case from "generic arc" to
	"unknown arc".  Merged ABI printing between two machine types.

gas/ChangeLog:

	* config/tc-arc.c (arc_select_cpu): Remove use of
	EF_ARC_CPU_GENERIC.

include/ChangeLog:

	* elf/arc.h (EF_ARC_CPU_GENERIC): Delete.  Update related comment.
2016-03-21 16:44:49 +00:00
Andrew Burgess 24740d83e4 arc/gas: default mach is arc700, initialised in md_begin
This commit restructures the selection of the default cpu/mach so that
the choice is made from md_begin (if the user has not provided a command
line choice).  This will reduce the amount of change needed in a later
patch.

At the request of Synopsys, the default architecture changes to ARC700
from this commit, previously the default was a non-existent
super-architecture that contained all instructions from all arc
variants.  There's some clean up associated with removing the default
merged architecture, and a small test fix now that the default is
ARC700.

binutils/ChangeLog:

	* testsuite/binutils-all/objdump.exp (cpus_expected): Add ARC700
	to the architecture list.

gas/ChangeLog:

	* config/tc-arc.c (arc_target): Delay initialisation until
	arc_select_cpu.
	(arc_target_name): Likewise.
	(arc_features): Likewise.
	(arc_mach_type): Likewise.
	(cpu_types): Remove "all" entry.
	(arc_select_cpu): New function, most of the content is from...
	(md_parse_option): ... here.  Call new arc_select_cpu.
	(md_begin): Call arc_select_cpu if needed, default is now arc700.

include/ChangeLog:

	* opcode/arc.h (ARC_OPCODE_BASE): Delete.

opcodes/ChangeLog:

	* arc-opc.c (BASE): Delete.
2016-03-21 16:44:49 +00:00