Commit Graph

8121 Commits

Author SHA1 Message Date
Tamar Christina 65a55fbbd9 [AArch64] Add dot product support for AArch64 to binutils
gas/
	* config/tc-aarch64.c (aarch64_reg_parse_32_64): Accept 4B.
	(aarch64_features): Added dotprod.
	* doc/c-aarch64.texi: Added dotprod.
	* testsuite/gas/aarch64/dotproduct.d: New.
	* testsuite/gas/aarch64/dotproduct.s: New.

opcodes/
	* aarch64-asm.c (aarch64_ins_reglane): Added 4B dotprod.
	* aarch64-dis.c (aarch64_ext_reglane): Likewise.
	* aarch64-tbl.h (QL_V3DOT, QL_V2DOT): New.
	(aarch64_feature_dotprod, DOT_INSN): New.
	(udot, sdot): New.
	* aarch64-dis-2.c: Regenerated.

include/
	* opcode/aarch64.h: (AARCH64_FEATURE_DOTPROD): New.
	(aarch64_insn_class): Added dotprod.
2017-06-28 11:09:01 +01:00
Jiong Wang c604a79ad4 [ARM] Assembler and disassembler support Dot Product Extension
This patch add assembler and disassembler support for new Dot Product
  Extension.

  The support can be enabled through the new "+dotprod" extension.

include/
	* opcode/arm.h (FPU_NEON_EXT_DOTPROD): New macro.
	(FPU_ARCH_DOTPROD_NEON_VFP_ARMV8): New macro.

gas/
	* config/tc-arm.c (fpu_neon_ext_dotprod): New variable.
	(neon_scalar_for_mul): Improve comments.
	(do_neon_dotproduct): New function to encode Dot Product instructions.
	(do_neon_dotproduct_s): Wrapper function for signed Dot Product
	instructions.
	(do_neon_dotproduct_u): Wrapper function for unsigned Dot Product
	instructions.
	(insns): New entries for vsdot and vudot.
	(arm_extensions): New entry for "dotprod".
	* doc/c-arm.texi: Document new "dotprod" extension.
	* testsuite/gas/arm/dotprod.s: New test source.
	* testsuite/gas/arm/dotprod-illegal.s: New test source.
	* testsuite/gas/arm/dotprod.d: New test.
	* testsuite/gas/arm/dotprod-thumb2.d: New test.
	* testsuite/gas/arm/dotprod-illegal.d: New test.
	* testsuite/gas/arm/dotprod-legacy-arch.d: New test.
	* testsuite/gas/arm/dotprod-illegal.l: New error file.
	* testsuite/gas/arm/dotprod-legacy-arch.l: New error file.

opcodes/
	* arm-dis.c (coprocessor_opcodes): New entries for vsdot and vudot.
2017-06-28 11:00:55 +01:00
Maciej W. Rozycki 819e1f8697 MIPS: Add new Imagination interAptiv MR2 GAS and LD tests
Add GAS tests to verify Imagination interAptiv MR2 instruction assembly,
disassembly and ELF object file flags.

Add LD tests to verify Imagination interAptiv MR2 ELF object file
link-time compatibility and flag merging/propagation.  Use the framework
enhancement added with commit 7575e6a752 ("MIPS/LD/testsuite:
mips-elf-flags: Add MIPS ABI Flags handling").

	gas/
	* testsuite/gas/mips/elf_mach_interaptiv-mr2.d: New test.
	* testsuite/gas/mips/save-err.d: New test.
	* testsuite/gas/mips/save-sub.d: New test.
	* testsuite/gas/mips/interaptiv-mr2@save.d: New test.
	* testsuite/gas/mips/mips1@save-sub.d: New test.
	* testsuite/gas/mips/mips2@save-sub.d: New test.
	* testsuite/gas/mips/mips3@save-sub.d: New test.
	* testsuite/gas/mips/mips4@save-sub.d: New test.
	* testsuite/gas/mips/mips5@save-sub.d: New test.
	* testsuite/gas/mips/mips32@save-sub.d: New test.
	* testsuite/gas/mips/mips64@save-sub.d: New test.
	* testsuite/gas/mips/mips16@save-sub.d: New test.
	* testsuite/gas/mips/mips16e@save-sub.d: New test.
	* testsuite/gas/mips/r3000@save-sub.d: New test.
	* testsuite/gas/mips/r3900@save-sub.d: New test.
	* testsuite/gas/mips/r4000@save-sub.d: New test.
	* testsuite/gas/mips/vr5400@save-sub.d: New test.
	* testsuite/gas/mips/interaptiv-mr2@save-sub.d: New test.
	* testsuite/gas/mips/sb1@save-sub.d: New test.
	* testsuite/gas/mips/octeon2@save-sub.d: New test.
	* testsuite/gas/mips/octeon3@save-sub.d: New test.
	* testsuite/gas/mips/xlr@save-sub.d: New test.
	* testsuite/gas/mips/r5900@save-sub.d: New test.
	* testsuite/gas/mips/mips16e2-copy.d: New test.
	* testsuite/gas/mips/mips16e2-copy-err.d: New test.
	* testsuite/gas/mips/save.d: Remove `MIPS16e' from the `name'
	option.  Adjust for trailing padding change.
	* testsuite/gas/mips/mips16e2-copy-err.l: New stderr output.
	* testsuite/gas/mips/save-sub.s: New test source.
	* testsuite/gas/mips/mips16e2-copy.s: New test source.
	* testsuite/gas/mips/mips16e2-copy-err.s: New test source.
	* testsuite/gas/mips/save.s: Update description, change trailing
	padding and remove trailing white space.
	* testsuite/gas/mips/mips.exp: Expand `save' and `save-err'
	tests across the regular MIPS interAptiv MR2 architecture.  Run
	the new tests.

	ld/
	* testsuite/ld-mips-elf/mips-elf-flags.exp: Add interAptiv MR2
	tests.
2017-06-28 02:07:36 +01:00
Maciej W. Rozycki c7d289d129 MIPS: Add Imagination interAptiv MR2 GAS test infrastructure
Define a new regular MIPS and MIPS16 interAptiv MR2 test architecture
and adjust existing tests now run against these architectures
accordingly.

This change causes new test failures:

FAIL: MIPS jal-svr4pic (interaptiv-mr2)
FAIL: MIPS jal-svr4pic noreorder (interaptiv-mr2)

with the `mips-sgi-irix5' and `mips-sgi-irix6' targets, which are
consistent with the remaining architecture results for these cases, that
do not take into account the lack of R_MIPS_JALR relocations produced by
GAS for these targets.  As a preexisting issue these failures are not
addressed with this change.

	gas/
	* testsuite/gas/mips/mips.exp (interaptiv-mr2): New architecture.
	(mips16e2-interaptiv-mr2): Likewise.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro.d: New
	test.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro-t.d:
	New test.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro-e.d:
	New test.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-insn-t.d:
	New test.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-insn-e.d:
	New test.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e-64.d: New
	test.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-sub.d: New
	test.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e-sub.d: New
	test.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e-64-sub.d:
	New test.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e2-mt-sub.d:
	New test.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-asmacro.d:
	New test.
	* testsuite/gas/mips/interaptiv-mr2@mcu.d: New test.
	* testsuite/gas/mips/interaptiv-mr2@isa-override-1.d: New test.
	* testsuite/gas/mips/interaptiv-mr2@isa-override-2.d: New test.
	* testsuite/gas/mips/attr-gnu-4-5.d: Ignore any number of ASE
	flag lines present rather than just one.
	* testsuite/gas/mips/attr-gnu-4-6.d: Likewise.
	* testsuite/gas/mips/attr-gnu-4-7.d: Likewise.
	* testsuite/gas/mips/attr-none-o32-fp64-nooddspreg.d: Likewise.
	* testsuite/gas/mips/attr-none-o32-fp64.d: Likewise.
	* testsuite/gas/mips/attr-none-o32-fpxx.d: Likewise.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro.l: New
	stderr output.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro-t.l:
	New stderr output.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro-e.l:
	New stderr output.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-insn-t.l:
	New stderr output.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-insn-e.l:
	New stderr output.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-sub.l: New
	stderr output.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e-sub.l: New
	stderr output.
	* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e-64-sub.l:
	New stderr output.
	* testsuite/gas/mips/interaptiv-mr2@isa-override-1.l: New stderr
	output.
	* testsuite/gas/mips/interaptiv-mr2@isa-override-2.l: New stderr
	output.
2017-06-28 02:07:36 +01:00
Maciej W. Rozycki 38bf472a15 MIPS: Add Imagination interAptiv MR2 MIPS32r3 processor support
Add support for the Imagination interAptiv MR2 MIPS32r3 processor with
the MIPS16e2 ASE as per documentation, including in particular:

1. Support for implementation-specific interAptiv MR2 COPYW and UCOPYW
   MIPS16e2 instructions[1], for assembly and disassembly,

2. Support for implementation-specific interAptiv MR2 SAVE and RESTORE
   regular MIPS instructions[2], for assembly and disassembly,

3. ELF binary file annotation for the interAptiv MR2 MIPS architecture
   extension.

4. Support for interAptiv MR2 architecture selection for assembly, in
   the form of the `-march=interaptiv-mr2' command-line option and its
   corresponding `arch=interaptiv-mr2' setting for the `.set' and
   `.module' pseudo-ops.

5. Support for interAptiv MR2 architecture selection for disassembly,
   in the form of the `mips:interaptiv-mr2' target architecture, for
   use e.g. with the `-m' command-line option for `objdump'.

Parts of this change by Matthew Fortune and Andrew Bennett.

References:

[1] "MIPS32 interAptiv Multiprocessing System Software User's Manual",
    Imagination Technologies Ltd., Document Number: MD00904, Revision
    02.01, June 15, 2016, Section 24.3 "MIPS16e2 Implementation Specific
    Instructions", pp. 878-883

[2] same, Chapter 25 "Implementation-specific Instructions", pp. 911-917

	include/
	* elf/mips.h (E_MIPS_MACH_IAMR2): New macro.
	(AFL_EXT_INTERAPTIV_MR2): Likewise.
	* opcode/mips.h: Document new operand codes defined.
	(INSN_INTERAPTIV_MR2): New macro.
	(INSN_CHIP_MASK): Adjust accordingly.
	(CPU_INTERAPTIV_MR2): New macro.
	(cpu_is_member) <CPU_INTERAPTIV_MR2>: New case.
	(MIPS16_ALL_ARGS): Rename to...
	(MIPS_SVRS_ALL_ARGS): ... this.
	(MIPS16_ALL_STATICS): Rename to...
	(MIPS_SVRS_ALL_STATICS): ... this.

	bfd/
	* archures.c (bfd_mach_mips_interaptiv_mr2): New macro.
	* cpu-mips.c (I_interaptiv_mr2): New enum value.
	(arch_info_struct): Add "mips:interaptiv-mr2" entry.
	* elfxx-mips.c (_bfd_elf_mips_mach) <E_MIPS_MACH_IAMR2>: New
	case.
	(mips_set_isa_flags) <bfd_mach_mips_interaptiv_mr2>: Likewise.
	(bfd_mips_isa_ext) <bfd_mach_mips_interaptiv_mr2>: Likewise.
	(print_mips_isa_ext) <AFL_EXT_INTERAPTIV_MR2>: Likewise.
	(mips_mach_extensions): Add `bfd_mach_mipsisa32r3' and
	`bfd_mach_mips_interaptiv_mr2' entries.
	* bfd-in2.h: Regenerate.

	opcodes/
	* mips-formats.h (INT_BIAS): New macro.
	(INT_ADJ): Redefine in INT_BIAS terms.
	* mips-dis.c (mips_arch_choices): Add "interaptiv-mr2" entry.
	(mips_print_save_restore): New function.
	(print_insn_arg) <OP_SAVE_RESTORE_LIST>: Update comment.
	(validate_insn_args) <OP_SAVE_RESTORE_LIST>: Remove `abort'
	call.
	(print_insn_args): Handle OP_SAVE_RESTORE_LIST.
	(print_mips16_insn_arg): Call `mips_print_save_restore' for
	OP_SAVE_RESTORE_LIST handling, factored out from here.
	* mips-opc.c (decode_mips_operand) <'-'> <'m'>: New case.
	(RD_31, RD_SP, WR_SP, MOD_SP, IAMR2): New macros.
	(mips_builtin_opcodes): Add "restore" and "save" entries.
	* mips16-opc.c (decode_mips16_operand) <'n', 'o'>: New cases.
	(IAMR2): New macro.
	(mips16_opcodes): Add "copyw" and "ucopyw" entries.

	binutils/
	* readelf.c (get_machine_flags) <E_MIPS_MACH_IAMR2>: New case.
	(print_mips_isa_ext) <AFL_EXT_INTERAPTIV_MR2>: Likewise.
	* NEWS: Mention Imagination interAptiv MR2 processor support.

	gas/
	* config/tc-mips.c (validate_mips_insn): Handle
	OP_SAVE_RESTORE_LIST specially.
	(mips_encode_save_restore, mips16_encode_save_restore): New
	functions.
	(match_save_restore_list_operand): Factor out SAVE/RESTORE
	operand insertion into the instruction word or halfword to these
	new functions.
	(mips_cpu_info_table): Add "interaptiv-mr2" entry.

	* doc/c-mips.texi (MIPS Options): Add `interaptiv-mr2' to the
	`-march=' argument list.
2017-06-28 02:07:36 +01:00
Maciej W. Rozycki 79cb3f75de MIPS/GAS/testsuite: Drop the `mips16e-' prefix from SAVE/RESTORE tests
In preparation to running these tests against regular MIPS instructions.

	gas/
	* testsuite/gas/mips/mips16e-save.d: Rename to...
	* testsuite/gas/mips/save.d: ... this.
	* testsuite/gas/mips/mips16e-save-err.d: Update the
	`error-output' option and rename to...
	* testsuite/gas/mips/save-err.d: ... this.
	* testsuite/gas/mips/mips16e-save-err.l: Rename to...
	* testsuite/gas/mips/save-err.l: ... this.
	* testsuite/gas/mips/mips16e-save.s: Rename to...
	* testsuite/gas/mips/save.s: ... this.
	* testsuite/gas/mips/mips16e-save-err.s: Rename to...
	* testsuite/gas/mips/save-err.s: ... this.
	* testsuite/gas/mips/mips.exp: Rename `mips16e-save' and
	`mips16e-save-err' invocations to `save' and `save-err'
	respectively and reorder these tests away from MIPS16 tests.
2017-06-27 04:23:54 +01:00
Maciej W. Rozycki b0bd097ef6 MIPS/GAS/testsuite: Run SAVE/RESTORE tests across all MIPS16e architectures
gas/
	* testsuite/gas/mips/mips16e-save.d: Remove `-mmips:isa32
	-mmips:16' from `objdump' flags and `-march=mips32 -mips16' from
	`as' flags.
	* testsuite/gas/mips/mips16e-save-err.d: Remove `-march=mips32'
	from `as' flags.
	* testsuite/gas/mips/mips16e-save.s: Remove the `.set mips16'
	pseudo-op.
	* testsuite/gas/mips/mips16e-save-err.s: Likewise.
	* testsuite/gas/mips/mips.exp: Run SAVE/RESTORE tests across all
	MIPS16e architectures.
2017-06-27 04:23:54 +01:00
Maciej W. Rozycki 2438385a4d MIPS/GAS/testsuite: Convert `mips16e-save-err' list test to a dump test
gas/
	* testsuite/gas/mips/mips16e-save-err.d: New test.
	* gas/testsuite/gas/mips/mips.exp: Fold `mips16e-save-err' list
	test into the new test.
2017-06-27 04:23:54 +01:00
Maciej W. Rozycki daba08c913 MIPS/GAS/testsuite: Capitalize the name of the `mips16e-save' test
For consistency with the subsequent changes in this area.

	gas/
	* testsuite/gas/mips/mips16e-save.d: Capitalize the `name'
	option.
2017-06-27 04:23:53 +01:00
Kuan-Lin Chen a6cbf936e3 RISC-V: Use pc-relative relocation for FDE initial location
The symbol address in .eh_frame may be adjusted in
_bfd_elf_discard_section_eh_frame, and the content of .eh_frame will be
adjusted in _bfd_elf_write_section_eh_frame. Therefore, we cannot insert
a relocation whose addend symbol is in .eh_frame. Othrewise, the value
may be adjusted twice.

bfd/ChangeLog
2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>

	* elfnn-riscv.c (perform_relocation): Support the new
	R_RISCV_32_PCREL relocation.
	(riscv_elf_relocate_section): Likewise.
	* elfxx-riscv.c (howto_table): Likewise.
	(riscv_reloc_map): Likewise.
	* bfd-in2.h (BFD_RELOC_RISCV_32_PCREL): New relocation.
	* libbfd.h: Regenerate.

gas/ChangeLog
2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>

	* config/tc-riscv.c (md_apply_fix) [BFD_RELOC_32]: Convert to a
	R_RISCV_32_PCREL relocation.

include/ChangeLog
2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>

	* elf/riscv.h (R_RISCV_32_PCREL): New.
2017-06-26 18:26:40 -07:00
H.J. Lu a3aea05a66 Check unsupported .symver with common symbol
The .symver directive on common symbol creates a new common symbol,
which shouldn't be allowed, similar to alias on common symbol:

$ cat y.S
	.comm	bar,8,8
	 .set bar1,bar
$ as -o y.o y.S
y.S: Assembler messages:
y.S:2: Error: `bar1' can't be equated to common symbol 'bar'
$

	PR gas/21661
	* config/obj-elf.c (obj_elf_symver): Don't allow .symver with
	common symbol.
	(elf_frob_symbol): Likewise.
	* testsuite/gas/elf/elf.exp: Run pr21661.
	* testsuite/gas/elf/pr21661.d: New file.
	* testsuite/gas/elf/pr21661.s: Likewise.
2017-06-26 05:11:29 -07:00
Nick Clifton 49fa50ef9c Fix compile time warning building gas for arm-wince target.
* config/tc-arm.c (fpu_any): Only define for ELF based targets.
2017-06-26 09:28:51 +01:00
claziss cf9bdae906 Update check conditions for illegal placed instructions.
ARC cpus do not accept any jump or instructions with long immediate
into the delay slots.

gas/
2017-06-07  Claudiu Zissulescu  <claziss@synopsys.com>

	* /config/tc-arc.c (is_br_jmp_insn_p): Update macro with known
	instructions to be accounted as jumps.
	(assemble_insn): Check for limms into the delay slots.  Emit an
	error if so.
	* testsuite/gas/arc/asm-errors-3.d: New file.
	* testsuite/gas/arc/asm-errors-3.err: Likewise.
	* testsuite/gas/arc/asm-errors-3.s: Likewise.
2017-06-26 08:53:10 +02:00
Thomas Preud'homme 0cda1e190d [ARM] Add support for ARM Cortex-R52 processor
=== Context ===

This patch is part of a patch series to add support for ARMv8-R
architecture. Its purpose is to add support for ARM Cortex-R52
processor.

=== Patch description ===

This patch adds support for Cortex-R52 as an ARMv8-R processor with CRC
extensions.

2017-06-26  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* NEWS: Mention support of ARM Cortex-R52 processor.
	* config/tc-arm.c (arm_cpus): Add entry for ARM Cortex-R52 processor.
	* doc/c-arm.texi: Mention support for -mcpu=cortex-r52.
2017-06-24 10:56:32 +01:00
Thomas Preud'homme ced40572e4 [ARM] Add support for ARMv8-R in assembler and readelf
=== Context ===

This patch is part of a patch series to add support for ARMv8-R
architecture. Its purpose is to add support for ARMv8-R in GAS:
instructions, build attributes and readelf.

=== Patch description ===

Although some differences exist for system registers, from GAS point of
view ARMv8-R supports the same instructions as ARMv8-A Aarch32 state
and a subset of its extensions. This patch therefore introduce a new
feature bit to distinguish the availability of the pan, ras and rdma
extensions between ARMv8-A and ARMv8-R and allow crypto, fp and simd
extensions to be used by ARMv8-R.

Most of the changes are then in the testsuite to (i) rename source files
and error output to be shared between ARMv8-A and ARMv8-R, (ii) rename
files with expected output for ARMv8-A build attributes and (iii) add
new files with expected output for ARMv8-R build attributes.

2017-06-24  Thomas Preud'homme  <thomas.preudhomme@arm.com>

binutils/
	* readelf.c (arm_attr_tag_CPU_arch): Fill value for ARMv8-R.

gas/
	* NEWS: Mention support for ARMv8-R architecture.
	* config/tc-arm.c (arm_archs): Add entry for ARMv8-R.
	(arm_extensions): Restrict pan, ras and rdma extension to
	ARMv8-A and make crypto, fp and simd extensions available to
	ARMv8-R.
	(cpu_arch_ver): Add entry for ARMv8-R.
	(aeabi_set_public_attributes): Update gas_assert for Tag_DIV_use
	logic.
	* testsuite/gas/arm/armv8-a+fp.s: Rename into ...
	* testsuite/gas/arm/armv8-ar+fp.s: This.  Remove .arch directive.
	* testsuite/gas/arm/armv8-a+fp.d: Specify source to assemble and
	architecture to assemble for.
	* testsuite/gas/arm/armv8-r+fp.d: New.
	* testsuite/gas/arm/armv8-a+simd.s: Rename into ...
	* testsuite/gas/arm/armv8-ar+simd.s: This.  Remove .arch directive.
	* testsuite/gas/arm/armv8-a+simd.d: Specify source to assemble and
	architecture to assemble for.
	* testsuite/gas/arm/armv8-r+simd.d: New.
	* testsuite/gas/arm/armv8-a-bad.s: Rename into ...
	* testsuite/gas/arm/armv8-ar-bad.s: This.  Remove .arch directive.
	* testsuite/gas/arm/armv8-a-bad.l: Rename into ...
	* testsuite/gas/arm/armv8-ar-bad.l: This.  Decrement line number by 1.
	* testsuite/gas/arm/armv8-a-bad.d: Specify source to assemble,
	architecture to assemble for and adjust error output file.
	* testsuite/gas/arm/armv8-r-bad.d: New.
	* testsuite/gas/arm/armv8-a-barrier.s: Rename into ...
	* testsuite/gas/arm/armv8-ar-barrier.s: This.
	* testsuite/gas/arm/armv8-a-barrier-arm.d: Adjust source.
	* testsuite/gas/arm/armv8-a-barrier-thumb.d: Likewise.
	* testsuite/gas/arm/armv8-r-barrier-arm.d: New.
	* testsuite/gas/arm/armv8-r-barrier-thumb.d: New.
	* testsuite/gas/arm/armv8-a-it-bad.s: Rename into ...
	* testsuite/gas/arm/armv8-ar-it-bad.s: This.  Remove .arch directive.
	* testsuite/gas/arm/armv8-a-it-bad.l: Rename into ...
	* testsuite/gas/arm/armv8-ar-it-bad.l: This.  Decrement line number
	by 1.
	* testsuite/gas/arm/armv8-a-it-bad.d: Specify source to assemble,
	architecture to assemble for and adjust error output file.
	* testsuite/gas/arm/armv8-r-it-bad.d: New.
	* testsuite/gas/arm/armv8-a.s: Rename into ...
	* testsuite/gas/arm/armv8-ar.s: This.  Remove .arch directive.
	* testsuite/gas/arm/armv8-a.d: Specify source to assemble and
	architecture to assemble for.
	* testsuite/gas/arm/armv8-r.d: New.
	* testsuite/gas/arm/attr-march-armv8-r+crypto.d: New.
	* testsuite/gas/arm/attr-march-armv8-r+fp.d: New.
	* testsuite/gas/arm/attr-march-armv8-r+simd.d: New.
	* testsuite/gas/arm/attr-march-armv8-r.d: New.
	* testsuite/gas/arm/crc32.s: Rename into ...
	* testsuite/gas/arm/crc32-armv8-ar.s: This.
	* testsuite/gas/arm/crc32.d: Rename into ...
	* testsuite/gas/arm/crc32-armv8-a.d: This.  Specify source to assemble.
	* testsuite/gas/arm/crc32-armv8-r.d: New.
	* testsuite/gas/arm/crc32-bad.s: Rename into ...
	* testsuite/gas/arm/crc32-armv8-ar-bad.s: This.
	* testsuite/gas/arm/crc32-bad.d: Rename into ...
	* testsuite/gas/arm/crc32-armv8-a-bad.d: This.  Specify source to
	assemble.
	* testsuite/gas/arm/crc32-armv8-r-bad.d: New.
	* testsuite/gas/arm/mask_1.s: Rename into ...
	* testsuite/gas/arm/mask_1-armv8-ar.s: This.
	* testsuite/gas/arm/mask_1.d: Rename into ...
	* testsuite/gas/arm/mask_1-armv8-a.d: This.  Specify source to
	assemble.
	* testsuite/gas/arm/mask_1-armv8-r.d: new.

include/
	* elf/arm.h (TAG_CPU_ARCH_V8R): New macro.
	* opcode/arm.h (ARM_EXT2_V8A): New macro.
	(ARM_AEXT2_V8A): Rename into ...
	(ARM_AEXT2_V8AR): This.
	(ARM_AEXT2_V8A): New macro.
	(ARM_AEXT_V8R): New macro.
	(ARM_AEXT2_V8R): New macro.
	(ARM_ARCH_V8R): New macro.
2017-06-24 10:37:47 +01:00
Thomas Preud'homme 173205ca33 [ARM] Remove ARMv6S-M special casing
=== Context ===

This patch is part of a patch series to add support for ARMv8-R
architecture. Its purpose is to remove special casing for ARMv6S-M
autodetection.

=== Motivation ===

Currently, SWI and SVC mnemonics are enabled for ARMv4T and successor
architectures with extra checks in the handler function (do_t_swi) to
give an error message when ARMv6-M is targeted and some more special
casing in aeabi_set_public_attributes. This was made to exclude these
mnemonics for ARMv6-M unless the OS extension is in use.

However this logic is superfluous: there is already code to check
whether an instruction is available based on the feature bit it is part
of and whether the targeted architecture has that feature bit. This
patch aims at removing that unneeded complexity.

=== Patch description ===

The OS extension is already limited to the ARMv6-M architecture so all
this patch does is redefined availability of the ARM_EXT_OS feature bit
to not be present for ARM_ARCH_V6M. ARM_ARCH_V6SM does not need any
change either because it already includes ARM_EXT_OS.

The patch also make sure that the error message that was given by
do_t_swi when SWI/SVC is unavailable is still the same by detecting the
situation in md_assemble.

2017-06-24  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (arm_ext_v6m): Delete.
	(arm_ext_v7m): Delete.
	(arm_ext_m): Remove ARM_EXT_OS from the set of feature defined M
	profile.
	(arm_arch_v6m_only): Delete.
	(do_t_swi): Remove special case for ARMv6S-M.
	(md_assemble): Display error message previously in do_t_swi when
	SVC is not available.
	(insns): Guard swi and svc by arm_ext_os for Thumb mode.
	(aeabi_set_public_attributes): Remove special case for ARMv6S-M.

include/
	* opcode/arm.h (ARM_AEXT_V4TxM): Add ARM_EXT_OS bit to the set.
	(ARM_AEXT_V4T): Likewise.
	(ARM_AEXT_V5TxM): Likewise.
	(ARM_AEXT_V5T): Likewise.
	(ARM_AEXT_V6M): Mask off ARM_EXT_OS bit.
2017-06-24 10:26:41 +01:00
Andrew Waterman 94f78a777c RISC-V: Error, don't warn, for shfit amounts/CSRs
gas/ChangeLog

2017-05-11  Andrew Waterman  <andrew@sifive.com>

       * config/tc-riscv.c (riscv_ip): Changes as_warn to as_bad for improper
       shift amounts.
2017-06-23 09:21:49 -07:00
Nick Clifton e7d39ed3e0 Fix compile time warning about unused static variable.
* config/tc-arm.c (arm_ext_v7m): Add ATTRIBUTE_UNUSED.
2017-06-22 09:34:12 +01:00
Thomas Preud'homme 2c6b98ea6f [ARM] Rework Tag_CPU_arch build attribute value selection
=== Context ===

This patch is part of a patch series to add support for ARMv8-R
architecture. Its purpose is to rework the Tag_CPU_arch build attribute
value selection to (i) match architecture or CPU if specified by user
without any need for hack and (ii) match an architecture with all the
features used if in autodetection mode or return an error.

=== Motivation ===

Currently, Tag_CPU_arch build attribute value selection assumes that an
architecture is always a superset of architectures released earlier. As
such, the logic is to browse architectures in chronological order of
release and selecting the Tag_CPU_arch value of the last one to
contribute a feature used[1]/requested[2] not contributed by earlier
architectures.

[1] in case of autodetection mode
[2] otherwise, ie. in case of -mcpu/-march or associated directives

This logic fails the two objectives mentionned in the Context section.
First, due to the assumption it does an architecture can be selected
while not having all the features used/requested which fails the second
objective. Second, not doing an exact match when an architecture or CPU
is selected by the user means the wrong value is chosen when a later
architecture provides a subset of the feature bits of an earlier
architecture. This is the case for the implementation of ARMv8-R (see
later patch).

An added benefit of this patch is that it is possible to easily generate
more consistent build attribute by setting the feature bits from the
architecture matched in aeabi_set_public_attributes in autodetection
mode. This is better done as a separate patch because lots of testcase'
expected results must then be updated accordingly.

=== Patch description ===

The patch changes the main logic for Tag_CPU_arch and
Tag_CPU_arch_profile
values selection to:
- look for an exact match in case an architecture or CPU was specified
  on the command line or in a directive
- select the first released architecture that provides a superset of the
  feature used in the autodetection case
- select the most featureful architecture in case of -march=all
The array cpu_arch_ver is updated to include all architectures in order
to make the first point work.

Note that when looking for an exact match, the architecture with
selected extension is tried first and then only the architecture. This
is because some architectures are exactly equivalent to an earlier
architecture with its extensions selected. ARMv6S-M (= ARMv6-M + OS
extension) and ARMv6KZ (ARMv6K + security extension) are two such
examples.

Other adjustments are also necessary in aeabi_set_public_attributes to
make this change work.

1) The logic to set Tag_ARM_ISA_use and Tag_THUMB_ISA_use must check the
absence of feature bit used/requested to decide whether to give the
default value for empty files (see EABI attribute defaults test). It was
previously checking that arch == 0 which would only happen if no feature
bit could be matched by any architecture, ie there is no feature bit to
match.

2) A fallback to a superset match must exist when no_cpu_selected ()
returns true. This is because aeabi_set_public_attributes is called
again after relaxation and at this point selected_cpu is set from the
previous execution of that function. There is therefore no way to check
whether the user specified an architecture or CPU.

3) Tag_CPU_arch lines are removed from expected output when the
detected architecture should be pre-ARMv4, since 0 is the Tag_CPU_arch
value for pre-ARMv4 architectures and default value for an absent entry
is 0.

2017-06-21  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (fpu_any): Defined from FPU_ANY.
	(cpu_arch_ver): Add all architectures and sort by release date.
	(have_ext_for_needed_feat_p): New.
	(get_aeabi_cpu_arch_from_fset): New.
	(aeabi_set_public_attributes): Call above function to determine
	Tag_CPU_arch and Tag_CPU_arch_profile values.  Adapt Tag_ARM_ISA_use
	and Tag_THUMB_ISA_use selection logic to check absence of feature bit
	accordingly.
	* testsuite/gas/arm/attr-march-armv1.d: Fix expected Tag_CPU_arch build
	attribute value.
	* testsuite/gas/arm/attr-march-armv2.d: Likewise.
	* testsuite/gas/arm/attr-march-armv2a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv2s.d: Likewise.
	* testsuite/gas/arm/attr-march-armv3.d: Likewise.
	* testsuite/gas/arm/attr-march-armv3m.d: Likewise.
	* testsuite/gas/arm/pr12198-2.d: Likewise.

include/
	* opcode/arm.h (FPU_ANY): New macro.
2017-06-21 16:42:01 +01:00
H.J. Lu 2234eee61c x86: CET v2.0: Update incssp and setssbsy
Update x86 assembler and disassembler for CET v2.0:

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

1. incsspd and incsspq are changed to take a register opeand with a
different opcode.
2. setssbsy is changed to take no opeand with a different opcode.

gas/

	* testsuite/gas/i386/cet-intel.d: Updated.
	* testsuite/gas/i386/cet.d: Likewise.
	* testsuite/gas/i386/x86-64-cet-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-cet.d: Likewise.
	* testsuite/gas/i386/cet.s: Update incsspd and setssbsy tests.
	* testsuite/gas/i386/x86-64-cet.s: Likewise.

opcodes/

	* i386-dis.c (RM_0FAE_REG_5): Removed.
	(PREFIX_MOD_3_0F01_REG_5_RM_1): Likewise.
	(PREFIX_MOD_3_0F01_REG_5_RM_0): New.
	(PREFIX_MOD_3_0FAE_REG_5): Likewise.
	(prefix_table): Remove PREFIX_MOD_3_0F01_REG_5_RM_1.  Add
	PREFIX_MOD_3_0F01_REG_5_RM_0.
	(prefix_table): Update PREFIX_MOD_0_0FAE_REG_5.  Add
	PREFIX_MOD_3_0FAE_REG_5.
	(mod_table): Update MOD_0FAE_REG_5.
	(rm_table): Update RM_0F01_REG_5.  Remove RM_0FAE_REG_5.
	* i386-opc.tbl: Update incsspd, incsspq and setssbsy.
	* i386-tbl.h: Regenerated.
2017-06-21 08:32:51 -07:00
H.J. Lu c2f7640243 x86: CET v2.0: Rename savessp to saveprevssp
Replace savessp with saveprevssp for CET v2.0:

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

gas/

	* testsuite/gas/i386/cet-intel.d: Updated.
	* testsuite/gas/i386/cet.d: Likewise.
	* testsuite/gas/i386/x86-64-cet-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-cet.d: Likewise.
	* testsuite/gas/i386/cet.s: Replace savessp with saveprevssp.
	* testsuite/gas/i386/x86-64-cet.s: Likewise.

opcodes/

	* i386-dis.c (prefix_table): Replace savessp with saveprevssp.
	* i386-opc.tbl: Likewise.
	* i386-tbl.h: Regenerated.
2017-06-21 08:30:52 -07:00
H.J. Lu 9fef80d683 x86: CET v2.0: Update NOTRACK prefix
Update NOTRACK prefix handling to support memory indirect branch for
CET v2.0:

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

gas/

	* config/tc-i386.c (md_assemble): Update NOTRACK prefix check.
	* testsuite/gas/i386/notrack-intel.d: Updated.
	* testsuite/gas/i386/notrack.d: Likewise.
	* testsuite/gas/i386/notrackbad.l: Likewise.
	* testsuite/gas/i386/x86-64-notrack-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-notrack.d: Likewise.
	* testsuite/gas/i386/x86-64-notrackbad.l: Likewise.
	* testsuite/gas/i386/notrack.s: Add NOTRACK prefix tests with
	memory indirect branch.
	* testsuite/gas/i386/x86-64-notrack.s: Likewise.
	* testsuite/gas/i386/notrackbad.s: Remove memory indirect branch
	with NOTRACK prefix.
	* testsuite/gas/i386/x86-64-notrackbad.s: Likewise.

opcodes/

	* i386-dis.c (reg_table): Swap indirEv with NOTRACK on "call{&|}"
	and "jmp{&|}".
	(NOTRACK_Fixup): Support memory indirect branch with NOTRACK
	prefix.
2017-06-21 08:28:43 -07:00
Thomas Preud'homme 3d030cdb4a [ARM] Allow Thumb division as an extension for ARMv7
=== Context ===

This patch is part of a patch series to add support for ARMv8-R
architecture. Its purpose is to allow ARMv7 to be selected in automatic
architecture selection in presence of Thumb division instructions.

=== Motivation ===

any-idiv.d and automatic-sdiv.d testcases in GAS testsuite expect
autodetection code to select ARMv7 in presence of Thumb integer
division. However, the definition of ARM_AEXT_V7 and thus ARM_ARCH_V7 do
not contain these instructions and the idiv extension is only available
for ARMv7-A and ARMv7-R. Therefore, under the stricter automatic
detection code proposed in the subsequent patch of the series ARMv7 is
refused if a Thumb division instruction is present.

=== Patch description ===

This patch adds a new "idiv" extension after the existing one that is
available to all ARMv7 targets. This new entry is ignored by all current
code parsing arm_extensions such that it would be unavailable on the
command-line and remain a purely internal hack, easily removed in favor
of a better solution later. This is considered though by the subsequent
patch reworking automatic detection of build attributes such that ARMv7
is allowed to match in present of Thumb division instructions. For good
measure, comments are added in all instances of code browsing
arm_extensions to mention the expected behavior in case of duplicate
entries as well as a new testcase.

2017-06-20  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (arm_extensions): New duplicate idiv entry to enable
	Thumb division for ARMv7 architecture.
	(arm_parse_extension): Document expected behavior for duplicate
	entries.
	(s_arm_arch_extension): Likewise.
	* testsuite/gas/arm/forbid-armv7-idiv-ext.d: New test.
	* testsuite/gas/arm/forbid-armv7-idiv-ext.l: New expected output for
	above test.
2017-06-21 15:08:49 +01:00
Thomas Preud'homme 54bab2816d [ARM] Rework selection of feature bits to base build attributes on
=== Context ===

This patch is part of a patch series to add support for ARMv8-R
architecture. Its purpose is to set the feature bits on which to decide
what the build attributes should be according to the mode
(autodetection, user specified architecture or CPU, or
-march/-mcpu=all).

=== Motivation ===

Currently, the flags variable which is used to determine the build
attribute is constructed from the instruction used (arm_arch_used and
thumb_arch_used) as well as the user specified architecture or CPU
(selected_cpu). This means when several .arch are specified the
resulting feature bits can be such that no architecture provide them
all and can thus result in incorrect Tag_CPU_arch. See for instance
what having both .arch armv8-a and .arch armv8-m.base would result in.
This is not caught by the testsuite because of further bugs in the
Tag_CPU_arch build attribute value selection logic (see next patch in
the series).

=== Patch description ===

As one would expect, this patch solves the problem by setting flags
from feature bits used if in autodetection mode [1] and from
selected_cpu otherwise. The logic to set arm_ext_v1, arm_ext_v4t and
arm_ext_os feature bits is also moved to only run in autodetection mode
since otherwise the architecture or CPU would have a consistent set of
feature bits already.

[1] No architecture or CPU was specified by the user

2017-06-21  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (aeabi_set_public_attributes): Populate flags from
	feature bits used or selected_cpu depending on whether a CPU was
	selected by the user.
2017-06-21 15:08:49 +01:00
Thomas Preud'homme 6c290d5387 [ARM] Simplify Tag_DSP_extension selection logic
=== Context ===

This patch is part of a patch series to add support for ARMv8-R
architecture. Its purpose is to simplify the logic to decide whether to
set Tag_DSP_extension.

=== Motivation ===

To decide whether to set Tag_DSP_extension, the current code was
checking whether the flags had DSP instruction but the architecture
selected for Tag_CPU_arch did not have any. This was necessary because
extension feature bit were not available separately. This is no longer
necessary and can be simplified.

=== Patch description ===

The patch change the logic to set Tag_DSP_extension to check whether any
DSP feature bit is set in the extension feature bit, as per the
definition of that build attribute. The patch also removes all
definitions of arm_arch which is now unneeded.

2017-06-21  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (aeabi_set_public_attributes): Test *mcpu_ext_opt to
	decide whether to set Tag_DSP_extension build attribute value.  Remove
	now useless arm_arch variable.
2017-06-21 14:11:14 +01:00
Thomas Preud'homme c168ce07e5 [ARM] Keep separation between extensions and architecture bits throughout execution
=== Context ===

This patch is part of a patch series to add support for ARMv8-R
architecture. Its purpose is to keep the distinction between
architecture feature bits and extension ones after parsing has occured.

=== Motivation ===

This distinction is necessary to allow the Tag_CPU_arch build attribute
value to be exactly as per the architecture of the selected CPU. With
mixed architecture and extension feature bit, it is impossible to find
an architecture with an exact match of feature bit and the build
attribute value logic must then select the closest match which might not
be the right architecture. The previous patch in the patch series makes
the distinction possible when parsing -mcpu and .cpu directives but the
distinction gets lost after. Similarly feature bits contributed by
extensions in -march or .arch_extensions directive are mixed together
with architecture extensions.

=== Patch description ===

The patch adds new feature bit pointer for extension feature bits.
Information from the parsing regarding extensions can then be kept
separate in those. This requires adapting arm_parse_extension to deal
with two feature bits, allowing the architecture bits to be marked as
const. It also requires extra care when setting cpu_variant and
selected_cpu because the extension bits are optional since there might
not be any extension in use.

Note that contrary to cpu feature bits, the extension feature bits are
made read/write and are always dynamically allocated. This allows to
unconditionally free them in arm_md_post_relax added for this occasion,
thereby fixing a longstanding memory leak when arm_parse_extension was
invoked (XNEW of ext_fset without corresponding XDELETE).
Introduction of arm_md_post_relax is necessary to only free the
extension feature bits after aeabi_set_attribute_string has been called
for the last time.

2017-06-21  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (dyn_mcpu_ext_opt): New static variable.
	(dyn_march_ext_opt): Likewise.
	(md_begin): Copy extension feature bits alongside architecture ones.
	Merge extensions feature bits in selected_cpu and cpu_variant if there
	is some.
	(arm_parse_extension): Pass architecture and extension feature bits in
	separate parameters, with architecture bits being read only.  Update
	**opt_p directly rather than *ext_set and initialize it if needed.
	(arm_parse_cpu): Stop merging architecture and extension feature bits
	and instead use mcpu_cpu_opt and dyn_mcpu_ext_opt to memorize them
	respectively.  Adapt to change in parameters of arm_parse_extension.
	(arm_parse_arch): Adapt to change in parameters of arm_parse_extension.
	(aeabi_set_attribute_string): Make function static.
	(arm_md_post_relax): New function.
	(s_arm_cpu): Stop merging architecture and extension feature bits and
	instead use mcpu_cpu_opt and dyn_mcpu_ext_opt to memorize them
	respectively.  Merge extension feature bits in cpu_variant
	if there is any.
	(s_arm_arch): Reset extension feature bit.  Set selected_cpu from
	*mcpu_cpu_opt and cpu_variant from selected_cpu and *mfpu_opt for
	consistency with s_arm_cpu.
	(s_arm_arch_extension): Update *dyn_mcpu_ext_opt rather than
	selected_cpu, allocating it before hand if needed.  Set selected_cpu
	from it and then cpu_variant.
	(s_arm_fpu): Merge *mcpu_ext_opt feature bits if any in cpu_variant.
	* config/tc-arm.h (md_post_relax_hook): Set to arm_md_post_relax.
	(aeabi_set_public_attributes): Delete external declaration.
	(arm_md_post_relax): Declare externally.
2017-06-21 14:11:14 +01:00
Thomas Preud'homme 996b5569bf [ARM] Separate extensions from architectures in arm_cpus
=== Context ===

This patch is part of a patch series to add support for ARMv8-R
architecture. Its purpose is to distinguish for a CPU the feature bits
coming from its architecture from the feature bits coming from
extension(s) available in this CPU.

=== Motivation ===

This distinction is necessary to allow the Tag_CPU_arch build attribute
value to be exactly as per the architecture of the selected CPU. With
mixed architecture and extension feature bit, it is impossible to find
an architecture with an exact match of feature bit and the build
attribute value logic must then select the closest match which might not
be the right architecture.

=== Patch description ===

The patch creates a new field in the arm_cpus table to hold the feature
set for the extensions available in each CPU. The existing architecture
feature set is then updated to remove those feature bit. The patch also
takes advantage of all the lines being changed to reindent the whole
table.

Note: This patch *adds* a memory leak due to mcpu_cpu_opt sometimes
pointing to dynamically allocated feature bits which is never freeed.
The subsequent patch in the series solves this issue as well as a
preexisting identical issue in arm_parse_extension. The patches are kept
separate for ease of review since they are both big enough already.

2017-06-21  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (struct arm_cpu_option_table): New ext field.
	(ARM_CPU_OPT): Add parameter to set new ext field and reorder canonical
	name field just after the name field.
	(arm_cpus): Move extension feature bit from value field to ext field,
	reorder parameter according to changes in ARM_CPU_OPT and reindent.
	(arm_parse_cpu): Point mcpu_cpu_opt to a bitfield merging the value and
	ext field from the selected arm_cpus entry.
	(s_arm_cpu): Likewise.
2017-06-21 14:11:14 +01:00
James Greenhalgh 1e29262747 Add support for the Cortex-A55 and Cortex-A75 versions of the AArch64 architecture.
* config/tc-aarch64.c (aarch64_cpus): Add cortex-a55 and cortex-a75.
	* doc/c-aarch64.texi (-mcpu): Document cortex-a55 and cortex-a75.
2017-06-21 09:13:25 +01:00
H.J. Lu 8cac017d35 i386-dis: Add 2 tests with invalid bnd register
PR binutils/21594
	* testsuite/gas/i386/mpx.s: Add 2 tests with invalid bnd
	register.
	* testsuite/gas/i386/x86-64-mpx.s: Likewise.
	* testsuite/gas/i386/mpx.d: Updated.
	* testsuite/gas/i386/x86-64-mpx.d: Likewise.
2017-06-15 08:21:48 -07:00
Max Filippov f7e16c2a9c xtensa: don't expect XCHAL_* macros to be constant
Get rid of the assumption that XCHAL_* macros are preprocessor
constants: don't use them in preprocessor conditionals or in static
variable initializers.

2017-06-14  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* elf32-xtensa.c (elf_xtensa_be_plt_entry,
	elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
	keep both windowed and call0 ABI PLT definitions.
	(elf_xtensa_create_plt_entry): Use selected ABI to choose upper
	elf_xtensa_*_plt_entry endex.
	(ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.

gas/
	* config/tc-xtensa.c (density_supported, xtensa_fetch_width,
	absolute_literals_supported): Leave definitions uninitialized.
	(directive_state): Leave entries for directive_density and
	directive_absolute_literals initialized to false.
	(xg_init_global_config, xtensa_init): New functions.
	* config/tc-xtensa.h (TARGET_BYTES_BIG_ENDIAN): Define as 0.
	(HOST_SPECIAL_INIT): New definition.
	(xtensa_init): New declaration.
2017-06-14 11:05:50 -07:00
Vineet Gupta 7ef0acc15e [ARC] Don't convert _DYNAMIC@ to _GLOBAL_OFFSET_TABLE_
Historically the arc abi demanded that a GOT[0] should be referencible as
[pc+_DYNAMIC@gotpc].  Hence we convert a _DYNAMIC@gotpc to a GOTPC reference to
_GLOBAL_OFFSET_TABLE_.

This is no longer the case and uClibc and upcomming GNU libc don't expect this
to happen.

gas/ChangeLog:

    Vineet Gupta  <vgupta@synopsys.com>
    Cupertino Miranda  <cmiranda@synopsys.com>

	* config/tc-arc.c (md_undefined_symbol): Changed.
	* config/tc-arc.h (DYNAMIC_STRUCT_NAME): Removed.
2017-06-08 19:00:35 +02:00
Michael Collison 62e20ed45e Add support for AArch64 system register names IP0, IP1, FP and LR.
* config/tc-aarch64.c (reg_entry_reg_names): Add IP0,
	IP1, FP, and LR as register aliases of register 16, 17, 29
	and 30 respectively.
	* testsuite/gas/aarch64/diagnostic.l: Remove diagnostic
	prohibiting register 'lr' which is now an alias.
	* testsuite/gas/aarch64/diagnostic.s: Remove instruction
	utilizing register 'lr' which is now an alias.
2017-06-07 13:34:34 +01:00
Jiong Wang 5c8ed6a4a1 [Patch, ARM] Relax the restrictions on REG_SP under Thumb mode on ARMv8-A
For Thumb mode, since ARMv8-A, REG_SP is allowed in most of the places in
Rd/Rt/Rt2 etc while it was disallowed before ARMv8-A, and was rejected through
the "reject_bad_reg" macro and several scattered checks.

  This patch only rejects REG_SP in "reject_bad_reg" and several related places
for legacy architectures before ARMv8-A. I have checked those affected instructions
, all of them qualify such relaxations.

  Testcases adjusted accordingly.
    * ld-sp-warn.d was written without .arch and without -march options passed.
      By default it assumes all architectures, so I deleted the REG_SP warning
      on ldrsb as it's supported on ARMv8-A.  There are actually quite a few
      seperate tests on other architectures, for example ld-sp-warn-v7.l etc.,
      so there the test for ldrsb on legacy architectures are still covered.
    * sp-pc-validations-bad-t has been extended to armv8-a.
    * strex-bad-t.d restricted on armv7-a.
    * Some new tests for REG_SP used as Rd/Rt etc added in sp-usage-thumb2-relax*.

gas/
	* config/tc-arm.c (reject_bad_reg): Allow REG_SP on ARMv8-A.
	(parse_operands): Allow REG_SP for OP_oRRnpcsp and OP_RRnpcsp on
	ARMv8-A.
	(do_co_reg): Allow REG_SP for Rd on ARMv8-A.
	(do_t_add_sub): Likewise.
	(do_t_mov_cmp): Likewise.
	(do_t_tb): Likewise.
	* testsuite/gas/arm/ld-sp-warn.l: Delete the warning on REG_SP as Rt for
	ldrsb.
	* testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d: New test.
	* testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l: New test.
	* testsuite/gas/arm/sp-pc-validations-bad-t.d: Specifies -march=armv7-a.
	* testsuite/gas/arm/sp-pc-validations-bad-t.s: Remove ".arch armv7-a".
	* testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.d: New test.
	* testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.l: New test.
	* testsuite/gas/arm/sp-usage-thumb2-relax-on-v8.d: New test.
	* testsuite/gas/arm/sp-usage-thumb2-relax.s: New test.
	* testsuite/gas/arm/strex-bad-t.d: Specifies -march=armv7-a.
2017-06-06 15:02:25 +01:00
Jim Wilson 61756f84ee Drop arm support for falkor/qdf24xx targets, not present in released hardware.
gas/
	* config/tc-arm.c (arm_cpus): Delete falkor and qdf24xx entries.
	* doc/c-arm.texi (-mcpu): Likewise.
2017-06-05 17:25:02 -07:00
Andreas Krebbel 19fb31c006 S/390: idte/ipte fixes
Later CPU generations added optional operands to the ipte/idte
instructions.  I've added these with:
https://sourceware.org/ml/binutils/2017-05/msg00316.html ... but
supported the optional operands only with the specific hardware
levels.  However, it is more useful to have the optional operands
already in the first versions.  Of course they need to be zero there.

Regression-tested with on s390 and s390x.  Committed to mainline.

Bye,

-Andreas-

opcodes/ChangeLog:

2017-06-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* s390-opc.txt: Support the optional parameters with the first
	versions of ipte/idte.

gas/ChangeLog:

2017-06-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* testsuite/gas/s390/esa-g5.d: Add ipte tests.
	* testsuite/gas/s390/esa-g5.s: Likewise.
	* testsuite/gas/s390/zarch-z196.d: Remove ipte tests.
	* testsuite/gas/s390/zarch-z196.s: Likewise.
	* testsuite/gas/s390/zarch-z990.d: Add idte tests.
	* testsuite/gas/s390/zarch-z990.s: Likewise.
	* testsuite/gas/s390/zarch-zEC12.d: Remove ipte/idte tests.
	* testsuite/gas/s390/zarch-zEC12.s: Likewise.
2017-06-01 15:06:17 +02:00
Anton Kolesov 940171d086 [ARC] Add arc-cpu.def with processor definitions
This patch extracts ARC CPU definitions from gas/config/tc-arc.c (cpu_types)
into a separate file arc-cpu.def.  This will allow reuse of CPU type definition
in multiple places where it might be needed, for example in disassembler.  This
will help ensure that gas and disassembker use same option values for CPUs.

arc-cpu.def file relies on preprocessor macroses which are defined somewhere
else.  This for example multiple C files to include arc-cpu.def, but define
different macroses, therefore creating different structures.

include/ChangeLog:
yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

	* elf/arc-cpu.def: New file.

gas/ChangeLog:
yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

	* config/tc-arc.c (cpu_types): Include arc-cpu.def

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
2017-05-30 16:52:28 +03:00
Andreas Krebbel 70c16c04ac S/390: Fix indentation
gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config/tc-s390.c (md_gather_operands): Fix indentation.
2017-05-30 12:05:49 +02:00
Andreas Krebbel ca87ae741f S/390: Fix instruction types of csdtr and csxtr
opcodes/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* s390-opc.c: Add new instruction types RRF_0URF and RRF_0UREFE.
	* s390-opc.txt: Fix instruction typs of csdtr and csxtr.

gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* testsuite/gas/s390/zarch-z9-ec.d: Adjust csdtr and csxtr.
	* testsuite/gas/s390/zarch-z9-ec.s: Likewise.
2017-05-30 10:36:35 +02:00
Andreas Krebbel 67aa8be4cb S/390: Add missing operand to tb instruction
gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* testsuite/gas/s390/esa-g5.d: Add missing operand to tb
	instruction.
	* testsuite/gas/s390/esa-g5.s: Likewise.

opcodes/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* s390-opc.txt: Add missing operand to tb instruction.
2017-05-30 10:35:55 +02:00
Andreas Krebbel ffc61c5de1 S/390: Add ipte/idte variants with optional operands
This patch adds missing variants of ipte and idte instructions added with later CPU
generations.

ipte got an optional operand with z196 and another one with zEC12.
idte got an optional operand with zEC12

opcodes/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* s390-opc.c: Add new idte/ipte variants.
	* s390-opc.txt: Likewise.

gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* testsuite/gas/s390/zarch-z196.d: Add new idte/ipte variants.
	* testsuite/gas/s390/zarch-z196.s: Likewise.
	* testsuite/gas/s390/zarch-zEC12.d: Likewise.
	* testsuite/gas/s390/zarch-zEC12.s: Likewise.
2017-05-30 10:32:44 +02:00
Andreas Krebbel a09f258601 S/390: Improve error checking for optional operands
So far we only had an instruction flag which made an arbitrary number
of operands optional.  This limits error checking capabilities for
instructions marked that way.  With this patch the optparm flag only
allows a single optional parameter and another one is added (optparm2)
allowing 2 optional arguments.  Hopefully we won't need more than that
in the future. So far there will be only a single use of optparm2.

gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config/tc-s390.c (md_gather_operands): Support new optparm2
	instruction flag.

include/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* opcode/s390.h: Add new instruction flags optparm2.

opcodes/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* s390-dis.c (s390_print_insn_with_opcode): Support new optparm2
	instruction flag.
	* s390-mkopc.c (main): Recognize the new instruction flag when
	parsing instruction list.
2017-05-30 10:22:25 +02:00
Andreas Krebbel bfcfbe611b S/390: Remove optional operand flag.
The per operand optional flag hasn't been used for quite some time.
Cleanup some remains.

include/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* opcode/s390.h: Remove S390_OPERAND_OPTIONAL.

gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config/tc-s390.c (md_gather_operands): Remove code dealing with
	S390_OPERAND_OPTIONAL.
2017-05-30 10:19:59 +02:00
H.J. Lu 6e92fed594 x86: Update notrackbad tests for non-ELF targets
* gas/testsuite/gas/i386/notrackbad.l: Updated for non-ELF
	targets.
	* gas/testsuite/gas/i386/x86-64-notrackbad.l: Likewise.
2017-05-23 06:49:35 -07:00
claziss 6e3f3473e2 [ARC] Reformat error messages.
gas/
2017-05-23  Claudiu Zissulescu <claziss@synopsys.com>

	* config/tc-arc.c (md_apply_fix): Use as_bad_where.
	(assemble_insn): Use as_bad.
2017-05-23 12:18:11 +02:00
H.J. Lu 04ef582ace x86: Add NOTRACK prefix support
For register indirect branches, NOTRACK prefix (0x3e), which is also
the DS segment register prefix, can be used to ignore the CET indirect
branch track.

gas/

	* config/tc-i386.c (REX_PREFIX): Changed to 7.
	(NOTRACK_PREFIX): New.
	(MAX_PREFIXES): Changed to 8.
	(_i386_insn): Add notrack_prefix.
	(PREFIX_GROUP): Add PREFIX_DS.
	(add_prefix): Return PREFIX_DS for DS_PREFIX_OPCODE.
	(md_assemble): Check if NOTRACK prefix is supported.
	(parse_insn): Set notrack_prefix and issue an error for
	other prefixes after NOTRACK prefix.
	* testsuite/gas/i386/i386.exp: Run tests for NOTRACK prefix.
	* testsuite/gas/i386/notrack-intel.d: New file.
	* testsuite/gas/i386/notrack.d: Likewise.
	* testsuite/gas/i386/notrack.s: Likewise.
	* testsuite/gas/i386/notrackbad.l: Likewise.
	* testsuite/gas/i386/notrackbad.s: Likewise.
	* testsuite/gas/i386/x86-64-notrack-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-notrack.d: Likewise.
	* testsuite/gas/i386/x86-64-notrack.s: Likewise.
	* testsuite/gas/i386/x86-64-notrackbad.l: Likewise.
	* testsuite/gas/i386/x86-64-notrackbad.s: Likewise.

include/

	* include/opcode/i386.h (NOTRACK_PREFIX_OPCODE): New.

opcodes/

	* i386-dis.c (NOTRACK_Fixup): New.
	(NOTRACK): Likewise.
	(NOTRACK_PREFIX): Likewise.
	(last_active_prefix): Likewise.
	(reg_table): Use NOTRACK on indirect call and jmp.
	(ckprefix): Set last_active_prefix.
	(prefix_name): Return "notrack" for NOTRACK_PREFIX.
	* i386-gen.c (opcode_modifiers): Add NoTrackPrefixOk.
	* i386-opc.h (NoTrackPrefixOk): New.
	(i386_opcode_modifier): Add notrackprefixok.
	* i386-opc.tbl: Add NoTrackPrefixOk to indirect call and jmp.
	Add notrack.
	* i386-tbl.h: Regenerated.
2017-05-22 11:02:58 -07:00
Jiong Wang 3c0367d0e2 [AArch64, gas] Support ILP32 triplet aarch64*-linux-gnu_ilp32
This patch allows AArch64 GAS defaulting to ILP32 if it is configured with
aarch64*-linux-gnu_ilp32.

"md_after_parse_args" is implemented to update ABI into ILP32 if DEFAULT_ARCH is
"aarch64:32".

gas/
	* configure.tgt: Set "arch" to "aarch64" if ${cpu} equals "aarch64".
	Recognize the new triplet name aarch64*-linux-gnu_ilp32.
	* configure.ac: Output DEFAULT_ARCH macro for AArch64.
	* configure: Regenerate.
	* config/tc-aarch64.h (aarch64_after_parse_args): New declaration.
	(md_after_parse_args): New define.
	* config/tc-aarch64.c (aarch64_abi_type): New enumeration
	AARCH64_ABI_NONE.
	(DEFAULT_ARCH): New define.
	(aarch64_abi): Set default value to AARCH64_ABI_NONE.
	(aarch64_after_parse_args): New function.
2017-05-22 13:27:11 +01:00
Jose E. Marchesi 6451799480 binutils: support for the SPARC M8 processor
This patch adds support for the new SPARC M8 processor (implementing OSA
2017) to binutils.

New instructions:

- Dictionary Unpack

  + dictunpack

- Partitioned Compare with shifted result

  + Signed variants:   fpcmp{le,gt,eq,ne}{8,16,32}shl
  + Unsigned variants: fpcmpu{le,gt}{8,16,32}shl

- Partitioned Dual-Equal compared, with shifted result

  + fpcmpde{8,16,32}shl

- Partitioned Unsigned Range Compare, with shifted result

  + fpcmpur{8,16,32}shl

- 64-bit shifts on Floating-Point registers

  + fps{ll,ra,rl}64x

- Misaligned loads and stores

  + ldm{sh,uh,sw,uw,x,ux}
  + ldm{sh,uh,sw,uw,x,ux}a
  + ldmf{s,d}
  + ldmf{s,d}a

  + stm{h,w,x}
  + stm{h,w,x}a
  + stmf{s,d}
  + stmf{s,d}a

- Oracle Numbers

  + on{add,sub,mul,div}

- Reverse Bytes/Bits

  + revbitsb
  + revbytes{h,w,x}

- Run-Length instructions

  + rle_burst
  + rle_length

- New crypto instructions

  + sha3

- Instruction to read the new register %entropy

  + rd %entropy

New Alternate Address Identifiers:

- 0x24, #ASI_CORE_COMMIT_COUNT
- 0x24, #ASI_CORE_SELECT_COUNT
- 0x48, #ASI_ARF_ECC_REG
- 0x53, #ASI_ITLB_PROBE
- 0x58, #ASI_DSFAR
- 0x5a, #ASI_DTLB_PROBE_PRIMARY
- 0x5b, #ASI_DTLB_PROBE_REAL
- 0x64, #ASI_CORE_SELECT_COMMIT_NHT

The new assembler command-line options for selecting the M8 architecture
are:

-Av9m8 or -Asparc6 for 64-bit binaries.
-Av8plusm8 for 32-bit (v8+) binaries.

The corresponding disassembler command-line options are:

-msparc:v9m8 for 64-bit binaries.
-msparc:v8plusm8 for 32-bit (v8+) binaries.

Tested for regressions in the following targets:
sparc-aout sparc-linux sparc-vxworks sparc64-linux

bfd/ChangeLog:

2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* archures.c (bfd_mach_sparc_v9m8): Define.
	(bfd_mach_sparc_v8plusm8): Likewise.
	(bfd_mach_sparc_v9_p): Adjust to M8.
	(bfd_mach_sparc_64bit_p): Likewise.
	* aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
	bfd_mach_sparc_v8plusm8.
	* bfd-in2.h: Regenerated.
	* cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
	sparc:v8plusm8.
	* elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
	bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
	capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
	SHA3.
	* elf32-sparc.c (elf32_sparc_final_write_processing): Handle
	bfd_mach_sparc_v8plusm8.

binutils/ChangeLog:

2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* NEWS: Mention the SPARC M8 support.

gas/ChangeLog:

2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-sparc.c (sparc_arch_table): Entries for `sparc6',
	`v9m8' and `v8plusm8'.
	(sparc_md_end): Handle SPARC_OPCODE_ARCH_M8.
	(get_hwcap_name): Support the M8 hardware capabilities.
	(sparc_ip): Handle new operand types.
	* doc/c-sparc.texi (Sparc-Opts): Document -Av9m8, -Av8plusm8 and
	-Asparc6, and the corresponding -xarch aliases.
	* testsuite/gas/sparc/sparc6.s: New file.
	* testsuite/gas/sparc/sparc6.d: Likewise.
	* testsuite/gas/sparc/sparc6-diag.s: Likewise.
	* testsuite/gas/sparc/sparc6-diag.l: Likewise.
	* testsuite/gas/sparc/fpcmpshl.s: Likewise.
	* testsuite/gas/sparc/fpcmpshl.d: Likewise.
	* testsuite/gas/sparc/fpcmpshl-diag.s: Likewise.
	* testsuite/gas/sparc/fpcmpshl-diag.l: Likewise.
	* testsuite/gas/sparc/ldm-stm.s: Likewise.
	* testsuite/gas/sparc/ldm-stm.d: Likewise.
	* testsuite/gas/sparc/ldm-stm-diag.s: Likewise.
	* testsuite/gas/sparc/ldm-stm-diag.l: Likewise.
	* testsuite/gas/sparc/ldmf-stmf.s: Likewise.
	* testsuite/gas/sparc/ldmf-stmf.d: Likewise.
	* testsuite/gas/sparc/ldmf-stmf-diag.s: Likewise.
	* testsuite/gas/sparc/ldmf-stmf-diag.l: Likewise.
	* testsuite/gas/sparc/on.s: Likewise.
	* testsuite/gas/sparc/on.d: Likewise.
	* testsuite/gas/sparc/on-diag.s: Likewise.
	* testsuite/gas/sparc/on-diag.l: Likewise.
	* testsuite/gas/sparc/rle.s: Likewise.
	* testsuite/gas/sparc/rle.d: Likewise.
	* testsuite/gas/sparc/sparc.exp (gas_64_check): Run new tests.
	* testsuite/gas/sparc/rdasr.s: Add test for RDENTROPY.
	* testsuite/gas/sparc/rdasr.d: Likewise.

include/ChangeLog:

2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* elf/sparc.h (ELF_SPARC_HWCAP2_SPARC6): Define.
	(ELF_SPARC_HWCAP2_ONADDSUB): Likewise.
	(ELF_SPARC_HWCAP2_ONMUL): Likewise.
	(ELF_SPARC_HWCAP2_ONDIV): Likewise.
	(ELF_SPARC_HWCAP2_DICTUNP): Likewise.
	(ELF_SPARC_HWCAP2_FPCMPSHL): Likewise.
	(ELF_SPARC_HWCAP2_RLE): Likewise.
	(ELF_SPARC_HWCAP2_SHA3): Likewise.
	* opcode/sparc.h (sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_M8
	and adjust SPARC_OPCODE_ARCH_MAX.
	(HWCAP2_SPARC6): Define.
	(HWCAP2_ONADDSUB): Likewise.
	(HWCAP2_ONMUL): Likewise.
	(HWCAP2_ONDIV): Likewise.
	(HWCAP2_DICTUNP): Likewise.
	(HWCAP2_FPCMPSHL): Likewise.
	(HWCAP2_RLE): Likewise.
	(HWCAP2_SHA3): Likewise.
	(OPM): Likewise.
	(OPMI): Likewise.
	(ONFCN): Likewise.
	(REVFCN): Likewise.
	(SIMM10): Likewise.

opcodes/ChangeLog:

2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* sparc-dis.c (MASK_V9): Include SPARC_OPCODE_ARCH_M8.
	(X_IMM2): Define.
	(compute_arch_mask): Handle bfd_mach_sparc_v8plusm8 and
	bfd_mach_sparc_v9m8.
	(print_insn_sparc): Handle new operand types.
	* sparc-opc.c (MASK_M8): Define.
	(v6): Add MASK_M8.
	(v6notlet): Likewise.
	(v7): Likewise.
	(v8): Likewise.
	(v9): Likewise.
	(v9a): Likewise.
	(v9b): Likewise.
	(v9c): Likewise.
	(v9d): Likewise.
	(v9e): Likewise.
	(v9v): Likewise.
	(v9m): Likewise.
	(v9andleon): Likewise.
	(m8): Define.
	(HWS_VM8): Define.
	(HWS2_VM8): Likewise.
	(sparc_opcode_archs): Add entry for "m8".
	(sparc_opcodes): Add OSA2017 and M8 instructions
	dictunpack, fpcmp{ule,ugt,eq,ne,de,ur}{8,16,32}shl,
	fpx{ll,ra,rl}64x,
	ldm{sh,uh,sw,uw,x,ux}, ldm{sh,uh,sw,uw,x,ux}a, ldmf{s,d},
	ldmf{s,d}a, on{add,sub,mul,div}, rdentropy, revbitsb,
	revbytes{h,w,x}, rle_burst, rle_length, sha3, stm{h,w,x},
	stm{h,w,x}a, stmf{s,d}, stmf{s,d}a.
	(asi_table): New M8 ASIs ASI_CORE_COMMIT_COUNT,
	ASI_CORE_SELECT_COUNT, ASI_ARF_ECC_REG, ASI_ITLB_PROBE, ASI_DSFAR,
	ASI_DTLB_PROBE_PRIMARY, ASI_DTLB_PROBE_REAL,
	ASI_CORE_SELECT_COMMIT_NHT.
2017-05-19 09:27:08 -07:00
Jose E. Marchesi ae0264a647 gas: fix tests call-relax and asi-bump-warn in 32-bit SPARC ELF targets
Tested in targets:
sparc-aout sparc-linux sparc-vxworks sparc64-linux

2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* testsuite/gas/sparc/call-relax.d: Support 32-bit targets.
	* testsuite/gas/sparc/sparc.exp (gas_64_check): Use -64 to
	run asi-bump-warn.
2017-05-19 07:02:25 -07:00
eorg-Johann Lay f4203b2b88 Update avrxmega3 linker emulation to support avrxmega2 devices with flash memory visible in the SRAM address range.
PR ld/21472
ld  * emulparams/avrxmega3.sh (RODATA_PM_OFFSET): Set to 0x8000.
    * scripttempl/avr.sc
    (__RODATA_PM_OFFSET__) [RODATA_PM_OFFSET]: Use RODATA_PM_OFFSET
    as default if not already defined.
    (.data) [!RODATA_PM_OFFSET]: Don't include .rodata and friends.
    (.rodata) [RODATA_PM_OFFSET]: Put at an offset of
    __RODATA_PM_OFFSET__.

gas * config/tc-avr.c (mcu_types): Add entries for: attiny416,
     attiny417, attiny816, attiny817.
2017-05-19 15:06:33 +01:00
Alan Modra 535b785fb0 Don't compare boolean values against TRUE or FALSE
bfd/
	* arc-got.h: Don't compare boolean values against TRUE or FALSE.
	* elf-m10300.c: Likewise.
	* elf.c: Likewise.
	* elf32-arc.c: Likewise.
	* elf32-bfin.c: Likewise.
	* elf32-m68k.c: Likewise.
	* elf32-nds32.c: Likewise.
	* elf32-tilepro.c: Likewise.
	* elflink.c: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elfnn-riscv.c: Likewise.
	* elfxx-tilegx.c: Likewise.
	* mach-o.c: Likewise.
	* peXXigen.c: Likewise.
	* vms-alpha.c: Likewise.
	* vms-lib.c: Likewise.
opcodes/
	* aarch64-asm.c: Don't compare boolean values against TRUE or FALSE.
	* aarch64-dis.c: Likewise.
	* aarch64-gen.c: Likewise.
	* aarch64-opc.c: Likewise.
binutils/
	* strings.c: Don't compare boolean values against TRUE or FALSE.
gas/
	* config/tc-aarch64.c: Don't compare booleans against TRUE or FALSE.
	* config/tc-hppa.c: Likewise.
	* config/tc-mips.c: Likewise.
	* config/tc-score7.c: Likewise.
ld/
	* emultempl/elf32.em: Don't compare boolean values against TRUE or FALSE.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/xtensaelf.em: Likewise.
2017-05-18 14:59:33 +09:30
Andreas Krebbel a0a110b0dd S/390: Fix arch level of pckmo instruction.
Fix wrong architecture level of PCKMO instruction.

Committed to mainline.

opcodes/ChangeLog:

2017-05-17  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* s390-opc.txt: PCKMO change arch level to z196.

gas/ChangeLog:

2017-05-17  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* testsuite/gas/s390/zarch-z10.d: Remove pckmo.
	* testsuite/gas/s390/zarch-z10.s: Remove pckmo.
	* testsuite/gas/s390/zarch-z196.d: Add pckmo.
	* testsuite/gas/s390/zarch-z196.s: Add pckmo.
2017-05-17 12:52:19 +02:00
Alan Modra 91cb9803fc Allow target files access to default TC_FORCE_RELOCATION defines
* write.c (GENERIC_FORCE_RELOCATION_LOCAL): Define.
	(TC_FORCE_RELOCATION_LOCAL): Use it.
	(GENERIC_FORCE_RELOCATION_SUB_SAME): Define.
	(TC_FORCE_RELOCATION_SUB_SAME): Use it.
	* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL,
	TC_FORCE_RELOCATION_SUB_SAME): Use GENERIC defines.
	* config/tc-aarch64.h: Similarly.
	* config/tc-avr.h: Similarly.
	* config/tc-cris.h: Similarly.
	* config/tc-i386.h: Similarly.
	* config/tc-i960.h: Similarly.
	* config/tc-ia64.h: Similarly.
	* config/tc-microblaze.h: Similarly.
	* config/tc-mips.h: Similarly.
	* config/tc-msp430.h: Similarly.
	* config/tc-nds32.h: Similarly.
	* config/tc-pru.h: Similarly.
	* config/tc-riscv.h: Similarly.
	* config/tc-rl78.h: Similarly.
	* config/tc-s390.h: Similarly.
	* config/tc-sh.h: Similarly.
	* config/tc-sh64.h: Similarly.
	* config/tc-sparc.h: Similarly.
	* config/tc-xtensa.h: Similarly.
	* config/tc-mn10300.h: Similarly.
	(GENERIC_FORCE_RELOCATION_LOCAL): Define.
	* config/tc-msp430.c (msp430_force_relocation_local): Modify to
	be addition to rather than replacement of standard
	TC_FORCE_RELOCATION_LOCAL.
2017-05-16 10:35:02 +09:30
Nick Clifton 52a86f843b Fix use of ARM ADR and ADRl pseudo-instructions with thumb function symbols.
PR gas/21458
	* config/tc-arm.c (do_adr): If the ADR involves a thumb function
	symbol, ensure that the T bit will be set.
	(do_adrl): Likewise.
	(do_t_adr): Likewise.
	* testsuite/gas/arm/pr21458.s: New test.
	* testsuite/gas/arm/pr21458.d: New test driver.
2017-05-15 15:29:02 +01:00
Maciej W. Rozycki b32465c97c MIPS16e2: Add new MIPS16e2 relaxation GAS and LD tests
Verify MIPS16 PC-relative instruction relaxation using the MIPS16e2 LUI
instruction rather than an LI/SLL instruction pair.

	gas/
	* testsuite/gas/mips/mips16-pcrel-1.d: Remove `-mips3' from `as'
	flags.
	* testsuite/gas/mips/mips16-pcrel-pic-1.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-n32-0.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-n32-1.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-n64-0.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-n64-1.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-n64-sym32-0.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-n64-sym32-1.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-reloc-4.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-reloc-5.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-reloc-6.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-reloc-7.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-4.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-5.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-6.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-7.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-9.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-pic-9.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-n32-8.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-n32-9.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-n64-sym32-8.d:
	Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-n64-sym32-9.d:
	Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-n64-8.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-addend-n64-9.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-2.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-3.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-6.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-7.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-6.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-n32-4.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-n32-6.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-n64-4.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-n64-6.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-n64-sym32-4.d:
	Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-n64-sym32-6.d:
	Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n32-4.d:
	Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n32-6.d:
	Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n64-4.d:
	Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n64-6.d:
	Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n64-sym32-4.d:
	Likewise.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n64-sym32-6.d:
	Likewise.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-0.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-1.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-2.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-n32-0.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-n32-1.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-n64-sym32-0.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-n64-sym32-1.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-delay-0.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-delay-1.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-reloc-2.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-reloc-3.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-reloc-6.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-reloc-7.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-addend-2.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-addend-3.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-addend-6.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-addend-7.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-addend-8.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-addend-9.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-addend-n32-8.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-addend-n32-9.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-addend-n64-sym32-8.d:
	New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-addend-n64-sym32-9.d:
	New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute.d: New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-1.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-2.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-3.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-4.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-5.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-6.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-7.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-pic-4.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-pic-6.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-n32-4.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-n32-6.d: New
	test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-n64-sym32-4.d:
	New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-n64-sym32-6.d:
	New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-pic-n32-4.d:
	New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-pic-n32-6.d:
	New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-pic-n64-sym32-4.d:
	New test.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-absolute-pic-n64-sym32-6.d:
	New test.
	* testsuite/gas/mips/mips16-pcrel-1.l: Adjust line numbers.
	* testsuite/gas/mips/mips16-pcrel-1.s: Adjust for alignment
	preservation between MIPS16 and MIPS16e2 code.
	* testsuite/gas/mips/mips.exp: Run MIPS16 relaxation tests over
	all MIPS16 architectures.

	ld/
	* testsuite/ld-mips-elf/mips16e2-pcrel-0.d: New test.
	* testsuite/ld-mips-elf/mips16e2-pcrel-1.d: New test.
	* testsuite/ld-mips-elf/mips16e2-pcrel-addend-2.d: New test.
	* testsuite/ld-mips-elf/mips16e2-pcrel-addend-6.d: New test.
	* testsuite/ld-mips-elf/mips16e2-pcrel-n32-0.d: New test.
	* testsuite/ld-mips-elf/mips16e2-pcrel-n32-1.d: New test.
	* testsuite/ld-mips-elf/mips16e2-pcrel-n64-sym32-0.d: New test.
	* testsuite/ld-mips-elf/mips16e2-pcrel-n64-sym32-1.d: New test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2017-05-15 14:00:50 +01:00
Maciej W. Rozycki 3f3467ffc4 MIPS16e2: Add new MIPS16e2 ASE binutils and GAS tests
Verify MIPS16e2 ASE instruction assembly, disassembly and object file
flags.

	binutils/
	* testsuite/binutils-all/mips/mips16-undecoded.d: Add `-mips3'
	to `as' flags.
	* testsuite/binutils-all/mips/mips16e2-undecoded.d: New test.
	* testsuite/binutils-all/mips/mips16e2-extend-insn.d: New test.
	* testsuite/binutils-all/mips/mips16-undecoded.s: Remove
	`.module mips3'.
	* testsuite/binutils-all/mips/mips.exp: Run the new tests.

	gas/
	* testsuite/gas/mips/mips16e2.d: New test.
	* testsuite/gas/mips/mips16e2-mt.d: New test.
	* testsuite/gas/mips/mips16e2-sub.d: New test.
	* testsuite/gas/mips/mips16e2@mips16e2-sub.d: New test.
	* testsuite/gas/mips/mips16e2-mt-sub.d: New test.
	* testsuite/gas/mips/mips16e2@mips16e2-mt-sub.d: New test.
	* testsuite/gas/mips/mips16e2-hilo.d: New test.
	* testsuite/gas/mips/mips16e2-hilo-n32.d: New test.
	* testsuite/gas/mips/mips16e2-reloc-error.d: New test.
	* testsuite/gas/mips/mips16e2-imm-error.d: New test.
	* testsuite/gas/mips/elf_ase_mips16e2.d: New test.
	* testsuite/gas/mips/elf_ase_mips16e2-2.d: New test.
	* testsuite/gas/mips/elf-rel9-mips16e2.d: New test.
	* testsuite/gas/mips/mips16e2-lui.d: New test.
	* testsuite/gas/mips/mips16e2@mips32r2-sync.d: New test.
	* testsuite/gas/mips/mips16e2@mips32r2-sync-1.d: New test.
	* testsuite/gas/mips/mips16e2@lui-2.d: New test.
	* testsuite/gas/mips/mips16e2-reloc-error.l: New stderr output.
	* testsuite/gas/mips/mips16e2-imm-error.l: New stderr output.
	* testsuite/gas/mips/mips16e2@lui-2.l: New stderr output.
	* testsuite/gas/mips/mips16e2.s: New test source.
	* testsuite/gas/mips/mips16e2-mt.s: New test source.
	* testsuite/gas/mips/mips16e2-sub.s: New test source.
	* testsuite/gas/mips/mips16e2-mt-sub.s: New test source.
	* testsuite/gas/mips/mips16e2-hilo.s: New test source.
	* testsuite/gas/mips/mips16e2-reloc-error.s: New test source.
	* testsuite/gas/mips/mips16e2-imm-error.s: New test source.
	* testsuite/gas/mips/elf-rel9-mips16e2.s: New test source.
	* testsuite/gas/mips/mips16e2-lui.s: New test source.
	* testsuite/gas/mips/mips.exp: Expand `mips32r2-sync',
	`mips32r2-sync-1', `lui-1' and `lui-2' tests across MIPS16e2
	architectures.  Run the new tests.
2017-05-15 13:57:11 +01:00
Maciej W. Rozycki 70ab592fba MIPS16e2: Add MIPS16e2 ASE GAS test infrastructure
Define a new 32-bit and 64-bit MIPS16e2 test architecture and adjust
existing tests now run against these architectures accordingly.

	gas/
	* testsuite/gas/mips/mips.exp (run_dump_test_arch): Add
	`mips16e2@' prefix.
	(run_list_test_arch): Likewise.
	(mips16e2-32, mips16e2-64): New architectures.
	* testsuite/gas/mips/mips16e2-32@mips16-macro.d: New test.
	* testsuite/gas/mips/mips16e2-32@mips16-macro-t.d: New test.
	* testsuite/gas/mips/mips16e2-32@mips16-macro-e.d: New test.
	* testsuite/gas/mips/mips16e2-32@mips16-insn-t.d: New test.
	* testsuite/gas/mips/mips16e2-32@mips16-insn-e.d: New test.
	* testsuite/gas/mips/mips16e2-32@mips16e-64.d: New test.
	* testsuite/gas/mips/mips16e2-32@mips16-sub.d: New test.
	* testsuite/gas/mips/mips16e2-32@mips16e-64-sub.d: New test.
	* testsuite/gas/mips/mips16e2@relax-swap3.d: New test.
	* testsuite/gas/mips/mips16-32@mips16-asmacro.d: Remove `source'
	tag.  Add `-I$srcdir/$subdir' to `as' flags.
	* testsuite/gas/mips/mips16-64@mips16-asmacro.d: Likewise.
	* testsuite/gas/mips/mips16e2-32@mips16-macro.l: New stderr
	output.
	* testsuite/gas/mips/mips16e2-32@mips16-macro-t.l: New stderr
	output.
	* testsuite/gas/mips/mips16e2-32@mips16-macro-e.l: New stderr
	output.
	* testsuite/gas/mips/mips16e2-32@mips16-insn-t.l: New stderr
	output.
	* testsuite/gas/mips/mips16e2-32@mips16-insn-e.l: New stderr
	output.
	* testsuite/gas/mips/mips16-sub.s: Add `.set nomips16e2'.
	* testsuite/gas/mips/mips16e-sub.s: Likewise.
	* testsuite/gas/mips/mips16e-64-sub.s: Likewise.
	* testsuite/gas/mips/mips16-asmacro.s: Remove `.set mips32'.
	* testsuite/gas/mips/mips16-32@mips16-asmacro.s: New test
	source.
	* testsuite/gas/mips/mips16-64@mips16-asmacro.s: New test
	source.
2017-05-15 13:57:11 +01:00
Maciej W. Rozycki 25499ac7ee MIPS16e2: Add MIPS16e2 ASE support
Add MIPS16e2 ASE support as per the architecture specification[1],
including in particular:

1. A new ELF ASE flag to mark MIPS16e2 binaries.

2. MIPS16e2 instruction assembly support, including a relaxation update
   to use LUI rather than an LI/SLL instruction pair for loading the
   high part of 32-bit addresses.

3. MIPS16e2 instruction disassembly support, including updated rules for
   extended forms of instructions that are now subdecoded and therefore
   do not alias to the original MIPS16 ISA revision instructions even
   for encodings that are not valid in the MIPS16e2 instruction set.

Add `-mmips16e2' and `-mno-mips16e2' GAS command-line options and their
corresponding `mips16e2' and `no-mips16e2' settings for the `.set' and
`.module' pseudo-ops.  Control the availability of the MT ASE subset of
the MIPS16e2 instruction set with a combination of these controls and
the preexisting MT ASE controls.

Parts of this change by Matthew Fortune and Andrew Bennett.

References:

[1] "MIPS32 Architecture for Programmers: MIPS16e2 Application-Specific
    Extension Technical Reference Manual", Imagination Technologies
    Ltd., Document Number: MD01172, Revision 01.00, April 26, 2016

	include/
	* elf/mips.h (AFL_ASE_MIPS16E2): New macro.
	(AFL_ASE_MASK): Adjust accordingly.
	* opcode/mips.h: Document new operand codes defined.
	(mips_operand_type): Add OP_REG28 enum value.
	(INSN2_SHORT_ONLY): Update description.
	(ASE_MIPS16E2, ASE_MIPS16E2_MT): New macros.

	bfd/
	* elfxx-mips.c (print_mips_ases): Handle MIPS16e2 ASE.

	opcodes/
	* mips-dis.c (mips_arch_choices): Add ASE_MIPS16E2 and
	ASE_MIPS16E2_MT flags to the unnamed MIPS16 entry.
	(mips_convert_abiflags_ases): Handle the AFL_ASE_MIPS16E2 flag.
	(print_insn_arg) <OP_REG28>: Add handler.
	(validate_insn_args) <OP_REG28>: Handle.
	(print_mips16_insn_arg): Handle MIPS16 instructions that require
	32-bit encoding and 9-bit immediates.
	(print_insn_mips16): Handle MIPS16 instructions that require
	32-bit encoding and MFC0/MTC0 operand decoding.
	* mips16-opc.c (decode_mips16_operand) <'>', '9', 'G', 'N', 'O'>
	<'Q', 'T', 'b', 'c', 'd', 'r', 'u'>: Add handlers.
	(RD_C0, WR_C0, E2, E2MT): New macros.
	(mips16_opcodes): Add entries for MIPS16e2 instructions:
	GP-relative "addiu" and its "addu" spelling, "andi", "cache",
	"di", "ehb", "ei", "ext", "ins", GP-relative "lb", "lbu", "lh",
	"lhu", and "lw" instructions, "ll", "lui", "lwl", "lwr", "mfc0",
	"movn", "movtn", "movtz", "movz", "mtc0", "ori", "pause",
	"pref", "rdhwr", "sc", GP-relative "sb", "sh" and "sw"
	instructions, "swl", "swr", "sync" and its "sync_acquire",
	"sync_mb", "sync_release", "sync_rmb" and "sync_wmb" aliases,
	"xori", "dmt", "dvpe", "emt" and "evpe".  Add split
	regular/extended entries for original MIPS16 ISA revision
	instructions whose extended forms are subdecoded in the MIPS16e2
	ISA revision: "li", "sll" and "srl".

	binutils/
	* readelf.c (print_mips_ases): Handle MIPS16e2 ASE.
	* NEWS: Mention MIPS16e2 ASE support.

	gas/
	* config/tc-mips.c (RELAX_MIPS16_ENCODE): Add `e2' flag.
	(RELAX_MIPS16_E2): New macro.
	(RELAX_MIPS16_PIC, RELAX_MIPS16_SYM32, RELAX_MIPS16_NOMACRO)
	(RELAX_MIPS16_USER_SMALL, RELAX_MIPS16_USER_EXT)
	(RELAX_MIPS16_DSLOT, RELAX_MIPS16_JAL_DSLOT)
	(RELAX_MIPS16_EXTENDED, RELAX_MIPS16_MARK_EXTENDED)
	(RELAX_MIPS16_CLEAR_EXTENDED, RELAX_MIPS16_ALWAYS_EXTENDED)
	(RELAX_MIPS16_MARK_ALWAYS_EXTENDED)
	(RELAX_MIPS16_CLEAR_ALWAYS_EXTENDED, RELAX_MIPS16_MACRO)
	(RELAX_MIPS16_MARK_MACRO, RELAX_MIPS16_CLEAR_MACRO): Shift bits.
	(mips16_immed_extend): New prototype.
	(options): Add OPTION_MIPS16E2 and OPTION_NO_MIPS16E2 enum
	values.
	(md_longopts): Add "mmips16e2" and "mno-mips16e2" options.
	(mips_ases): Add "mips16e2" entry.
	(mips_set_ase): Handle MIPS16e2 ASE.
	(insn_insert_operand): Explicitly handle immediates with MIPS16
	instructions that require 32-bit encoding.
	(is_opcode_valid_16): Pass enabled ASE bitmask on to
	`opcode_is_member'.
	(validate_mips_insn): Explicitly handle immediates with MIPS16
	instructions that require 32-bit encoding.
	(operand_reg_mask) <OP_REG28>: Add handler.
	(match_reg28_operand): New function.
	(match_operand) <OP_REG28>: Add handler.
	(append_insn): Pass ASE_MIPS16E2 setting to RELAX_MIPS16_ENCODE.
	(match_mips16_insn): Handle MIPS16 instructions that require
	32-bit encoding and `V' and `u' operand codes.
	(mips16_ip): Allow any characters except from `.' in opcodes.
	(mips16_immed_extend): Handle 9-bit immediates.  Do not shuffle
	immediates whose width is not one of these listed.
	(md_estimate_size_before_relax): Handle MIPS16e2 relaxation.
	(mips_relax_frag): Likewise.
	(md_convert_frag): Likewise.
	(mips_convert_ase_flags): Handle MIPS16e2 ASE.

	* doc/as.texinfo (Target MIPS options): Add `-mmips16e2' and
	`-mno-mips16e2' options.
	(-mmips16e2, -mno-mips16e2): New options.
	* doc/c-mips.texi (MIPS Options): Add `-mmips16e2' and
	`-mno-mips16e2' options.
	(MIPS ASE Instruction Generation Overrides): Add `.set mips16e2'
	and `.set nomips16e2'.
2017-05-15 13:57:10 +01:00
Maciej W. Rozycki 20c59b843a MIPS16/GAS: Improve [32768,65535] out-of-range operand error diagnostics
Improve out-of-range operand error diagnostics for invalid values in the
[32768,65535] range used for a signed 16-bit immediate, making the
message consistent with that used for other invalid values, e.g.:

foo.s:1: Error: operand 2 must be an immediate expression `addiu $2,$gp,32768'
foo.s:2: Error: invalid operands `lw $2,32768($gp)'

vs:

foo.s:3: Error: operand 3 out of range `addiu $2,$gp,-32769'
foo.s:4: Error: operand 2 out of range `lw $2,-32769($gp)'

This case does not currently trigger however, for two reasons.

First, for regular MIPS and microMIPS assembly in the case of no match
caused by `match_int_operand' here, the function is always called again
from `mips_ip' via `match_insns', `match_insn' and then `match_operand'
for the same opcode table's entry with `lax_match' set to TRUE, in which
case the attempt to match succeeds and no error is issued.

Second, in the case of MIPS16 assembly no call to `match_int_operand' is
made at all for signed 16-bit immediates, because such immediates are
currently only matched with extensible instructions, and these are
handled in `match_mips16_insn' via `match_expression' directly rather
than via `match_operand'.

This will change for MIPS16 code with MIPS16e2 support introduced, where
non-extensible instructions accepting signed 16-bit immediates will be
added, so make the case work well right from the start:

foo.s:1: Error: operand 3 out of range `addiu $2,$gp,32768'
foo.s:2: Error: operand 2 out of range `lw $2,32768($gp)'

	gas/
	* config/tc-mips.c (match_int_operand): Call
	`match_out_of_range' before returning failure for 0x8000-0xffff
	values conditionally allowed.
2017-05-15 13:57:10 +01:00
Maciej W. Rozycki 602b88e3ab MIPS16/GAS: Improve non-constant operand error diagnostics
Improve operand error diagnostics for non-constant expressions used for
a 16-bit immediate, making the message more descriptive and indicating
the offending operand, e.g.:

foo.s:1: Error: invalid operands `lui $2,foo-bar'

will show as:

foo.s:1: Error: operand 2 must be constant `lui $2,foo-bar'

This case does not currently trigger however, for two reasons.

First, for regular MIPS and microMIPS assembly in the case of no match
caused by `match_int_operand' here, the function is always called again
from `mips_ip' via `match_insns', `match_insn' and then `match_operand'
for the same opcode table's entry with `lax_match' set to TRUE, in which
case the attempt to match succeeds and no error is issued.

Second, in the case of MIPS16 assembly no call to `match_int_operand' is
made at all for 16-bit immediates, because such immediates are currently
only matched with extensible instructions, and these are handled in
`match_mips16_insn' via `match_expression' directly rather than via
`match_operand'.

This will change for MIPS16 code with MIPS16e2 support introduced, where
non-extensible instructions accepting 16-bit immediates will be added,
so make the case work well right from the start.

	gas/
	* config/tc-mips.c (match_int_operand): Call
	`match_not_constant' before returning failure for a non-constant
	16-bit immediate conditionally allowed.
2017-05-15 13:57:09 +01:00
Maciej W. Rozycki c96425c560 MIPS/GAS: Improve bignum operand error diagnostics
Improve bignum operand error diagnostics for cases where a constant
would be accepted and report them as range errors, also indicating the
offending operand and instruction, e.g.:

$ cat bignum.s
	addiu	$2, 0x10000000000000000
	break	0x10000000000000000
$ as -o bignum.o bignum.s
bignum.s:1: Error: bignum invalid
bignum.s:2: Error: operand 1 must be constant `break 0x10000000000000000'
$

now show as:

$ as -o bignum.o bignum.s
bignum.s:1: Error: operand 2 out of range `addiu $2,0x10000000000000000'
bignum.s:2: Error: operand 1 out of range `break 0x10000000000000000'
$

	gas/
	* config/tc-mips.c (match_const_int): Call `match_out_of_range'
	rather than `match_not_constant' for unrelocated operands
	retrieved as an `O_big' expression.
	(match_int_operand): Call `match_out_of_range' for relocatable
	operands retrieved as an `O_big' expression.
	(match_mips16_insn): Call `match_out_of_range' for relaxable
	operands retrieved as an `O_big' expression.
	* testsuite/gas/mips/addiu-error.d: New test.
	* testsuite/gas/mips/mips16@addiu-error.d: New test.
	* testsuite/gas/mips/micromips@addiu-error.d: New test.
	* testsuite/gas/mips/break-error.d: New test.
	* testsuite/gas/mips/lui-1.l: Adjust error message.
	* testsuite/gas/mips/addiu-error.l: New stderr output.
	* testsuite/gas/mips/mips16@addiu-error.l: New stderr output.
	* testsuite/gas/mips/micromips@addiu-error.l: New stderr output.
	* testsuite/gas/mips/break-error.l: New stderr output.
	* testsuite/gas/mips/addiu-error.s: New test source.
	* testsuite/gas/mips/break-error.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2017-05-15 13:57:09 +01:00
Maciej W. Rozycki 1a7bf198b6 MIPS16/GAS: Improve non-immediate operand error diagnostics
Improve non-immediate operand error diagnostics for extensible MIPS16
instructions and make it match corresponding regular MIPS and microMIPS
handling, e.g:

$ cat addiu.s
        addiu    $4, $3, $2
$ as -o addiu.o addiu.s
addiu.s: Assembler messages:
addiu.s:1: Error: operand 3 must be an immediate expression `addiu $4,$3,$2'
$ as -mips16 -o addiu.o addiu.s
addiu.s: Assembler messages:
addiu.s:1: Error: invalid operands `addiu $4,$3,$2'
$

To do so observe that for extensible MIPS16 instructions and a non-PC
relative operand this case is handled by an explicit OT_INTEGER check in
`match_mips16_insn' returning a failure right away and consequently
preventing a call to `match_expression' from being made.  As from commit
d436c1c2e8 ("Improve error reporting for register expressions"),
<https://sourceware.org/ml/binutils/2013-08/msg00134.html>, however the
check has become redundant as `match_expression' now only ever returns
success for OT_INTEGER argument tokens, and a special case of an OT_CHAR
`(' token already handled by `match_mips16_insn' just ahead of the
`match_expression' call.  Previously it also returned success for OT_REG
argument tokens.

Let the call to `match_expression' always happen then, yielding the same
failure for the affected cases, however with more accurate diagnostics
provided by the call making reporting consistent:

$ as -mips16 -o addiu.o addiu.s
addiu.s: Assembler messages:
addiu.s:1: Error: operand 3 must be an immediate expression `addiu $4,$3,$2'
$

	gas/
	* config/tc-mips.c (match_mips16_insn): Remove the explicit
	OT_INTEGER check before the `match_expression' call.
	* testsuite/gas/mips/mips16-insn-e.l: Adjust messages.
	* testsuite/gas/mips/mips16-32@mips16-insn-e.l: Likewise.
	* testsuite/gas/mips/mips16-64@mips16-insn-e.l: Likewise.
	* testsuite/gas/mips/mips16e-32@mips16-insn-e.l: Likewise.
	* testsuite/gas/mips/mips16-reg-error.d: New test.
	* testsuite/gas/mips/mips16-reg-error.l: New stderr output.
	* testsuite/gas/mips/mips16-reg-error.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new test.
2017-05-15 13:57:08 +01:00
Maciej W. Rozycki e295202f60 MIPS16/GAS: Improve disallowed relocation operand error diagnostics
Improve disallowed relocation operand error diagnostics for MIPS16 code
and make it match corresponding regular MIPS and microMIPS handling,
e.g:

$ cat sltu.s
	sltu	$2, %lo(foo)
$ as -o sltu.o sltu.s
sltu.s: Assembler messages:
sltu.s:1: Error: operand 2 must be constant `sltu $2,%lo(foo)'
$ as -mips16 -o sltu.o sltu.s
sltu.s: Assembler messages:
sltu.s:1: Error: invalid operands `sltu $2,%lo(foo)'
$

To do so call `match_not_constant' from `match_mips16_insn' whenever a
disallowed relocation operation has been noticed, like `match_const_int'
does, making reporting consistent:

$ as -mips16 -o sltu.o sltu.s
sltu.s: Assembler messages:
sltu.s:1: Error: operand 2 must be constant `sltu $2,%lo(foo)'
$

	gas/
	* config/tc-mips.c (match_mips16_insn): Call
	`match_not_constant' for a disallowed relocation operation.
	* testsuite/gas/mips/mips16-reloc-error.d: New test.
	* testsuite/gas/mips/mips16-reloc-error.l: New stderr output.
	* testsuite/gas/mips/mips16-reloc-error.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new test.
2017-05-15 13:57:08 +01:00
Maciej W. Rozycki c76081bc87 MIPS/GAS/testsuite: Convert LUI list tests to dump tests
gas/
	* testsuite/gas/mips/lui-1.d: New test.
	* testsuite/gas/mips/lui-2.d: New test.
	* gas/testsuite/gas/mips/mips.exp: Fold corresponding list tests
	into the new tests.
2017-05-15 13:57:07 +01:00
Maciej W. Rozycki a54d5f8bb3 MIPS/GAS: Update `match_const_int' description
Remove a stale reference to FALLBACK parameter from the description of
`match_const_int', matching commit 1a00e61226 ("Remove soft_match"),
<https://sourceware.org/ml/binutils/2013-08/msg00133.html>.

	gas/
	* config/tc-mips.c (match_const_int): Update description.
2017-05-15 13:57:07 +01:00
Maciej W. Rozycki 32035f5151 MIPS/GAS/doc: Refer to `.module' rather than `.set'
Complement commit 919731affb ("Add MIPS .module directive") and update
the GAS manual to refer to the `.module' rather than `.set' directive in
command-line option descriptions, following an observation that unlike
`.set' and like the respective command-line option the use of the
`.module' directive affects the ISA and ASE flags recorded in the object
file produced, and therefore it is `.module' rather than `.set' that
corresponds to the respective command-line option.

	gas/
	* doc/as.texinfo (-mips16, -no-mips16): Refer to `.module
	mips16' rather than `.set mips16'.
	(-mmicromips, -mno-micromips): Refer to `.module micromips' and
	`.module nomicromips' rather than `.set micromips' and `.set
	nomicromips'.
	(-msmartmips, -mno-smartmips): Refer to `.module smartmips'
	rather than `.set smartmips'.
	* doc/c-mips.texi (MIPS Options): Refer to `.module mips16',
	`.module micromips', `.module nomicromips' and `.module
	smartmips' rather than `.set mips16', `.set micromips', `.set
	nomicromips' and `.set smartmips' respectively.
2017-05-15 13:57:06 +01:00
Maciej W. Rozycki be3f100674 MIPS/GAS: Unify GP-relative percent-ops
For a reason that is unclear commit d6f1659387 ("Support for MIPS16
HI16/LO16 relocations"),
<https://sourceware.org/ml/binutils/2005-02/msg00332.html>, which has
added support for the R_MIPS16_GPREL relocation, has spelled its
corresponding MIPS16 percent-op as `%gprel', rather than `%gp_rel' which
is how its regular MIPS counterpart is spelled.  To make assembly code
sharing easier between the regular MIPS and the MIPS16 ISA make both
percent-op spellings acceptable in both kinds of code now.

Parts of this change by Matthew Fortune.

	gas/
	* config/tc-mips.c (mips_percent_op): Add "%gprel".
	(mips16_percent_op): Add "%gp_rel".
	* testsuite/gas/mips/elf-rel8.s:: Add `%gprel' forms.
	* testsuite/gas/mips/elf-rel8-mips16.s: Add `%gp_rel' forms.
	* testsuite/gas/mips/elf-rel8.d: Adjust accordingly.
	* testsuite/gas/mips/elf-rel8-mips16.d: Likewise.
2017-05-12 02:34:56 +01:00
Maciej W. Rozycki a4f8991513 MIPS16/opcodes: Make the handling of BREAK and SDBBP consistent
Disassemble the MIPS16 BREAK and SDBBP instruction's immediate operand
in the hexadecimal rather than decimal numeral system and add respective
operandless variants with an implicit 0 operand, making our handling of
these instructions consistent with how we have processed their regular
MIPS and microMIPS counterparts since forever.

	opcodes/
	* mips16-opc.c (decode_mips16_operand) <'6'>: Switch the operand
	type to hexadecimal.
	(mips16_opcodes): Add operandless "break" and "sdbbp" entries.

	binutils/
	* testsuite/binutils-all/mips/mips16-extend-insn.d: Adjust BREAK
	and SDBBP disassembly.

	gas/
	* testsuite/gas/mips/mips16.d: Adjust BREAK disassembly.
	* testsuite/gas/mips/mips16-64@mips16.d: Likewise.
	* testsuite/gas/mips/mips16-64.d: Likewise.
	* testsuite/gas/mips/mips16-64@mips16-64.d: Likewise.
	* testsuite/gas/mips/mips16-macro.d: Likewise.
	* testsuite/gas/mips/mips16-64@mips16-macro.d: Likewise.
	* testsuite/gas/mips/mips16-sub.d: Likewise.
	* testsuite/gas/mips/mips16-32@mips16-sub.d: Likewise.
2017-05-12 01:12:10 +01:00
Maciej W. Rozycki 99e2d67a0e MIPS/opcodes: Mark descriptive SYNC mnemonics as aliases
Following the way how descriptive SYNC mnemonics have been defined in
the architecture[1][2] mark them as aliases, so that the generic SYNC
instruction can be alternatively disassembled along with its immediate
operand, as noted in the documents referred.

References:

[1] "MIPS Architecture For Programmers, Volume II-A: The MIPS32
    Instruction Set", MIPS Technologies, Inc., Document Number: MD00086,
    Revision 5.04, December 11, 2013, Table 4.7 "Encodings of the
    Bits[10:6] of the SYNC instruction; the SType Field", p. 305

[2] "MIPS Architecture for Programmers, Volume II-B: The microMIPS32
    Instruction Set", MIPS Technologies, Inc., Document Number: MD00582,
    Revision 5.04, January 15, 2014, Table 5.28 "Encodings of the
    Bits[10:6] of the SYNC instruction; the SType Field", p. 481

	opcodes/
	* mips-opc.c (mips_builtin_opcodes): Mark "synciobdma", "syncs",
	"syncw", "syncws", "sync_acquire", "sync_mb", "sync_release",
	"sync_rmb" and "sync_wmb" as aliases.
	* micromips-opc.c (micromips_opcodes): Mark "sync_acquire",
	"sync_mb", "sync_release", "sync_rmb" and "sync_wmb" as aliases.

	gas/
	* testsuite/gas/mips/mips32r2-sync-1.d: New test.
	* testsuite/gas/mips/micromips@mips32r2-sync-1.d: New test.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2017-05-12 00:48:19 +01:00
Maciej W. Rozycki 7f401e8417 MIPS/GAS/testsuite: Convert ISA override list tests to dump tests
And remove the zillion duplicate sources.  Also `mips1@isa-override-2.l'
is the same as `r3000@isa-override-2.l', so remove the latter too, now
that `r3000@isa-override-2.d' can name a file to match stderr output
against.

	gas/
	* testsuite/gas/mips/isa-override-2.d: New test.
	* testsuite/gas/mips/mips1@isa-override-2.d: New test.
	* testsuite/gas/mips/r3000@isa-override-2.d: New test.
	* testsuite/gas/mips/r3900@isa-override-2.d: New test.
	* testsuite/gas/mips/mips2@isa-override-2.d: New test.
	* testsuite/gas/mips/mips32@isa-override-2.d: New test.
	* testsuite/gas/mips/mips32r2@isa-override-2.d: New test.
	* testsuite/gas/mips/mips32r3@isa-override-2.d: New test.
	* testsuite/gas/mips/mips32r5@isa-override-2.d: New test.
	* testsuite/gas/mips/mips32r6@isa-override-2.d: New test.
	* testsuite/gas/mips/octeon3@isa-override-2.d: New test.
	* testsuite/gas/mips/r3000@isa-override-2.l: Remove list test.
	* testsuite/gas/mips/mips1@isa-override-2.s: Remove test source.
	* testsuite/gas/mips/r3000@isa-override-2.s: Remove test source.
	* testsuite/gas/mips/r3900@isa-override-2.s: Remove test source.
	* testsuite/gas/mips/mips2@isa-override-2.s: Remove test source.
	* testsuite/gas/mips/mips32@isa-override-2.s: Remove test
	source.
	* testsuite/gas/mips/mips32r2@isa-override-2.s: Remove test
	source.
	* testsuite/gas/mips/mips32r3@isa-override-2.s: Remove test
	source.
	* testsuite/gas/mips/mips32r5@isa-override-2.s: Remove test
	source.
	* testsuite/gas/mips/mips32r6@isa-override-2.s: Remove test
	source.
	* testsuite/gas/mips/octeon3@isa-override-2.s: Remove test
	source.
	* gas/testsuite/gas/mips/mips.exp: Fold corresponding list tests
	into the new tests.
2017-05-10 20:15:09 +01:00
Maciej W. Rozycki 9fc1813479 MIPS/GAS/testsuite: Correct swapped MIPS16e subset test names
Correct the test names swapped between common and 64-bit MIPS16e subset
tests.

	gas/
	* testsuite/gas/mips/mips16e-sub.d: Correct test name.
	* testsuite/gas/mips/mips16-32@mips16e-sub.d: Likewise.
	* testsuite/gas/mips/mips16-64@mips16e-sub.d: Likewise.
	* testsuite/gas/mips/mips16e-64-sub.d: Likewise.
	* testsuite/gas/mips/mips16-32@mips16e-64-sub.d: Likewise.
	* testsuite/gas/mips/mips16-64@mips16e-64-sub.d: Likewise.
	* testsuite/gas/mips/mips16e-32@mips16e-64-sub.d: Likewise.
2017-05-10 18:35:34 +01:00
Maciej W. Rozycki f78c0b9158 MIPS/GAS/testsuite: Remove stale `mips16-macro' list test output
Complement commit c60aaac10f ("MIPS/GAS/testsuite: Extend MIPS16
testing over multiple ISAs") and remove a stale `mips16-macro' list test
output replaced with the `mips16-32@mips16-macro' stderr output.

	gas/
	* testsuite/gas/mips/mips16-macro.l: Remove list test.
2017-05-10 14:38:49 +01:00
Maciej W. Rozycki 58667758b1 MIPS/GAS/testsuite: Remove last remnants of ECOFF support
Complement commit 16e5e222b6 ("Make gas/mips/mips.exp ELF-only"),
<https://sourceware.org/ml/binutils/2013-06/msg00195.html>, and commit
fcedb9f3ca ("MIPS/GAS/testsuite: Remove remnants of a.out/ECOFF
support"), and remove stale ECOFF test dumps previously missed.

	gas/
	* testsuite/gas/mips/r3900@ecoff@ld.d: Remove test.
	* testsuite/gas/mips/mips2@ecoff@ld.d: Remove test.
	* testsuite/gas/mips/mips32@ecoff@ld.d: Remove test.
	* testsuite/gas/mips/mips32r2@ecoff@ld.d: Remove test.
	* testsuite/gas/mips/r3900@ecoff@ld-forward.d: Remove test.
	* testsuite/gas/mips/mips2@ecoff@ld-forward.d: Remove test.
	* testsuite/gas/mips/mips32@ecoff@ld-forward.d: Remove test.
	* testsuite/gas/mips/mips32r2@ecoff@ld-forward.d: Remove test.
	* testsuite/gas/mips/mips1@ecoff@sd.d: Remove test.
	* testsuite/gas/mips/r3000@ecoff@sd.d: Remove test.
	* testsuite/gas/mips/r3900@ecoff@sd.d: Remove test.
	* testsuite/gas/mips/mips2@ecoff@sd.d: Remove test.
	* testsuite/gas/mips/mips32@ecoff@sd.d: Remove test.
	* testsuite/gas/mips/mips32r2@ecoff@sd.d: Remove test.
	* testsuite/gas/mips/mips1@ecoff@sd-forward.d: Remove test.
	* testsuite/gas/mips/r3000@ecoff@sd-forward.d: Remove test.
	* testsuite/gas/mips/r3900@ecoff@sd-forward.d: Remove test.
	* testsuite/gas/mips/mips2@ecoff@sd-forward.d: Remove test.
	* testsuite/gas/mips/mips32@ecoff@sd-forward.d: Remove test.
	* testsuite/gas/mips/mips32r2@ecoff@sd-forward.d: Remove test.
2017-05-10 14:20:32 +01:00
Claudiu Zissulescu 53a346d823 [ARC] Object attributes.
gas/
2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/attr-arc600.d: New file.
	* testsuite/gas/arc/attr-arc600_mul32x16.d: Likewise.
	* testsuite/gas/arc/attr-arc600_norm.d: Likewise.
	* testsuite/gas/arc/attr-arc601.d: Likewise.
	* testsuite/gas/arc/attr-arc601_mul32x16.d: Likewise.
	* testsuite/gas/arc/attr-arc601_mul64.d: Likewise.
	* testsuite/gas/arc/attr-arc601_norm.d: Likewise.
	* testsuite/gas/arc/attr-arc700.d: Likewise.
	* testsuite/gas/arc/attr-arcem.d: Likewise.
	* testsuite/gas/arc/attr-archs.d: Likewise.
	* testsuite/gas/arc/attr-autodetect-1.d: Likewise.
	* testsuite/gas/arc/attr-autodetect-1.s: Likewise.
	* testsuite/gas/arc/attr-cpu-a601.d: Likewise.
	* testsuite/gas/arc/attr-cpu-a601.s: Likewise.
	* testsuite/gas/arc/attr-cpu-a700.d: Likewise.
	* testsuite/gas/arc/attr-cpu-a700.s: Likewise.
	* testsuite/gas/arc/attr-cpu-em.d: Likewise.
	* testsuite/gas/arc/attr-cpu-em.s: Likewise.
	* testsuite/gas/arc/attr-cpu-hs.d: Likewise.
	* testsuite/gas/arc/attr-cpu-hs.s: Likewise.
	* testsuite/gas/arc/attr-em.d: Likewise.
	* testsuite/gas/arc/attr-em4.d: Likewise.
	* testsuite/gas/arc/attr-em4_dmips.d: Likewise.
	* testsuite/gas/arc/attr-em4_fpuda.d: Likewise.
	* testsuite/gas/arc/attr-em4_fpus.d: Likewise.
	* testsuite/gas/arc/attr-hs.d: Likewise.
	* testsuite/gas/arc/attr-hs34.d: Likewise.
	* testsuite/gas/arc/attr-hs38.d: Likewise.
	* testsuite/gas/arc/attr-hs38_linux.d: Likewise.
	* testsuite/gas/arc/attr-mul64.d: Likewise.
	* testsuite/gas/arc/attr-name.d: Likewise.
	* testsuite/gas/arc/attr-name.s: Likewise.
	* testsuite/gas/arc/attr-nps400.d: Likewise.
	* testsuite/gas/arc/attr-override-mcpu.d: Likewise.
	* testsuite/gas/arc/attr-override-mcpu.s
	* testsuite/gas/arc/attr-quarkse_em.d: Likewise.
	* testsuite/gas/arc/blank.s: Likewise.
	* testsuite/gas/elf/section2.e-arc: Likewise.
	* testsuite/gas/arc/cpu-pseudop-1.d: Update test.
	* testsuite/gas/arc/cpu-pseudop-2.d: Likewise.
	* testsuite/gas/arc/nps400-0.d: Likewise.
	* testsuite/gas/elf/elf.exp: Set target_machine for ARC.
	* config/tc-arc.c (opcode/arc-attrs.h): Include.
	(ARC_GET_FLAG, ARC_SET_FLAG, streq): Define.
	(arc_attribute): Declare new function.
	(md_pseudo_table): Add arc_attribute.
	(cpu_types): Rename default cpu features.
	(selected_cpu): Set the default OSABI flag.
	(mpy_option): New variable.
	(pic_option): Likewise.
	(sda_option): Likewise.
	(tls_option): Likewise.
	(feature_type, feature_list): Remove.
	(arc_initial_eflag): Likewise.
	(attributes_set_explicitly): New variable.
	(arc_check_feature): Check also for the conflicting features.
	(arc_select_cpu): Refactor assignment of selected_cpu.eflags.
	(arc_option): Remove setting of private flags and architecture.
	(check_cpu_feature): Refactor feature names.
	(autodetect_attributes): New function.
	(assemble_tokens): Use above function.
	(md_parse_option): Refactor feature names.
	(arc_attribute): New function.
	(arc_set_attribute_int): Likewise.
	(arc_set_attribute_string): Likewise.
	(arc_stralloc): Likewise.
	(arc_set_public_attributes): Likewise.
	(arc_md_end): Likewise.
	(arc_copy_symbol_attributes): Likewise.
	(rc_convert_symbolic_attribute): Likewise.
	* config/tc-arc.h (md_end): Define.
	(CONVERT_SYMBOLIC_ATTRIBUTE): Likewise.
	(TC_COPY_SYMBOL_ATTRIBUTES): Likewise.
	* doc/c-arc.texi: Document ARC object attributes.

binutils/
2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>

	* readelf.c (decode_ARC_machine_flags): Recognize OSABI v4.
	(get_arc_section_type_name): New function.
	(get_section_type_name): Use the above function.
	(display_arc_attribute): New function.
	(process_arc_specific): Likewise.
	(process_arch_specific): Handle ARC specific information.
	* testsuite/binutils-all/strip-3.d: Consider ARC.attributes
	section.

include/
2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>

	* elf/arc.h (SHT_ARC_ATTRIBUTES): Define.
	(Tag_ARC_*): Define.
	(E_ARC_OSABI_V4): Define.
	(E_ARC_OSABI_CURRENT): Reassign it.
	(TAG_CPU_*): Define.
	* opcode/arc-attrs.h: New file.
	* opcode/arc.h (insn_subclass_t): Assign enum values.
	(insn_subclass_t): Update enum with QUARKSE1, QUARKSE2, and LL64.
	(ARC_EA, ARC_CD, ARC_LLOCK, ARC_ATOMIC, ARC_MPY, ARC_MULT)
	(ARC_NPS400, ARC_DPFP, ARC_SPFP, ARC_FPU, ARC_FPUDA, ARC_SWAP)
	(ARC_NORM, ARC_BSCAN, ARC_UIX, ARC_TSTAMP, ARC_VBFDW)
	(ARC_BARREL, ARC_DSPA, ARC_SHIFT, ARC_INTR, ARC_DIV, ARC_XMAC)
	(ARC_CRC): Delete.

bfd/
2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>

	* elf32-arc.c (FEATURE_LIST_NAME): Define.
	(CONFLICT_LIST): Likewise.
	(opcode/arc-attrs.h): Include.
	(arc_elf_print_private_bfd_data): Print OSABI v4 flag.
	(arc_extract_features): New file.
	(arc_stralloc): Likewise.
	(arc_elf_merge_attributes): Likewise.
	(arc_elf_merge_private_bfd_data): Use object attributes.
	(bfd_arc_get_mach_from_attributes): New function.
	(arc_elf_object_p): Use object attributes.
	(arc_elf_final_write_processing): Likewise.
	(elf32_arc_obj_attrs_arg_type): New function.
	(elf32_arc_obj_attrs_handle_unknown): Likewise.
	(elf32_arc_section_from_shdr): Likewise.
	(elf_backend_obj_attrs_vendor): Define.
	(elf_backend_obj_attrs_section): Likewise.
	(elf_backend_obj_attrs_arg_type): Likewise.
	(elf_backend_obj_attrs_section_type): Likewise.
	(elf_backend_obj_attrs_handle_unknown): Likewise.
	(elf_backend_section_from_shdr): Likewise.

ld/
2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/ld-arc/attr-merge-0.d: New file.
	* testsuite/ld-arc/attr-merge-0.s: Likewise.
	* testsuite/ld-arc/attr-merge-0e.s: Likewise.
	* testsuite/ld-arc/attr-merge-1.d: Likewise.
	* testsuite/ld-arc/attr-merge-1.s: Likewise.
	* testsuite/ld-arc/attr-merge-1e.s: Likewise.
	* testsuite/ld-arc/attr-merge-2.d: Likewise.
	* testsuite/ld-arc/attr-merge-2.s: Likewise.
	* testsuite/ld-arc/attr-merge-3.d: Likewise.
	* testsuite/ld-arc/attr-merge-3.s: Likewise.
	* testsuite/ld-arc/attr-merge-3e.s: Likewise.
	* testsuite/ld-arc/attr-merge-4.s: Likewise.
	* testsuite/ld-arc/attr-merge-5.d: Likewise.
	* testsuite/ld-arc/attr-merge-5a.s: Likewise.
	* testsuite/ld-arc/attr-merge-5b.s: Likewise.
	* testsuite/ld-arc/attr-merge-conflict-isa.d: Likewise.
	* testsuite/ld-arc/attr-merge-err-isa.d: Likewise.
	* testsuite/ld-arc/attr-merge-incompatible-cpu.d: Likewise.
	* testsuite/ld-arc/got-01.d: Update test.
	* testsuite/ld-arc/attr-merge-err-quarkse.d: New file.
	* testsuite/ld-arc/attr-quarkse.s: Likewise.
	* testsuite/ld-arc/attr-quarkse2.s: Likewise.

opcodes/
2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-dis.c (parse_option): Update quarkse_em option..
	* arc-ext-tbl.h (dsp_fp_flt2i, dsp_fp_i2flt): Change subclass to
	QUARKSE1.
	(dsp_fp_div, dsp_fp_cmp): Change subclass to QUARKSE2.
2017-05-10 14:42:22 +02:00
Maciej W. Rozycki 8507b6e797 MIPS16/GAS: Relax 32-bit non-PIC PC-relative synthetic instructions
Implement the relaxation of MIPS16 PC-relative synthetic LA, DLA, LW and
LD instructions to an equivalent sequence of instructions produced where
the address operand requested is out of range, absolute or requires
linker relocation, for ABIs that use 32-bit addressing and non-PIC code.

The sequence generated uses the register specified for the destination
operand as a temporary and begins with LI to load the high 16-bit part
of the address, then continues with SLL by 16 bits to move that part
into place and finally completes with a suitable operation corresponding
to the synthetic instruction used, one of: 2-argument ADDIU, 2-argument
DADDIU, absolute LW, and absolute LD respectively, providing the low
16-bit part of the address.  All instructions use the extended encoding.
As a special exception accept absolute addresses for relaxation even in
PIC code.

For example:

	la	$2, 0x12345678

produces code as:

	li	$2, 0x1234
	sll	$2, $2, 16
	addiu	$2, 0x5678

would.

Where linker relocation is required emit an R_MIPS16_HI16 relocation on
the initial LI instruction and an R_MIPS16_LO16 relocation on the final
operation.

For example (where `foo' is not local):

	lw	$3, foo

produces code as:

	li	$3, %hi(foo)
	sll	$3, $3, 16
	lw	$3, %lo(foo)($3)

would.

Emit assembly warnings as appropriate where this new relaxation triggers
in the `nomacro' mode or for an instruction manually placed in a branch
delay slot in the `noreorder' mode.  Refrain from relaxation where an
explicit instruction size suffix has been used and in the `noautoextend'
mode.

	gas/
	* config/tc-mips.c (RELAX_MIPS16_ENCODE): Add `pic', `sym32' and
	`nomacro' flags.
	(RELAX_MIPS16_PIC, RELAX_MIPS16_SYM32, RELAX_MIPS16_NOMACRO):
	New macros.
	(RELAX_MIPS16_USER_SMALL, RELAX_MIPS16_USER_EXT)
	(RELAX_MIPS16_DSLOT, RELAX_MIPS16_JAL_DSLOT)
	(RELAX_MIPS16_EXTENDED, RELAX_MIPS16_MARK_EXTENDED)
	(RELAX_MIPS16_CLEAR_EXTENDED, RELAX_MIPS16_ALWAYS_EXTENDED)
	(RELAX_MIPS16_MARK_ALWAYS_EXTENDED)
	(RELAX_MIPS16_CLEAR_ALWAYS_EXTENDED): Shift bits.
	(RELAX_MIPS16_MACRO, RELAX_MIPS16_MARK_MACRO)
	(RELAX_MIPS16_CLEAR_MACRO): New macros.
	(append_insn): Pass `mips_pic', HAVE_32BIT_SYMBOLS and
	`mips_opts.warn_about_macros' settings to RELAX_MIPS16_ENCODE.
	(mips16_macro_frag): New function.
	(md_estimate_size_before_relax): Handle HI16/LO16 relaxation.
	(mips_relax_frag): Likewise.
	(md_convert_frag): Likewise.

	* testsuite/gas/mips/mips16@relax-swap3.d: Remove error output,
	add dump patterns.
	* testsuite/gas/mips/mips16e@relax-swap3.d: New test
	subarchitecture.
	* testsuite/gas/mips/micromips@relax-swap3.d: Remove trailing
	NOP padding.
	* testsuite/gas/mips/mips16-pcrel-reloc-2.d: Remove error
	output, add dump patterns.
	* testsuite/gas/mips/mips16-pcrel-reloc-3.d: Remove error
	output, add dump patterns.
	* testsuite/gas/mips/mips16-pcrel-reloc-6.d: Remove error
	output, add dump patterns.
	* testsuite/gas/mips/mips16-pcrel-reloc-7.d: Remove error
	output, add dump patterns.
	* testsuite/gas/mips/mips16-pcrel-addend-2.d: Remove error
	output, add dump patterns.
	* testsuite/gas/mips/mips16-pcrel-addend-3.d: Remove error
	output, add dump patterns.
	* testsuite/gas/mips/mips16-pcrel-absolute.d: Remove error
	output, add dump patterns.
	* testsuite/gas/mips/mips16-pcrel-absolute-1.d: Remove error
	output, add dump patterns.
	* testsuite/gas/mips/mips16@relax-swap3.l: Remove file.
	* testsuite/gas/mips/mips16-pcrel-reloc-2.l: Remove file.
	* testsuite/gas/mips/mips16-pcrel-reloc-3.l: Remove file.
	* testsuite/gas/mips/mips16-pcrel-reloc-6.l: Remove file.
	* testsuite/gas/mips/mips16-pcrel-reloc-7.l: Remove file.
	* testsuite/gas/mips/mips16-pcrel-addend-2.l: Remove file.
	* testsuite/gas/mips/mips16-pcrel-addend-3.l: Remove file.
	* testsuite/gas/mips/mips16-pcrel-absolute.l: Remove file.
	* testsuite/gas/mips/mips16-pcrel-absolute-1.l: Remove file.
	* testsuite/gas/mips/relax-swap3.s: Adjust trailing padding.

	* testsuite/gas/mips/mips16-pcrel-0.d: New test.
	* testsuite/gas/mips/mips16-pcrel-1.d: New test.
	* testsuite/gas/mips/mips16-pcrel-2.d: New test.
	* testsuite/gas/mips/mips16-pcrel-3.d: New test.
	* testsuite/gas/mips/mips16-pcrel-4.d: New test.
	* testsuite/gas/mips/mips16-pcrel-5.d: New test.
	* testsuite/gas/mips/mips16-pcrel-pic-0.d: New test.
	* testsuite/gas/mips/mips16-pcrel-pic-1.d: New test.
	* testsuite/gas/mips/mips16-pcrel-n32-0.d: New test.
	* testsuite/gas/mips/mips16-pcrel-n32-1.d: New test.
	* testsuite/gas/mips/mips16-pcrel-n64-sym32-0.d: New test.
	* testsuite/gas/mips/mips16-pcrel-n64-sym32-1.d: New test.
	* testsuite/gas/mips/mips16-pcrel-n64-0.d: New test.
	* testsuite/gas/mips/mips16-pcrel-n64-1.d: New test.
	* testsuite/gas/mips/mips16-pcrel-delay-0.d: New test.
	* testsuite/gas/mips/mips16-pcrel-delay-1.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-4.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-5.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-6.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-7.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-8.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-9.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-pic-8.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-pic-9.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-n32-8.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-n32-9.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-n64-sym32-8.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-n64-sym32-9.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-n64-8.d: New test.
	* testsuite/gas/mips/mips16-pcrel-addend-n64-9.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-2.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-3.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-4.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-5.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-6.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-7.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-4.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-6.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-n32-4.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-n32-6.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-n64-4.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-n64-6.d: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-n64-sym32-4.d: New
	test.
	* testsuite/gas/mips/mips16-pcrel-absolute-n64-sym32-6.d: New
	test.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n32-4.d: New
	test.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n32-6.d: New
	test.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n64-4.d: New
	test.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n64-6.d: New
	test.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n64-sym32-4.d:
	New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-pic-n64-sym32-6.d:
	New test.
	* testsuite/gas/mips/mips16-pcrel-0.l: New stderr output.
	* testsuite/gas/mips/mips16-pcrel-1.l: New stderr output.
	* testsuite/gas/mips/mips16-pcrel-2.l: New stderr output.
	* testsuite/gas/mips/mips16-pcrel-3.l: New stderr output.
	* testsuite/gas/mips/mips16-pcrel-4.l: New stderr output.
	* testsuite/gas/mips/mips16-pcrel-5.l: New stderr output.
	* testsuite/gas/mips/mips16-pcrel-delay-0.l: New stderr output.
	* testsuite/gas/mips/mips16-pcrel-delay-1.l: New stderr output.
	* testsuite/gas/mips/mips16-pcrel-addend-8.l: New stderr output.
	* testsuite/gas/mips/mips16-pcrel-addend-9.l: New stderr output.
	* testsuite/gas/mips/mips16-pcrel-absolute-4.l: New stderr
	output.
	* testsuite/gas/mips/mips16-pcrel-absolute-6.l: New stderr
	output.
	* testsuite/gas/mips/mips16-pcrel-0.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-1.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-2.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-3.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-4.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-5.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-delay-0.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-delay-1.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-addend-4.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-addend-5.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-addend-6.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-addend-7.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-addend-8.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-addend-9.s: New test source.
	* testsuite/gas/mips/mips16-pcrel-absolute-2.s: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-3.s: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-4.s: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-5.s: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-6.s: New test.
	* testsuite/gas/mips/mips16-pcrel-absolute-7.s: New test.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	ld/
	* testsuite/ld-mips-elf/mips16-pcrel-0.d: New test.
	* testsuite/ld-mips-elf/mips16-pcrel-1.d: New test.
	* testsuite/ld-mips-elf/mips16-pcrel-addend-2.d: New test.
	* testsuite/ld-mips-elf/mips16-pcrel-addend-6.d: New test.
	* testsuite/ld-mips-elf/mips16-pcrel-n32-0.d: New test.
	* testsuite/ld-mips-elf/mips16-pcrel-n32-1.d: New test.
	* testsuite/ld-mips-elf/mips16-pcrel-n64-sym32-0.d: New test.
	* testsuite/ld-mips-elf/mips16-pcrel-n64-sym32-1.d: New test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2017-05-03 20:47:40 +01:00
Nick Clifton e78bb25cb6 Prevent a seg-fault in the assembler when provided with a bogus input source file.
PR gas/20941
	* symbols.c (snapshot_symbol): Handle the case where
	resolve_expression returns a local symbol.
2017-05-03 09:52:01 +01:00
Maciej W. Rozycki 82d808edbc MIPS16/GAS: Fix absolute references with PC-relative synthetic instructions
Complement commit 88a7ef1689 ("MIPS16/GAS: Restore unsupported
relocation diagnostics") and also propagate constant expressions, either
already reduced from absolute symbol references or created from literals
in the first place, used as a PC-relative operand with the MIPS16 LA,
LW, DLA and LD synthetic instructions to relaxation, matching the way
forward absolute symbol references have been handled as from the commit
referred and letting relaxation produce any necessary relocations, if
possible, for the absolute value requested to be reproduced at the run
time.

Call `symbol_append' for any expression symbol created for the purpose
of MIPS16 relaxation as with constant expressions now propagated from
earlier on such symbols may make it through and have R_MIPS16_PC16_S1
relocations emitted against, and therefore need to appear in the symbol
table produced.

	gas/
	* config/tc-mips.c (append_insn): Call `symbol_append' for any
	expression symbol created for MIPS16 relaxation.
	(match_mips16_insn): Don't encode a constant value as an
	immediate with a PC-relative operand.

	* testsuite/gas/mips/mips16-pcrel-absolute-1.d: New test.
	* testsuite/gas/mips/mips16-branch-absolute-1.d: New test.
	* testsuite/gas/mips/mips16-branch-absolute-2.d: New test.
	* testsuite/gas/mips/mips16-branch-absolute-addend-1.d: New
	test.
	* testsuite/gas/mips/mips16-branch-absolute-n32-1.d: New test.
	* testsuite/gas/mips/mips16-branch-absolute-n32-2.d: New test.
	* testsuite/gas/mips/mips16-branch-absolute-addend-n32-1.d: New
	test.
	* testsuite/gas/mips/mips16-branch-absolute-n64-1.d: New test.
	* testsuite/gas/mips/mips16-branch-absolute-n64-2.d: New test.
	* testsuite/gas/mips/mips16-branch-absolute-addend-n64-1.d: New
	test.
	* testsuite/gas/mips/mips16-pcrel-absolute-1.l: New stderr
	output.
	* testsuite/gas/mips/mips16-pcrel-absolute-1.s: New test source.
	* testsuite/gas/mips/mips16-branch-absolute-1.s: New test
	source.
	* testsuite/gas/mips/mips16-branch-absolute-2.s: New test
	source.
	* testsuite/gas/mips/mips16-branch-absolute-addend-1.s: New test
	source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	ld/
	* testsuite/ld-mips-elf/mips16-branch-absolute-1.d: New test.
	* testsuite/ld-mips-elf/mips16-branch-absolute-2.d: New test.
	* testsuite/ld-mips-elf/mips16-branch-absolute-addend-1.d: New
	test.
	* testsuite/ld-mips-elf/mips16-branch-absolute-n32-1.d: New
	test.
	* testsuite/ld-mips-elf/mips16-branch-absolute-n32-2.d: New
	test.
	* testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32-1.d:
	New test.
	* testsuite/ld-mips-elf/mips16-branch-absolute-n64-1.d: New
	test.
	* testsuite/ld-mips-elf/mips16-branch-absolute-n64-2.d: New
	test.
	* testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64-1.d:
	New test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2017-05-03 00:15:56 +01:00
Maciej W. Rozycki 14f72d45a2 MIPS16/GAS: Factor out duplicate symbol value conversion code
Factor out and consolidate duplicate section-relative to PC-relative
symbol value conversion in `mips16_extended_frag' and `md_convert_frag'
used for MIPS16 relaxation, observing that the final calculation in the
latter function implies `stretch == 0'.  Sanitize the formatting of code
moved.

	gas/
	* config/tc-mips.c (mips16_pcrel_val): New function, factored
	out from...
	(mips16_extended_frag): ... here.
	(md_convert_frag): Use `mips16_pcrel_val' rather than repeated
	code in MIPS16 relaxation, with `stretch' hardcoded to 0.
2017-04-27 12:21:58 +01:00
Maciej W. Rozycki 1425c41dcd MIPS16/GAS: Rename the LONG_BRANCH relaxation flag
Following commit 177b4a6ad0 ("infinite loop in mips16 assembler
relaxation"), <https://sourceware.org/ml/binutils/2002-03/msg00345.html>
the LONG_BRANCH flag used in MIPS16 relaxation has lost its use for
branches.  Complement commit 88a7ef1689 ("MIPS16/GAS: Restore
unsupported relocation diagnostics") then, which has removed the remains
of code deactivated by the former commit, and rename the flag to
ALWAYS_EXTENDED, more accurately reflecting its current use to select
the extended form of PC-relative ADDIU, DADDIU, LD and LW instructions.

	gas/
	* config/tc-mips.c (RELAX_MIPS16_LONG_BRANCH): Rename to...
	(RELAX_MIPS16_ALWAYS_EXTENDED): ... this.
	(RELAX_MIPS16_MARK_LONG_BRANCH): Rename to...
	(RELAX_MIPS16_MARK_ALWAYS_EXTENDED): ... this.
	(RELAX_MIPS16_CLEAR_LONG_BRANCH): Rename to...
	(RELAX_MIPS16_CLEAR_ALWAYS_EXTENDED): ... this.
	(mips16_extended_frag): Adjust accordingly.
2017-04-27 12:19:39 +01:00
Alan Modra f2d830a50d Tidy S_FORCE_RELOC
Separate out symbol flag reasons from section reasons to force a
reloc.  Yes, this adds another section test to the local symbol case
too.

	* symbols.c (S_FORCE_RELOC): Separate section and symbol tests.
2017-04-27 12:20:10 +09:30
Maciej W. Rozycki ce8ad87213 MIPS/GAS: Fix `.option picX' handling with relaxation
Correct the handling of `.option pic0' and `.option pic2' GAS pseudo-ops
in relaxation and use the setting of `mips_pic' (which these directives
control) as at the time a relaxed frag has been created rather than the
final `mips_pic' setting at the end of the source file processed.

To do so record whether `mips_pic' is NO_PIC or not in the frag itself
and use this information throughout relaxation instead of `mips_pic' to
decide which of NO_PIC or SVR4_PIC to produce machine code for, fixing
code generation and removing a possible fatal failure reproducible with:

$ as -32 --relax-branch -o option-pic-relax-3.o option-pic-relax-3.s
option-pic-relax-3.s: Assembler messages:
option-pic-relax-3.s:7: Warning: relaxed out-of-range branch into a jump
option-pic-relax-3.s: Internal error in cvt_frag_to_fill at .../gas/write.c:490.
Please report this bug.
$

using the test source included, due to a buffer overrun in filling the
variable part of a frag.

Likewise use the `fx_tcbit2' flag of a BFD_RELOC_16_PCREL_S2 fixup to
handle the simple case of substituting an out of range unconditional
branch with an equivalent absolute jump in NO_PIC code.

Retain the current way of VXWORKS_PIC use, which commit 41a1578ed1
("MIPS/GAS: Sanitize `.option picX' pseudo-op") has forbidden the use of
`.option picX' with.

	gas/
	* config/tc-mips.c (RELAX_ENCODE): Add `PIC' flag.
	(RELAX_PIC): New macro.
	(RELAX_USE_SECOND, RELAX_SECOND_LONGER, RELAX_NOMACRO)
	(RELAX_DELAY_SLOT, RELAX_DELAY_SLOT_16BIT)
	(RELAX_DELAY_SLOT_SIZE_FIRST, RELAX_DELAY_SLOT_SIZE_SECOND):
	Shift bits.
	(RELAX_BRANCH_ENCODE): Add `pic' flag.
	(RELAX_BRANCH_UNCOND, RELAX_BRANCH_LIKELY, RELAX_BRANCH_LINK)
	(RELAX_BRANCH_TOOFAR): Shift bits.
	(RELAX_BRANCH_PIC): New macro.
	(RELAX_MICROMIPS_ENCODE): Add `pic' flag.
	(RELAX_MICROMIPS_PIC): New macro.
	(RELAX_MICROMIPS_UNCOND, RELAX_MICROMIPS_COMPACT)
	(RELAX_MICROMIPS_LINK, RELAX_MICROMIPS_NODS)
	(RELAX_MICROMIPS_RELAX32): Shift bits.
	(relax_close_frag): Pass `mips_pic' setting to RELAX_ENCODE.
	(append_insn): Pass `mips_pic' setting to RELAX_BRANCH_ENCODE
	and RELAX_MICROMIPS_ENCODE, and record it in `fx_tcbit2' of the
	first fixup created.
	(md_apply_fix) <BFD_RELOC_16_PCREL_S2>: Use `fx_tcbit2' of the
	fixup processed rather than `mips_pic' in choosing to relax an
	out of range branch to a jump.
	(relaxed_branch_length): Use the `pic' flag of the relaxed frag
	rather than `mips_pic'.
	(relaxed_micromips_32bit_branch_length): Likewise.
	(md_estimate_size_before_relax): Likewise.
	(md_convert_frag): Likewise.

	* testsuite/gas/mips/option-pic-relax-0.d: New test.
	* testsuite/gas/mips/option-pic-relax-1.d: New test.
	* testsuite/gas/mips/option-pic-relax-2.d: New test.
	* testsuite/gas/mips/option-pic-relax-3.d: New test.
	* testsuite/gas/mips/option-pic-relax-3a.d: New test.
	* testsuite/gas/mips/option-pic-relax-4.d: New test.
	* testsuite/gas/mips/option-pic-relax-5.d: New test.
	* testsuite/gas/mips/option-pic-relax-2.l: New stderr output.
	* testsuite/gas/mips/option-pic-relax-3.l: New stderr output.
	* testsuite/gas/mips/option-pic-relax-4.l: New stderr output.
	* testsuite/gas/mips/option-pic-relax-5.l: New stderr output.
	* testsuite/gas/mips/option-pic-relax-0.s: New test source.
	* testsuite/gas/mips/option-pic-relax-1.s: New test source.
	* testsuite/gas/mips/option-pic-relax-2.s: New test source.
	* testsuite/gas/mips/option-pic-relax-3.s: New test source.
	* testsuite/gas/mips/option-pic-relax-4.s: New test source.
	* testsuite/gas/mips/option-pic-relax-5.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2017-04-27 00:50:57 +01:00
Claudiu Zissulescu 126124cc0f [ARC] Enhance enter/leave mnemonics.
enter/leave mnemonics are enhanced to not only accept register ranges
but also single register (i.e., r13) or even no GPR register at all.

gas/
2017-04-25  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/leave_enter.d: Update test.
	* testsuite/gas/arc/leave_enter.s: Likewise.

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

	* arc-dis.c (print_insn_arc): Smartly print enter/leave mnemonics.
	* arc-opc.c (insert_r13el): New function.
	(R13_EL): Define.
	* arc-tbl.h: Add new enter/leave variants.
2017-04-25 17:07:00 +02:00
Claudiu Zissulescu be6a24d8ea [ARC] Prefer NOP instead of MOV 0,0
NOP and MOV 0,0 are having the same encoding. As MOV mnemonic is
located before NOP in the instruction table, the disassembler prints
MOV 0,0 for NOP. Reorder the instructions such that NOP is first.

gas/
2017-04-25  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/b.d: Update test.
	* testsuite/gas/arc/noargs_hs.d: Likewise.

opcode/
2017-04-25  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-tbl.h: Reorder NOP entry to be before MOV instructions.
2017-04-25 17:07:00 +02:00
Maciej W. Rozycki adc1273cb2 MIPS/GAS: Correct BFD_RELOC_MIPS16_16_PCREL_S1 fixup size
Correct the size of a BFD_RELOC_MIPS16_16_PCREL_S1 fixup made in
`md_convert_frag', fixing a bug introduced with commit c9775dde32
("MIPS16: Add R_MIPS16_PC16_S1 branch relocation support)".  Add test
cases to verify that the overflow of this fixup's in-place addend is
still correctly detected.

	gas/
	* config/tc-mips.c (md_convert_frag): Correct
	BFD_RELOC_MIPS16_16_PCREL_S1 fixup size.
	* testsuite/gas/mips/mips16-branch-addend-4.d: New test.
	* testsuite/gas/mips/mips16-branch-addend-5.d: New test.
	* testsuite/gas/mips/mips16-branch-addend-5.l: New stderr
	output.
	* testsuite/gas/mips/mips16-branch-addend-4.s: New test source.
	* testsuite/gas/mips/mips16-branch-addend-5.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.
2017-04-25 11:53:45 +01:00
Jose E. Marchesi d28b6364b1 gas: sparc: fix relaxation of CALL instruction into branches in a.out targets
This patch avoids CALL instructions to be optimized into branches if
the symbols referred to in the CALL instruction are not fully resolved
at the time the assembler writes its output.

Tested in sparc64-linux-gnu and sparc-sun-sunos4.1.3 targets.
No regressions.

gas/ChangeLog:

2017-04-25  Jose E. Marchesi  <jose.marchesi@oracle.com>

	PR gas/21407
	* config/tc-sparc.c (md_apply_fix): Do not transform `call'
	instructions into branch instructions in fixups generating
	additional relocations.
	* testsuite/gas/sparc/call-relax.s: New file.
	* testsuite/gas/sparc/call-relax.d: Likewise.
	* testsuite/gas/sparc/call-relax-aout.d: Likewise.
	* testsuite/gas/sparc/sparc.exp: Test call-relax and call-relax-aout.
2017-04-25 02:40:43 -07:00
Thomas Preud'homme 5344555470 [GAS/ARM] Fix expansion of ldr pseudo instruction
The LDR rX, =cst pseudo-instruction suffers from two issues for loading
integer constants in Thumb mode:

- movs is used if the constant and register can be encoded using that
  instruction which leads to unexpected behavior due to its flag-setting
  behavior
- mov.w, movw and mvn are used for r13 (sp) and r15 (pc) but these
  encoding are marked as UNPREDICTABLE

This patch fixes those issues and update testing accordingly.

2017-04-24  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (move_or_literal_pool): Remove code generating MOVS.
	Forbid MOV.W and MOVW if destination is SP or PC.
	* testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.s: Explain
	expectation of LDR not generating a MOVS for low registers and small
	constants.  Add tests of MOVW generation.
	* testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.d: Update
	expected disassembly.
2017-04-24 14:51:24 +01:00
Alan Modra a8cc8a548e PowerPC VLE insn set additions
opcodes/
	* ppc-opc.c (ELEV): Define.
	(vle_opcodes): Add se_rfgi and e_sc.
	(powerpc_opcodes): Enable lbdx, lhdx, lwdx, stbdx, sthdx, stwdx
	for E200Z4.
gas/
	* testsuite/gas/ppc/vle.s: Format.  Add se_rfgi and e_sc.
	* testsuite/gas/ppc/vle.d: Update.
2017-04-22 17:45:50 +09:30
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