Commit Graph

8135 Commits

Author SHA1 Message Date
Nick Clifton 792f174f8a Fix detection of illegal AArch64 opcodes that resemble LD1R, LD2R, LD3R and LD4R.
PR binutils/21380
opcodes	* aarch64-tbl.h (aarch64_opcode_table): Fix masks for LD1R, LD2R,
	LD3R and LD4R.

gas	* testsuite/gas/aarch64/illegal-3.s: New file.
	* testsuite/gas/aarch64/illegal-3.d: New file.
2017-04-21 12:18:06 +01:00
Alan Modra ef85eab0ec Bye bye PPC_OPCODE_HTM and -mhtm
The -mhtm option is fairly useless too.

include/
	* opcode/ppc.h (PPC_OPCODE_HTM): Delete.
gas/
	* config/tc-ppc.c (md_show_usage): Delete mention of -mhtm.
	* testsuite/gas/ppc/htm.d: Pass -mpower8 and -Mpower8.
opcodes/
	* ppc-dis.c (ppc_opts): Remove PPC_OPCODE_HTM and "htm".
	* ppc-opc.c (PPCHTM): Define as PPC_OPCODE_POWER8.
2017-04-11 07:40:24 +09:30
Max Filippov 947fa91414 gas: xtensa: fix incorrect code generated with auto litpools
* config/tc-xtensa.c (xtensa_maybe_create_literal_pool_frag):
	Initialize lps->frag_count with auto_litpool_limit.
	(xg_promote_candidate_litpool): New function.
	(xtensa_move_literals): Extract candidate litpool promotion code
	into separate function. Call it for all possible found
	candidates.
	(xtensa_switch_to_literal_fragment): Drop 'recursive' flag and
	call to xtensa_mark_literal_pool_location that it guards.
	Replace it with call to xtensa_maybe_create_literal_pool_frag.
	Initialize pool_location with created literal pool candidate.
	* testsuite/gas/xtensa/all.exp: Add new tests.
	* testsuite/gas/xtensa/auto-litpools-first1.d: New test results.
	* testsuite/gas/xtensa/auto-litpools-first1.s: New test.
	* testsuite/gas/xtensa/auto-litpools-first2.d: New test results.
	* testsuite/gas/xtensa/auto-litpools-first2.s: New test.
	* testsuite/gas/xtensa/auto-litpools.d: Fix offsets changed due
	to additional jump instruction.
2017-04-10 13:12:52 +01:00
Alan Modra ac8f0f721b Remove E6500 insns from PPC_OPCODE_ALTIVEC2
This isn't losing anything from the testsuite.  All of these insns
appear in testsuite/gas/ppc/e6500.s

opcodes/
	* ppc-opc.c (powerpc_opcodes <mviwsplt, mvidsplt, lvexbx, lvepxl,
	lvexhx, lvepx, lvexwx, stvexbx, stvexhx, stvexwx, lvtrx, lvtlx,
	lvswx, stvfrx, stvflx, stvswx, lvsm, stvepxl, lvtrxl, stvepx,
	lvtlxl, lvswxl, stvfrxl, stvflxl, stvswxl>): Enable E6500 only
	vector instructions with E6500 not PPCVEC2.
gas/
	* testsuite/gas/ppc/altivec2.s: Delete E6500 vector insns.
	* testsuite/gas/ppc/altivec2.d: Adjust to suit.
2017-04-07 18:24:38 +09:30
Alan Modra 498e34425b MBIND gas test tweak
score-elf aligns text sections.

	* testsuite/gas/elf/section12a.d: Don't expect alignment of 1
	for .mbind.text.
2017-04-07 18:24:38 +09:30
Pip Cet 62ecb94c4a Add support for disassembling WebAssembly opcodes.
include	* dis-asm.h: Add prototypes for wasm32 disassembler.

opcodes	* Makefile.am: Add wasm32-dis.c.
	* configure.ac: Add wasm32-dis.c to wasm32 target.
	* disassemble.c: Add wasm32 disassembler code.
	* wasm32-dis.c: New file.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/POTFILES.in: Regenerate.
	* po/opcodes.pot: Regenerate.

gas	* testsuite/gas/wasm32/allinsn.d: Adjust test for disassembler
	changes.
	* testsuite/gas/wasm32/disass.d: New test.
	* testsuite/gas/wasm32/disass.s: New test.
	* testsuite/gas/wasm32/disass-2.d: New test.
	* testsuite/gas/wasm32/disass-2.s: New test.
	* testsuite/gas/wasm32/reloc.d: Adjust test for changed reloc
	names.
	* testsuite/gas/wasm32/reloc.s: Update test for changed assembler
	syntax.
	* testsuite/gas/wasm32/wasm32.exp: Run new tests.  Expect allinsn
	test to succeed.
2017-04-06 17:20:02 +01:00
H.J. Lu a91e1603af Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND.  Its sh_info field indicates the special memory
type.  GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker.  All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section.  In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value.  Each GNU_MBIND segment is
aligned at page boundary.

The assembler syntax:

    .section .mbind.foo,"adx",%progbits
                          ^             0: Special memory type.
                          |
                         'd' for SHF_GNU_MBIND.

    .section .mbind.foo,"adx",%progbits,0x1
                          ^             1: Special memory type.
                          |
                         'd' for SHF_GNU_MBIND.

    .section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
                          ^                               2: Special memory type.
                          |
                         'd' for SHF_GNU_MBIND.

bfd/

	* elf.c (get_program_header_size): Add a GNU_MBIND segment for
	each GNU_MBIND section and align GNU_MBIND section to page size.
	(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
	segment for each GNU_MBIND section.
	(_bfd_elf_init_private_section_data): Copy sh_info from input
	for GNU_MBIND section.

binutils/

	* NEWS: Mention support for ELF SHF_GNU_MBIND and
	PT_GNU_MBIND_XXX.
	* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
	(get_elf_section_flags): Handle SHF_GNU_MBIND.
	(process_section_headers): Likewise.
	* testsuite/binutils-all/mbind1.s: New file.
	* testsuite/binutils-all/objcopy.exp: Run readelf test on
	mbind1.s.

gas/

	* NEWS: Mention support for ELF SHF_GNU_MBIND.
	* config/obj-elf.c (section_match): New.
	(get_section): Match both sh_info and group name.
	(obj_elf_change_section): Add argument for sh_info.  Pass both
	sh_info and group name to get_section. Issue an error for
	SHF_GNU_MBIND section without SHF_ALLOC.  Set sh_info.
	(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
	(obj_elf_section): Support SHF_GNU_MBIND section info.
	* config/obj-elf.h (obj_elf_change_section): Add argument for
	sh_info.
	* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
	obj_elf_change_section.
	* config/tc-ia64.c (obj_elf_vms_common): Likewise.
	* config/tc-microblaze.c (microblaze_s_data): Likewise.
	(microblaze_s_sdata): Likewise.
	(microblaze_s_rdata): Likewise.
	(microblaze_s_bss): Likewise.
	* config/tc-mips.c (s_change_section): Likewise.
	* config/tc-msp430.c (msp430_profiler): Likewise.
	* config/tc-rx.c (parse_rx_section): Likewise.
	* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
	* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
	* testsuite/gas/elf/elf.exp: Run section12a, section12b and
	section13.
	* testsuite/gas/elf/section10.d: Updated.
	* testsuite/gas/elf/section10.s: Likewise.
	* testsuite/gas/elf/section12.s: New file.
	* testsuite/gas/elf/section12a.d: Likewise.
	* testsuite/gas/elf/section12b.d: Likewise.
	* testsuite/gas/elf/section13.l: Likewise.
	* testsuite/gas/elf/section13.d: Likewise.
	* testsuite/gas/elf/section13.s: Likewise.

include/

	* elf/common.h (PT_GNU_MBIND_NUM): New.
	(PT_GNU_MBIND_LO): Likewise.
	(PT_GNU_MBIND_HI): Likewise.
	(SHF_GNU_MBIND): Likewise.

ld/

	* NEWS: Mention support for ELF SHF_GNU_MBIND and
	PT_GNU_MBIND_XXX.
	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
	input GNU_MBIND sections with the same type, attributes and
	sh_info field into a single output GNU_MBIND section.
	* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
	* testsuite/ld-elf/mbind1.s: New file.
	* testsuite/ld-elf/mbind1a.d: Likewise.
	* testsuite/ld-elf/mbind1b.d: Likewise.
	* testsuite/ld-elf/mbind1c.d: Likewise.
	* testsuite/ld-elf/mbind2a.s: Likewise.
	* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-04 09:06:04 -07:00
Palmer Dabbelt c41cf6fdf5 RISC-V: Avoid a const warning
2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>

       * config/tc-riscv.c (riscv_clear_subsets): Cast argument to free to
       avoid const warnings.
2017-04-03 09:14:50 -07:00
Andrew Jenner 2f5f29cada IA16 support
* config.sub: Handle ia16 in $basic_machine.

       bfd/
       * config.bfd: Handle ia16.

       gas/
       * configure.tgt: Handle ia16.

       ld/
       * configure.tgt: Handle ia16.
2017-04-03 09:13:19 -07:00
Palmer Dabbelt fecb9c4665 RISC-V: Allow ISA subsets to be disabled
Without this patch, passing "-march=rv64ic -march=rv64i" results in
you getting a "RV64IC" toolchain, which isn't expected.

gas/ChangeLog:

2017-03-30  Palmer Dabbelt  <palmer@dabbelt.com>

       * config/tc-riscv.c (riscv_clear_subsets): New function.
       (riscv_add_subset): Call riscv_clear_subsets and riscv_set_rvc to
       clear RVC when it's been previously set.
2017-03-31 09:35:21 -07:00
Nick Clifton dc1e4d6ded Reduce the size of s390 symbol tables by allowing relocations in mergeable string sections (eg .debug_str) to be made section relative rather than symbol relative.
PR gas/21333
	* config/tc-s390.c (tc_s390_fix_adjustable): Allow non pc-relative
	fixups in mergeable sections to be adjusted.
2017-03-31 12:54:38 +01:00
Pip Cet f96bd6c2d7 Add support for the WebAssembly file format and the wasm32 ELF conversion to gas and the binutils.
binutils * readelf.c: Add support for wasm32 ELF format WebAssembly files.
	(guess_is_rela): Likewise.
	(dump_relocations): Likewise.
	(is_32bit_abs_reloc): Likewise.
	(is_none_reloc_): Likewise.
	* NEWS: Mention the new support.
	* testsuite/lib/binutils-common.exp (is_elf_format): Mark wasm32
	as ELF target.
	(supports_gnu_unique): Mark wasm32 as supporting STB_GNU_UNIQUE.
	* testsuite/binutils-all/nm.exp: Mark wasm32 as requiring .size annotations.
	* testsuite/binutils-all/wasm32: New directory.
	* testsuite/binutils-all/wasm32/create-wasm.d: New file.
	* testsuite/binutils-all/wasm32/create-wasm.s: Likewise.
	* testsuite/binutils-all/wasm32/custom-section.d: Likewise.
	* testsuite/binutils-all/wasm32/custom-section.s: Likewise.
	* testsuite/binutils-all/wasm32/invalid-wasm-1.d: Likewise.
	* testsuite/binutils-all/wasm32/invalid-wasm-1.s: Likewise.
	* testsuite/binutils-all/wasm32/long-sections.d: Likewise.
	* testsuite/binutils-all/wasm32/long-sections.s: Likewise.
	* testsuite/binutils-all/wasm32/parse-wasm.d: Likewise.
	* testsuite/binutils-all/wasm32/parse-wasm.s: Likewise.
	* testsuite/binutils-all/wasm32/parse-wasm-2.d: Likewise.
	* testsuite/binutils-all/wasm32/parse-wasm-2.s: Likewise.
	* testsuite/binutils-all/wasm32/prepared-section.d: Likewise.
	* testsuite/binutils-all/wasm32/prepared-section.s: Likewise.
	* testsuite/binutils-all/wasm32/wasm32.exp: New file, run tests.

gas	* config/tc-wasm32.h: New file: Add WebAssembly assembler target.
	* config/tc-wasm32.c: New file: Add WebAssembly assembler target.
	* Makefile.am: Add WebAssembly assembler target.
	* configure.tgt: Add WebAssembly assembler target.
	* doc/c-wasm32.texi: New file: Start documenting WebAssembly
	assembler.
	* doc/all.texi: Define WASM32.
	* doc/as.texinfo: Add WebAssembly entries.
	* NEWS: Mention the new support.
	* Makefile.in: Regenerate.
	* po/gas.pot: Regenerate.
	* po/POTFILES.in: Regenerate.
	* testsuite/gas/wasm32: New directory.
	* testsuite/gas/wasm32/allinsn.d: New file.
	* testsuite/gas/wasm32/allinsn.s: New file.
	* testsuite/gas/wasm32/illegal.l: New file.
	* testsuite/gas/wasm32/illegal.s: New file.
	* testsuite/gas/wasm32/illegal-2.l: New file.
	* testsuite/gas/wasm32/illegal-2.s: New file.
	* testsuite/gas/wasm32/illegal-3.l: New file.
	* testsuite/gas/wasm32/illegal-3.s: New file.
	* testsuite/gas/wasm32/illegal-4.l: New file.
	* testsuite/gas/wasm32/illegal-4.s: New file.
	* testsuite/gas/wasm32/illegal-5.l: New file.
	* testsuite/gas/wasm32/illegal-5.s: New file.
	* testsuite/gas/wasm32/illegal-6.l: New file.
	* testsuite/gas/wasm32/illegal-6.s: New file.
	* testsuite/gas/wasm32/illegal-7.l: New file.
	* testsuite/gas/wasm32/illegal-7.s: New file.
	* testsuite/gas/wasm32/illegal-8.l: New file.
	* testsuite/gas/wasm32/illegal-8.s: New file.
	* testsuite/gas/wasm32/illegal-9.l: New file.
	* testsuite/gas/wasm32/illegal-9.s: New file.
	* testsuite/gas/wasm32/illegal-10.l: New file.
	* testsuite/gas/wasm32/illegal-10.s: New file.
	* testsuite/gas/wasm32/illegal-11.l: New file.
	* testsuite/gas/wasm32/illegal-11.s: New file.
	* testsuite/gas/wasm32/illegal-12.l: New file.
	* testsuite/gas/wasm32/illegal-12.s: New file.
	* testsuite/gas/wasm32/illegal-13.l: New file.
	* testsuite/gas/wasm32/illegal-13.s: New file.
	* testsuite/gas/wasm32/illegal-14.l: New file.
	* testsuite/gas/wasm32/illegal-14.s: New file.
	* testsuite/gas/wasm32/illegal-15.l: New file.
	* testsuite/gas/wasm32/illegal-15.s: New file.
	* testsuite/gas/wasm32/illegal-16.l: New file.
	* testsuite/gas/wasm32/illegal-16.s: New file.
	* testsuite/gas/wasm32/illegal-17.l: New file.
	* testsuite/gas/wasm32/illegal-17.s: New file.
	* testsuite/gas/wasm32/illegal-18.l: New file.
	* testsuite/gas/wasm32/illegal-18.s: New file.
	* testsuite/gas/wasm32/illegal-19.l: New file.
	* testsuite/gas/wasm32/illegal-19.s: New file.
	* testsuite/gas/wasm32/illegal-20.l: New file.
	* testsuite/gas/wasm32/illegal-20.s: New file.
	* testsuite/gas/wasm32/illegal-21.l: New file.
	* testsuite/gas/wasm32/illegal-21.s: New file.
	* testsuite/gas/wasm32/illegal-22.l: New file.
	* testsuite/gas/wasm32/illegal-22.s: New file.
	* testsuite/gas/wasm32/illegal-24.l: New file.
	* testsuite/gas/wasm32/illegal-24.s: New file.
	* testsuite/gas/wasm32/illegal-25.l: New file.
	* testsuite/gas/wasm32/illegal-25.s: New file.
	* testsuite/gas/wasm32/reloc.d: New file.
	* testsuite/gas/wasm32/reloc.s: New file.
	* testsuite/gas/wasm32/wasm32.exp: New tests for WebAssembly
	architecture.

opcodes * configure.ac: Add (empty) bfd_wasm32_arch target.
	* configure: Regenerate
	* po/opcodes.pot: Regenerate.

include	* opcode/wasm.h: New file to support wasm32 architecture.
	* elf/wasm32.h: Add R_WASM32_32 relocation.

bfd	* elf32-wasm32.c: Add relocation code, two relocs.
	* reloc.c: Add wasm32 relocations.
	* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.
	* bfd/po/bfd.pot: Regenerate.
2017-03-30 10:57:21 +01:00
Alan Modra 52be03fd13 PowerPC -Mraw disassembly
This adds -Mraw for PowerPC objdump, a disassembler option to display
the underlying machine instruction rather than aliases.  For example,
"rlwinm" always rather than "rotlwi" when the instruction is
performing a simple rotate.

binutils/
	* doc/binutils.texi (objdump): Document PowerPC -M options.
gas/
	* config/tc-ppc.c (md_parse_option): Reject -mraw.
include/
	* opcode/ppc.h (PPC_OPCODE_RAW): Define.
	(PPC_OPCODE_*): Make them all unsigned long long constants.
opcodes/
	* ppc-dis.c (ppc_opts): Set PPC_OPCODE_PPC for "any" flags.  Add
	"raw" option.
	(lookup_powerpc): Don't special case -1 dialect.  Handle
	PPC_OPCODE_RAW.
	(print_insn_powerpc): Mask out PPC_OPCODE_ANY on first
	lookup_powerpc call, pass it on second.
2017-03-29 22:55:18 +10:30
Alan Modra 9b75393746 PR21303, objdump doesn't show e200z4 insns
PR 21303
opcodes/
	* ppc-dis.c (struct ppc_mopt): Comment.
	(ppc_opts <e200z4>): Move PPC_OPCODE_VLE from .sticky to .cpu.
gas/
	* testsuite/gas/ppc/pr21303.d,
	* testsuite/gas/ppc/pr21303.s: New test
	* testsuite/gas/ppc/ppc.exp: Run it.
2017-03-27 21:49:32 +10:30
Rinat Zelig c0c31e91ad Implement ARC NPS-400 Ultra Ip and Miscellaneous instructions.
opcodes	* arc-nps400-tbl.h: Add Ultra Ip and Miscellaneous instructions format.
	* arc-opc.c: Add defines. e.g. F_NJ, F_NM , F_NO_T, F_NPS_SR, F_NPS_M, F_NPS_CORE, F_NPS_ALL.
	(insert_nps_misc_imm_offset): New function.
	(extract_nps_misc imm_offset): New function.
	(arc_num_flag_operands): Add F_NJ, F_NM, F_NO_T.
	(arc_flag_special_cases): Add F_NJ, F_NM, F_NO_T.

include * opcode/arc.h (insn_class_t): Add ULTRAIP and MISC class.

gas     * testsuite/gas/arc/nps400-12.s: New file.
        * testsuite/gas/arc/nps400-12.d: New file.
2017-03-27 11:14:30 +01:00
Thomas Preud'homme 62785b0998 [GAS/ARM] Fix selected_cpu with default CPU and -mcpu
When GAS is compiled with DEFAULT_CPU set and then run with a -mcpu or
-march option, selected_cpu will be set to the default CPU. This means
the -mcpu is ignored which is surprising behavior. This commit instead
sets selected_cpu from the value passed to -mcpu/-march.

2017-03-24  Thomas preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.: (md_begin): Set selected_cpu from *mcpu_cpu_opt when
	CPU_DEFAULT is defined.
2017-03-24 13:23:36 +00:00
Palmer Dabbelt 19683c0408 Sanitize RISC-V GAS help text, documentation
It looks like I missed the GAS help text when going through all the
documentation last time, so it printed some of the old-format (never
upstream) arguments.  I fixed this, and when I went to check doc/ I
noticed it was missing the '-fpic'/'-fno-pic' options.
2017-03-22 15:46:52 -07:00
Max Filippov 24e5b4e682 gas: xtensa: make trampolines relaxation work with jumps in slots other than 0
add_jump_to_trampoline assumes that jump instruction is in slot 0,
when it's in other slot that results in fixup that references NULL symbol,
which results in segfault later in xtensa_make_cached_fixup.
Search for the non-NULL symbol in the tc_frag_data.slot_symbols and check
that there's exactly one such slot.

xtensa_relax_frag for RELAX_TRAMPOLINE reassigns fixup from the original
instruction with jump to generated jump in the trampoline frag, but does not
fix its fx_r_type or fx_size. That results in "undecodable fix" or
"fixup not contained within frag" error messages during relaxation.
Fix both these fields.

gas/
2017-03-22  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (xtensa_relax_frag): Change fx_size of the
	reassigned fixup to size of jump instruction (3) and fx_r_type
	to BFD_RELOC_XTENSA_SLOT0_OP, as there's only one slot.
	(add_jump_to_trampoline): Search
	origfrag->tc_frag_data.slot_symbols for the slot with non-NULL
	symbol and use that slot instead of slot 0.
2017-03-22 10:35:18 -07:00
Andreas Krebbel 2253c8f089 S/390: Remove vx2 facility flag
This patch removes the vx2 facility flag.  It will not be used by GCC
and was a misnomer anyway.

Committed to mainline and 2.28 branch.

include/ChangeLog:

2017-03-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* opcode/s390.h (S390_INSTR_FLAG_VX2): Remove.
	(S390_INSTR_FLAG_FACILITY_MASK): Adjust value.

gas/ChangeLog:

2017-03-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config/tc-s390.c (s390_parse_cpu): Remove S390_INSTR_FLAG_VX2
	from cpu_table.  Remove vx2, and novx2 from cpu_flags.

opcodes/ChangeLog:

2017-03-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* s390-mkopc.c (main): Remove vx2 check.
	* s390-opc.txt: Remove vx2 instruction flags.
2017-03-21 14:21:02 +01:00
Rinat Zelig 645d3342ba arc/nps400: Add cp16/cp32 instructions to opcodes library
Instructions for loading or storing 16/32B data from one address type to
another.

gas/ChangeLog

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

include/ChangeLog

	* opcode/arc.h (insn_class_t): Add DMA class.

opcodes/ChangeLog

	* arc-nps400-tbl.h: Add cp32/cp16 instructions format.
	* arc-opc.c: Add F_NPS_NA, NPS_DMA_IMM_ENTRY, NPS_DMA_IMM_OFFSET.
	(insert_nps_imm_offset): New function.
	(extract_nps_imm_offset): New function.
	(insert_nps_imm_entry): New function.
	(extract_nps_imm_entry): New function.
2017-03-21 11:51:49 +00:00
Nick Clifton e406e428df Update descriptions of the .2byte, .4byte and .8byte directives.
* doc/as.texinfo (2byte): Note that if no expressions are present
	the directive does nothing.  Emphasize that the output is
	unaligned, and that this can have an effect on the relocations
	generated.
	(4byte): Simplify description.  Refer back to the 2byte
	description.
	(8byte): Likewise.
2017-03-20 16:57:07 +00:00
Richard Earnshaw d5e0ba9cdb [arm] Document missing -mfpu entries.
Nick pointed out that I hadn't documented the new -mfpu option
neon-vfpv3 and mentioned that some others were missing.

Having looked through the list only one (neon-fp16) really should be
documented; the other two entries in the real table should not be
documented as they are aliases kept for legacy compatibility reasons.
This patch adds the missing entries and notes in the main table that
the other two entries should not be documented.

I've also fixed a small spelling error in the accompanying text.

	* config/tc-arm.c (arm_fpus): Note entires that should not be
	documented.
	* doc/c-arm.texi (-mfpu): Add missing FPU entries for neon-vfpv3 and
	neon-fp16.  Fix spelling error.
2017-03-20 14:56:22 +00:00
Richard Earnshaw d3375ddde4 [arm] Add neon-vfp3 as an alias for neon to -mfpu.
GCC recently added neon-vfpv3 as an alias for neon in -mfpu.  This patch adds a similar alias in GAS.

* config/tc-arm.c (arm_fpus): Add neon-vfpv3 as an alias for neon.
2017-03-20 10:03:15 +00:00
Rinat Zelig 2c52e2e8c9 gas/arc: Limit special handling of t/nt flag to ARCv2
In a later commit I'll be adding a new version of the ".nt" flag for an
ARC700 extension (NPS400) which does not require this same special
handling.

In this commit I have restricted the special flag handling to only apply
if we are assembling for ARCv2.  This is a restructuring commit, and
there should be no user visible changes after this commit.

gas/ChangeLog:

	* config/tc-arc.c (assemble_insn): Only handle ".t" and ".nt"
	specially for ARCv2.
2017-03-16 10:07:22 +00:00
Kito Cheng b416fe873e RISC-V: Fix assembler for c.li, c.andi and c.addiw
- They can accept 0 in imm field

 2017-03-14  Kito Cheng  <kito.cheng@gmail.com>

       * riscv-opc.c (riscv_opcodes> <c.li>: Use the 'o' immediate encoding.
       <c.andi>: Likewise.
       <c.addiw> Likewise.
2017-03-15 07:47:52 -07:00
Nick Clifton 7cb7b948ce Fix building riscv targets with gcc v6.3.1
* config/tc-riscv.c (riscv_pre_output_hook): Fix compile time
	warning about discarding a const qualifier.
2017-03-15 09:19:42 +00:00
Kuan-Lin Chen d47c3ff7d5 RISC-V: Define DWARF2_USE_FIXED_ADVANCE_PC.
gas/ChangeLog

2017-03-02  Kuan-Lin Chen  <rufus@andestech.com>

        * config/tc-riscv.h (HWARD2_USE_FIXED_ADVANCE_PC): New define.
2017-03-14 09:51:29 -07:00
Kuan-Lin Chen 2aece2ba02 RISC-V: Fix DW_CFA_advance_loc relocation.
gas/ChangeLog:

2017-03-02  Kuan-Lin Chen  <rufus@andestech.com>

        * config/tc-riscv.c (md_apply_fix): Set fx_frag and
        fx_next->fx_frag for CFA_advance_loc relocations.
2017-03-14 09:51:29 -07:00
Kuan-Lin Chen c1b465c94e RISC-V: Fix the offset of CFA relocation.
gas/ChangeLog:

2017-03-02  Kuan-Lin Chen  <rufus@andestech.com>

        * config/tc-riscv.c (md_apply_fix): Compute the correct offsets
        for CFA relocations.
2017-03-14 09:51:29 -07:00
Nick Clifton f955cccff3 Rename R_AARCH64_TLSDESC_LD64_LO12_NC to R_AARCH64_TLSDESC_LD64_LO12 and R_AARCH64_TLSDESC_ADD_LO12_NC to R_AARCH64_TLSDESC_ADD_LO12.
PR binutils/21202
include	* elf/aarch64.h (R_AARCH64_TLSDESC_LD64_LO12_NC): Rename to
	R_AARCH64_TLSDESC_LD64_LO12.
	(R_AARCH64_TLSDESC_ADD_LO12_NC): Rename to
	R_AARCH64_TLSDESC_ADD_LO12_NC.

bfd	* reloc.c (BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC): Rename to
	BFD_RELOC_AARCH64_TLSDESC_LD64_LO12.
	(BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC): Rename to
	BFD_RELOC_AARCH64_TLSDESC_ADD_LO12.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Update reloc
	names.
	(IS_AARCH64_TLSDESC_RELOC): Likewise.
	(elfNN_aarch64_howto_table): Likewise.
	(aarch64_tls_transition_without_check): Likewise.
	(aarch64_reloc_got_type): Likewise.
	(elfNN_aarch64_final_link_relocate): Likewise.
	(elfNN_aarch64_tls_relax): Likewise.
	(elfNN_aarch64_relocate_section): Likewise.
	(elfNN_aarch64_gc_sweep_hook): Likewise.
	(elfNN_aarch64_check_relocs): Likewise.
	* elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
	(_bfd_aarch64_elf_resolve_relocation): Likewise.

gas	* config/tc-aarch64.c (reloc_table): Rename
	BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC to
	BFD_RELOC_AARCH64_TLSDESC_LD64_LO12.  Rname
	BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC to
	BFD_RELOC_AARCH64_TLSDESC_ADD_LO12.
	(md_apply_fix): Likewise.
	(aarch64_force_relocation): Likewise.
	* testsuite/gas/aarch64/tls.d: Update regexp.

ld	* testsuite/ld-aarch64/ifunc-5r-local.d: Update regexp.
2017-03-13 09:58:04 +00:00
Nick Clifton 8b1e5da10a Document that the .2byte and .4byte directives warn about overlarge values.
* doc/as.texinfo (2byte): Tidy up wording.  Add note that
	overlarge values will produce a warning message and be trunacted.
	(4byte): Likewise.
2017-03-10 15:42:04 +00:00
H.J. Lu 86fa6981e7 X86: Add pseudo prefixes to control encoding
Many x86 instructions have more than one encodings.  Assembler picks
the default one, usually the shortest one.  Although the ".s", ".d8"
and ".d32" suffixes can be used to swap register operands or specify
displacement size, they aren't very flexible.  This patch adds pseudo
prefixes, {xxx}, to control instruction encoding.  The available
pseudo prefixes are {disp8}, {disp32}, {load}, {store}, {vex2}, {vex3}
and {evex}.  Pseudo prefixes are preferred over the ".s", ".d8" and
".d32" suffixes, which are deprecated.

gas/

	* config/tc-i386.c (_i386_insn): Add dir_encoding and
	vec_encoding.  Remove swap_operand and need_vrex.
	(extra_symbol_chars): Add '}'.
	(md_begin): Mark '}' with LEX_BEGIN_NAME.  Allow '}' in
	mnemonic.
	(build_vex_prefix): Don't use 2-byte VEX encoding with
	{vex3}.  Check dir_encoding and load.
	(parse_insn): Check pseudo prefixes.  Set dir_encoding.
	(VEX_check_operands): Likewise.
	(match_template): Check dir_encoding and load.
	(parse_real_register): Set vec_encoding instead of need_vrex.
	(parse_register): Likewise.
	* doc/c-i386.texi: Document {disp8}, {disp32}, {load}, {store},
	{vex2}, {vex3} and {evex}.  Remove ".s", ".d8" and ".d32"
	* testsuite/gas/i386/i386.exp: Run pseudos and x86-64-pseudos.
	* testsuite/gas/i386/pseudos.d: New file.
	* testsuite/gas/i386/pseudos.s: Likewise.
	* testsuite/gas/i386/x86-64-pseudos.d: Likewise.
	* testsuite/gas/i386/x86-64-pseudos.s: Likewise.

opcodes/

	* i386-gen.c (opcode_modifiers): Replace S with Load.
	* i386-opc.h (S): Removed.
	(Load): New.
	(i386_opcode_modifier): Replace s with load.
	* i386-opc.tbl: Add {disp8}, {disp32}, {swap}, {vex2}, {vex3}
	and {evex}.  Replace S with Load.
	* i386-tbl.h: Regenerated.
2017-03-09 09:59:00 -08:00
Peter Bergner 4b8b687e88 Update -maltivec and -mvsx options to only enable their oldest instructions.
Currently, the -maltivec and -mvsx GAS options enable *all* of the altivec
and vsx instructions respecitively that have ever been added.  This is in
constract to GCC's -maltivec and -mvsx options, which only enable the oldest
(ie, first) set of altivec and vsx instructions.  This patch changes GAS to
mimic GCC's behaviour with respect to -maltivec and -mvsx and it solves a
problem with trying to assemble the lxvx instruction which is different
between POWER8 and POWER9.

opcodes/
	* ppc-dis.c (ppc_opts) <altivec>: Do not use PPC_OPCODE_ALTIVEC2;
	<vsx>: Do not use PPC_OPCODE_VSX3;

gas/
	* testsuite/gas/ppc/altivec2.d (as): Use the -mpower8 option.
	(objdump): Use the -Mpower8 option.
2017-03-08 20:49:03 -06:00
Peter Bergner 1437d0631b Add support for the new 'lnia' extended mnemonic.
opcodes/
	* ppc-opc.c (powerpc_opcodes) <lnia>: New extended mnemonic.

gas/
	* testsuite/gas/ppc/power9.d <lnia> New test.
	* testsuite/gas/ppc/power9.s: Likewise.
2017-03-08 14:02:18 -06:00
Alan Modra ea86f53442 Correct @section placement for makeinfo 4.13
* doc/as.texinfo (2byte, 4byte, 8byte): Correct @section placement.
2017-03-07 19:41:56 +10:30
Alan Modra 2b841ec206 Document .Nbyte assembler directives
* doc/as.texinfo (2byte, 4byte, 8byte): Document.
	* doc/c-arm.texi (2byte, 4byte, 8byte): Omit if ELF.
2017-03-07 17:00:57 +10:30
H.J. Lu 603555e563 Add support for Intel CET instructions
Support Intel Control-flow Enforcement Technology (CET) instructions:

https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf

gas/

	* config/tc-i386.c (cpu_arch): Add .cet.
	* doc/c-i386.texi: Document cet.
	* testsuite/gas/i386/cet-intel.d: New file.
	* testsuite/gas/i386/cet.d: Likewise.
	* testsuite/gas/i386/cet.s: Likewise.
	* testsuite/gas/i386/x86-64-cet-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-cet.d: Likewise.
	* testsuite/gas/i386/x86-64-cet.s: Likewise.
	* testsuite/gas/i386/i386.exp: Run Intel CET tests.

opcodes/

	* i386-dis.c (REG_0F1E_MOD_3): New enum.
	(MOD_0F1E_PREFIX_1): Likewise.
	(MOD_0F38F5_PREFIX_2): Likewise.
	(MOD_0F38F6_PREFIX_0): Likewise.
	(RM_0F1E_MOD_3_REG_7): Likewise.
	(PREFIX_MOD_0_0F01_REG_5): Likewise.
	(PREFIX_MOD_3_0F01_REG_5_RM_1): Likewise.
	(PREFIX_MOD_3_0F01_REG_5_RM_2): Likewise.
	(PREFIX_0F1E): Likewise.
	(PREFIX_MOD_0_0FAE_REG_5): Likewise.
	(PREFIX_0F38F5): Likewise.
	(dis386_twobyte): Use PREFIX_0F1E.
	(reg_table): Add REG_0F1E_MOD_3.
	(prefix_table): Add PREFIX_MOD_0_0F01_REG_5,
	PREFIX_MOD_3_0F01_REG_5_RM_1, PREFIX_MOD_3_0F01_REG_5_RM_2,
	PREFIX_0F1E, PREFIX_MOD_0_0FAE_REG_5 and PREFIX_0F38F5.  Update
	PREFIX_0FAE_REG_6 and PREFIX_0F38F6.
	(three_byte_table): Use PREFIX_0F38F5.
	(mod_table): Use PREFIX_MOD_0_0F01_REG_5, PREFIX_MOD_0_0FAE_REG_5.
	Add MOD_0F1E_PREFIX_1, MOD_0F38F5_PREFIX_2, MOD_0F38F6_PREFIX_0.
	(rm_table): Add MOD_0F38F5_PREFIX_2, MOD_0F38F6_PREFIX_0,
	RM_0F1E_MOD_3_REG_7.  Use PREFIX_MOD_3_0F01_REG_5_RM_1 and
	PREFIX_MOD_3_0F01_REG_5_RM_2.
	* i386-gen.c (cpu_flag_init): Add CPU_CET_FLAGS.
	(cpu_flags): Add CpuCET.
	* i386-opc.h (CpuCET): New enum.
	(CpuUnused): Commented out.
	(i386_cpu_flags): Add cpucet.
	* i386-opc.tbl: Add Intel CET instructions.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.
2017-03-06 15:26:37 -08:00
H.J. Lu 1cccfb31f5 Update x86-64-mpx-inval-2 test for COFF
Assembler displays upper case hex numbers and we need to force a good
alignment to avoid matching NOPs at the end.

	* testsuite/gas/i386/x86-64-mpx-inval-2.s: Force a good alignment.
	* testsuite/gas/i386/x86-64-mpx-inval-2.l: Expect [0-9A-F]+.
2017-03-06 15:00:52 -08:00
Alan Modra ea0de82ec2 dw2gencfi.c DWARF2_FDE_RELOC_SIZE
Add asserts that reloc size matches encoding size, and tidy.

	* dw2gencfi.c (encoding_size): Return unsigned int.
	(emit_expr_encoded): Assert size matches reloc bitsize.
	(output_fde): Use unsigned for offset_size and addr_size.  Set
	addr_size earlier and use in place of constant 4 and uses of
	DWARF2_FDE_RELOC_SIZE.  Assert it matches reloc bitsize.
2017-03-06 20:43:45 +10:30
Alan Modra 9e1a8675d4 gas/dw2gencfi.c formatting
* dw2gencfi.c: Wrap overlong lines.  Add parens for emacs
	auto reformat.  Formatting and whitespace fixes.
2017-03-06 20:36:59 +10:30
Mark Wielaard 49fced1206 gas: Emit name, comp_dir and producer strings in .debug_str.
Putting the name, comp_dir and producer strings in the .debug_str section
makes it possible to share them across CUs. This saves a small amount of
space (about ~20K on a glibc libc.so.6 build with debuginfo). And makes
it easier for tools like rpm debugedit to adjust the source paths when
generating separate debuginfo files.

gas/
       * dwarf2dbg.c (out_debug_abbrev): Use DW_FORM_strp instead of
       DW_FORM_string for DW_AT_name, DW_AT_comp_dir and DW_AT_producer.
       (out_debug_info): Accept symbols to name, comp_dir and producer
       in the .debug_str section and emit those offsets not full strings.
       (out_debug_str): New function that outputs the strings for name,
       comp_dir and producer in .debug_str and generates symbols to
       those strings.
       (out_debug_line): Create a .debug_str section if necessary and
       call out_debug_str before calling out_debug_info.
       * testsuite/gas/aarch64/dwarf.d: Add extra section symbol to
       expected output.
2017-03-05 23:37:54 +01:00
Maciej W. Rozycki 9875b36538 GAS: Fix bogus "attempt to move .org backwards" relaxation errors
Fix a commit 6afe8e98a6 ("internal error for backwards .org"),
<https://www.sourceware.org/ml/binutils/2008-06/msg00212.html>,
GAS regression that caused legitimate code to fail assembly with an
"attempt to move .org backwards" error.

For example with the `mips-linux' target we get:

$ cat org.s
	.set	mips16
	la	$2, foo
	.org	0x1000
	.align	2
foo:
	.half	0
$ as -o org.o org.s
org.s: Assembler messages:
org.s:3: Error: attempt to move .org backwards
$

where the location pointer is obviously not moved backwards with `.org'.

The cause is positive `stretch' in relaxation due to a PC-relative ADDIU
instruction (produced from the LA macro used) getting expanded from 2 to
4 bytes as `foo' is noticed to be out of range for the short encoding.
This in turn triggers logic in `relax_segment' which concludes in the
processing of an `rs_org' frag produced that the location pointer is
moved backwards while in fact only the amount to space forward to the
location requested has shrunk, resulting in a negative growth of the
frag.

Correct the bad logic then and instead verify that the fixed part of an
`rs_org' frag has not overrun the location requested, as per the comment
already included with the error message:

/* Growth may be negative, but variable part of frag
   cannot have fewer than 0 chars.  That is, we can't
   .org backwards.  */

which accurately describes the regression scenario.  Move the comment
ahead the conditional noted, for clarity.

Add generic and MIPS test cases for the `.org' pseudo-op, including the
test case discussed though not integrated with the offending commit in
particular, adjusted to work across all targets.

	gas/
	* write.c (relax_segment) <rs_org>: Only bail out if the fixed
	part of the frag has overrun the location requested.

	* testsuite/gas/all/org-1.d: New test.
	* testsuite/gas/all/org-2.d: New test.
	* testsuite/gas/all/org-3.d: New test.
	* testsuite/gas/all/org-4.d: New test.
	* testsuite/gas/all/org-5.d: New test.
	* testsuite/gas/all/org-6.d: New test.
	* testsuite/gas/all/org-1.l: New stderr output.
	* testsuite/gas/all/org-2.l: New stderr output.
	* testsuite/gas/all/org-3.l: New stderr output.
	* testsuite/gas/all/org-1.s: New test source.
	* testsuite/gas/all/org-2.s: New test source.
	* testsuite/gas/all/org-3.s: New test source.
	* testsuite/gas/all/org-4.s: New test source.
	* testsuite/gas/all/org-5.s: New test source.
	* testsuite/gas/all/org-6.s: New test source.
	* testsuite/gas/all/gas.exp: Run the new tests.

	* testsuite/gas/mips/org-1.d: New test.
	* testsuite/gas/mips/org-2.d: New test.
	* testsuite/gas/mips/org-3.d: New test.
	* testsuite/gas/mips/org-4.d: New test.
	* testsuite/gas/mips/org-5.d: New test.
	* testsuite/gas/mips/org-6.d: New test.
	* testsuite/gas/mips/org-7.d: New test.
	* testsuite/gas/mips/org-8.d: New test.
	* testsuite/gas/mips/org-9.d: New test.
	* testsuite/gas/mips/org-10.d: New test.
	* testsuite/gas/mips/org-11.d: New test.
	* testsuite/gas/mips/org-12.d: New test.
	* testsuite/gas/mips/org-1.l: New stderr output.
	* testsuite/gas/mips/org-4.l: New stderr output.
	* testsuite/gas/mips/org-5.l: New stderr output.
	* testsuite/gas/mips/org-6.l: New stderr output.
	* testsuite/gas/mips/org-10.l: New stderr output.
	* testsuite/gas/mips/org-1.s: New test source.
	* testsuite/gas/mips/org-2.s: New test source.
	* testsuite/gas/mips/org-3.s: New test source.
	* testsuite/gas/mips/org-4.s: New test source.
	* testsuite/gas/mips/org-5.s: New test source.
	* testsuite/gas/mips/org-6.s: New test source.
	* testsuite/gas/mips/org-7.s: New test source.
	* testsuite/gas/mips/org-8.s: New test source.
	* testsuite/gas/mips/org-9.s: New test source.
	* testsuite/gas/mips/org-10.s: New test source.
	* testsuite/gas/mips/org-11.s: New test source.
	* testsuite/gas/mips/org-12.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2017-03-02 01:44:07 +00:00
Szabolcs Nagy 01cca2f95e [AArch64] Document +rcpc weak release consistency extension
gas/
	* doc/c-aarch64.texi (AArch64 Extensions): Document rcpc.
2017-03-01 14:51:13 +00:00
Jan Beulich 15c7c1d8a5 x86: fix handling of 64-bit operand size VPCMPESTR{I,M}
Just like REX.W affects operand size of the implicit rAX/rDX inputs to
PCMPESTR{I,M}, VEX.W does for VPCMPESTR{I,M}. Allow Q or L suffixes on
the instructions.

Similarly the disassembler needs to be adjusted to no longer require
VEX.W to be zero for the instructions to be valid, and to emit proper
suffixes.

Note, however, that this doesn't address the problem of there being no
way to control (at least) {,E}VEX.W for 32- or 16-bit code. Nor does it
address the problem of the many WIG instructions not getting properly
disassembled when VEX.W=1.
2017-02-28 10:53:35 +01:00
Alan Modra 4ef97a1b45 Nios2 dynobj handling fixes
A number of places in elf32-nios.c created dynamic sections but didn't
set the hash table dynobj.  That meant we could have duplicate dynamic
sections connected to a number of bfds, so size_dynamic_sections
didn't properly discard or allocate contents.

Also, the entire set of dynamic sections was created in check_relocs
on seeing GOT relocs, when only .got related sections are needed,
probably done to hide segfaults later in finish_dynamic_sections.

The patch fixes these issues and makes the assembler emit errors when
nios2 lacks the necessary pc-relative relocs for subtraction
expressions, rather than silently generating bad code.
eg. ld-elf/merge.  I've also tidied uses of elf32_nios2_hash_table and
elf_hash_table.

bfd/
	PR 20995
	* elf32-nios2.c (nios2_elf32_relocate_section): Use htab
	rather than elf32_nios2_hash_table or elf_hash_table.
	(create_got_section): Likewise.
	(nios2_elf32_finish_dynamic_symbol): Likewise.
	(nios2_elf32_adjust_dynamic_symbol): Likewise.
	(nios2_elf32_size_dynamic_sections): Likewise.
	(nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot
	vars.  Use htab equivalents directly instead.  Don't create
	all dynamic sections on needing just the GOT.  Use a goto
	rather than a fall-through with reloc test.  Ensure
	htab->dynobj is set when making dynamic sreloc section.
	(nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab
	equivalent directly instead.  Don't segfault on looking for
	.dynamic when dynamic sections have not been created.  Don't
	segfault on .got.plt being discarded.
	(nios2_elf32_size_dynamic_sections): Delete plt and got vars.
	Don't set "relocs" on .rela.plt.  Do handle .sbss.  Delete
	fixme and another not so relevant comment.
	(nios2_elf_add_symbol_hook): Delete dynobj var.  If not
	already set, set hash table dynobj on creating .sbss.
gas/
	* config/tc-nios2.h (TC_FORCE_RELOCATION_SUB_LOCAL): Define.
ld/
	* testsuite/ld-elf/merge.d: xfail for nios.
2017-02-28 13:20:21 +10:30
Alan Modra 7ba71655a4 PowerPC addpcis fix
This came up because I was looking at ld/tmpdir/addpcis.o and noticed
the odd addends on REL16DX_HA.  They ought to both be -4.  The error
crept in due REL16DX_HA howto being pc-relative (as indeed it should
be), and code at gas/write.c:1001 after this comment
	      /* Make it pc-relative.  If the back-end code has not
		 selected a pc-relative reloc, cancel the adjustment
		 we do later on all pc-relative relocs.  */
*not* cancelling the pc-relative adjustment.  So I've made a dummy
non-relative split reloc so that the generic code handles this, rather
than attempting to add hacks later in md_apply_fix which would not be
very robust.  Having the new internal reloc also makes it easy to
support

 addpcis rx,sym@ha

as an equivalent to

 addpcis rx,(sym-0f)@ha
0:

The patch also fixes overflow checking, which must test whether the
addi will overflow too since @l relocs don't have any overflow check.

Lastly, since I was poking at md_apply_fix, I arranged to have the
generic gas/write.c code emit errors for subtraction expressions where
we lack reloc support.

include/
	* elf/ppc64.h (R_PPC64_16DX_HA): New.  Expand fake reloc comment.
	* elf/ppc.h (R_PPC_16DX_HA): Likewise.
bfd/
	* reloc.c (BFD_RELOC_PPC_16DX_HA): New.
	* elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto.
	(ppc64_elf_reloc_type_lookup): Translate new bfd reloc.
	(ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA.
	(ppc64_elf_relocate_section): Likewise.
	* elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto.
	(ppc_elf_reloc_type_lookup): Translate new bfd reloc.
	(ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc.
	* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.
gas/
	* config/tc-ppc.c (md_assemble): Use BFD_RELOC_PPC_16DX_HA for addpcis.
	(md_apply_fix): Remove fx_subsy check.  Move code converting to
	pcrel reloc earlier and handle BFD_RELOC_PPC_16DX_HA.  Remove code
	emiiting errors on seeing fx_pcrel set on unexpected relocs, as
	that is done now by the generic code via..
	* config/tc-ppc.h (TC_FORCE_RELOCATION_SUB_LOCAL): ..this. Define.
	(TC_VALIDATE_FIX_SUB): Define.
ld/
	* testsuite/ld-powerpc/addpcis.d: Define ext1 and ext2 at
	limits of addpcis range.
2017-02-28 11:59:47 +10:30
Maciej W. Rozycki 0e39210161 MIPS/BFD: Also handle `jalr $0, $25' with R_MIPS_JALR
Interpret the `jalr $0, $25' instruction encoding with an R_MIPS_JALR
relocation attached as an alias to `jr $25' and convert the jump to an
equivalent branch where possible, consequently covering the MIPSr6
architecture for the purpose of this optimization too.

	bfd/
	* elfxx-mips.c (mips_elf_perform_relocation): Also handle the
	`jalr $0, $25' instruction encoding.

	gas/
	* testsuite/gas/mips/jalr4.s: Add `jalr $0, $25' instructions.
	* testsuite/gas/mips/jalr4.d: Adjust accordingly.  Remove MIPSr6
	encoding patterns.
	* testsuite/gas/mips/jalr4-n64.d: Likewise.
	* testsuite/gas/mips/mipsr6@jalr4.d: New test.
	* testsuite/gas/mips/mipsr6@jalr4-n32.d: New test.
	* testsuite/gas/mips/mipsr6@jalr4-n64.d: New test.

	ld/
	* testsuite/ld-mips-elf/jalr4.dd: Adjust for `jalr $0, $25'
	instructions.
	* testsuite/ld-mips-elf/jalr4-r6.dd: New test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2017-02-28 00:22:36 +00:00
Alan Modra dd803a2430 Testsuite fixes for hppa64-hpux
HPUX has a different .comm syntax, and anything in the first column
is a label.

gas/
	* testsuite/gas/elf/strtab.s: Don't put directives on first
	column or continuation with labels not in first column.
ld/
	* testsuite/ld-elf/elf.exp: Xfail pr20995 tests on hppa64-hpux.
	Set up HPUX defsym.  Run pr14170 tests and build symbol3 objects,
	defining HPUX where necessary.  Define HPUX for implib tests.
	* testsuite/ld-elf/comm-data4.d: Run for hpux.
	* testsuite/ld-elf/endsym.d: Likewise.
	* testsuite/ld-elf/linkoncerdiff.d: Likewise.
	* testsuite/ld-elf/comm-data4.s: Add alternate .comm when HPUX.
	* testsuite/ld-elf/comm-data5.s: Likewise.
	* testsuite/ld-elf/endsym.s: Likewise.
	* testsuite/ld-elf/pr14170c.s: Likewise.
	* testsuite/ld-elf/symbol3.s: Likewise.
	* testsuite/ld-elf/implib.s: Likewise.  Don't start directives
	in first column.
	* testsuite/ld-elf/linkoncerdiff2.s: Don't use numeric labels.
	* testsuite/ld-elf/warn3.d: Run for hpux.
	* testsuite/ld-scripts/rgn-at10.d: Xfail for hpux.
	* testsuite/ld-scripts/rgn-at11.d: Likewise.
	* testsuite/ld-scripts/size-2.d: Remove xfail for hpux.
2017-02-25 19:13:34 +10:30
Richard Sandiford 582e12bf76 [AArch64] Additional SVE instructions
This patch supports some additions to the SVE architecture prior to
its public release.

include/
	* opcode/aarch64.h (AARCH64_OPND_SVE_ADDR_RI_S4x16)
	(AARCH64_OPND_SVE_IMM_ROT1, AARCH64_OPND_SVE_IMM_ROT2)
	(AARCH64_OPND_SVE_Zm3_INDEX, AARCH64_OPND_SVE_Zm3_22_INDEX)
	(AARCH64_OPND_SVE_Zm4_INDEX): New aarch64_opnds.

opcodes/
	* aarch64-tbl.h (OP_SVE_HMH, OP_SVE_VMU_HSD, OP_SVE_VMVU_HSD)
	(OP_SVE_VMVV_HSD, OP_SVE_VMVVU_HSD, OP_SVE_VM_HSD, OP_SVE_VUVV_HSD)
	(OP_SVE_VUV_HSD, OP_SVE_VU_HSD, OP_SVE_VVVU_H, OP_SVE_VVVU_S)
	(OP_SVE_VVVU_HSD, OP_SVE_VVV_D, OP_SVE_VVV_D_H, OP_SVE_VVV_H)
	(OP_SVE_VVV_HSD, OP_SVE_VVV_S, OP_SVE_VVV_S_B, OP_SVE_VVV_SD_BH)
	(OP_SVE_VV_BHSDQ, OP_SVE_VV_HSD, OP_SVE_VZVV_HSD, OP_SVE_VZV_HSD)
	(OP_SVE_V_HSD): New macros.
	(OP_SVE_VMU_SD, OP_SVE_VMVU_SD, OP_SVE_VM_SD, OP_SVE_VUVV_SD)
	(OP_SVE_VU_SD, OP_SVE_VVVU_SD, OP_SVE_VVV_SD, OP_SVE_VZVV_SD)
	(OP_SVE_VZV_SD, OP_SVE_V_SD): Delete.
	(aarch64_opcode_table): Add new SVE instructions.
	(aarch64_opcode_table): Use imm_rotate{1,2} instead of imm_rotate
	for rotation operands.  Add new SVE operands.
	* aarch64-asm.h (ins_sve_addr_ri_s4): New inserter.
	(ins_sve_quad_index): Likewise.
	(ins_imm_rotate): Split into...
	(ins_imm_rotate1, ins_imm_rotate2): ...these two inserters.
	* aarch64-asm.c (aarch64_ins_imm_rotate): Split into...
	(aarch64_ins_imm_rotate1, aarch64_ins_imm_rotate2): ...these two
	functions.
	(aarch64_ins_sve_addr_ri_s4): New function.
	(aarch64_ins_sve_quad_index): Likewise.
	(do_misc_encoding): Handle "MOV Zn.Q, Qm".
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis.h (ext_sve_addr_ri_s4): New extractor.
	(ext_sve_quad_index): Likewise.
	(ext_imm_rotate): Split into...
	(ext_imm_rotate1, ext_imm_rotate2): ...these two extractors.
	* aarch64-dis.c (aarch64_ext_imm_rotate): Split into...
	(aarch64_ext_imm_rotate1, aarch64_ext_imm_rotate2): ...these two
	functions.
	(aarch64_ext_sve_addr_ri_s4): New function.
	(aarch64_ext_sve_quad_index): Likewise.
	(aarch64_ext_sve_index): Allow quad indices.
	(do_misc_decoding): Likewise.
	* aarch64-dis-2.c: Regenerate.
	* aarch64-opc.h (FLD_SVE_i3h, FLD_SVE_rot1, FLD_SVE_rot2): New
	aarch64_field_kinds.
	(OPD_F_OD_MASK): Widen by one bit.
	(OPD_F_NO_ZR): Bump accordingly.
	(get_operand_field_width): New function.
	* aarch64-opc.c (fields): Add new SVE fields.
	(operand_general_constraint_met_p): Handle new SVE operands.
	(aarch64_print_operand): Likewise.
	* aarch64-opc-2.c: Regenerate.

gas/
	* doc/c-aarch64.texi: Document that sve implies fp16, simd and compnum.
	* config/tc-aarch64.c (parse_vector_type_for_operand): Allow .q
	to be used with SVE registers.
	(parse_operands): Handle new SVE operands.
	(aarch64_features): Make "sve" require F16 rather than FP.  Also
	require COMPNUM.
	* testsuite/gas/aarch64/sve.s: Add tests for new instructions.
	Include compnum tests.
	* testsuite/gas/aarch64/sve.d: Update accordingly.
	* testsuite/gas/aarch64/sve-invalid.s: Add tests for new instructions.
	* testsuite/gas/aarch64/sve-invalid.l: Update accordingly.  Also
	update expected output for new FMOV and MOV alternatives.
2017-02-24 18:29:00 +00:00
Richard Sandiford f482d30447 [AArch64] Add a "compnum" feature
This patch adds a named "compnum" feature for the ARMv8.3-A FCADD
and FCMLA extensions.

include/
	* opcode/aarch64.h (AARCH64_FEATURE_COMPNUM): New macro.
	(AARCH64_ARCH_V8_3): Include AARCH64_FEATURE_COMPNUM.

opcodes/
	* aarch64-tbl.h (aarch64_feature_simd_v8_3): Replace with...
	(aarch64_feature_compnum): ...this.
	(SIMD_V8_3): Replace with...
	(COMPNUM): ...this.
	(CNUM_INSN): New macro.
	(aarch64_opcode_table): Use it for the complex number instructions.

gas/
	* doc/c-aarch64.texi: Add a "compnum" entry.
	* config/tc-aarch64.c (aarch64_features): Likewise,
	* testsuite/gas/aarch64/advsimd-compnum.s: New test.
	* testsuite/gas/aarch64/advsimd-compnum.d: Likewise.
2017-02-24 18:27:26 +00:00
Jan Beulich 7db2c58848 x86: also correctly support TEST opcode aliases
Opcodes F6/1 and F7/1 are aliases of F6/0 and F7/0 in all modes. This
complements commit 8b89fe14b5 ("X86: Decode opcode 0x82 as opcode 0x80
in 32-bit mode"), just that here 64-bit mode is also covered.
2017-02-24 10:04:26 +01:00
Sheldon Lobo 1b3cee563c gas: test cases for the architecture level aware SPARC ASI work.
gas/ChangeLog:

	Test cases for the architecture level aware SPARC ASI work.
	* gas/testsuite/gas/sparc/sparc.exp: 2 new tests
	* gas/testsuite/gas/sparc/asi-bump-warn.s: New test
	* gas/testsuite/gas/sparc/asi-bump-warn.l: Likewise
	* gas/testsuite/gas/sparc/asi-arch-error.s: Likewise
	* gas/testsuite/gas/sparc/asi-arch-error.l: Likewise
2017-02-24 00:23:50 -08:00
Maciej W. Rozycki c1556ecd78 MIPS/BFD: Discard ineligible JALR relocations right away
Discard R_MIPS_JALR and R_MICROMIPS_JALR relocations associated with
jumps that cannot be converted to an equivalent branch right away in
`mips_elf_calculate_relocation' rather than letting them through to
`mips_elf_perform_relocation'.  This includes cross-mode jumps which
need to flip the ISA bit or jumps to a misaligned location that cannot
be encoded with a branch, in addition to preemptible symbol references
already handled.

Cross-mode jumps are actually already rejected as the conversion is made
in `mips_elf_perform_relocation', so in this case this change only saves
some processing.  Jumps to a misaligned location are however converted,
with bits causing misalignment lost, making resulting code functionally
different even if the lone effect is avoiding an address error exception
with an instruction fetch at the jump destination requested.

Add test cases suitable, also including GAS verification to confirm that
the JALR relocations explicitly requested have indeed been output in the
intermediate objects used.

	bfd/
	* elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
	<R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
	or misaligned.

	gas/
	* testsuite/gas/mips/jalr4.d: New test.
	* testsuite/gas/mips/jalr4-n32.d: New test.
	* testsuite/gas/mips/jalr4-n64.d: New test.
	* testsuite/gas/mips/jalr4.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	ld/
	* testsuite/ld-mips-elf/jalr4.dd: New test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2017-02-23 23:45:14 +00:00
Andreas Krebbel 64025b4ec9 S/390: Add support for new cpu architecture - arch12.
This adds support of new instructions to the S/390 specific parts.

The important feature of the new instruction set is the support of
single and extended precision floating point vector operations.

Note: arch12 is NOT the official name of the new CPU.  It just
continues the series of archXX options supported as alternate names.
The archXX terminology refers to the edition number of the Principle
of Operations manual.  The official CPU name will be added later while
keeping support of the arch12 for backwards compatibility.

No testsuite regressions.

Committed to mainline.

Bye,

-Andreas-

opcodes/ChangeLog:

2017-02-23  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* s390-mkopc.c (main): Accept arch12 as cpu string and vx2 as
	facility.
	* s390-opc.c: Add new operand description macros, new instruction
	types, instruction masks, and new .insn instruction types.
	* s390-opc.txt: Add new arch12 instructions.

include/ChangeLog:

2017-02-23  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* opcode/s390.h (enum s390_opcode_cpu_val): New value
	S390_OPCODE_ARCH12.
	(S390_INSTR_FLAG_VX2): New macro definition.

gas/ChangeLog:

2017-02-23  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config/tc-s390.c (s390_parse_cpu): New entry for arch12.
	* doc/as.texinfo: Document arch12 as cpu type.
	* doc/c-s390.texi: Likewise.
	* testsuite/gas/s390/s390.exp: Run arch12 specific tests.
	* testsuite/gas/s390/zarch-arch12.d: New test.
	* testsuite/gas/s390/zarch-arch12.s: New test.
	* testsuite/gas/s390/zarch-z13.d: Rename some mnemonics in the
	output patterns.
2017-02-23 18:27:38 +01:00
Sheldon Lobo 1e9d41d49f opcodes,gas: associate SPARC ASIs with an architecture level.
With this change an architecture level bump due to assembly ASIs will show
up as a warning/error depending on options passed to gas.

Tested with sparc64-linux-gnu, and it does not introduce any regressions.

gas/ChangeLog:

	Add support for associating SPARC ASIs with an architecture level.
	* config/tc-sparc.c (parse_sparc_asi): New encode SPARC ASIs.

opcodes/ChangeLog:

	Add support for associating SPARC ASIs with an architecture level.
	* include/opcode/sparc.h (sparc_asi): New sparc_asi struct.
	* opcodes/sparc-opc.c (asi_table): Updated asi_table and encoding/
	decoding of SPARC ASIs.
2017-02-23 07:53:16 -08:00
Jan Beulich 946416fc5a gas: slightly relax .startof.()/.sizeof.() testcase 2017-02-23 11:21:10 +01:00
Jan Beulich 4c5b8d1e01 x86: extend 64-bit invalid MPX insn forms testcase 2017-02-23 11:00:44 +01:00
Maciej W. Rozycki 5ff6a06c21 GAS: Consistently fix labels at the `.end' pseudo-op
Fix a functional regression with the `.end' pseudo-op, introduced with
commit ecb4347ade ("Last take: approval for MIPS_STABS_ELF killing"),
<https://sourceware.org/ml/binutils/2002-06/msg00443.html>, and commit
dcd410fe15 ("GNU as 2.14 on IRIX 6: crashes with shared libs"),
<https://sourceware.org/ml/binutils/2003-07/msg00415.html>, which caused
symbol values for labels placed between the end of a function's contents
and its terminating `.end' followed by one of the alignment pseudo-ops
to be different depending on whether either `-mdebug', or `-mno-pdr', or
neither of the command-line options is in effect, be it implied or
specified.

Given debug-label-end.s as follows and the `mips-linux' target we have:

$ cat debug-label-end.s
	.text

	.globl	foo
	.globl	bar
	.align	4, 0
	.ent	foo
foo:
	nop
	.aent	bar
bar:
	.insn
	.end	foo
	.align	4, 0
	.space	16

	.globl	baz
	.ent	baz
baz:
	nop
	.end	baz
	.align	4, 0
	.space	16
$ as -o debug-label-end.o debug-label-end.s
$ readelf -s debug-label-end.o | grep bar
     9: 00000004     0 FUNC    GLOBAL DEFAULT    1 bar
$ as -mdebug -o debug-label-end.o debug-label-end.s
$ readelf -s debug-label-end.o | grep bar
     9: 00000010     0 FUNC    GLOBAL DEFAULT    1 bar
$ as -mno-pdr -o debug-label-end.o debug-label-end.s
$ readelf -s debug-label-end.o | grep bar
     8: 00000010     0 FUNC    GLOBAL DEFAULT    1 bar
$

The reason is the call to `md_flush_pending_output', which in the case
of `mips*-*-*' targets expands to `mips_emit_delays', which in turn
calls `mips_no_prev_insn', which calls `mips_clear_insn_labels', which
clears the list of outstanding labels.  That list is in turn consulted
in `mips_align', called in the interpretation of alignment directives,
and the labels adjusted to the current location.

A call to `md_flush_pending_output' is only made from `s_mips_end' and
then only if `-mpdr' is in effect, which is the default for `*-*-linux*'
and some other `mips*-*-*' targets.  A call to `md_flush_pending_output'
is never made from `ecoff_directive_end', which is used in place of
`s_mips_end' when `-mdebug' is in effect.  Consequently if `-mno-pdr' or
`-mdebug' is in effect the list of outstanding labels makes it through
to any alignment directive that follows and the labels are differently
interpreted depending on the command-lines options used.  And we want
code produced to be always the same.

Call `md_flush_pending_output' unconditionally then in `s_mips_end' and
add such a call from `ecoff_directive_end' as well, as long as the macro
is defined.  While `ecoff_directive_end' is shared among targets, the
only one other than `mips*-*-*' actually using it is `alpha*-*-*' and it
does not define `md_flush_pending_output'.  So the semantics isn't going
to change for it and neither it has to have its `s_alpha_end' updated
or have code in `ecoff_directive_end' conditionalized.

	gas/
	* ecoff.c (ecoff_directive_end) [md_flush_pending_output]: Call
	`md_flush_pending_output'.
	* config/tc-mips.c (s_mips_end) [md_flush_pending_output]: Call
	`md_flush_pending_output' unconditionally.
	* testsuite/gas/mips/debug-label-end-1.d: New test.
	* testsuite/gas/mips/debug-label-end-2.d: New test.
	* testsuite/gas/mips/debug-label-end-3.d: New test.
	* testsuite/gas/mips/debug-label-end.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2017-02-22 18:15:33 +00:00
Hans-Peter Nilsson 25890fc239 Fix gas/all/err-sizeof.s for cris*-*-* 2017-02-22 14:17:33 +01:00
Nick Clifton 5ffbd927b9 Skip ARM vcmp-noprefix-imm test on non-ELF targets 2017-02-22 12:00:01 +00:00
Jan Beulich b0c53498a3 gas: require an operand to .startof.()/.sizeof.() 2017-02-22 10:37:52 +01:00
Alan Modra ece5dcc1c0 Downgrade powerpc register error to warning
PR 21118
	* NEWS: Revise powerpc register check.
	* config/tc-ppc.c (ppc_optimize_expr, md_assemble): Make "invalid
	register expression" a warning.
2017-02-20 13:32:02 +10:30
Maciej W. Rozycki 37f9ec62db GAS: Add ECOFF `.aent' pseudo-op support
Implement the ECOFF `.aent' pseudo-op for ECOFF-style `.mdebug' section
support with ELF objects and, for consistency, also with ECOFF objects.
This is so that the same MIPS source can be assembled without and with
`.mdebug' section generation enabled.

Taking the `gas/testsuite/gas/mips/aent.s' test case source as an
example and the `mips-linux' target we have:

$ as -o aent.o aent.s
$ as -mdebug -o aent.o aent.s
aent.s: Assembler messages:
aent.s:10: Error: unknown pseudo-op: `.aent'
$

because for the !ECOFF_DEBUGGING case (which is the default) the
pseudo-op is already handled by the MIPS backend with `s_mips_ent',
however no handler is present for the opposite case.

For the MIPS target this is a functional regression introduced with
commit ecb4347ade ("Last take: approval for MIPS_STABS_ELF killing"),
<https://sourceware.org/ml/binutils/2002-06/msg00443.html>, where
support for the `.mdebug' section was added along with its associated
`-mdebug'/`-no-mdebug' command-line options, bringing an inconsistency
between the assembly syntax supported for each of these options as far
as the `.aent' pseudo-op is concerned.

Assembly language documentation available describes the pseudo-op
respectively as follows[1]:

"
.aent name, symno Sets an alternate entry point for the current
                  procedure.  Use this information when you want
                  to generate information for the debugger.  It must
                  appear inside an .ent/.end pair."

and[2]:

"
.aent name [,symno]
     Sets an alternate entry point for the current procedure.  Use this
     information when you want to generate information for the debugger.
     This directive must appear between a pair of .ent and .end directives.
     (The optional symno is for compiler use only.  It refers to a dense
     number in a .T file (symbol table).)"

Copy the approach from `s_mips_ent' then and add `.aent' support to the
`.ent' pseudo-op handler shared between the ELF and ECOFF object file
format backends, by setting BSF_FUNCTION for the symbol requested.

References:

[1] "MIPSpro Assembly Language Programmer's Guide", Silicon Graphics,
    Inc., Document Number 007-2418-004, Section 8.1 "Op-Codes", p. 96
    <http://techpubs.sgi.com/library/manuals/2000/007-2418-004/pdf/007-2418-004.pdf>

[2] "Digital UNIX Assembly Language Programmer's Guide", Digital
    Equipment Corporation, Order Number: AA-PS31D-TE, March 1996,
    Chapter 5 "Assembler Directives", p. 5-2
    <http://h41361.www4.hpe.com/docs/base_doc/DOCUMENTATION/V40G_PDF/APS31DTE.PDF>

	gas/
	* ecoff.c (ecoff_directive_ent, add_procedure): Handle `.aent'.
	* config/obj-ecoff.c (obj_pseudo_table): Add "aent" entry.
	* config/obj-elf.c (ecoff_debug_pseudo_table): Likewise.
	* testsuite/gas/mips/aent-2.d: New test.
	* testsuite/gas/mips/aent-mdebug.d: New test.
	* testsuite/gas/mips/aent-mdebug-2.d: New test.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2017-02-17 21:29:11 +00:00
Richard Sandiford 773fb66344 [AArch64] Add SVE system registers
This patch adds the SVE-specific system registers.

opcodes/
	* aarch64-opc.c (aarch64_sys_regs): Add SVE registers.
	(aarch64_sys_reg_supported_p): Handle them.

gas/
	* testsuite/gas/aarch64/sve-sysreg.s,
	testsuite/gas/aarch64/sve-sysreg.d,
	testsuite/gas/aarch64/sve-sysreg-invalid.d,
	testsuite/gas/aarch64/sve-sysreg-invalid.l: New tests.
2017-02-15 16:54:21 +00:00
Richard Sandiford 7a2114e7a4 [AArch64] Fix +sve documentation
The documentation entry for the SVE feature incorrectly said that
it was enabled by default for ARMv8-A or later.  This patch fixes
that and also mentions that +sve implies +simd.  (It also implies
+fp, but that follows by transitivity.)

gas/
	* doc/c-aarch64.texi: Fix sve entry.
2017-02-15 16:51:17 +00:00
Claudiu Zissulescu cc07cda69e [ARC] Fix assembler relaxation.
Fix assembler relaxation step for add, ld, mov, mpy and sub
instructions. Add tests to it.

gas/
2017-02-15  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (md_convert_frag): Remove @pcl relocation
	information from input expression.
	(assemble_insn): Make sure pcrel is correctly set.
	(arc_pcrel_adjust): Compensate for PCL rounding.
	* testsuite/gas/arc/relax-add01.d: New file.
	* testsuite/gas/arc/relax-add01.s: Likewise.
	* testsuite/gas/arc/relax-add02.d: Likewise.
	* testsuite/gas/arc/relax-add02.s: Likewise.
	* testsuite/gas/arc/relax-add03.d: Likewise.
	* testsuite/gas/arc/relax-add03.s: Likewise.
	* testsuite/gas/arc/relax-add04.d: Likewise.
	* testsuite/gas/arc/relax-add04.s: Likewise.
	* testsuite/gas/arc/relax-ld01.d: Likewise.
	* testsuite/gas/arc/relax-ld01.s: Likewise.
	* testsuite/gas/arc/relax-ld02.d: Likewise.
	* testsuite/gas/arc/relax-ld02.s: Likewise.
	* testsuite/gas/arc/relax-mov01.d: Likewise.
	* testsuite/gas/arc/relax-mov01.s: Likewise.
	* testsuite/gas/arc/relax-mov02.d: Likewise.
	* testsuite/gas/arc/relax-mov02.s: Likewise.
	* testsuite/gas/arc/relax-mpy01.d: Likewise.
	* testsuite/gas/arc/relax-mpy01.s: Likewise.
	* testsuite/gas/arc/relax-sub01.d: Likewise.
	* testsuite/gas/arc/relax-sub01.s: Likewise.
	* testsuite/gas/arc/relax-sub02.d: Likewise.
	* testsuite/gas/arc/relax-sub02.s: Likewise.
	* testsuite/gas/arc/relax-sub03.d: Likewise.
	* testsuite/gas/arc/relax-sub03.s: Likewise.
	* testsuite/gas/arc/relax-sub04.d: Likewise.
	* testsuite/gas/arc/relax-sub04.s: Likewise.

opcodes/
2017-02-15  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-opc.c (UIMM6_20R): Define.
	(SIMM12_20): Use above.
	(SIMM12_20R): Define.
	(SIMM3_5_S): Use above.
	(UIMM7_A32_11R_S): Define.
	(UIMM7_9_S): Use above.
	(UIMM3_13R_S): Define.
	(SIMM11_A32_7_S): Use above.
	(SIMM9_8R): Define.
	(UIMM10_A32_8_S): Use above.
	(UIMM8_8R_S): Define.
	(W6): Use above.
	(arc_relax_opcodes): Use all above defines.
2017-02-15 12:02:28 +01:00
Vineet Gupta 66a5a74065 Distinguish some of the registers different on ARC700 and HS38 cpus
opcodes	* arc-regs.h: Distinguish some of the registers different on
	ARC700 and HS38 cpus.

gas	* testsuite/gas/arc/st.d: Update for 0xe having a name now
2017-02-15 08:54:25 +00:00
Alan Modra 7e0de605cb PowerPC register expression checks
This stops powerpc gas blithely accepting such nonsense as
"addi %f4,%cr3,%r31".

	PR 21118
gas/
	* NEWS: Mention powerpc register checks.
	* config/tc-ppc.c (struct pd_reg): Make value a short.  Add flags.
	(pre_defined_registers): Delete fpscr and pmr entries.  Set
	register type in flags.
	(cr_names): Set type in flags.
	(reg_name_search): Return pointer to struct pd_reg rather than value.
	(register_name): Adjust to suit.  Set X_md from flags.
	(ppc_parse_name): Likewise.
	(ppc_optimize_expr): New function.
	(md_assemble): Verify expresion reg flags match operand.
	* config/tc-ppc.h (md_optimize_expr): Define.
	(ppc_optimize_expr): Declare.
include/
	* opcode/ppc.h (PPC_OPERAND_*): Reassign values, regs first.
	(PPC_OPERAND_SPR, PPC_OPERAND_GQR): Define.
opcodes/
	* ppc-opc.c (powerpc_operands): Flag SPR, SPRG and TBR entries
	with PPC_OPERAND_SPR.  Flag PSQ and PSQM with PPC_OPERAND_GQR.
2017-02-14 21:12:07 +10:30
Alan Modra 606a935e3a Fix powerpc testsuite source errors
PR 21118 work exposed these errors in the testsuite.

	* testsuite/gas/ppc/cell.s: Correct invalid registers.
	* testsuite/gas/ppc/vle-simple-1.s: Likewise.
	* testsuite/gas/ppc/vle-simple-2.s: Likewise.
2017-02-14 21:12:07 +10:30
Thomas Preud'homme 3c6452ae8d [ARM] Allow immediate without prefix in unified syntax for VCMP
2017-02-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	gas/
	* config/tc-arm.c (parse_ifimm_zero): Make prefix optional in unified
	syntax.
	* testsuite/gas/arm/vcmp-noprefix-imm.d: New file.
	* testsuite/gas/arm/vcmp-noprefix-imm.s: New file.
2017-02-13 17:47:21 +00:00
Nicholas Piggin dce75bf984 POWER9 add scv/rfscv instruction support
opcodes/
	* ppc-opc.c (powerpc_opcodes) <scv, rfscv>: New mnemonics.

gas/
	* testsuite/gas/ppc/power9.d <scv, rfscv>: New tests.
2017-02-10 19:04:26 +10:30
Claudiu Zissulescu 6ec7c1ae19 [ARC] Provide an interface to decode ARC instructions.
gas/
2017-02-06  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (parse_opcode_flags): Ignore implicit flags.

include/
2017-02-06  Claudiu Zissulescu  <claziss@synopsys.com>
	    Anton Kolesov  <anton.kolesov@synopsys.com>

	* opcode/arc.h (insn_class_t): Add ENTER, LEAVE, POP, PUSH, BBIT0,
	BBIT1, BI, BIH, BRCC, EI, JLI, and SUB instruction classes.
	(flag_class_t): Add F_CLASS_WB, F_CLASS_ZZ, and F_CLASS_IMPLICIT
	flag classes.

opcode/
2017-02-06  Claudiu Zissulescu  <claziss@synopsys.com>
	    Anton Kolesov  <anton.kolesov@synopsys.com>

	* arc-dis.c (arc_disassemble_info): New structure.
	(init_arc_disasm_info): New function.
	(find_format_from_table): Ignore implicit flags.
	(find_format): Update dissassembler private data.
	(print_flags): Likewise.
	(print_insn_arc): Likewise.
	(arc_opcode_to_insn_type): Consider the new added instruction
	classes.
	(arcAnalyzeInstr): Remove.
	(arc_insn_decode): New function.
	* arc-dis.h (arc_ldst_writeback_mode): New enum.
	(arc_ldst_data_size): Likewise.
	(arc_condition_code): Likewise.
	(arc_operand_kind): Likewise.
	(arc_insn_kind): New struct.
	(arc_instruction): Likewise.
	(arc_insn_decode): Declare function.
	(ARC_Debugger_OperandType): Deleted.
	(Flow): Likewise.
	(NullifyMode): Likewise.
	(allOperandsSize): Likewise.
	(arcDisState): Likewise.
	(arcAnalyzeInstr): Likewise.
	* arc-dis.c (arc_opcode_to_insn_type): Handle newly introduced
	insn_class_t enums.
	* arc-opc.c (F_SIZED): New define.
	(C_CC_EQ, C_CC_GE, C_CC_GT, C_CC_HI, C_CC_HS): Likewise.
	(C_CC_LE, C_CC_LO, C_CC_LS, C_CC_LT, C_CC_NE): Likewise.
	(C_CC_NE, C_AA_AB, C_AA_AW, C_ZZ_D, C_ZZ_H, C_ZZ_B): Likewise.
	(arc_flag_classes): Add F_CLASS_COND/F_CLASS_IMPLICIT flags.
	* opcodes/arc-tbl.h: Update instructions to include new
	F_CLASS_IMPLICIT flags.
	(bbit0, lp): Change class.
	(bbit1, bi, bih, br*, ei_s, jli_s): Likewsie
2017-02-06 11:26:13 +01:00
Maciej W. Rozycki 7320133163 MIPS/GAS/doc: Include MIPS options in the man page
Include the detailed MIPS option description in the man page along with
other target descriptions and complementing the terse list earlier on.

	gas/
	* doc/as.texinfo (Overview): Select MIPS options for man page
	inclusion.
2017-02-02 22:15:57 +00:00
Maciej W. Rozycki 8b10b0b3e1 MIPS: Add options to control branch ISA checks
Complement commit 9d862524f6 ("MIPS: Verify the ISA mode and alignment
of branch and jump targets") and add GAS and LD options to control the
checks for invalid branches between ISA modes introduced there, to help
with some handwritten code lacking `.insn' annotation for labels used as
branch targets and code produced by older versions of GCC which suffers
from the issue with branches to code that has been optimized away,
addressed with GCC commit 242424 ("MIPS/GCC: Mark trailing labels with
`.insn'"), <https://gcc.gnu.org/ml/gcc-patches/2016-11/msg01061.html>.

	bfd/
	* elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
	(_bfd_mips_elf_linker_flags): ... this.  Add another parameter.
	* elfxx-mips.c (mips_elf_link_hash_table): Add
	`ignore_branch_isa' member.
	(mips_elf_perform_relocation): Do not treat an ISA mode mismatch
	in branch relocation calculation as an error if
	`ignore_branch_isa' has been set.
	(_bfd_mips_elf_insn32): Rename to...
	(_bfd_mips_elf_linker_flags): ... this.  Rename the `on'
	parameter to `insn32' and add an `ignore_branch_isa' parameter.
	Handle the new parameter.

	gas/
	* config/tc-mips.c (mips_ignore_branch_isa): New variable.
	(options): Add OPTION_IGNORE_BRANCH_ISA and
	OPTION_NO_IGNORE_BRANCH_ISA enum values.
	(md_longopts): Add "mignore-branch-isa" and
	"mno-ignore-branch-isa" options.
	(md_parse_option): Handle OPTION_IGNORE_BRANCH_ISA and
	OPTION_NO_IGNORE_BRANCH_ISA.
	(fix_bad_cross_mode_branch_p): Return FALSE if
	`mips_ignore_branch_isa' has been set.
	(md_show_usage): Add `-mignore-branch-isa' and
	`-mno-ignore-branch-isa'.

	* doc/as.texinfo (Target MIPS options): Add
	`-mignore-branch-isa' and `-mno-ignore-branch-isa' options.
	(-mignore-branch-isa, -mno-ignore-branch-isa): New options.
	* doc/c-mips.texi (MIPS Options): Add `-mignore-branch-isa' and
	`-mno-ignore-branch-isa' options.

	* testsuite/gas/mips/branch-local-ignore-2.d: New test.
	* testsuite/gas/mips/branch-local-ignore-3.d: New test.
	* testsuite/gas/mips/branch-local-ignore-n32-2.d: New test.
	* testsuite/gas/mips/branch-local-ignore-n32-3.d: New test.
	* testsuite/gas/mips/branch-local-ignore-n64-2.d: New test.
	* testsuite/gas/mips/branch-local-ignore-n64-3.d: New test.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	ld/
	* emultempl/mipself.em (ignore_branch_isa): New variable.
	(mips_create_output_section_statements): Rename
	`_bfd_mips_elf_insn32' called to `_bfd_mips_elf_linker_flags',
	add `ignore_branch_isa' argument.
	(PARSE_AND_LIST_PROLOGUE): Add OPTION_IGNORE_BRANCH_ISA and
	OPTION_NO_IGNORE_BRANCH_ISA enum values.
	(PARSE_AND_LIST_LONGOPTS): Add "ignore-branch-isa" and
	"no-ignore-branch-isa" options.
	(PARSE_AND_LIST_OPTIONS): Add `--ignore-branch-isa' and
	`--no-ignore-branch-isa'.
	(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_IGNORE_BRANCH_ISA and
	OPTION_NO_IGNORE_BRANCH_ISA.

	* ld.texinfo (Options specific to MIPS targets): Add
	`--ignore-branch-isa' and `--no-ignore-branch-isa' options.
	(ld and the MIPS family): Likewise.

	* testsuite/ld-mips-elf/bal-jalx-pic-ignore.d: New test.
	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-n32.d: New test.
	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-n64.d: New test.
	* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d: New test.
	* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1: New test.
	* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16: New
	test.
	* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips: New
	test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2017-01-30 17:16:01 +00:00
Maciej W. Rozycki 7795a8f8bd MIPS/GAS/testsuite: Convert branch local list tests to dump tests
gas/
	* testsuite/gas/mips/branch-local-2.d: New test.
	* testsuite/gas/mips/branch-local-3.d: New test.
	* testsuite/gas/mips/branch-local-n32-2.d: New test.
	* testsuite/gas/mips/branch-local-n32-3.d: New test.
	* testsuite/gas/mips/branch-local-n64-2.d: New test.
	* testsuite/gas/mips/branch-local-n64-3.d: New test.
	* testsuite/gas/mips/mips.exp: Fold corresponding list tests
	into the new tests.
2017-01-30 17:13:08 +00:00
Alexis Deruell 8ec5cf65a8 Fix disassembling of TIC6X parallel instructions where the previous fetch packet ended with a 32-bit insn.
PR 21056
opcodes	* tic6x-dis.c (print_insn_tic6x): Correct displaying of parallel
	instructions when the previous fetch packet ends with a 32-bit
	instruction.

gas	* testsuite/gas/tic6x/insns16-parallel.s: New test case.
	* testsuite/gas/tic6x/insns16-parallel.d: New test driver.
2017-01-27 12:00:55 +00:00
Sebastian Huber de514cf3db gas: Default to ELF for RTEMS targets
* configure.tgt (aarch64*-*-rtems*): Remove.
	(bfin-*-rtems*): Likewise.
	(h8300-*-rtems*): Likewise.
	(i386-*-rtems*): Likewise.
	(m32c-*-rtems*): Likewise.
	(m32r-*-rtems*): Likewise.
	(m68k-*-rtems*): Likewise.
	(mips-*-rtems*): Likewise.
	(nios2-*-rtems*): Likewise.
	(ppc-*-rtems*): Likewise.
	(sh-*-rtems*): Likewise.
	(sparc64-*-rtems*): Likewise.
	(sparc-*-rtems*): Likewise.
	(*-*-rtems*) Use ELF format.
2017-01-25 17:54:47 +10:30
Sebastian Huber 3e97ba8a52 gas: Use ARM EABI for RTEMS
* configure.tgt (arm-*-rtems*): Move to (arm-*-eabi*).
2017-01-25 17:53:44 +10:30
Sebastian Huber 850d84f6a4 Remove all RTEMS COFF targets
bfd/
	* config.bfd (*-*-rtemscoff*): Mark as removed.
gas/
	* configure.tgt (sh-*-rtemscoff*): Remove.
ld/
	* configure.tgt (h8300-*-rtemscoff*): Remove.
	(i960-*-rtems*): Likewise.
	(m68*-*-rtemscoff*): Likewise.
	(sh-*-rtemscoff*): Likewise.
2017-01-25 17:52:27 +10:30
Sebastian Huber 666c6aff6b RISC-V gas: Remove em=linux from configure.tgt
The use of te-linux.h is unnecessary since the TE_LINUX define is unused
and LOCAL_LABELS_FB is defined to 1 in tc-riscv.h as well.

gas/
	* configure.tgt (riscv*-*-*): Remove em=linux.
2017-01-24 10:38:42 -08:00
Nick Clifton 33eaf5de31 Fix spelling mistakes and typos in the GAS sources.
PR gas/21072
	* asintl.h: Fix spelling mistakes and typos.
	* atof-generic.c: Likewise.
	* bit_fix.h: Likewise.
	* config/atof-ieee.c: Likewise.
	* config/bfin-defs.h: Likewise.
	* config/bfin-parse.y: Likewise.
	* config/obj-coff-seh.h: Likewise.
	* config/obj-coff.c: Likewise.
	* config/obj-evax.c: Likewise.
	* config/obj-macho.c: Likewise.
	* config/rx-parse.y: Likewise.
	* config/tc-aarch64.c: Likewise.
	* config/tc-alpha.c: Likewise.
	* config/tc-arc.c: Likewise.
	* config/tc-arm.c: Likewise.
	* config/tc-avr.c: Likewise.
	* config/tc-bfin.c: Likewise.
	* config/tc-cr16.c: Likewise.
	* config/tc-cris.c: Likewise.
	* config/tc-crx.c: Likewise.
	* config/tc-d10v.c: Likewise.
	* config/tc-d30v.c: Likewise.
	* config/tc-dlx.c: Likewise.
	* config/tc-epiphany.c: Likewise.
	* config/tc-frv.c: Likewise.
	* config/tc-hppa.c: Likewise.
	* config/tc-i370.c: Likewise.
	* config/tc-i386-intel.c: Likewise.
	* config/tc-i386.c: Likewise.
	* config/tc-i960.c: Likewise.
	* config/tc-ia64.c: Likewise.
	* config/tc-m32r.c: Likewise.
	* config/tc-m68hc11.c: Likewise.
	* config/tc-m68k.c: Likewise.
	* config/tc-mcore.c: Likewise.
	* config/tc-mep.c: Likewise.
	* config/tc-mep.h: Likewise.
	* config/tc-metag.c: Likewise.
	* config/tc-microblaze.c: Likewise.
	* config/tc-mips.c: Likewise.
	* config/tc-mmix.c: Likewise.
	* config/tc-mn10200.c: Likewise.
	* config/tc-mn10300.c: Likewise.
	* config/tc-msp430.c: Likewise.
	* config/tc-msp430.h: Likewise.
	* config/tc-nds32.c: Likewise.
	* config/tc-nds32.h: Likewise.
	* config/tc-nios2.c: Likewise.
	* config/tc-nios2.h: Likewise.
	* config/tc-ns32k.c: Likewise.
	* config/tc-pdp11.c: Likewise.
	* config/tc-ppc.c: Likewise.
	* config/tc-pru.c: Likewise.
	* config/tc-rx.c: Likewise.
	* config/tc-s390.c: Likewise.
	* config/tc-score.c: Likewise.
	* config/tc-score7.c: Likewise.
	* config/tc-sh.c: Likewise.
	* config/tc-sh64.c: Likewise.
	* config/tc-sparc.c: Likewise.
	* config/tc-tic4x.c: Likewise.
	* config/tc-tic54x.c: Likewise.
	* config/tc-v850.c: Likewise.
	* config/tc-vax.c: Likewise.
	* config/tc-visium.c: Likewise.
	* config/tc-xgate.c: Likewise.
	* config/tc-xtensa.c: Likewise.
	* config/tc-z80.c: Likewise.
	* config/tc-z8k.c: Likewise.
	* config/te-vms.c: Likewise.
	* config/xtensa-relax.c: Likewise.
	* doc/as.texinfo: Likewise.
	* doc/c-arm.texi: Likewise.
	* doc/c-hppa.texi: Likewise.
	* doc/c-i370.texi: Likewise.
	* doc/c-i386.texi: Likewise.
	* doc/c-m32r.texi: Likewise.
	* doc/c-m68k.texi: Likewise.
	* doc/c-mmix.texi: Likewise.
	* doc/c-msp430.texi: Likewise.
	* doc/c-nds32.texi: Likewise.
	* doc/c-ns32k.texi: Likewise.
	* doc/c-riscv.texi: Likewise.
	* doc/c-rx.texi: Likewise.
	* doc/c-s390.texi: Likewise.
	* doc/c-tic6x.texi: Likewise.
	* doc/c-tilegx.texi: Likewise.
	* doc/c-tilepro.texi: Likewise.
	* doc/c-v850.texi: Likewise.
	* doc/c-xgate.texi: Likewise.
	* doc/c-xtensa.texi: Likewise.
	* dwarf2dbg.c: Likewise.
	* ecoff.c: Likewise.
	* itbl-ops.c: Likewise.
	* listing.c: Likewise.
	* macro.c: Likewise.
	* po/gas.pot: Likewise.
	* read.c: Likewise.
	* struc-symbol.h: Likewise.
	* symbols.h: Likewise.
	* testsuite/gas/arc/relocs-errors.err: Likewise.
	* write.c: Likewise.
2017-01-23 15:23:07 +00:00
Nick Clifton 8069955ee0 Updated Irish translation for ld and Swedish translation for gas. 2017-01-23 13:32:12 +00:00
Nick Clifton 9d46ce346f Fix potential array overrun in x86 assembler.
* config/tc-i386.c (parse_operands): Check for operand overflow
	before setting the unspecified bit.
2017-01-20 10:32:25 +00:00
Maciej W. Rozycki 9e009953a5 PR gas/20649: MIPS: Fix GOT16/LO16 reloc pairing with comdat sections
Correct a regression from commit 8614eeee67 ("Traditional MIPS
patches"), <https://sourceware.org/ml/binutils/2000-07/msg00018.html>,
which caused symbols in linkonce or what is these days known as comdat
sections to be treated as external for the purpose of PIC relocation
generation even if their binding remains STB_LOCAL.  This in turn
disabled GOT16/LO16 relocation pairing with references to such symbols,
as no complementing LO16 relocation is expected for external GOT16
references in the o32 ABI, which ultimately leads to link errors, e.g.:

ld: comdat-reloc.o: Can't find matching LO16 reloc against `foo' for R_MIPS_GOT16 at 0x24 in section `.text.bar[bar]'

as with the LD test case included with this change.

Revert the special case for symbols in comdat sections then, making code
actually match `adjust_reloc_syms' as indicated in its explanatory
comment, and adjust calling code accordingly.  Also bring back the
corresponding description of what now is `s_is_linkonce', lost with
commit 5f0fe04bc5 ("Improved MIPS16/MIPS32 code intermixing for
gas."), <https://www.sourceware.org/ml/binutils/2006-07/msg00039.html>.

	gas/
	PR gas/20649
	* config/tc-mips.c (pic_need_relax): Don't check for linkonce
	symbols, remove the `segtype' parameter.
	(mips_frob_file, md_estimate_size_before_relax): Adjust
	accordingly.
	(s_is_linkonce): Add an explanatory comment.
	* testsuite/gas/mips/comdat-reloc.d: New test.
	* testsuite/gas/mips/comdat-reloc.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new test.

	ld/
	PR gas/20649
	* testsuite/ld-mips-elf/mips-elf.exp: Add PIC comdat GOT16/LO16
	relocation pairing link test.
2017-01-18 18:24:08 +00:00
Szabolcs Nagy c13a63b046 [ARM] Fix the decoding of indexed element VCMLA instruction
Bit 24 of the indexed element vcmla decode mask was incorrectly
left unset.  This could cause incorrect disassembly of some
currently undefined instructions as vcmla.

Rotatation immediates were not printed correctly in the disassembly
(could print 170 and 280 instead of 180 and 270).

opcodes/
	* arm-dis.c (coprocessor_opcodes): Fix vcmla mask and disassembly.

gas/
	* testsuite/gas/arm/armv8_3-a-simd.s: Add vcmla tests.
	* testsuite/gas/arm/armv8_3-a-simd.d: Update.
2017-01-18 17:08:34 +00:00
Bernhard Rosenkranzer 2cedb9ebf8 Add support for processing lex source files with flex v 2.6.3
PR 21059
binutils* arlex.l: Support processing with flex 2.6.3.
	* deflex.l: Likewise.

gas	* config/bfin-lex.l: Support processing with flex 2.6.3.
	* itbl-lex.l: Likewise.
2017-01-18 13:38:27 +00:00
Nathan Sidwell 1ec4b9f28b Catch gas exit-via-signal
gas/
	* as.h (gas_assert): Use abort.
	(as_assert): Remove.
	(signal_init): Declare.
	* as.c (main): Call signal_init.
	* messages.c: #include <signal.h>
	(as_assert): Delete.
	(as_abort): Allow NULL FILE.
	(signal_crash): New.
	(signal_init): Register fatal signal handlers.
	* configure.ac: Check for strsignal.
	* config.in: Rebuilt.
	* configure: Rebuilt.
2017-01-18 08:23:10 -05:00
Nick Clifton 01fabda4d4 Updated Swedish translation for GAS. 2017-01-18 11:35:29 +00:00
Nick Clifton 6aa1df2d44 Updated Swedish translations for GAS and LD subdirectories.
gas	* po/sv.po: Updated Swedish translation.
ld	* po/sv.po: Updated Swedish translation.
2017-01-16 10:59:23 +00:00
Igor Tsimbalist 620214f742 Enable Intel AVX512_VPOPCNTDQ instructions
gas/

2017-01-12  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>

	* config/tc-i386.c (cpu_arch): Add .avx512_vpopcntdq.
	(cpu_noarch): Add noavx512_vpopcntdq.
	* doc/c-i386.texi: Document avx512_vpopcntdq, noavx512_vpopcntdq.
	* testsuite/gas/i386/i386.exp: Run AVX512_VPOPCNTDQ tests.
	* testsuite/gas/i386/avx512_vpopcntdqd-intel.d: New file.
	* testsuite/gas/i386/avx512_vpopcntdqd.d: Ditto.
	* testsuite/gas/i386/avx512_vpopcntdqd.s: Ditto.
	* testsuite/gas/i386/x86-64-avx512_vpopcntdqd-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx512_vpopcntdqd.d: Ditto.
	* testsuite/gas/i386/x86-64-avx512_vpopcntdqd.s: Ditto.

opcodes/

2017-01-12  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>

	* i386-dis.c (enum): Add PREFIX_EVEX_0F3855, EVEX_W_0F3855_P_2.
	* i386-dis-evex.h (evex_table): Updated.
	* i386-gen.c (cpu_flag_init): Add CPU_AVX512_VPOPCNTDQ_FLAGS,
	CPU_ANY_AVX512_VPOPCNTDQ_FLAGS. Update CPU_ANY_AVX512F_FLAGS.
	(cpu_flags): Add CpuAVX512_VPOPCNTDQ.
	* i386-opc.h (enum): (AVX512_VPOPCNTDQ): New.
	(i386_cpu_flags): Add cpuavx512_vpopcntdq.
	* i386-opc.tbl: Add Intel AVX512_VPOPCNTDQ instructions.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Ditto.
2017-01-12 08:44:24 -08:00
Nick Clifton 1181551ef0 Prevent internal assembler errors if a stabs creation function builds an badly formatted input string.
* read.c (temp_ilp): New function.  Installs a temporary input
	line pointer.
	(restore_ilp): New function.  Restores the original input line
	pointer.
	* read.h (temp_ilp): Prototype.
	(restore_ilp): Prototype.
	* stabs.c (dot_func_p): Use bfd_boolean type.
	(generate_asm_file): Use temp_ilp and restore_ilp.
	(stabs_generate_asm_lineno): Likewise.
	(stabs_generate_asm_endfunc): Likewise.
2017-01-12 14:56:13 +00:00
Jeremy Soller f2e2d2f54b Add support for x86/64 redox target.
bfd	* config.bfd: Add entries for i686-redox and x86_64-redox.

gas	* configure.tgt: Add entry for i386-redox.

ld	* configure.tgt: Add entries for x86-redox and x86_64-redox.
2017-01-11 15:05:53 +00:00
Tristan Gingold 1a94eb29d0 Fix sleb128-8 regressions.
gas/
	* testsuite/gas/all/sleb128-8.d: Adjust test.
	* testsuite/gas/all/gas.exp (test_cond): Likewise.
2017-01-10 14:43:28 +01:00
Nick Clifton 07e8e62387 Updated Swedish translations for GAS and LD 2017-01-10 11:28:36 +00:00
Tristan Gingold 74def31dcd This patch ensure same output for sleb128 with large number.
gas/
	* read.c (emit_leb128_expr): Extended unsigned big number for
	sleb128.
	* testsuite/gas/all/gas.exp (test_cond): Add sleb128-8 test.
	* testsuite/gas/all/sleb128.d: New test.
	* testsuite/gas/all/sleb128.s: New test source.
2017-01-10 10:23:23 +01:00
Andrew Waterman a5ec5e3fe1 RISC-V/GAS: Support more relocs against constant addresses
Previously, some pseudoinstructions like "call" only accepted
symbolic addresses and rejected constant addresses with an
esoteric internal error.  This patch enables them by deferring
application of constant relocations to md_apply_fix, rather than
eagerly applying them during instruction assembly.

gas/ChangeLog

2017-01-09  Andrew Waterman <andrew@sifive.com>

	* config/tc-riscv.c (append_insn): Don't eagerly apply relocations
	against constants.
	(md_apply_fix): Mark relocations against constants as "done."
2017-01-09 09:20:05 -08:00
Andrew Waterman e294484ee7 RISC-V/GAS: Improve handling of invalid relocs
TLS relocs against constants previously segfaulted, and illegal
symbol subtractions were silently ignored.

The previous behavior was to segfault.

gas/ChangeLog

2017-01-09  Andrew Waterman <andrew@sifive.com>

	* config/tc-riscv.c (md_apply_fix): Report TLS relocations against
	constants.  Report disallowed symbol subtractions.
2017-01-09 09:18:36 -08:00
Palmer Dabbelt 6ec11ab97a Remove some custom sections from RISC-V's default linker scripts
This was added so compressed loads could have smaller offsets for
accessing the data section, but the result was that writable sections
ended up in INITIAL_READONLY_SECTIONS.  This is a bad idea.  The fix is
to just remove this micro-optimization.

Thanks to Alan Morda for finding the problem!

ld/ChangeLog

2017-01-09  Palmer Dabbelt <palmer@dabbelt.com>
            Kito Cheng <kito.cheng@gmail.com>

        * emulparams/elf32lriscv-defs.sh (INITIAL_READONLY_SECTIONS):
        Removed.
        (SDATA_START_SYMBOLS): Likewise.
2017-01-09 09:12:20 -08:00
Nick Clifton 20b52c88ea Add Swedish translation for GAS.
* po/sv.po: New Swedish translation.
	* configure.ac (ALL_LINGUAS): Add sv.
	* configure: Regenerate.
2017-01-09 10:11:50 +00:00
Andrew Waterman 011561117e RISC-V/GAS: Correct branch relaxation for weak symbols.
* config/tc-riscv.c (relaxed_branch_length): Use the long
	sequence when the target is a weak symbol.
2017-01-09 09:22:33 +00:00
Szabolcs Nagy d74d4880e2 [AArch64] Add separate feature flag for weaker release consistent load insns
The weaker release consistency support of ARMv8.3-A is allowed as an optional
extension for ARMv8.2-A, so separate command line option and feature flag is
added: -march=armv8.2-a+rcpc turns LDAPR, LDAPRB, LDAPRH instructions on.

opcodes/
	* aarch64-tbl.h (RCPC, RCPC_INSN): Define.
	(aarch64_opcode_table): Use RCPC_INSN.

include/
	* opcode/aarch64.h (AARCH64_FEATURE_RCPC): Define.
	(AARCH64_ARCH_V8_3): Update.

gas/
	* config/tc-aarch64.c (aarch64_features): Add rcpc.
	* doc/c-aarch64.texi (AArch64 Extensions): Document rcpc.
	* testsuite/gas/aarch64/ldst-exclusive-armv8_3.d: Rename to ...
	* testsuite/gas/aarch64/ldst-rcpc.d: This.
	* testsuite/gas/aarch64/ldst-exclusive-armv8_3.s: Rename to ...
	* testsuite/gas/aarch64/ldst-rcpc.s: This.
	* testsuite/gas/aarch64/ldst-rcpc-armv8_2.d: New test.
2017-01-04 12:31:08 +00:00
Norm Jacobs 10ab38d930 When configuring GAS treat as sparcv9 target the same way as a sparc64 target.
PR gas/20992
	* configure.tgt: Treat sparcv9 as sparc64.
2017-01-04 11:49:00 +00:00
Kito Cheng cc917fd93d Add support for the Q extension to the RISCV ISA.
gas    * config/tc-riscv.c (riscv_set_arch): Whitelist the "q" ISA
        extension.
        (riscv_after_parse_args): Set FLOAT_ABI_QUAD when the Q ISA is
        enabled and no other ABI is specified.

include * opcode/riscv-opc.h: Add support for the "q" ISA extension.

opcodes * riscv-opc.c (riscv-opcodes): Add support for the "q" ISA
        extension.
        * riscv-opcodes/all-opcodes: Likewise.
2017-01-03 17:42:01 +00:00
Dimitar Dimitrov ddb2c6fdfc Fix PRU GAS for 32-bit hosts
The PRU GAS port I originally submitted does not build on 32bit hosts.
This patch fixes it by aligning md_number_to_chars's definition with
the global declaration in tc.h.

Here is the original bug report I got:
  https://github.com/rcn-ee/repos/pull/23#issuecomment-269915175

	* config/tc-pru.c (md_number_to_chars): Fix parameter to be
	valueT, as declared in tc.h.
	(md_apply_fix): Fix to work on 32-bit hosts.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2017-01-03 17:40:44 +10:30
Alan Modra 2571583aed Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
Alan Modra 5c1ad6b5bb ChangeLog rotation 2017-01-02 13:55:05 +10:30
Dimitar Dimitrov 93f11b16ec PRU GAS Port
* NEWS: Mention new PRU target.
	* Makefile.am: Add PRU target.
	* config/obj-elf.c: Ditto.
	* configure.tgt: Ditto.
	* config/tc-pru.c: New file.
	* config/tc-pru.h: New file.
	* doc/Makefile.am: Add documentation for PRU GAS port.
	* doc/all.texi, Ditto.
	* doc/as.texinfo: Ditto.
	* doc/c-pru.texi: Document PRU GAS options.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.
	* testsuite/gas/pru/alu.d: New file for PRU GAS testsuite.
	* testsuite/gas/pru/alu.s: Ditto.
	* testsuite/gas/pru/branch.d: Ditto.
	* testsuite/gas/pru/branch.s: Ditto.
	* testsuite/gas/pru/illegal.l: Ditto.
	* testsuite/gas/pru/illegal.s: Ditto.
	* testsuite/gas/pru/ldi.d: Ditto.
	* testsuite/gas/pru/ldi.s: Ditto.
	* testsuite/gas/pru/ldst.d: Ditto.
	* testsuite/gas/pru/ldst.s: Ditto.
	* testsuite/gas/pru/loop.d: Ditto.
	* testsuite/gas/pru/loop.s: Ditto.
	* testsuite/gas/pru/misc.d: Ditto.
	* testsuite/gas/pru/misc.s: Ditto.
	* testsuite/gas/pru/pru.exp: Ditto.
	* testsuite/gas/pru/pseudo.d: Ditto.
	* testsuite/gas/pru/pseudo.s: Ditto.
	* testsuite/gas/pru/warn_reglabel.l: Ditto.
	* testsuite/gas/pru/warn_reglabel.s: Ditto.
	* testsuite/gas/pru/xfr.d: Ditto.
	* testsuite/gas/pru/xfr.s: Ditto.
	* testsuite/gas/lns/lns.exp: Mark lns-common-1-alt variant for PRU.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2016-12-31 12:03:35 +10:30
Maciej W. Rozycki 5284e471d5 MIPS16: Add ASMACRO instruction support
Add ASMACRO instruction support as per the MIPS16e ASE architecture
specifications [1][2], completing MIPS16e instruction set support.

[1] "MIPS32 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS32 Architecture", MIPS
    Technologies, Inc., Document Number: MD00076, Revision 2.63, July
    16, 2013, Section 4.1 "MIPS16e Instruction Descriptions", p. 65

[2] "MIPS64 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS64 Architecture", MIPS
    Technologies, Inc., Document Number: MD00077, Revision 2.60, June
    25, 2008, Section 1.1 "MIPS16e Instruction Descriptions", p. 66

	include/
	* opcode/mips.h: Document `0', `1', `2', `3', `4' and `s'
	operand codes.

	opcodes/
	* mips16-opc.c (decode_mips16_operand): Add `0', `1', `2', `3',
	`4' and `s' operand codes.
	(mips16_opcodes): Add "asmacro" entry.

	binutils/
	* testsuite/binutils-all/mips/mips16-extend-insn.d: Update for
	ASMACRO support.

	gas/
	* testsuite/gas/mips/mips16-asmacro.d: New test.
	* testsuite/gas/mips/mips16-32@mips16-asmacro.d: New test.
	* testsuite/gas/mips/mips16-64@mips16-asmacro.d: New test.
	* testsuite/gas/mips/mips16-asmacro.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2016-12-23 19:55:21 +00:00
Maciej W. Rozycki bdd152861c MIPS16: Simplify extended operand handling
Simplify extended operand handling and only specially process immediates
which require bit shuffling, using the generic operand insertion and
extraction handlers for the '<' (5-bit shift amount) operand code in
particular.  Require the least significant bit of all extended operand
forms to be (artificially) set to 0 for their special processing to
trigger.

	gas/
	* config/tc-mips.c (mips16_immed): Limit `mips16_immed_extend'
	use to operands whose LSB position is zero.

	opcodes/
	* mips-dis.c (print_mips16_insn_arg): Simplify processing of
	extended operands.
	* mips16-opc.c (decode_mips16_operand): Switch the extended
	form of the `<' operand type to LSB position 22.
2016-12-23 19:42:28 +00:00
Maciej W. Rozycki 1da43accb4 MIPS16/GAS: Clean up invalid unextended operand handling
Bail out right away when an unextended instruction encoding is required
either with the use of a `.t' suffix or by means of `.set noautoextend',
however an operand supplied requires the extended instruction form to be
used.

This is to avoid messing up with the internal state of the assembler,
even though no actual failures are known to happen as a result.  Add
test cases for the situation concerned.

	gas/
	* config/tc-mips.c (match_mips16_insn): Don't update
	`forced_insn_length' or the instruction opcode if an operand
	requires an extended instruction form, but an unextended one
	has been requested.
	* testsuite/gas/mips/mips16-relax-unextended-1.d: New test.
	* testsuite/gas/mips/mips16-relax-unextended-2.d: New test.
	* testsuite/gas/mips/mips16-relax-unextended-1.l: New stderr
	output.
	* testsuite/gas/mips/mips16-relax-unextended-2.l: New stderr
	output.
	* testsuite/gas/mips/mips16-relax-unextended-1.s: New test
	source.
	* testsuite/gas/mips/mips16-relax-unextended-2.s: New test
	source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2016-12-23 19:38:41 +00:00
Maciej W. Rozycki d8722d7641 MIPS16: Reassign `0' and `4' operand codes
Replace `0' and `4' operand codes with `.' and `F' respectively to free
up the `0'-`4' consecutive range.  No functional change.

	gas/
	* config/tc-mips.c (mips16_macro_build): Replace `0' and `4'
	operand codes with `.' and `F' respectively.
	(mips16_macro): Likewise.

	include/
	* opcode/mips.h: Replace `0' and `4' operand codes with `.' and
	`F' respectively.

	opcodes/
	* mips16-opc.c (decode_mips16_operand): Replace `0' and `4'
	operand codes with `.' and `F' respectively.
	(mips16_opcodes): Likewise.
2016-12-23 19:37:13 +00:00
Maciej W. Rozycki 0674ee5dad MIPS16: Handle non-extensible instructions correctly
Identify non-extensible instructions in the MIPS16 opcode table and
disallow their use with the `.e' instruction size suffix in assembly and
do not interpret any EXTEND prefix present as a part of the instruction
in disassembly.

According to all versions of the MIPS16 ASE specifications the following
instructions encodings are not extensible [1][2][3][4][5][6]: I8/MOV32R,
I8/MOVR32, all RRR minor opcodes, all RR minor opcodes except from DSRA
and DSRL, and EXTEND itself, and as from revision 2.50 of the MIPS16e
ASE specifications it has been further clarified what was previously
implied, that non-extesiable instructions when preceded with an EXTEND
prefix must cause a Reserved Instruction exception [3][5].

Therefore in the presence of an EXTEND prefix none of these instructions
are supposed to be handled as extended instructions and supporting these
forms in disassembly causes confusion, and in the case of the RRR major
opcode it also clashes with the ASMACRO encoding.

References:

[1] "Product Description, MIPS16 Application-Specific Extension",
    Version 1.3, MIPS Technologies, Inc., 970130, Table 3. "MIPS16
    Instruction Set Summary", p. 5

[2] same, Table 5 "RR Minor Opcodes (RR-type instructions)", p.10

[3] "MIPS32 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS32 Architecture", MIPS
    Technologies, Inc., Document Number: MD00076, Revision 2.63, July
    16, 2013, Section 3.9 "MIPS16e Instruction Summaries", pp. 37-39

[4] same, Section 3.15 "Instruction Bit Encoding", pp. 46-49

[5] "MIPS64 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS64 Architecture", MIPS
    Technologies, Inc., Document Number: MD00077, Revision 2.60, June
    25, 2008, Section 1.9 "MIPS16e Instruction Summaries", pp. 38-41

[6] same, Section 1.15 "Instruction Bit Encoding", pp. 48-51

	include/
	* opcode/mips.h (INSN2_SHORT_ONLY): New macro.

	gas/
	* config/tc-mips.c (is_size_valid_16): Disallow a `.e' suffix
	instruction size override for INSN2_SHORT_ONLY opcode table
	entries.
	* testsuite/gas/mips/mips16-extend-swap.d: Adjust output.
	* testsuite/gas/mips/mips16-macro-e.l: Adjust error messages.
	* testsuite/gas/mips/mips16-32@mips16-macro-e.l: Adjust error
	messages.
	* testsuite/gas/mips/mips16e-32@mips16-macro-e.l: Adjust error
	messages.
	* testsuite/gas/mips/mips16-insn-e.d: New test.
	* testsuite/gas/mips/mips16-insn-t.d: New test.
	* testsuite/gas/mips/mips16-32@mips16-insn-e.d: New test.
	* testsuite/gas/mips/mips16-64@mips16-insn-e.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16-insn-e.d: New test.
	* testsuite/gas/mips/mips16-32@mips16-insn-t.d: New test.
	* testsuite/gas/mips/mips16-64@mips16-insn-t.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16-insn-t.d: New test.
	* testsuite/gas/mips/mips16-insn-e.l: New stderr output.
	* testsuite/gas/mips/mips16-insn-t.l: New stderr output.
	* testsuite/gas/mips/mips16-32@mips16-insn-e.l: New stderr
	output.
	* testsuite/gas/mips/mips16-64@mips16-insn-e.l: New stderr
	output.
	* testsuite/gas/mips/mips16e-32@mips16-insn-e.l: New stderr
	output.
	* testsuite/gas/mips/mips16-32@mips16-insn-t.l: New stderr
	output.
	* testsuite/gas/mips/mips16-64@mips16-insn-t.l: New stderr
	output.
	* testsuite/gas/mips/mips16e-32@mips16-insn-t.l: New stderr
	output.
	* testsuite/gas/mips/mips16-insn-e.s: New test source.
	* testsuite/gas/mips/mips16-insn-t.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	opcodes/
	* mips-dis.c (print_insn_mips16): Disallow EXTEND prefix
	matching for INSN2_SHORT_ONLY opcode table entries.
	* mips16-opc.c (SH): New macro.
	(mips16_opcodes): Set SH in `pinfo2' for non-extensible
	instruction entries: "nop", "addu", "and", "break", "cmp",
	"daddu", "ddiv", "ddivu", "div", "divu", "dmult", "dmultu",
	"drem", "dremu", "dsllv", "dsll", "dsrav", "dsra", "dsrlv",
	"dsrl", "dsubu", "exit", "entry", "jalr", "jal", "jr", "j",
	"jalrc", "jrc", "mfhi", "mflo", "move", "mult", "multu", "neg",
	"not", "or", "rem", "remu", "sllv", "sll", "slt", "sltu",
	"srav", "sra", "srlv", "srl", "subu", "xor", "sdbbp", "seb",
	"seh", "sew", "zeb", "zeh", "zew" and "extend".

	binutils/
	* testsuite/binutils-all/mips/mips16-extend-insn.d: New test.
	* testsuite/binutils-all/mips/mips16-extend-insn.s: New test
	source.
	* testsuite/binutils-all/mips/mips.exp: Run the new tests.
2016-12-23 19:33:45 +00:00
Maciej W. Rozycki b2805ed554 MIPS16: Remove "extended" BREAK/SDBBP handling
Remove special casing for the `6' operand code used for the embedded
trap code of the BREAK and the SDBBP instructions to support supposedly
extended forms of these instructions.

According to all versions of the MIPS16 ASE specifications these
instructions are not extensible [1][2][3][4][5][7][8][10][11], and as
from revision 2.50 of the MIPS16e ASE specifications it has been further
clarified what was previously implied, that non-extesiable instructions
when preceded with an EXTEND prefix must cause a Reserved Instruction
exception [5][6][9][10].

Therefore supposedly extended BREAK and SDBBP instructions do not serve
their purpose anymore as they do not cause a Bp and a Debug exception
respectively and supporting these forms in disassembly only causes
confusion.

References:

[1] "Product Description, MIPS16 Application-Specific Extension",
    Version 1.3, MIPS Technologies, Inc., 970130, Table 3. "MIPS16
    Instruction Set Summary", p. 5

[2] same, Table 5 "RR Minor Opcodes (RR-type instructions)", p.10

[3] same, Table 18. "Extendable MIPS16 Instructions", p. 24

[4] "MIPS32 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS32 Architecture", MIPS
    Technologies, Inc., Document Number: MD00076, Revision 2.63, July
    16, 2013, Table 3.8 "MIPS16e Special Instructions", p. 38

[5] same, Section 3.11 "MIPS16e Extensible Instructions, p. 41

[6] same, Table 3.15 "MIPS16e Extensible Instructions", p. 41

[7] same, Table 3.24 "MIPS16e RR Encoding of the Funct Field", p. 49

[8] "MIPS64 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS64 Architecture", MIPS
    Technologies, Inc., Document Number: MD00077, Revision 2.60, June
    25, 2008, Table 1.8 "MIPS16e Special Instructions", p. 39

[9] same, Section 1.11 "MIPS16e Extensible Instructions", p. 42

[10] same, Table 1.15 "MIPS16e Extensible Instructions", pp. 42-43

[11] same, Table 1.24 "MIPS16e RR Encoding of the Funct Field", p. 50

	gas/
	* config/tc-mips.c (match_mips16_insn): Remove the `6' operand
	code special case and its associated comment.

	opcodes/
	* mips16-opc.c (decode_mips16_operand) <'6'>: Remove extended
	encoding support.
2016-12-23 19:30:39 +00:00
Maciej W. Rozycki 3fb4970943 MIPS16/GAS: Fix forced size suffixes with argumentless instructions
Correct the handling of `.e' and `.t' instruction size suffixes with
instruction mnemonics which are not followed by any text on the same
line, such as arguments or white space, e.g.:

$ cat test.s
	.set	mips16
foo:
	entry.t		# comment
	entry.t
	exit.t		# comment
	exit.t
	nop.t		# comment
	nop.t
$ as -32 -o test.o test.s
test.s: Assembler messages:
test.s:4: Error: unrecognized opcode `entry.t'
test.s:6: Error: unrecognized opcode `exit.t'
test.s:8: Error: unrecognized opcode `nop.t'
$

	gas/
	* config/tc-mips.c (mips16_ip): Handle `.e' and `.t' instruction
	suffixes followed by a null character rather than a space too.
	* testsuite/gas/mips/mips16-insn-length-noargs.d: New test.
	* testsuite/gas/mips/mips16-insn-length-noargs.s: New test
	source.
	* testsuite/gas/mips/mips.exp: Run the new test.
2016-12-23 19:28:23 +00:00
Maciej W. Rozycki 645c455650 MIPS16/GAS: Disallow EXTEND delay-slot scheduling
Do not allow any explicitly coded EXTEND instruction to be automatically
scheduled into a jump delay slot, as an EXTEND prefix is coupled with
the next regular MIPS16 instruction and therefore swapping it with a
jump would change program's semantics; EXTEND is not architecturally
allowed to be present in a jump delay slot anyway.

	opcodes/
	* mips16-opc.c (mips16_opcodes): Set NODS in `pinfo' for
	"extend".

	gas/
	* testsuite/gas/mips/mips16-extend-swap.d: New test.
	* testsuite/gas/mips/mips16-extend-swap.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new test.
2016-12-23 19:25:44 +00:00
Joe Seymour 4eabf34463 [msp430] Sync tc-msp430.c with devices.csv
This patch syncs the generated data structure in tc-msp430.c with the
latest version of devices.csv released by TI.

My understanding is that the devices being removed were "invalid spins",
so can't be being used by anyone, and never will be. Current web
searches related to these devices return no relevant results.

Built and tested (no regressions) as follows:
  Configured with: --target=msp430-elf --disable-gdb
  Test variations:
    msp430-sim/-mcpu=msp430
    msp430-sim/-mcpu=msp430x
    msp430-sim/-mcpu=msp430x/-mlarge/-mdata-region=either/-mcode-region=either
    msp430-sim/-mhwmult=none
    msp430-sim/-mhwmult=f5series

gas/
	* config/tc-msp430.c (msp430_mcu_data): Sync with data from TI's
	devices.csv file as of September 2016.
2016-12-23 10:19:15 +00:00
Tristan Gingold 99b5dbf2e7 Bump version to 2.28.51
bfd/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

	* version.m4: Bump version to 2.28.51
	* configure: Regenerate.

binutils/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

	* configure: Regenerate.

gas/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

	* configure: Regenerate.

gprof/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

	* configure: Regenerate.

ld/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

	* configure: Regenerate.

opcodes/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

	* configure: Regenerate.
2016-12-23 09:50:53 +01:00
Tristan Gingold 9703a4ef4d Add marker in NEWS files
binutils/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.28.

gas/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.28.

ld/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.28.
2016-12-23 09:43:13 +01:00
Tristan Gingold e0e7a9d436 Regenerate pot files. 2016-12-23 09:32:28 +01:00
Alan Modra b2c6190bfc ChangeLog formatting fixes 2016-12-22 00:40:21 +10:30
Andrew Waterman e5b737de4a Support aligning text section from odd addresses
Previously, the alignment directives were not correctly supported
in the text section when current alignment was only 1 byte (i.e.,
when the address was odd).  Since there are no 1-byte instructions
in RISC-V, this patch resolves the bug by writing a zero byte to
obtain 2-byte alignment, at which point a 2-byte NOP can be used
to obtain 4-byte alignment.

Resolves https://github.com/riscv/riscv-gnu-toolchain/issues/205

	* config/tc-riscv.c (riscv_make_nops): Emit 2-byte NOPs.
	(riscv_frag_align_code): Correct frag_align_code arg.
2016-12-22 00:27:09 +10:30
Tim Newsome ad5bc88245 Fix a const-safety issue on GCC-4.9 and above
* config/tc-riscv.c (riscv_pre_output_hook): Remove const from
	loc4_frag.
2016-12-22 00:21:16 +10:30
Alan Modra 4e25adb395 Remove high bit set characters
gas/
	* doc/c-lm32.texi: Fix chars with high bit set.
	* testsuite/gas/bfin/vector2.s: Likewise.
gold/
	* arm.cc: Fix comment chars with high bit set.
include/
	* coff/pe.h: Fix comment chars with high bit set.
	* opcode/xgate.h: Likewise.
ld/
	* testsuite/ld-scripts/sysroot-prefix.exp: Fix chars with high bit set.
2016-12-21 19:18:46 +10:30
Alan Modra 9962fe293d Document character escape sequences
PR gas/10946
	* doc/as.texinfo (Chars): Document escape sequences.
2016-12-21 19:09:38 +10:30
Maciej W. Rozycki 11dd08e9a0 MIPS16/opcodes: Respect ISA and ASE in disassembly
Limit MIPS16 instruction disassembly according to the ISA level and ASE
set selected, as with the regular MIPS and microMIPS instruction sets.
Retain the property of `objdump -m mips:16' disassembling all MIPS16
instructions however, regardless of any ISA level recorded in the binary
examined.

To validate the disassembler use the GAS test suite for its convenience
of running tests across multiple ISAs, even though placing the tests in
the binutils test suite would be more appropriate.  Adjust the single
binutils test which depends on 64-bit instruction disassembly to have
the ISA level required actually recorded in the binary examined.

	opcodes/
	* mips-dis.c (mips_arch_choices): Use ISA_MIPS64 rather than
	ISA_MIPS3 as the `isa' selection in the `bfd_mach_mips16' entry.
	(print_insn_mips16): Check opcode entries for validity against
	the ISA level and ASE set selected.

	binutils/
	* testsuite/binutils-all/mips/mips16-undecoded.s: Use `.module'
	rather than `.set' to set the ISA level.

	gas/
	* testsuite/gas/mips/mips16-sub.d: New test.
	* testsuite/gas/mips/mips16-32@mips16-sub.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16-sub.d: New test.
	* testsuite/gas/mips/mips16e-sub.d: New test.
	* testsuite/gas/mips/mips16-32@mips16e-sub.d: New test.
	* testsuite/gas/mips/mips16-64@mips16e-sub.d: New test.
	* testsuite/gas/mips/mips16e-64-sub.d: New test.
	* testsuite/gas/mips/mips16-32@mips16e-64-sub.d: New test.
	* testsuite/gas/mips/mips16-64@mips16e-64-sub.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16e-64-sub.d: New test.
	* testsuite/gas/mips/mips16-sub.s: New test source.
	* testsuite/gas/mips/mips16e-sub.s: New test source.
	* testsuite/gas/mips/mips16e-64-sub.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2016-12-20 12:05:48 +00:00
Maciej W. Rozycki 853faf5cc3 MIPS/GAS/testsuite: Add RESTORE instruction to `mips16e' test
Add a RESTORE instruction smoke test to the `mips16e' GAS test.

	gas/
	* testsuite/gas/mips/mips16e.s: Add a RESTORE instruction.
	* testsuite/gas/mips/mips16e.d: Adjust accordingly.
2016-12-20 12:03:41 +00:00
Maciej W. Rozycki c60aaac10f MIPS/GAS/testsuite: Extend MIPS16 testing over multiple ISAs
Run the `mips16', `mips16-64', `mips16e-64', `mips16-macro',
`mips16-macro-e' and `mips16-macro-t' GAS tests over multiple MIPS16
ISAs.

	gas/
	* testsuite/gas/mips/mips16.d: Adjust test for multiple MIPS16
	ISA testing.
	* testsuite/gas/mips/mips16-64.d: Adjust test for multiple
	MIPS16 ISA testing.
	* testsuite/gas/mips/mips16e-64.d: Adjust test for multiple
	MIPS16 ISA testing.
	* testsuite/gas/mips/mips16-macro.d: Adjust test for multiple
	MIPS16 ISA testing.
	* testsuite/gas/mips/mips16e-64.s: Ensure MIPS16 ISA annotation.
	* testsuite/gas/mips/mips16e-64.l: Rename to...
	* testsuite/gas/mips/mips16e-32@mips16e-64.l: ... this.
	* testsuite/gas/mips/mips16-64@mips16.d: New test.
	* testsuite/gas/mips/mips16-64@mips16-64.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16e-64.d: New test.
	* testsuite/gas/mips/mips16-32@mips16-macro.d: New test.
	* testsuite/gas/mips/mips16-64@mips16-macro.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16-macro.d: New test.
	* testsuite/gas/mips/mips16-32@mips16-macro-e.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16-macro-e.d: New test.
	* testsuite/gas/mips/mips16-32@mips16-macro-t.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16-macro-t.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16e-64.l: New stderr output.
	* testsuite/gas/mips/mips16-32@mips16-macro.l: New stderr
	output.
	* testsuite/gas/mips/mips16e-32@mips16-macro.l: New stderr
	output.
	* testsuite/gas/mips/mips16-32@mips16-macro-e.l: New stderr
	output.
	* testsuite/gas/mips/mips16e-32@mips16-macro-e.l: New stderr
	output.
	* testsuite/gas/mips/mips16-32@mips16-macro-t.l: New stderr
	output.
	* testsuite/gas/mips/mips16e-32@mips16-macro-t.l: New stderr
	output.
	* testsuite/gas/mips/mips.exp: Run `mips16', `mips16-64',
	`mips16-macro', `mips16-macro-t', `mips16-macro-e' and
	`mips16e-64' testing across multiple MIPS16 ISAs.  Fold
	`mips16-macro' and `mips16e-64' list test invocations into
	corresponding dump tests.
2016-12-20 12:02:30 +00:00
Maciej W. Rozycki 6b4382006b MIPS/GAS/testsuite: Implement individual MIPS16 ISA testing
Implement individual MIPS16 ISA GAS testing for the 32-bit and 64-bit
variants of the base MIPS16 and the MIPS16e ISA each.

	gas/
	* testsuite/gas/mips/mips.exp (run_dump_test_arch): Add
	`mips16e' and `mips16' prefixes.
	(run_list_test_arch): Likewise.
	Rename `mips16' architecture to `mips16-32'.  Add `mips16-64',
	`mips16e-32' and `mips16e-64' architectures.  Update `rol64',
	`mips16e', `elf${el}-rel2' and `elf-rel4' test invocations
	accordingly.
	* testsuite/gas/mips/mips16e@branch-swap-3.d: New test.
	* testsuite/gas/mips/mips16e@branch-swap-4.d: New test.
	* testsuite/gas/mips/mips16e@loc-swap-dis.d: New test.
	* testsuite/gas/mips/mips16e@loc-swap.d: New test.
2016-12-20 12:01:13 +00:00
Maciej W. Rozycki 23c212516e MIPS/GAS/testsuite: Fix trailing padding in `loc-swap.s'
Pad alignment with zeros rather than NOP instructions, for sensible
multi-ISA MIPS16 testing.

	gas/
	* testsuite/gas/mips/loc-swap.s: Use zeros rather than NOPs for
	trailing alignment padding.
	* testsuite/gas/mips/loc-swap.d: Adjust accordingly.
	* testsuite/gas/mips/micromips@loc-swap.d: Likewise.
	* testsuite/gas/mips/mips16@loc-swap-dis.d: Likewise.
2016-12-20 11:58:56 +00:00
Maciej W. Rozycki 7fd5392005 MIPS16: Switch to 32-bit opcode table interpretation
Switch to 32-bit MIPS16 opcode table entry interpretation, similar to
how the microMIPS opcode table is handled, for both the `match' and
`mask' fields, removing special casing for JAL and JALX instructions and
their `a' and `i' operand codes throughout, while retaining automatic
processing of extendable opcodes in assembly and disassembly.

In assembly disallow size enforcement suffixes as appropriate: `.t' for
both 32-bit instructions and macros and `.e' for macros only, making
macro handling consistent with the microMIPS instruction set.

In disassembly fully decode EXTEND prefixes prepended to unsupported
instruction encodings (according to the ISA selection) rather than
dumping them as hexadecimal data along with the following instruction,
removing all special casing for the EXTEND prefix and making its
handling rely on its opcode table entry, except where it is considered a
part of an extendable instruction.

	include/
	* opcode/mips.h (mips_opcode_32bit_p): New inline function.

	gas/
	* config/tc-mips.c (micromips_insn_length): Use
	`mips_opcode_32bit_p'.
	(is_size_valid): Adjust description.
	(is_size_valid_16): New function.
	(validate_mips_insn): Use `mips_opcode_32bit_p' in MIPS16
	operand decoding.
	(validate_mips16_insn): Remove `a' and `i' operand code special
	casing, use `mips_opcode_32bit_p' to determine instruction
	width.
	(append_insn): Adjust forced MIPS16 instruction size
	determination.
	(match_mips16_insn): Likewise.  Don't shift the instruction's
	opcode with the `a' and `i' operand codes.  Use
	`mips_opcode_32bit_p' in operand decoding.
	(match_mips16_insns): Check for forced instruction size's
	validity.
	(mips16_ip): Don't force instruction size in the `noautoextend'
	mode.
	* testsuite/gas/mips/mips16-jal-e.d: New test.
	* testsuite/gas/mips/mips16-jal-t.d: New test.
	* testsuite/gas/mips/mips16-macro-e.d: New test.
	* testsuite/gas/mips/mips16-macro-t.d: New test.
	* testsuite/gas/mips/mips16-jal-t.l: New stderr output.
	* testsuite/gas/mips/mips16-macro-e.l: New stderr output.
	* testsuite/gas/mips/mips16-macro-t.l: New stderr output.
	* testsuite/gas/mips/mips16-jal-e.s: New test source.
	* testsuite/gas/mips/mips16-jal-t.s: New test source.
	* testsuite/gas/mips/mips16-macro-e.s: New test source.
	* testsuite/gas/mips/mips16-macro-t.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	opcodes/
	* mips-dis.c (print_mips16_insn_arg): Always handle `extend' and
	`insn' together, with `extend' as the high-order 16 bits.
	(match_kind): New enum.
	(print_insn_mips16): Rework for 32-bit instruction matching.
	Do not dump EXTEND prefixes here.
	* mips16-opc.c (mips16_opcodes): Move "extend" entry to the end.
	Recode `match' and `mask' fields as 32-bit in absolute "jal" and
	"jalx" entries.

	binutils/
	* testsuite/binutils-all/mips/mips16-extend-noinsn.d: Adjust
	test for separate EXTEND prefix disassembly.
2016-12-20 11:56:32 +00:00
Maciej W. Rozycki 4ebce1a0a5 MIPS16/opcodes: Correct 64-bit macros' ISA membership
Limit the DDIV, DDIVU, DREM, DREMU and DSUBU macros to the MIPS III
rather than MIPS I ISA.  These macros expand to machine code sequences
including 64-bit instructions which require a 64-bit ISA.  Entries for
those instructions are already correctly marked, however the marking is
ignored if entries are used in the process of macro expansion rather
than directly, making it possible to indirectly produce 64-bit machine
code even when output requested has been limited to a 32-bit ISA.

	opcodes/
	* mips16-opc.c (mips16_opcodes): Set membership to I3 rather
	than I1 for the "ddiv", "ddivu", "drem", "dremu" and "dsubu"
	INSN_MACRO entries.

	gas/
	* testsuite/gas/mips/mips16-macro.l: New list test.
	* testsuite/gas/mips/mips.exp: Run the new test.
2016-12-20 11:52:11 +00:00
Maciej W. Rozycki c97dda72b9 MIPS16/opcodes: Correct I64/SDRASP opcode's ISA membership
Limit the `SD ra, offset(sp)' instruction (I64/SDRASP major/minor
opcode) to the MIPS III rather than MIPS I ISA.  This is a 64-bit
instruction requiring a 64-bit ISA.  This bug has been there since
forever.

	opcodes/
	* mips16-opc.c (mips16_opcodes): Set membership to I3 rather
	than I1 for the SP-relative "sd"/$ra entry (SDRASP minor
	opcode).

	gas/
	* testsuite/gas/mips/mips16-sdrasp.d: New test.
	* testsuite/gas/mips/mips16-sdrasp.l: New stderr output.
	* testsuite/gas/mips/mips16-sdrasp.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new test.
2016-12-20 11:49:44 +00:00
Maciej W. Rozycki 95f6ac8822 MIPS/GAS/testsuite: Correct NewABI test selection
Make sure all tests that require NewABI support are only run with
`has_newabi' targets, removing numerous `mips-sgi-irix5' failures.

	gas/
	* testsuite/gas/mips/mips.exp: Limit remaining tests that
	require NewABI support to `has_newabi' targets.
2016-12-20 11:47:40 +00:00
Andrew Waterman d115ab8eee Don't define RISC-V .p2align
* config/tc-riscv.c (riscv_pseudo_table): Remove "align",
	"p2align", and "balign".
	(s_align): Remove.
	(riscv_handle_align): New function.
	(riscv_frag_align_code): Likewise.
	(riscv_make_nops): Likewise.
	* config/tc-riscv.h (MAX_MEM_FOR_RS_ALIGN_CODE): Change to 7.
	(HANDLE_ALIGN): Define.
	(md_do_align): Define.
	(riscv_handle_align): Declare.
	(riscv_frag_align_code): Likewise.
2016-12-20 12:26:34 +10:30
Andrew Waterman 2922d21da1 Re-work RISC-V gas flags: now we just support -mabi and -march
We've decided to standardize on two flags for RISC-V: "-march" sets the
target architecture (which determines which instructions can be
generated), and "-mabi" sets the target ABI.  We needed to rework this
because the old flag set didn't support soft-float or single-float ABIs,
and didn't support an x32-style ABI on RISC-V.

Additionally, we've changed the behavior of the -march flag: it's now a
lot stricter and only parses things we can actually understand.
Additionally, it's now lowercase-only: the rationale is that while the
RISC-V ISA manual specifies that ISA strings are case-insensitive, in
Linux-land things are usually case-sensitive.  Since this flag can be
used to determine library paths, we didn't want to bake some
case-insensitivity in there that would case trouble later.

This patch implements these two new flags and removes the old flags that
could conflict with these.  There wasn't a RISC-V release before, so we
want to just support a clean flag set.

include/
	* elf/riscv.h (EF_RISCV_SOFT_FLOAT): Don't define.
	(EF_RISCV_FLOAT_ABI, EF_RISCV_FLOAT_ABI_SOFT): Define.
	(EF_RISCV_FLOAT_ABI_SINGLE, EF_RISCV_FLOAT_ABI_DOUBLE): Define.
	(EF_RISCV_FLOAT_ABI_QUAD): Define.
bfd/
	* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Use
	EF_RISCV_FLOAT_ABI_SOFT instead of EF_RISCV_SOFT_FLOAT.
binutils/
	* readelf.c (get_machine_flags): Use
	EF_RISCV_FLOAT_ABI_{SOFT,SINGLE,DOBULE,QUAD) instead of
	EF_RISCV_{SOFT,HARD}_FLOAT.
gas/
	* config/tc-riscv.h (xlen): Delete.
	* config/tc-riscv.c (xlen): Make static.
	(abi_xlen): New variable.
	(options): Replace OPTION_{M32,M64,MSOFT_FLOAT,MHARD_FLOAT,MRVC}
	with OPTION_MABI.
	(md_longopts): Likewise.
	(md_parse_option): Likewise.
	(riscv_elf_final_processing): Likewise.
	* doc/as.texinfo (Target RISC-V options): Likewise.
	* doc/c-riscv.texi (OPTIONS): Likewise.
	* config/tc-riscv.c (float_mode): Removed.
	(float_abi): New type, specifies the floating-point ABI.
	(riscv_set_abi): New function.
	(riscv_add_subset): Only allow lower-case ISA names and require
	them to start with "rv".
	(riscv_after_parse_args): Likewise.
opcodes/
	* riscv-dis.c (riscv_disassemble_insn): Default to the ELF's
	XLEN when none is provided.
2016-12-20 12:26:34 +10:30
Andrew Waterman 45f764234a Rework RISC-V relocations
Before this commit we didn't cleanly support CFI directives because the
internal offsets used to get relaxed which broke them.  This patch
significantly reworks how we handle linker relaxations:

 * DWARF is now properly supported

 * There is a ".option norelax" to disable relaxations, for when users
   write assembly that can't be relaxed (if it's to be later patched up,
   for example).

 * There is an additional _RELAX relocation that specifies when previous
   relocations can be relaxed.

We're in the process of documenting the RISC-V ELF ABI, which will
include documentation of our relocations

  https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md

but we expect that this relocation set will remain ABI compatible in the
future (ie, it's safe to release).

Thanks to Kuan-Lin Chen for figuring out how to correctly relax the
debug info!

include/
	* elf/riscv.h: Add R_RISCV_TPREL_I through R_RISCV_SET32.
bfd/
	* reloc.c (BFD_RELOC_RISCV_TPREL_I): New relocation.
	(BFD_RELOC_RISCV_TPREL_S): Likewise.
	(BFD_RELOC_RISCV_RELAX): Likewise.
	(BFD_RELOC_RISCV_CFA): Likewise.
	(BFD_RELOC_RISCV_SUB6): Likewise.
	(BFD_RELOC_RISCV_SET8): Likewise.
	(BFD_RELOC_RISCV_SET8): Likewise.
	(BFD_RELOC_RISCV_SET16): Likewise.
	(BFD_RELOC_RISCV_SET32): Likewise.
	* elfnn-riscv.c (perform_relocation): Handle the new
	relocations.
	(_bfd_riscv_relax_tls_le): Likewise.
	(_bfd_riscv_relax_align): Likewise.
	(_bfd_riscv_relax_section): Likewise.
	(howto_table): Likewise.
	(riscv_reloc_map): Likewise.
	(relax_func_t): New type.
	(_bfd_riscv_relax_call): Add reserve_size argument, which
	controls the maximal offset pessimism.  Correct type of max_alignment.
	(_bfd_riscv_relax_lui): Likewise.
	(_bfd_riscv_relax_tls_le): Likewise.
	(_bfd_riscv_relax_align): Likewise.
	(_bfd_riscv_relax_section): Compute the required reserve size
	when relocating and use it to when calling relax_func.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Likewise.
gas/
	* config/tc-riscv.c (riscv_set_options): Add relax.
	(riscv_opts): Likewise.
	(s_riscv_option): Add relax and norelax.
	(riscv_apply_const_reloc): New function.
	(append_insn): Move constant relocation handling to
	riscv_apply_const_reloc.
	(md_pcrel_from): Likewise.
	(parse_relocation): Skip BFD_RELOC_UNUSED.
	(md_pcrel_from): Handle BFD_RELOC_RISCV_SUB6,
	BFD_RELOC_RISCV_RELAX, BFD_RELOC_RISCV_CFA.
	(md_apply_fix): Likewise.
	(riscv_pre_output_hook): New function.
	* config/tc-riscv.h (md_pre_output_hook): Define.
	(riscv_pre_output_hook): Declare.
	(DWARF_CIE_DATA_ALIGNMENT): Always -4.
2016-12-20 12:26:33 +10:30
Andrew Waterman 1d65abb5e2 Formatting changes for RISC-V
This is a mixed bag of format changes:

 * Replacing constants with macros (0xffffffff with MINUS_ONE, for
   example).  There's one technically functional change in here (some
   MINUS_ONEs are changed to 0), but it only changes the behavior of an
   otherwise-unused field.
 * Using 0 instead of 0x0 in the relocation table.
 * There were some missing spaces before parens, the spaces have been
   added.
 * A handful of comments are now more descriptive.
 * A bunch of whitespace-only changes, mostly alignment and brace
   newlines.

bfd/
	* elfnn-riscv.c: Formatting and comment fixes throughout.
	* elfxx-riscv.c: Likewise.
	(howto_table): Change the src_mask field from MINUS_ONE to 0 for
	R_RISCV_TLS_DTPMOD32, R_RISCV_TLS_DTPMOD64, R_RISCV_TLS_DTPREL32,
	R_RISCV_TLS_DTPREL64, R_RISCV_TLS_TPREL32, R_RISCV_TLS_TPREL64.
opcodes/
	* riscv-opc.c: Formatting fixes.
gas/
	* config/tc-riscv.c: Formatting and comment fixes throughout.
2016-12-20 12:26:33 +10:30
Maciej W. Rozycki eefc336583 MIPS16/GAS: Fix assertion failures with relocations on 16-bit instructions
Complement commit c9775dde32 ("MIPS16: Add R_MIPS16_PC16_S1 branch
relocation support)" and report an assembly error when a relocation is
required for an instruction, currently a branch only, that has been
forced to use its unextended encoding, either with the use of an
explicit `.t' mnemonic suffix, or by means of `.set noautoextend' being
active, fixing an assertion failure currently caused instead.

	gas/
	* config/tc-mips.c (md_convert_frag): Report an error instead of
	asserting on `ext'.
	* testsuite/gas/mips/mips16-branch-unextended-1.d: New test.
	* testsuite/gas/mips/mips16-branch-unextended-2.d: New test.
	* testsuite/gas/mips/mips16-branch-unextended-1.s: New test
	source.
	* testsuite/gas/mips/mips16-branch-unextended-2.s: New test.
	* testsuite/gas/mips/mips16-branch-unextended.l: New stderr
	output.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2016-12-14 22:05:38 +00:00
Maciej W. Rozycki 353abf7c10 MIPS16: Fix SP-relative SD instruction annotation
Fix the annotation of SP-relative SD instructions incorrectly marked as
reading from the PC rather than SP, which in turn prevented their 16-bit
forms from being scheduled into jump delay slots.  This bug has been
there since forever.

	opcodes/
	* mips16-opc.c (mips16_opcodes): Set RD_SP rather than RD_PC in
	`pinfo2' with SP-relative "sd" entries.

	gas/
	* testsuite/gas/mips/mips16-sprel-swap.d: New test.
	* testsuite/gas/mips/mips16-sprel-swap.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new test.
2016-12-14 22:04:39 +00:00
Renlin Li a6a5175474 [Binutils][AARCH64]Remove Cn register for coprocessor CRn, CRm field
The internal CN register representation for coprocessor fields used in aarch64
sys, sysl instructions are removed in this patch.

After the change, those fields are represented as immediate. Related checks are
added as well.

opcodes/

	* aarch64-opc.c (aarch64_opnd_qualifiers): New CR value range
	qualifier.
	(operand_general_constraint_met_p): Remove case for CP_REG.
	(aarch64_print_operand): Print CRn, CRm operand using imm field.
	* aarch64-tbl.h (QL_SYS): Use CR qualifier.
	(QL_SYSL): Likewise.
	(aarch64_opcode_table): Change CRn, CRm operand class and type.
	* aarch64-opc-2.c : Regenerate.
	* aarch64-asm-2.c : Likewise.
	* aarch64-dis-2.c : Likewise.

include/

	* opcode/aarch64.h (aarch64_operand_class): Remove
	AARCH64_OPND_CLASS_CP_REG.
	(enum aarch64_opnd): Change AARCH64_OPND_Cn to AARCH64_OPND_CRn,
	AARCH64_OPND_Cm to AARCH64_OPND_CRm.
	(aarch64_opnd_qualifier): Define AARCH64_OPND_QLF_CR qualifier.

gas/

	* config/tc-aarch64.c (AARCH64_REG_TYPES): Remove CN register.
	(get_reg_expected_msg): Remove CN register case.
	(parse_operands): rewrite parser for CRn, CRm operand.
	(reg_names): Remove CN register.
	* testsuite/gas/aarch64/diagnostic.s: Add a new test case.
	* testsuite/gas/aarch64/diagnostic.l: Adjust error message.
2016-12-13 17:20:08 +00:00
Jiong Wang 1bec0c8632 [AArch64] Make GAS testcases support ILP32 mode
gas/
	* gas/testsuite/gas/aarch64/addsub.d: Support ILP32 mode.
	* gas/testsuite/gas/aarch64/advsimd-across.d: Likewise.
	* gas/testsuite/gas/aarch64/advsimd-armv8_3.d: Likewise.
	* gas/testsuite/gas/aarch64/advsimd-fp16.d: Likewise.
	* gas/testsuite/gas/aarch64/advsimd-misc.d: Likewise.
	* gas/testsuite/gas/aarch64/advsisd-copy.d: Likewise.
	* gas/testsuite/gas/aarch64/advsisd-misc.d: Likewise.
	* gas/testsuite/gas/aarch64/alias.d: Likewise.
	* gas/testsuite/gas/aarch64/armv8-ras-1.d: Likewise.
	* gas/testsuite/gas/aarch64/b_1.d: Likewise.
	* gas/testsuite/gas/aarch64/beq_1.d: Likewise.
	* gas/testsuite/gas/aarch64/bitfield-dump: Likewise.
	* gas/testsuite/gas/aarch64/bitfield-no-aliases.d: Likewise.
	* gas/testsuite/gas/aarch64/codealign.d: Likewise.
	* gas/testsuite/gas/aarch64/codealign_1.d: Likewise.
	* gas/testsuite/gas/aarch64/crc32-directive.d: Likewise.
	* gas/testsuite/gas/aarch64/crc32.d: Likewise.
	* gas/testsuite/gas/aarch64/crypto-directive.d: Likewise.
	* gas/testsuite/gas/aarch64/crypto.d: Likewise.
	* gas/testsuite/gas/aarch64/dwarf.d: Likewise.
	* gas/testsuite/gas/aarch64/float-fp16.d: Likewise.
	* gas/testsuite/gas/aarch64/floatdp2.d: Likewise.
	* gas/testsuite/gas/aarch64/fp-armv8_3.d: Likewise.
	* gas/testsuite/gas/aarch64/fp-const0-parse.d: Likewise.
	* gas/testsuite/gas/aarch64/fp_cvt_int.d: Likewise.
	* gas/testsuite/gas/aarch64/fpmov.d: Likewise.
	* gas/testsuite/gas/aarch64/inst-directive.d: Likewise.
	* gas/testsuite/gas/aarch64/ldr_1.d: Likewise.
	* gas/testsuite/gas/aarch64/ldst-exclusive-armv8_3.d: Likewise.
	* gas/testsuite/gas/aarch64/ldst-exclusive.d: Likewise.
	* gas/testsuite/gas/aarch64/ldst-reg-imm-post-ind.d: Likewise.
	* gas/testsuite/gas/aarch64/ldst-reg-imm-pre-ind.d: Likewise.
	* gas/testsuite/gas/aarch64/ldst-reg-pair.d: Likewise.
	* gas/testsuite/gas/aarch64/ldst-reg-reg-offset.d: Likewise.
	* gas/testsuite/gas/aarch64/ldst-reg-uns-imm.d: Likewise.
	* gas/testsuite/gas/aarch64/ldst-reg-unscaled-imm.d: Likewise.
	* gas/testsuite/gas/aarch64/lor-directive.d: Likewise.
	* gas/testsuite/gas/aarch64/lor.d: Likewise.
	* gas/testsuite/gas/aarch64/lse-atomic.d: Likewise.
	* gas/testsuite/gas/aarch64/mapmisc.d: Likewise.
	* gas/testsuite/gas/aarch64/mov-no-aliases.d: Likewise.
	* gas/testsuite/gas/aarch64/mov.d: Likewise.
	* gas/testsuite/gas/aarch64/movi.d: Likewise.
	* gas/testsuite/gas/aarch64/movw_label.d: Likewise.
	* gas/testsuite/gas/aarch64/msr.d: Likewise.
	* gas/testsuite/gas/aarch64/neon-fp-cvt-int.d: Likewise.
	* gas/testsuite/gas/aarch64/neon-frint.d: Likewise.
	* gas/testsuite/gas/aarch64/neon-ins.d: Likewise.
	* gas/testsuite/gas/aarch64/neon-not.d: Likewise.
	* gas/testsuite/gas/aarch64/neon-vfp-reglist-post.d: Likewise.
	* gas/testsuite/gas/aarch64/neon-vfp-reglist.d: Likewise.
	* gas/testsuite/gas/aarch64/no-aliases.d: Likewise.
	* gas/testsuite/gas/aarch64/optional.d: Likewise.
	* gas/testsuite/gas/aarch64/pac.d: Likewise.
	* gas/testsuite/gas/aarch64/pan-directive.d: Likewise.
	* gas/testsuite/gas/aarch64/pan.d: Likewise.
	* gas/testsuite/gas/aarch64/rdma-directive.d: Likewise.
	* gas/testsuite/gas/aarch64/rdma.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_g0.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_g0_nc.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_g1.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_hi12.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_lo12-1.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-tlsldm-1.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-tlsldm-page-1.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-tlsldm_lo12_nc-1.d: Likewise.
	* gas/testsuite/gas/aarch64/shifted.d: Likewise.
	* gas/testsuite/gas/aarch64/sve.d: Likewise.
	* gas/testsuite/gas/aarch64/symbol.d: Likewise.
	* gas/testsuite/gas/aarch64/sysreg-1.d: Likewise.
	* gas/testsuite/gas/aarch64/sysreg-2.d: Likewise.
	* gas/testsuite/gas/aarch64/sysreg-3.d: Likewise.
	* gas/testsuite/gas/aarch64/sysreg.d: Likewise.
	* gas/testsuite/gas/aarch64/system-2.d: Likewise.
	* gas/testsuite/gas/aarch64/system-3.d: Likewise.
	* gas/testsuite/gas/aarch64/system.d: Likewise.
	* gas/testsuite/gas/aarch64/tbz_1.d: Likewise.
	* gas/testsuite/gas/aarch64/tlbi_op.d: Likewise.
	* gas/testsuite/gas/aarch64/tls.d: Likewise.
	* gas/testsuite/gas/aarch64/uao-directive.d: Likewise.
	* gas/testsuite/gas/aarch64/uao.d: Likewise.
	* gas/testsuite/gas/aarch64/virthostext-directive.d: Likewise.
	* gas/testsuite/gas/aarch64/virthostext.d: Likewise.
	* gas/testsuite/gas/aarch64/adr_1.d: Restrict test under -mabi=lp64.
	* gas/testsuite/gas/aarch64/int-insns.d: Likewise.
	* gas/testsuite/gas/aarch64/programmer-friendly.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-data.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_g1_nc.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_g2.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst16.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst32.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst64.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_lo12-ldst8.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst16.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst32.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst64.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-dtprel_lo12_nc-ldst8.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-gotoff_g0_nc.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-gotoff_g1.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-gottprel_g0_nc.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-gottprel_g1.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-insn.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-tlsdesc_off_g0_nc.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-tlsdesc_off_g1.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-tlsgd_g0_nc.d: Likewise.
	* gas/testsuite/gas/aarch64/reloc-tlsgd_g1.d: Likewise.
	* gas/testsuite/gas/aarch64/tail_padding.d: Likewise.
	* gas/testsuite/gas/aarch64/tls-desc.d: Likewise.
2016-12-13 12:46:35 +00:00
Maciej W. Rozycki 64c1118340 MIPS16: Remove unused `>' operand code
This code has never been used throughout the repository history, and
likely not before either, as due to the assymetry of MIPS16 instruction
set encoding there are no 32-bit shift operations having their immediate
shift count placed in the position of the usual `rx' instruction field.

	gas/
	* config/tc-mips.c (mips16_macro_build) <'>'>: Remove case.

	include/
	* opcode/mips.h: Remove references to `>' operand code.

	opcodes/
	* mips16-opc.c (decode_mips16_operand) <'>'>: Remove cases.
2016-12-09 23:21:40 +00:00
Maciej W. Rozycki f17ecb4bac MIPS16/opcodes: Use hexadecimal interpretation for the `e' operand code
Make the `e' operand code used with raw EXTEND instructions use the
hexadecimal rather than decimal format, for consistency with what is
actually produced by code in `print_insn_mips16' dedicated to EXTEND
disassembly.  Due to that special handling the operand code is only
interpreted for assembly however, which accepts either format either
way, so there is no functional change here.

	opcodes/
	* mips16-opc.c (decode_mips16_operand) <'e'>: Use HINT rather
	than UINT.

	gas/
	* testsuite/gas/mips/mips16-extend.d: New test.
	* testsuite/gas/mips/mips16-extend.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new test.
2016-12-09 23:19:52 +00:00
Maciej W. Rozycki 731f7c4ea3 ARC/GAS: Correct a `spaces' global shadowing error
Fix a commit a9752fdf83 ("[ARC] Sync cpu names with the ones accepted
by GCC.") build regression:

cc1: warnings being treated as errors
.../gas/config/tc-arc.c: In function 'arc_show_cpu_list':
.../gas/config/tc-arc.c:3452: error: declaration of 'spaces' shadows a global declaration
.../gas/../include/libiberty.h:248: error: shadowed declaration is here
make[4]: *** [tc-arc.o] Error 1

in a way following commit 91d6fa6a03 ("Add -Wshadow to the gcc command
line options used when compiling the binutils.").

	gas/
	* config/tc-arc.c (arc_show_cpu_list): Rename `spaces' local
	variable to `space_buf'.
2016-12-08 23:24:05 +00:00
Maciej W. Rozycki bf355b690f ARM/GAS: Correct an `index' global shadowing error
Fix a commit 008a97eff0 ("[GAS][ARM]Generate unpredictable warning for
pc used in data processing instructions with register-shifted register
operand.") build regression:

cc1: warnings being treated as errors
.../gas/config/tc-arm.c: In function 'encode_arm_shift':
.../gas/config/tc-arm.c:7439: error: declaration of 'index' shadows a global declaration
/usr/include/string.h:303: error: shadowed declaration is here
make[4]: *** [tc-arm.o] Error 1

in a way following commit 91d6fa6a03 ("Add -Wshadow to the gcc command
line options used when compiling the binutils.").

	gas/
	* config/tc-arm.c (encode_arm_shift): Rename `index' local
	variable to `op_index'.
2016-12-08 23:22:54 +00:00
Alan Modra da17fe9de9 sync binutils config/ with gcc
config/
	* acx.m4: Import from gcc.
	* bootstrap-asan.mk: Likewise.
	* multi.m4: Likewise.
/
	* configure: Regnerate.
gas/
	* configure: Regnerate.
ld/
	* configure: Regnerate.
libiberty/
	* configure: Regnerate.
zlib/
	* configure: Regnerate.
2016-12-08 21:35:11 +10:30
Maciej W. Rozycki be0fcbee1d MIPS/GAS: Use local `isa' consistently in `is_opcode_valid'
Replace a global `mips_opts.isa' reference in `is_opcode_valid' and use
a local copy just made in `isa'.  No functional change.

	gas/
	* config/tc-mips.c (is_opcode_valid): Use local `isa'
	consistently.
2016-12-07 12:24:39 +00:00
Nick Clifton 5eecd8621b fix typo 2016-12-06 15:34:33 +00:00
Nick Clifton 005304aae3 Stop the assembler from running out of memory when asked to generate a huge number of spaces.
PR gas/20901
	* read.c (s_space): Place an upper limit on the number of spaces
	generated.
2016-12-06 15:31:14 +00:00
Nick Clifton 5e359a63b7 Fix mmix assembler test to account for changes in the error messages produced by the assembler.
PR gas/20896
	* testsuite/gas/mmix/err-byte1.s: Adjust expected warning messages
	to account for patch to next_char_of_string.
2016-12-06 14:13:57 +00:00
Nick Clifton f49547a604 Fix fault in assembler when passed a bogus input file.
PR gas/20902
	* read.c (next_char_of_string): Do end advance past the end of the
	buffer.
2016-12-05 17:36:45 +00:00
Nick Clifton 14c1428b29 Fix ICE in assembler when passed a bogus input file.
PR gas/20904
	* as.h (SKIP_ALL_WHITESPACE): New macro.
	* expr.c (operand): Use it.
2016-12-05 16:54:59 +00:00
Szabolcs Nagy c28eeff2ea [ARM] Add ARMv8.3 VCMLA and VCADD instructions
Add support for VCMLA and VCADD advanced SIMD complex number instructions.

The command line option is -march=armv8.3-a+fp16+simd for enabling all
instructions.

In arm-dis.c the formatting syntax was abused a bit to select between
0 vs 90 or 180 vs 270 or 90 vs 270 based on a bit value instead of
duplicating entries in the opcode table.

gas/
	* config/tc-arm.c (do_vcmla, do_vcadd): Define.
	(neon_scalar_for_vcmla): Define.
	(enum operand_parse_code): Add OP_IROT1 and OP_IROT2.
	(NEON_ENC_TAB): Add DDSI and QQSI variants.
	(insns): Add vcmla and vcadd.
	* testsuite/gas/arm/armv8_3-a-simd.d: New.
	* testsuite/gas/arm/armv8_3-a-simd.s: New.
	* testsuite/gas/arm/armv8_3-a-simd-bad.d: New.
	* testsuite/gas/arm/armv8_3-a-simd-bad.l: New.
	* testsuite/gas/arm/armv8_3-a-simd-bad.s: New.

opcodes/
	* arm-dis.c (coprocessor_opcodes): Add vcmla and vcadd.
	(print_insn_coprocessor): Add 'V' format for neon D or Q regs.
2016-12-05 14:24:17 +00:00
Claudiu Zissulescu 0691188992 [ARC] Don't check extAuxRegister second argument for sign.
gas/
2016-12-05  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/textauxregister-1.d: New file.
	* testsuite/gas/arc/textauxregister-1.s: Likewise.
	* testsuite/gas/arc/textcondcode-err.s: Likewise.
	* testsuite/gas/arc/textcoreregister-err.s: Likewise.
	* config/tc-arc.c (tokenize_extregister): Return bfd_boolean,
	don't check second argument of extension auxiliary register for
	signess.
	(arc_extcorereg): Consider the return of tokenize_extregister
	function call.
2016-12-05 15:16:28 +01:00
Szabolcs Nagy 49e8a72582 [ARM] Add ARMv8.3 VJCVT instruction
Add support for VJCVT javascript conversion instruction.

gas/
	* config/tc-arm.c (arm_ext_v8_3, do_vjcvt): Define.
	(insns): Add vjcvt.
	* testsuite/gas/aarch64/armv8_3-a-fp.s: New.
	* testsuite/gas/aarch64/armv8_3-a-fp.d: New.
	* testsuite/gas/aarch64/armv8_3-a-fp-bad.s: New.
	* testsuite/gas/aarch64/armv8_3-a-fp-bad.d: New.
	* testsuite/gas/aarch64/armv8_3-a-fp-bad.l: New.

opcodes/
	* arm-dis.c (coprocessor_opcodes): Add vjcvt.
2016-12-05 14:13:27 +00:00
Szabolcs Nagy a12fd8e1b1 [ARM] Add ARMv8.3 command line option and feature flag
ARMv8.3 is an architectural extension of ARMv8.  Add the
feature macro and -march=armv8.3-a gas command line option
for the ARM target.

https://community.arm.com/groups/processors/blog/2016/10/27/armv8-a-architecture-2016-additions

gas/
	* config/tc-arm.c (arm_archs): Add "armv8.3-a".
	* doc/c-arm.texi (-march): Add "armv8.3-a".

include/
	* opcode/arm.h (ARM_EXT2_V8_3A, ARM_AEXT2_V8_3A): New.
	(ARM_ARCH_V8_3A): New.
2016-12-05 14:07:25 +00:00
Claudiu Zissulescu a9752fdf83 [ARC] Sync cpu names with the ones accepted by GCC.
gas/
2016-12-02  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/cpu-em-err.s: New file.
	* testsuite/gas/arc/cpu-em4-err.s: Likewise.
	* testsuite/gas/arc/cpu-fpuda-err.s: Likewise.
	* testsuite/gas/arc/cpu-hs-err.s: Likewise.
	* testsuite/gas/arc/cpu-quarkse-err.s: Likewise.
	* testsuite/gas/arc/noargs_a7.s: Add .cpu.
	* config/tc-arc.c (ARC_CPU_TYPE_A6xx): Define.
	(ARC_CPU_TYPE_A7xx): Likewise.
	(ARC_CPU_TYPE_AV2EM): Likewise.
	(ARC_CPU_TYPE_AV2HS): Likewise.
	(cpu_types): Update list of known CPU names.
	(arc_show_cpu_list): New function.
	(md_show_usage): Print accepted CPU names.
	(cl_features): New variable.
	(arc_select_cpu): Use cl_features.
	(arc_option): Allow various .cpu names.
	(md_parse_option): Set cl_features.
	* doc/c-arc.texi: Update -mcpu and .cpu documentation.
2016-12-02 16:30:00 +01:00
Josh Conner d5451cd453 Add support for Fushia OS.
* configure.ac: Add fuchsia to targets that use ELF.
        * configure: Regenerated.

bfd     * configure.tgt: Add support for fuchsia (OS).

gas     * configure.tgt: Add support for fuchsia (OS).

ld      * Makefile.am: Add dependency information for earmelf_fuchsia.c.
        * Makefile.in: Regenerate.
        * configure.tgt: Add support for aarch64-*-fuchsia, arm*-*-fuchsia*, and
        x86_64-*-fuchsia* targets.
        * emulparams/armelf_fuchsia.sh: New file.
        * emulparams/armelfb_fuchsia.sh: New file.
2016-12-02 10:44:29 +00:00
Nick Clifton 69ace22001 Fix seg fault attempting to unget an EOF character.
PR gas/20898
	* app.c (do_scrub_chars): Do not attempt to unget EOF.
2016-12-01 15:20:19 +00:00
Nick Clifton 4cbd84083e Fix seg-fault printing assembler statistics when the output file was not created.
PR gas/20897
	* subsegs.c (subsegs_print_statistics): Do nothing if no output
	file was created.
2016-12-01 15:02:45 +00:00
Nick Clifton 6d6ad65b43 Fix ICE in assembler when passed a corrupt input file.
PR gas/20895
	* symbols.c (resolve_symbol_value): Gracefully handle erroneous
	symbolic expressions.
2016-12-01 10:38:40 +00:00
Claudiu Zissulescu abe7c33b45 [ARC] Add checking for LP_COUNT reg usage, improve error reporting.
gas/
2016-11-29  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (find_opcode_match): New function argument
	errmsg.
	(assemble_tokens): Collect and report the eventual error message
	found during opcode matching process.
	* testsuite/gas/arc/lpcount-err.s: New file.
	* testsuite/gas/arc/add_s-err.s: Update error message.

opcode/
2016-11-29  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-opc.c (insert_ra_chk): New function.
	(insert_rb_chk): Likewise.
	(insert_rad): Update text error message.
	(insert_rcd): Likewise.
	(insert_rhv2): Likewise.
	(insert_r0): Likewise.
	(insert_r1): Likewise.
	(insert_r2): Likewise.
	(insert_r3): Likewise.
	(insert_sp): Likewise.
	(insert_gp): Likewise.
	(insert_pcl): Likewise.
	(insert_blink): Likewise.
	(insert_ilink1): Likewise.
	(insert_ilink2): Likewise.
	(insert_ras): Likewise.
	(insert_rbs): Likewise.
	(insert_rcs): Likewise.
	(insert_simm3s): Likewise.
	(insert_rrange): Likewise.
	(insert_fpel): Likewise.
	(insert_blinkel): Likewise.
	(insert_pcel): Likewise.
	(insert_nps_3bit_dst): Likewise.
	(insert_nps_3bit_dst_short): Likewise.
	(insert_nps_3bit_src2_short): Likewise.
	(insert_nps_bitop_size_2b): Likewise.
	(MAKE_SRC_POS_INSERT_EXTRACT_FUNCS): Likewise.
	(RA_CHK): Define.
	(RB): Adjust.
	(RB_CHK): Define.
	(RC): Adjust.
	* arc-dis.c (print_insn_arc): Add LOAD and STORE class.
	* arc-tbl.h (div, divu): All instructions are DIVREM class.
	Change first insn argument to check for LP_COUNT usage.
	(rem): Likewise.
	(ld, ldd): All instructions are LOAD class.  Change first insn
	argument to check for LP_COUNT usage.
	(st, std): All instructions are STORE class.
	(mac, mpy, dmac, mul, dmpy): All instructions are MPY class.
	Change first insn argument to check for LP_COUNT usage.
	(mov): All instructions are MOVE class.  Change first insn
	argument to check for LP_COUNT usage.

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

	* opcode/arc.h (insn_class_t): Add DIVREM, LOAD, MOVE, MPY, STORE
	instruction classes.
2016-11-29 11:29:18 +01:00
Amit Pawar abfcb414b9 X86: Ignore REX_B bit for 32-bit XOP instructions
While decoding 32-bit XOP instructions, 64 bit registers names are printed.
This patch fixes this by ignoring REX_B bit in 32-bit mode.

opcodes/

	PR binutils/20637
	* i386-dis.c (get_valid_dis386): Ignore REX_B for 32-bit XOP
	instructions.

gas/

	PR binutils/20637
	* testsuite/gas/i386/xop32reg.d: New file.
	* testsuite/gas/i386/xop32reg.s: New file.
	* testsuite/gas/i386/i386.exp: Run new test.
2016-11-28 09:21:05 -08:00
Ambrogino Modigliani a582903f51 Fix spelling in comments in .y files (binutils)
* arparse.y: Fix spelling in comments.
2016-11-27 20:19:31 +10:30
Ambrogino Modigliani 8f02b5ad62 Fix spelling in comments in .l files (gas)
* config/bfin-lex.l: Fix spelling in comments.
2016-11-27 20:19:12 +10:30
Ambrogino Modigliani c29ae970e7 Fix spelling in comments in Expect scripts (gas)
* testsuite/gas/all/gas.exp: Fix spelling in comments.
	* testsuite/gas/cris/cris.exp: Fix spelling in comments.
	* testsuite/gas/hppa/basic/basic.exp: Fix spelling in comments.
	* testsuite/gas/hppa/parse/parse.exp: Fix spelling in comments.
	* testsuite/gas/hppa/reloc/reloc.exp: Fix spelling in comments.
	* testsuite/gas/sh/arch/arch.exp: Fix spelling in comments.
	* testsuite/gas/tic4x/tic4x.exp: Fix spelling in comments.
2016-11-27 15:08:06 +10:30
Ambrogino Modigliani a40d0312ad Fix spelling in comments in Assembler files (gas)
* testsuite/gas/arm/local_function.d: Fix spelling in comments.
	* testsuite/gas/arm/req.s: Fix spelling in comments.
	* testsuite/gas/arm/vfp1.s: Fix spelling in comments.
	* testsuite/gas/arm/vfp1_t2.s: Fix spelling in comments.
	* testsuite/gas/arm/vfp1xD.s: Fix spelling in comments.
	* testsuite/gas/arm/vfp1xD_t2.s: Fix spelling in comments.
	* testsuite/gas/mcore/allinsn.s: Fix spelling in comments.
	* testsuite/gas/mips/24k-triple-stores-5.s: Fix spelling in comments.
	* testsuite/gas/mips/delay.d: Fix spelling in comments.
	* testsuite/gas/mips/nodelay.d: Fix spelling in comments.
	* testsuite/gas/mips/r5900-full.s: Fix spelling in comments.
	* testsuite/gas/mips/r5900.s: Fix spelling in comments.
2016-11-27 15:06:43 +10:30
Ambrogino Modigliani 2b0f37619f Fix spelling in comments in C source files (gas)
* as.h: Fix spelling in comments.
	* config/obj-ecoff.c: Fix spelling in comments.
	* config/obj-macho.c: Fix spelling in comments.
	* config/tc-aarch64.c: Fix spelling in comments.
	* config/tc-arc.c: Fix spelling in comments.
	* config/tc-arm.c: Fix spelling in comments.
	* config/tc-avr.c: Fix spelling in comments.
	* config/tc-cr16.c: Fix spelling in comments.
	* config/tc-epiphany.c: Fix spelling in comments.
	* config/tc-frv.c: Fix spelling in comments.
	* config/tc-hppa.c: Fix spelling in comments.
	* config/tc-hppa.h: Fix spelling in comments.
	* config/tc-i370.c: Fix spelling in comments.
	* config/tc-m68hc11.c: Fix spelling in comments.
	* config/tc-m68k.c: Fix spelling in comments.
	* config/tc-mcore.c: Fix spelling in comments.
	* config/tc-mep.c: Fix spelling in comments.
	* config/tc-metag.c: Fix spelling in comments.
	* config/tc-mips.c: Fix spelling in comments.
	* config/tc-mn10200.c: Fix spelling in comments.
	* config/tc-mn10300.c: Fix spelling in comments.
	* config/tc-nds32.c: Fix spelling in comments.
	* config/tc-nios2.c: Fix spelling in comments.
	* config/tc-ns32k.c: Fix spelling in comments.
	* config/tc-pdp11.c: Fix spelling in comments.
	* config/tc-ppc.c: Fix spelling in comments.
	* config/tc-riscv.c: Fix spelling in comments.
	* config/tc-rx.c: Fix spelling in comments.
	* config/tc-score.c: Fix spelling in comments.
	* config/tc-score7.c: Fix spelling in comments.
	* config/tc-sparc.c: Fix spelling in comments.
	* config/tc-tic54x.c: Fix spelling in comments.
	* config/tc-vax.c: Fix spelling in comments.
	* config/tc-xgate.h: Fix spelling in comments.
	* config/tc-xtensa.c: Fix spelling in comments.
	* config/tc-z80.c: Fix spelling in comments.
	* dwarf2dbg.c: Fix spelling in comments.
	* input-file.h: Fix spelling in comments.
	* itbl-ops.c: Fix spelling in comments.
	* read.c: Fix spelling in comments.
	* stabs.c: Fix spelling in comments.
	* symbols.c: Fix spelling in comments.
	* write.c: Fix spelling in comments.
	* testsuite/gas/all/itbl-test.c: Fix spelling in comments.
	* testsuite/gas/tic4x/opclasses.h: Fix spelling in comments.
2016-11-27 15:02:09 +10:30
Jose E. Marchesi 65d1cff97c gas: fix CBCOND diagnostics for invalid immediate operands.
This patch fixes two problems in the SPARC assembler:

- The diagnostic message

  Error: Illegal operands: Immediate value in cbcond is out of range.

  is incorrectly issued for non-CBCOND instructions that feature a
  simm5 immediate field, such as MPMUL, MONTMUL, etc.

- When an invalid immediate operand is used in a CBCOND
  instruction, two redundant error messages are issued to the
  user, the second due to a stale fixup (this happens since
  commit 85024cd8bc).

Some diagnostic tests for the CBCOND instructions are also
included in the patch.

Tested in both sparc64-linux-gnu and sparcv9-linux-gnu targets.

gas/ChangeLog:

2016-11-25  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-sparc.c (sparc_ip): Avoid emitting a cbcond error
	messages for non-cbcond instructions.
	* testsuite/gas/sparc/cbcond-diag.s: New file.
	* testsuite/gas/sparc/cbcond-diag.l: Likewise.
	* testsuite/gas/sparc/sparc.exp (gas_64_check): Run cbcond-diag tests.
2016-11-25 03:40:15 -08:00
Jose E. Marchesi 128e85e3ab gas: run the hwcaps-bump tests with 64-bit sparc objects only.
gas/ChangeLog:

2016-11-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* testsuite/gas/sparc/sparc.exp (gas_64_check): Make sure the
	hwcaps-bump test is run with 64-bit objects.
2016-11-23 03:04:17 -08:00
Kuan-Lin Chen 073808edb7 RISCV/GAS Add missing break in md_apply_fix.
gdb/ChangeLog:
	* config/tc-riscv.c: Add missing break.
2016-11-23 16:31:07 +08:00
Alan Modra 3ae0486cdc Regen POTFILES.in
bfd/
	* po/BLD-POTFILES.in: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
gas/
	* po/POTFILES.in: Regenerate.
2016-11-23 15:06:10 +10:30
Ambrogino Modigliani 96fe45624e Fix spelling mistakes in comments in configure scripts
All changes are limited to comments, and no run-time behavior is
affected.

bfd/ChangeLog:
2016-11-22  Ambrogino Modigliani  <ambrogino.modigliani@gmail.com>

        * warning.m4: Fix spelling in comments.
        * configure.ac: Fix spelling in comments.
        * configure: Regenerate.

binutils/ChangeLog:
2016-11-22  Ambrogino Modigliani  <ambrogino.modigliani@gmail.com>

        * configure: Regenerate.

gdb/ChangeLog:
2016-11-22  Ambrogino Modigliani  <ambrogino.modigliani@gmail.com>

        * configure.ac: Fix spelling in comments.
        * configure: Regenerate.

gas/ChangeLog:
2016-11-22  Ambrogino Modigliani  <ambrogino.modigliani@gmail.com>

        * configure: Regenerate.

gold/ChangeLog:
2016-11-22  Ambrogino Modigliani  <ambrogino.modigliani@gmail.com>

        * configure: Regenerate.

gprof/ChangeLog:
2016-11-22  Ambrogino Modigliani  <ambrogino.modigliani@gmail.com>

        * configure: Regenerate.

ld/ChangeLog:
2016-11-22  Ambrogino Modigliani  <ambrogino.modigliani@gmail.com>

        * configure: Regenerate.

opcodes/ChangeLog:
2016-11-22  Ambrogino Modigliani  <ambrogino.modigliani@gmail.com>

        * configure: Regenerate.
2016-11-22 15:43:03 +00:00
Jose E. Marchesi 6884417a0f gas,opcodes: fix hardware capabilities bumping in the sparc assembler.
When the assembler finds an instruction which is part of a higher
opcode architecture it bumps the current opcode architecture.  For
example:

   $ echo "mwait" | as -bump
   {standard input}: Assembler messages:
   {standard input}:1: Warning: architecture bumped from "v6" to "v9m" on "mwait"

However, when two instructions pertaining to the same opcode
architecture but associated to different SPARC hardware capabilities
are found in the input stream, and no GAS architecture is specified in
the command line, the assembler bangs:

   $ echo "mwait; wr %g0,%g1,%mcdper" | as -bump
   {standard input}: Assembler messages:
   {standard input}:1: Warning: architecture bumped from "v6" to "v9m" on "mwait"
   {standard input}:1: Error: Hardware capability "sparc5" not enabled for "wr".

... and it should'nt, as WRMCDPER pertains to the same architecture
level than MWAIT.

This patch fixes this by extending the definition of sparc opcode
architectures to contain a set of hardware capabilities and making the
assembler to take these capabilities into account when updating the
set of allowed hwcaps when an architecture bump is triggered by some
instruction.

This way, hwcaps associated to architecture levels are maintained in
opcodes, while the assembler keeps the flexibiity of defining GAS
architectures including additional hwcaps (like -Asparcfmaf or the
v8plus* variants).

A test covering this failure case is included.

gas/ChangeLog:

2016-11-22  Jose E. Marchesi  <jose.marchesi@oracle.com>

       	* config/tc-sparc.c: Move HWS_* and HWS2_* definitions to
       	opcodes/sparc-opc.c.
       	(sparc_arch): Clarify the new role of the hwcap_allowed and
       	hwcap2_allowed fields.
       	(sparc_arch_table): Remove HWS_* and HWS2_* instances from
       	hwcap_allowed and hwcap2_allowed respectively.
       	(md_parse_option): Include the opcode arch hwcaps when processing
       	-A.
       	(sparc_ip): Use the current opcode arch hwcaps to update
       	hwcap_allowed, as well of the hwcaps of the instruction triggering
       	the bump.
       	* testsuite/gas/sparc/hwcaps-bump.s: New file.
       	* testsuite/gas/sparc/hwcaps-bump.l: Likewise.
       	* testsuite/gas/sparc/sparc.exp (gas_64_check): Run tests in
       	hwcaps-bump.

include/ChangeLog:

2016-11-22  Jose E. Marchesi  <jose.marchesi@oracle.com>

       	* opcode/sparc.h (sparc_opcode_arch): New fields hwcaps and
       	hwcaps2.

opcodes/ChangeLog:

2016-11-22  Jose E. Marchesi  <jose.marchesi@oracle.com>

       	* sparc-opc.c (HWS_V8): Definition moved from
       	gas/config/tc-sparc.c.
       	(HWS_V9): Likewise.
       	(HWS_VA): Likewise.
       	(HWS_VB): Likewise.
       	(HWS_VC): Likewise.
       	(HWS_VD): Likewise.
       	(HWS_VE): Likewise.
       	(HWS_VV): Likewise.
       	(HWS_VM): Likewise.
       	(HWS2_VM): Likewise.
       	(sparc_opcode_archs): Initialize hwcaps and hwcaps2 fields of
       	existing entries.
2016-11-22 04:40:37 -08:00
Claudiu Zissulescu c4b943d7ae [ARC] Fix printing 'b' mnemonics.
gas/
2016-11-22  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/b.d: Update test result.

opcode/
2016-11-22  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-tbl.h: Reorder conditional flags with delay flags for 'b'
	instructions.
2016-11-22 12:34:51 +01:00
Alan Modra 08dc996fed PR20744, Incorrect PowerPC VLE relocs
VLE 16A and 16D relocs were functionally swapped.

	PR 20744
include/
	* opcode/ppc.h: Define VLE insns using 16A and 16D relocs.
bfd/
	* elf32-ppc.h (struct ppc_elf_params): Add vle_reloc_fixup field.
	* elf32-ppc.c: Include opcode/ppc.h.
	(ppc_elf_howto_raw): Correct dst_mask for R_PPC_VLE_LO16A,
	R_PPC_VLE_LO16D, R_PPC_VLE_HI16A, R_PPC_VLE_HI16D, R_PPC_VLE_HA16A,
	R_PPC_VLE_HA16D, R_PPC_VLE_SDAREL_LO16A, R_PPC_VLE_SDAREL_LO16D,
	R_PPC_VLE_SDAREL_HI16A, R_PPC_VLE_SDAREL_HI16D,
	R_PPC_VLE_SDAREL_HA16A, and R_PPC_VLE_SDAREL_HA16D relocs.
	(ppc_elf_link_hash_table_create): Update default_params init.
	(ppc_elf_vle_split16): Correct shift and mask.  Add params.
	Report or fix insn/reloc mismatches.
	(ppc_elf_relocate_section): Pass input_section, offset and fixup
	to ppc_elf_vle_split16.
binutils/
	* NEWS: Mention PowerPC VLE relocation error.
gas/
	* config/tc-ppc.c: Delete VLE insn defines.
	(md_assemble): Swap use_a_reloc and use_d_reloc.
	* testsuite/gas/ppc/vle-reloc.d: Update.
ld/
	* emultempl/ppc32elf.em (params): Update initializer.  Handle
	--vle-reloc-fixup command line arg.
2016-11-22 20:19:29 +10:30
Renlin Li 5689c9424b [GAS][ARM][PR20827]Fix gas error for two register form instruction (pre-UAL syntax).
gas/

2016-11-21  Renlin Li  <renlin.li@arm.com>

	PR gas/20827
	* config/tc-arm.c (encode_arm_shift): Don't assert for operands not
	presented.
	* testsuite/gas/arm/add-shift-two.d: New.
	* testsuite/gas/arm/add-shift-two.s: New.
2016-11-21 12:06:04 +00:00
Alan Modra 2d7f2507d4 Use ACX_PROG_CMP_IGNORE_INITIAL in gas
* configure.ac: Invoke ACX_PROG_CMP_IGNORE_INITIAL.
	* Makefile.am (comparison): Rewrite using do_compare.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
2016-11-21 21:12:37 +10:30
Claudiu Zissulescu bb050a6932 [ARC] Fix and extend features of .cpu directive.
gas/
2016-11-18  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/cl-warn.s: New file.
	* testsuite/gas/arc/cpu-pseudop-1.d: Likewise.
	* testsuite/gas/arc/cpu-pseudop-1.s: Likewise.
	* testsuite/gas/arc/cpu-pseudop-2.d: Likewise.
	* testsuite/gas/arc/cpu-pseudop-2.s: Likewise.
	* testsuite/gas/arc/cpu-warn2.s: Likewise.
	* config/tc-arc.c (selected_cpu): Initialize.
	(feature_type): New struct.
	(feature_list): New variable.
	(arc_check_feature): New function.
	(arc_select_cpu): Check for .cpu duplicates. Don't overwrite the
	current cpu features. Check if a feature is available for a given
	cpu.
	(md_parse_option): Test if features are available for a given cpu.
2016-11-18 14:29:48 +01:00
Szabolcs Nagy c2c4ff8d52 [AArch64] Add ARMv8.3 FCMLA and FCADD instructions
Add support for FCMLA and FCADD complex arithmetic SIMD instructions.
FCMLA has an indexed element variant where the index range has to be
treated specially because a complex number takes two elements and the
indexed vector size depends on the other operands.

These complex number SIMD instructions are part of ARMv8.3
https://community.arm.com/groups/processors/blog/2016/10/27/armv8-a-architecture-2016-additions

include/
2016-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* opcode/aarch64.h (enum aarch64_opnd): Add AARCH64_OPND_IMM_ROT1,
	AARCH64_OPND_IMM_ROT2, AARCH64_OPND_IMM_ROT3.
	(enum aarch64_op): Add OP_FCMLA_ELEM.

opcodes/
2016-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* aarch64-tbl.h (QL_V3SAMEHSD_ROT, QL_ELEMENT_ROT): Define.
	(aarch64_feature_simd_v8_3, SIMD_V8_3): Define.
	(aarch64_opcode_table): Add fcmla and fcadd.
	(AARCH64_OPERANDS): Add IMM_ROT{1,2,3}.
	* aarch64-asm.h (aarch64_ins_imm_rotate): Declare.
	* aarch64-asm.c (aarch64_ins_imm_rotate): Define.
	* aarch64-dis.h (aarch64_ext_imm_rotate): Declare.
	* aarch64-dis.c (aarch64_ext_imm_rotate): Define.
	* aarch64-opc.h (enum aarch64_field_kind): Add FLD_rotate{1,2,3}.
	* aarch64-opc.c (fields): Add FLD_rotate{1,2,3}.
	(operand_general_constraint_met_p): Rotate and index range check.
	(aarch64_print_operand): Handle rotate operand.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Likewise.
	* aarch64-opc-2.c: Likewise.

gas/
2016-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config/tc-aarch64.c (parse_operands): Handle AARCH64_OPND_IMM_ROT*.
	* testsuite/gas/aarch64/advsimd-armv8_3.d: New.
	* testsuite/gas/aarch64/advsimd-armv8_3.s: New.
	* testsuite/gas/aarch64/illegal-fcmla.s: New.
	* testsuite/gas/aarch64/illegal-fcmla.l: New.
	* testsuite/gas/aarch64/illegal-fcmla.d: New.
2016-11-18 10:02:16 +00:00
Szabolcs Nagy 28617675c2 [AArch64] Add ARMv8.3 weaker release consistency load instructions
Add support for ARMv8.3 LDAPRB, LDAPRH and LDAPR weak release
consistency load instructions. (They are equivalent to LDARB,
LDARH and LDAR instructions other than the weaker memory ordering
requirement.)

For more details about weak release consistency see
https://community.arm.com/groups/processors/blog/2016/10/27/armv8-a-architecture-2016-additions

opcodes/
2016-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* aarch64-tbl.h (arch64_opcode_table): Add ldaprb, ldaprh, ldapr.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Regenerate.
	* aarch64-opc-2.c: Regenerate.

gas/
2016-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* testsuite/gas/aarch64/ldst-exclusive-armv8_3.s: Add ldaprb, ldaprh, ldapr tests.
	* testsuite/gas/aarch64/ldst-exclusive-armv8_3.d: Likewise.
	* testsuite/gas/aarch64/illegal-ldapr.s: Likewise.
	* testsuite/gas/aarch64/illegal-ldapr.d: Likewise.
	* testsuite/gas/aarch64/illegal-ldapr.l: Likewise.
2016-11-18 09:58:38 +00:00
Szabolcs Nagy ccfc90a39b [AArch64] Add ARMv8.3 javascript floating-point conversion instruction
Add support for ARMv8.3 FJCVTZS floating-point conversion
instruction.

For details about javascript floating-point conversion see
https://community.arm.com/groups/processors/blog/2016/10/27/armv8-a-architecture-2016-additions

opcodes/
2016-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* aarch64-tbl.h (arch64_opcode_table): Add fjcvtzs.
	(QL_FP2INT_W_D, aarch64_feature_fp_v8_3, FP_V8_3): Define.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Regenerate.
	* aarch64-opc-2.c: Regenerate.

gas/
2016-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* testsuite/gas/aarch64/fp-armv8_3.s: Add fjcvtzs test.
	* testsuite/gas/aarch64/fp-armv8_3.d: Likewise.
	* testsuite/gas/aarch64/illegal-fjcvtzs.s: Likewise.
	* testsuite/gas/aarch64/illegal-fjcvtzs.d: Likewise.
	* testsuite/gas/aarch64/illegal-fjcvtzs.l: Likewise.
	* testsuite/gas/aarch64/illegal-nofp-armv8_3.s: Likewise.
	* testsuite/gas/aarch64/illegal-nofp-armv8_3.d: Likewise.
	* testsuite/gas/aarch64/illegal-nofp-armv8_3.l: Likewise.
2016-11-18 09:53:45 +00:00
Szabolcs Nagy 3f06e55061 [AArch64] Add ARMv8.3 combined pointer authentication load instructions
Add support for ARMv8.3 LDRAA and LDRAB combined pointer authentication and
load instructions.

These instructions authenticate the base register and load 8 byte from it plus
a scaled 10-bit offset with optional writeback to update the base register.

A new instruction class (ldst_imm10) and operand type (AARCH64_OPND_ADDR_SIMM10)
were introduced to handle the special addressing form.

include/
2016-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* opcode/aarch64.h (enum aarch64_opnd): Add AARCH64_OPND_ADDR_SIMM10.
	(enum aarch64_insn_class): Add ldst_imm10.

opcodes/
2016-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* aarch64-tbl.h (QL_X1NIL): New.
	(arch64_opcode_table): Add ldraa, ldrab.
	(AARCH64_OPERANDS): Add "ADDR_SIMM10".
	* aarch64-asm.h (aarch64_ins_addr_simm10): Declare.
	* aarch64-asm.c (aarch64_ins_addr_simm10): Define.
	* aarch64-dis.h (aarch64_ext_addr_simm10): Declare.
	* aarch64-dis.c (aarch64_ext_addr_simm10): Define.
	* aarch64-opc.h (enum aarch64_field_kind): Add FLD_S_simm10.
	* aarch64-opc.c (fields): Add data for FLD_S_simm10.
	(operand_general_constraint_met_p): Handle AARCH64_OPND_ADDR_SIMM10.
	(aarch64_print_operand): Likewise.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Regenerate.
	* aarch64-opc-2.c: Regenerate.

gas/
2016-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config/tc-aarch64.c (parse_operands): Handle AARCH64_OPND_ADDR_SIMM10.
	(fix_insn): Likewise.
	(warn_unpredictable_ldst): Handle ldst_imm10.
	* testsuite/gas/aarch64/pac.s: Add ldraa and ldrab tests.
	* testsuite/gas/aarch64/pac.d: Likewise.
	* testsuite/gas/aarch64/illegal-ldraa.s: New.
	* testsuite/gas/aarch64/illegal-ldraa.l: New.
	* testsuite/gas/aarch64/illegal-ldraa.d: New.
2016-11-18 09:49:06 +00:00
Nick Clifton 93ca393659 Fix SPARC relocations generated for the .eh_frame section.
PR gas/20803
	* config/tc-sparc.c (cons_fix_new_sparc): Use unaligned relocs in
	the .eh_frame section.
2016-11-15 15:41:27 +00:00
Anthony Green b612f4193c add missing ChangeLog entry 2016-11-13 08:11:44 -05:00
Anthony Green 3f47df7fb3 Assemble 'bad' moxie instruction 2016-11-13 07:37:02 -05:00
Nick Clifton 86b80085c8 Accept L and LL suffixes to integer constants.
PR gas/20732
	* expr.c (integer_constant): If tc_allow_L_suffix is defined and
	non-zero then accept a L or LL suffix.
	* testsuite/gas/sparc/pr20732.d: New test source file.
	* testsuite/gas/sparc/pr20732.d: New test output file.
	* testsuite/gas/sparc/sparc.exp: Run new test.
2016-11-11 15:13:07 +00:00
Szabolcs Nagy 74f5402d08 [AArch64] Add ARMv8.3 combined pointer authentication branch instructions
Add support for ARMv8.3 pointer authentication instructions
that are encoded as unconditional branch instructions.

opcodes/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* aarch64-tbl.h (arch64_opcode_table): Add braa, brab, blraa, blrab, braaz,
	brabz, blraaz, blrabz, retaa, retab, eretaa, eretab.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Regenerate.
	* aarch64-opc-2.c: Regenerate.

gas/
2016-11-08  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* testsuite/gas/aarch64/pac.s: Add ARMv8.3 branch instruction tests.
	* testsuite/gas/aarch64/pac.d: Likewise.
2016-11-11 10:43:15 +00:00
Szabolcs Nagy c84364ece4 [AArch64] Add ARMv8.3 PACGA instruction
Add support for the ARMv8.3 PACGA instruction.

include/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* opcode/aarch64.h (enum aarch64_opnd): Add AARCH64_OPND_Rm_SP.

opcodes/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* aarch64-tbl.h (arch64_opcode_table): Add pacga.
	(AARCH64_OPERANDS): Add Rm_SP.
	* aarch64-opc.c (aarch64_print_operand): Handle AARCH64_OPND_Rm_SP.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Regenerate.
	* aarch64-opc-2.c: Regenerate.

gas/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config/tc-aarch64.c (process_omitted_operand): Handle AARCH64_OPND_Rm_SP.
	(parse_operands): Likewise.
	* testsuite/gas/aarch64/pac.s: Add pacga.
	* testsuite/gas/aarch64/pac.d: Add pacga.
2016-11-11 10:39:46 +00:00
Szabolcs Nagy a2cfc830e7 [AArch64] Add ARMv8.3 single source PAC instructions
Add support for ARMv8.3 pointer authentication instructions
that are encoded as single source data processing instructions.

opcodes/
2016-11-08  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* aarch64-tbl.h (arch64_opcode_table): Add pacia, pacib, pacda, pacdb, autia,
	autib, autda, autdb, paciza, pacizb, pacdza, pacdzb, autiza, autizb, autdza,
	autdzb, xpaci, xpacd.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Regenerate.
	* aarch64-opc-2.c: Regenerate.

gas/testsuite/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* testsuite/gas/aarch64/pac.s: New.
	* testsuite/gas/aarch64/pac.d: New.
2016-11-11 10:36:32 +00:00
Szabolcs Nagy b0bfa7b5b8 [AArch64] Add ARMv8.3 pointer authentication key registers
Add support for system registers introduced in ARMv8.3
for pointer authentication.

opcodes/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* aarch64-opc.c (aarch64_sys_regs): Add apiakeylo_el1, apiakeyhi_el1,
	apibkeylo_el1, apibkeyhi_el1, apdakeylo_el1, apdakeyhi_el1,
	apdbkeylo_el1, apdbkeyhi_el1, apgakeylo_el1 and apgakeyhi_el1.
	(aarch64_sys_reg_supported_p): Add feature test for new registers.

gas/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* testsuite/gas/aarch64/sysreg-3.s: New.
	* testsuite/gas/aarch64/sysreg-3.d: New.
	* testsuite/gas/aarch64/illegal-sysreg-3.l: New.
	* testsuite/gas/aarch64/illegal-sysreg-3.d: New.
2016-11-11 10:33:30 +00:00
Szabolcs Nagy 8787d804e1 [AArch64] Add ARMv8.3 instructions which are in the NOP space
This patch adds support for a subset of the ARMv8.3 pointer authentication
instructions: XPACLRI, PACIA1716, PACIB1716, AUTIA1716, AUTIA1716, PACIAZ,
PACIASP, PACIBZ, PACISP, AUTIAZ, AUTIASP, AUTIBZ, AUTIBSP.

These are aliases to HINT #0x7, HINT #0x8, HINT #0xa, HINT #0xc, HINT #0xe,
HINT #0x18, HINT #0x19, ..., HINT #0x1f respectively.

For more details about pointer authentication in ARMv8.3 see
https://community.arm.com/groups/processors/blog/2016/10/27/armv8-a-architecture-2016-additions

opcodes/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* aarch64-tbl.h (aarch64_feature_v8_3, ARMV8_3, V8_3_INSN): New.
	(arch64_opcode_table): Add xpaclri, pacia1716, pacib1716, autia1716,
	autib1716, paciaz, paciasp, pacibz, pacibsp, autiaz, autiasp, autibz,
	autibsp.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Regenerate.

gas/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* testsuite/gas/aarch64/system-3.s: New.
	* testsuite/gas/aarch64/system-3.d: New.
	* testsuite/gas/aarch64/system.d: Update expected output.
2016-11-11 10:29:07 +00:00
Szabolcs Nagy 1924ff7567 [AArch64] Add ARMv8.3 command line option and feature flag
ARMv8.3 can be selected with -march=armv8.3-a command line option.
An overview of the ARMv8.3 architecture extension is at
https://community.arm.com/groups/processors/blog/2016/10/27/armv8-a-architecture-2016-additions

gas/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config/tc-aarch64.c (aarch64_archs): Add "armv8.3-a".
	* doc/c-aarch64.texi (-march): Likewise.

include/
2016-11-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* opcode/aarch64.h (AARCH64_FEATURE_V8_3): Define.
	(AARCH64_ARCH_V8_3): Define.
	(AARCH64_ARCH_V8_1, AARCH64_ARCH_V8_2): Simplify.
2016-11-11 10:20:30 +00:00
Szabolcs Nagy fa09f4ea58 [AArch64] Fix feature dependencies for +simd and +crypto
According to the gas manual, +simd implies +fp and +crypto implies +simd.
Make sure +nofp turns +simd, +crypto and +fp16 off.

gas/
2016-11-07  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config/tc-aarch64.c (aarch64_features): Fix "simd" and "crypto".
	* testsuite/gas/aarch64/illegal-crypto-nofp.d: New.
	* testsuite/gas/aarch64/illegal-crypto-nofp.l: New.
	* testsuite/gas/aarch64/illegal-fp16-nofp.d: New.
	* testsuite/gas/aarch64/illegal-fp16-nofp.l: New.
	* testsuite/gas/aarch64/illegal-fp16-nofp.s: New.
2016-11-11 10:14:31 +00:00
H.J. Lu 60227d64dd X86: Remove the .s suffix from EVEX vpextrw
The .s suffix indicates that the instruction is encoded by swapping
2 register operands.  Since vpextrw takes an XMM register and an
integer register, the .s suffix should be ignored for EVEX vpextrw.

gas/

	PR binutils/20799
	* testsuite/gas/i386/opcode.s: Add a test for EVEX vpextrw.
	* testsuite/gas/i386/opcode-intel.d: Updated.
	* testsuite/gas/i386/opcode-suffix.d: Likewise.
	* testsuite/gas/i386/opcode.d: Likewise.
	* testsuite/gas/i386/x86-64-avx512bw-opts.s: Remove vpextrw
	tests.
	* testsuite/gas/i386/x86-64-avx512bw-opts-intel.d: Updated.
	* testsuite/gas/i386/x86-64-avx512bw-opts.d: Likewise.

opcodes/

	PR binutils/20799
	* i386-dis-evex.h (evex_table): Replace EdqwS with Edqw.
	* i386-dis.c (EdqwS): Removed.
	(dqw_swap_mode): Likewise.
	(intel_operand_size): Don't check dqw_swap_mode.
	(OP_E_register): Likewise.
	(OP_E_memory): Likewise.
	(OP_G): Likewise.
	(OP_EX): Likewise.
	* i386-opc.tbl: Remove "S" from EVEX vpextrw.
	* i386-tbl.h: Regerated.
2016-11-09 14:00:18 -08:00
H.J. Lu 7766fd1002 X86: Update opcode-suffix.d
PR binutils/20754
	* testsuite/gas/i386/opcode-suffix.d: Updated.
2016-11-09 12:11:50 -08:00
H.J. Lu 48c97fa1ba X86: Properly handle bad FPU opcode
Since Bad_Opcode and FGRPd9_2 were the same in i386-dis.c, all
Bad_Opcode entries in float_reg were displaced as FGRPd9_2.  This
patch adds an entry for Bad_Opcode in fgrps to avoid treating it
as FGRPd9_2.

gas/

	PR binutils/20775
	* testsuite/gas/i386/i386.exp: Run fpu-bad.
	* testsuite/gas/i386/fpu-bad.d: New file.
	* testsuite/gas/i386/fpu-bad.s: Likewise.

opcodes/

	PR binutils/20775
	* i386-dis.c (FGRPd9_2): Replace 0 with 1.
	(FGRPd9_4): Replace 1 with 2.
	(FGRPd9_5): Replace 2 with 3.
	(FGRPd9_6): Replace 3 with 4.
	(FGRPd9_7): Replace 4 with 5.
	(FGRPda_5): Replace 5 with 6.
	(FGRPdb_4): Replace 6 with 7.
	(FGRPde_3): Replace 7 with 8.
	(FGRPdf_4): Replace 8 with 9.
	(fgrps): Add an entry for Bad_Opcode.
2016-11-07 14:58:38 -08:00
Nathan Sidwell 9cee1c1eb3 Fix gas crash with unreasonably long lines
gas/
	* input-scrub.c (partial_size): Make size_t.
	(buffer_length): Likewise.  Adjust meaning.
	(struct input_save): Adjust partial_size type.
	(input_scrub_reinit): New.
	(input_scrub_push, input_scrub_begin): Use it.
	(input_scrub_next_buffer): Fix buffer extension logic. Only scan
	newly read buffer for newline.
2016-11-04 21:26:34 -07:00
Andrew Burgess b437d035dd arc/nps400: Validate address type operands correctly
When we match against an address type operand within an instruction it
is important that we match exactly the right address type operand early
on, during the opcode selection phase.  If we wait until the operand
insertion phase to check that we have the correct address operand, then
it is too late to select an alternative opcode.  This becomes important
only when we have multiple opcodes with the same mnemonic, and operand
lists that differ only in the type of the address operands.

This commit fixes this issue, and adds some example instructions that
require this issue to be fixed (the instructions are identical except
for the address type operand).

gas/ChangeLog:

	* config/tc-arc.c (find_opcode_match): Use insert function to
	validate matching address type operands.
	* testsuite/gas/arc/nps400-10.d: New file.
	* testsuite/gas/arc/nps400-10.s: New file.

opcodes/ChangeLog:

	* arc-opc.c (arc_flag_operands): Add F_DI14.
	(arc_flag_classes): Add C_DI14.
	* arc-nps400-tbl.h: Add new exc instructions.
2016-11-04 22:46:51 +00:00
Andreas Krebbel feb4bea70a S/390: Fix 16 bit pc relative relocs.
Since the bpp instruction has been added the 16 bit wide pc relative
relocs might occur at offset 2 as well at offset 4 in an instruction.
With this patch the different adjustment is passed from
md_gather_operand to md_apply_fix via fx_pcrel_adjust field in the fix
data structure.

No regressions on s390x.

gas/ChangeLog:

2016-11-04  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config/tc-s390.c (md_gather_operands): Set fx_pcrel_adjust.
	(md_apply_fix): Use/Set fx_pcrel_adjust.
	* testsuite/gas/s390/zarch-zEC12.d: Add bpp reloc test pattern.
	* testsuite/gas/s390/zarch-zEC12.s: Add bpp reloc test.
2016-11-04 20:18:35 +01:00