Commit Graph

9448 Commits

Author SHA1 Message Date
YunQiang Su dec7b24be8 MIPS/fix_loongson3_llsc: fix when target has multi labels
When there is multi-labels on the same insn, the current code
will take care about the last one. it may cause that no sync
is added at the target.

Here we scan all labels with same value of
   S_GET_VALUE(label_list->label)
by label_list->next.

2020-02-28  YunQiang Su  <syq@debian.org>

    PR gas/25539
    * config/tc-mips.c (fix_loongson3_llsc): Compare label value
    to handle multi-labels.
    (has_label_name): New.
2020-02-28 16:47:55 +08:00
Matthew Malcomson cceb53b884 [binutils][arm] Arm CDE CX*A instructions allow condition code
The implementation of the Arm CDE CX*A instructions doesn't allow a
condition code on the instructions but does allow the instruction in an
ITBlock.

The specification has been recently updated, though this is yet to be
published.

The instructions now should allow a suffix, and should behave in the
standard way around ITBlocks.

This patch removes the custom pred_instruction_type and handling for
these instructions, and uses the standard INSIDE_IT_INSN predication
type to describe the new instructions.

gas/ChangeLog:

2020-02-26  Matthew Malcomson  <matthew.malcomson@arm.com>

	* config/tc-arm.c (enum pred_instruction_type): Remove
	NEUTRAL_IT_NO_VPT_INSN predication type.
	(cxn_handle_predication): Modify to require condition suffixes.
	(handle_pred_state): Remove NEUTRAL_IT_NO_VPT_INSN cases.
	* testsuite/gas/arm/cde-scalar.s: Update test.
	* testsuite/gas/arm/cde-warnings.l: Update test.
	* testsuite/gas/arm/cde-warnings.s: Update test.
2020-02-26 14:23:11 +00:00
Alan Modra da3ec71fd4 gas gettext warning
gettext("") returns the header entry with meta information, not the
empty string.

	* config/tc-arm.c (reg_expected_msgs[REG_TYPE_RNB]): Don't use
	N_() on empty string.
2020-02-26 13:04:54 +10:30
Alan Modra 42135cadf5 gas strncpy warning
Avoid a warning that the buffer may not be zero terminated.

	* read.c (read_a_source_file): Call strncpy with length one
	less than size of original_case_string.
2020-02-26 13:04:48 +10:30
Alan Modra dc1e8a474f Indent labels
Labels don't go in the first column according to standard emacs C
indent rules, and I got annoyed enough at seeing diff -p show a label
rather than the function name to fix this.

bfd/
	* aoutx.h: Indent labels correctly.  Format error strings.
	* archive.c: Likewise.
	* archive64.c: Likewise.
	* coff-arm.c: Likewise.
	* coff-rs6000.c: Likewise.
	* coff-stgo32.c: Likewise.
	* cpu-arm.c: Likewise.
	* dwarf2.c: Likewise.
	* elf-ifunc.c: Likewise.
	* elf-properties.c: Likewise.
	* elf-s390-common.c: Likewise.
	* elf-strtab.c: Likewise.
	* elf.c: Likewise.
	* elf32-arm.c: Likewise.
	* elf32-bfin.c: Likewise.
	* elf32-cr16.c: Likewise.
	* elf32-csky.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-m68k.c: Likewise.
	* elf32-msp430.c: Likewise.
	* elf32-nds32.c: Likewise.
	* elf32-nios2.c: Likewise.
	* elf32-pru.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-ia64-vms.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elfcode.h: Likewise.
	* elfcore.h: Likewise.
	* elflink.c: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elfnn-ia64.c: Likewise.
	* elfnn-riscv.c: Likewise.
	* elfxx-mips.c: Likewise.
	* elfxx-sparc.c: Likewise.
	* elfxx-x86.c: Likewise.
	* i386lynx.c: Likewise.
	* merge.c: Likewise.
	* pdp11.c: Likewise.
	* plugin.c: Likewise.
	* reloc.c: Likewise.
binutils/
	* elfedit.c: Indent labels correctly.
	* readelf.c: Likewise.
	* resres.c: Likewise.
gas/
	* config/obj-elf.c: Indent labels correctly.
	* config/obj-macho.c: Likewise.
	* config/tc-aarch64.c: Likewise.
	* config/tc-alpha.c: Likewise.
	* config/tc-arm.c: Likewise.
	* config/tc-cr16.c: Likewise.
	* config/tc-crx.c: Likewise.
	* config/tc-frv.c: Likewise.
	* config/tc-i386-intel.c: Likewise.
	* config/tc-i386.c: Likewise.
	* config/tc-ia64.c: Likewise.
	* config/tc-mn10200.c: Likewise.
	* config/tc-mn10300.c: Likewise.
	* config/tc-nds32.c: Likewise.
	* config/tc-riscv.c: Likewise.
	* config/tc-s12z.c: Likewise.
	* config/tc-xtensa.c: Likewise.
	* config/tc-z80.c: Likewise.
	* read.c: Likewise.
	* symbols.c: Likewise.
	* write.c: Likewise.
ld/
	* emultempl/cskyelf.em: Indent labels correctly.
	* ldfile.c: Likewise.
	* ldlang.c: Likewise.
	* plugin.c: Likewise.
opcodes/
	* aarch64-asm.c: Indent labels correctly.
	* aarch64-dis.c: Likewise.
	* aarch64-gen.c: Likewise.
	* aarch64-opc.c: Likewise.
	* alpha-dis.c: Likewise.
	* i386-dis.c: Likewise.
	* nds32-asm.c: Likewise.
	* nfp-dis.c: Likewise.
	* visium-dis.c: Likewise.
2020-02-26 10:37:25 +10:30
Nelson Chu 54b2aec10d RISC-V: Support the read-only CSR checking.
CSRRW and CSRRWI always write CSR.  CSRRS, CSRRC, CSRRSI and CSRRCI write CSR
when RS1 isn't zero.  The CSR is read only if the [11:10] bits of CSR address
is 0x3.  The read-only CSR can not be written by the CSR instructions.

	gas/
	* config/tc-riscv.c (riscv_ip): New boolean insn_with_csr to indicate
	we are assembling instruction with CSR.  Call riscv_csr_read_only_check
	after parsing all arguments.
	(enum csr_insn_type): New enum is used to classify the CSR instruction.
	(riscv_csr_insn_type, riscv_csr_read_only_check): New functions.  These
	are used to check if we write a read-only CSR by the CSR instruction.

	* testsuite/gas/riscv/priv-reg-fail-read-only-01.s: New testcase.  Test
	all CSR for the read-only CSR checking.
	* testsuite/gas/riscv/priv-reg-fail-read-only-01.d: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-read-only-01.l: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-read-only-02.s: New testcase.  Test
	all CSR instructions for the read-only CSR checking.
	* testsuite/gas/riscv/priv-reg-fail-read-only-02.d: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-read-only-02.l: Likewise.
2020-02-20 16:49:09 -08:00
Nelson Chu 2ca89224b1 RISC-V: Disable the CSR checking by default.
Add new .option `csr-check/no-csr-check` and GAS option `-mcsr-check
/-mno-csr-check` to enbale/disable the CSR checking.  Disable the CSR
checking by default.

	gas/
	* config/tc-riscv.c: Add new .option and GAS options to enbale/disable
	the CSR checking.  We disable the CSR checking by default.
	(reg_lookup_internal): Check the `riscv_opts.csr_check`
	before we doing the CSR checking.

	* doc/c-riscv.texi: Add description for the new .option and assembler
	options.

	* testsuite/gas/riscv/priv-reg-fail-fext.d: Add `-mcsr-check` to enable
	the CSR checking.
	* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: Likewise.
2020-02-20 16:49:09 -08:00
Nelson Chu bd0cf5a6ba RISC-V: Support the ISA-dependent CSR checking.
According to the riscv privilege spec, some CSR are only valid when rv32 or
the specific extension is set.  We extend the DECLARE_CSR and DECLARE_CSR_ALIAS
to record more informaton we need, and then check whether the CSR is valid
according to these information.  We report warning message when the CSR is
invalid, so we have a choice between error and warning by --fatal-warnings
option.  Also, a --no-warn/-W option is used to turn the warnings off, if
people don't want the warnings.

	gas/
	* config/tc-riscv.c (enum riscv_csr_class): New enum.  Used to decide
	whether or not this CSR is legal in the current ISA string.
	(struct riscv_csr_extra): New structure to hold all extra information
	of CSR.
	(riscv_init_csr_hash): New function.  According to the DECLARE_CSR and
	DECLARE_CSR_ALIAS, insert CSR extra information into csr_extra_hash.
	Call hash_reg_name to insert CSR address into reg_names_hash.
	(md_begin): Call riscv_init_csr_hashes for each DECLARE_CSR.
	(reg_csr_lookup_internal, riscv_csr_class_check): New functions.
	Decide whether the CSR is valid according to the csr_extra_hash.
	(init_opcode_hash): Update 'if (hash_error != NULL)' as hash_error is
	not a boolean.  This is same as riscv_init_csr_hash, so keep the
	consistent usage.

	* testsuite/gas/riscv/csr-dw-regnums.d: Add -march=rv32if option.
	* testsuite/gas/riscv/priv-reg.d: Add f-ext by -march option.
	* testsuite/gas/riscv/priv-reg-fail-fext.d: New testcase.  The source
	file is `priv-reg.s`, and the ISA is rv32i without f-ext, so the
	f-ext CSR are not allowed.
	* testsuite/gas/riscv/priv-reg-fail-fext.l: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: New testcase.  The
	source file is `priv-reg.s`, and the ISA is rv64if, so the
	rv32-only CSR are not allowed.
	* testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise.

	include/
	* opcode/riscv-opc.h: Extend DECLARE_CSR and DECLARE_CSR_ALIAS to
	record riscv_csr_class.

	opcodes/
	* riscv-dis.c (print_insn_args): Updated since the DECLARE_CSR is changed.

	gdb/
	* riscv-tdep.c: Updated since the DECLARE_CSR is changed.
	* riscv-tdep.h: Likewise.
	* features/riscv/rebuild-csr-xml.sh: Generate the 64bit-csr.xml without
	rv32-only CSR.
	* features/riscv/64bit-csr.xml: Regernated.

	binutils/
	* dwarf.c: Updated since the DECLARE_CSR is changed.
2020-02-20 16:49:09 -08:00
Alan Modra 10a95fcc1f pdp11 reloc processing
This allows pdp11 to handle 32-bit fixups that can be applied by gas,
and improves the error message emitted when the required reloc isn't
available.

	* config/tc-pdp11.c (md_apply_fix): Handle BFD_RELOC_32.
	(tc_gen_reloc): Only give a BAD_CASE assertion on pcrel relocs.
2020-02-21 10:47:05 +10:30
Alan Modra dda2980f54 PR25569, PDP11 ld -s clobbers last data byte
This patch fixes an ancient wart in aout support, in that text and
data section sizes are rounded up for alignment rather that just the
corresponding header sizes.  Changing section sizes could conceivably
result in buffer overflows if section contents were held in memory.
Also, keeping the original section sizes allows this PR to be fixed
nicely.

bfd/
	PR 25569
	* aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic): Use
	"text", "data" and "bss" section pointer vars.  Don't update
	section size, just exec header sizes.
	(adjust_sizes_and_vmas): Don't update text section size.  Set
	initial exec header a_text.  Print exec headers sizes.
	* pdp11.c (adjust_o_magic, adjust_z_magic, adjust_n_magic),
	(adjust_sizes_and_vmas): Similarly.  Formatting.
	(final_link): Correct final file extension.
gas/
	PR 25569
	* config/obj-aout.c (obj_aout_frob_file_before_fix): Don't loop
	on section size adjustment, instead perform another write if
	exec header size is larger than section size.
2020-02-21 10:47:05 +10:30
Nelson Chu bd3380bcdd RISC-V: Add description for -march-attr/-mno-arch-attr options in gas doc.
gas/
	* doc/c-riscv.texi: Add the doc entries for -march-attr/
	-mno-arch-attr command line options.
2020-02-19 17:18:25 -08:00
Jim Wilson fa16423949 RISC-V: Convert the ADD/ADDI to the compressed MV/LI if RS1 is zero.
2020-02-19  Nelson Chu  <nelson.chu@sifive.com>
	gas/
	* testsuite/gas/riscv/c-add-addi.d: New testcase.
	* testsuite/gas/riscv/c-add-addi.s: Likewise.
	opcodes/
	* riscv-opc.c (riscv_opcodes): Convert add/addi to the compressed
	c.mv/c.li if rs1 is zero.

Change-Id: Id939b5e6db80d267a832545f3ffef7b9ba881f7d
2020-02-19 14:51:07 -08:00
Sergey Belyashov fcaaac0a0d Various fixes for the Z80 support.
PR 25537
ld	* emultempl/z80.em: Remove machine compatability checking.

	PR 25517
	* testsuite/ld-z80/arch_ez80_adl.d: Update command line.
	* testsuite/ld-z80/arch_ez80_z80.d: Likewise.
	* testsuite/ld-z80/arch_r800.d: Likewise.
	* testsuite/ld-z80/arch_z180.d: Likewise.
	* testsuite/ld-z80/arch_z80n.d: Likewise.
	* testsuite/ld-z80/comb_arch_ez80_z80.d: Likewise.
	* testsuite/ld-z80/comb_arch_z180_z80.d: Likewise.
	* testsuite/ld-z80/comb_arch_z80_ez80.d: Likewise.
	* testsuite/ld-z80/comb_arch_z80_z180.d: Likewise.
	* testsuite/ld-z80/comb_arch_z80_z80n.d: Likewise.
	* testsuite/ld-z80/relocs_b_ez80.d: Likewise.
	* testsuite/ld-z80/relocs_b_z80.d: Likewise.
	* testsuite/ld-z80/relocs_f_ez80.d: Likewise.
	* testsuite/ld-z80/relocs_f_z80.d: Likewise.
	* testsuite/ld-z80/relocs_f_z80n.d: Likewise.

bfd
	* cpu-z80.c: Add machine type compatibility checking.

gas
	* config/tc-z80.c (md_parse_option): Do not use an underscore
	prefix for local labels in SDCC compatability mode.
	(z80_start_line_hook): Remove SDCC dollar label support.
	* testsuite/gas/z80/sdcc.d: Update expected disassembly.
	* testsuite/gas/z80/sdcc.s: Likewise.

	* config/tc-z80.c: Add -march option.
	* doc/as.texi: Update Z80 documentation.
	* doc/c-z80.texi: Likewise.
	* testsuite/gas/z80/ez80_adl_all.d: Update command line.
	* testsuite/gas/z80/ez80_adl_suf.d: Likewise.
	* testsuite/gas/z80/ez80_pref_dis.d: Likewise.
	* testsuite/gas/z80/ez80_z80_all.d: Likewise.
	* testsuite/gas/z80/ez80_z80_suf.d: Likewise.
	* testsuite/gas/z80/gbz80_all.d: Likewise.
	* testsuite/gas/z80/r800_extra.d: Likewise.
	* testsuite/gas/z80/r800_ii8.d: Likewise.
	* testsuite/gas/z80/r800_z80_doc.d: Likewise.
	* testsuite/gas/z80/sdcc.d: Likewise.
	* testsuite/gas/z80/z180.d: Likewise.
	* testsuite/gas/z80/z180_z80_doc.d: Likewise.
	* testsuite/gas/z80/z80_doc.d: Likewise.
	* testsuite/gas/z80/z80_ii8.d: Likewise.
	* testsuite/gas/z80/z80_in_f_c.d: Likewise.
	* testsuite/gas/z80/z80_op_ii_ld.d: Likewise.
	* testsuite/gas/z80/z80_out_c_0.d: Likewise.
	* testsuite/gas/z80/z80_sli.d: Likewise.
	* testsuite/gas/z80/z80n_all.d: Likewise.
	* testsuite/gas/z80/z80n_reloc.d: Likewise.
2020-02-19 17:46:10 +00:00
H.J. Lu a7e12755d5 x86: Mark cvtpi2ps and cvtpi2pd as MMX
* config/tc-i386.c (output_insn): Mark cvtpi2ps and cvtpi2pd
	with GNU_PROPERTY_X86_FEATURE_2_MMX.
	* testsuite/gas/i386/i386.exp: Run property-3 and
	x86-64-property-3.
	* testsuite/gas/i386/property-3.d: New file.
	* testsuite/gas/i386/property-3.s: Likewise.
	* testsuite/gas/i386/x86-64-property-3.d: Likewise.
2020-02-19 04:54:45 -08:00
H.J. Lu 272a84b120 x86: Remove CpuABM and add CpuPOPCNT
AMD ABM has 2 instructions: popcnt and lzcnt.  ABM CPUID feature bit has
been reused for lzcnt and a POPCNT CPUID feature bit is added for popcnt
which used to be the part of SSE4.2.  This patch removes CpuABM and adds
CpuPOPCNT.  It changes ABM to enable both lzcnt and popcnt, changes SSE4.2
to also enable popcnt.

gas/

	* config/tc-i386.c (cpu_arch): Add .popcnt.
	* doc/c-i386.texi: Remove abm and .abm.  Add popcnt and .popcnt.
	Add a tab before @samp{.sse4a}.

opcodes/

	* i386-gen.c (cpu_flag_init): Replace CpuABM with
	CpuLZCNT|CpuPOPCNT.  Add CpuPOPCNT to CPU_SSE4_2_FLAGS.  Add
	CPU_POPCNT_FLAGS.
	(cpu_flags): Remove CpuABM.  Add CpuPOPCNT.
	* i386-opc.h (CpuABM): Removed.
	(CpuPOPCNT): New.
	(i386_cpu_flags): Remove cpuabm.  Add cpupopcnt.
	* i386-opc.tbl: Replace CpuABM|CpuSSE4_2 with CpuPOPCNT on
	popcnt.  Remove CpuABM from lzcnt.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.
2020-02-17 07:31:28 -08:00
Jan Beulich c8f8eebc3f x86: fold AddrPrefixOpReg templates
There's no need to have separate Cpu64 and CpuNo64 templates: There
already is special logic handling the attribute, and all that's needed
is rejecting 16-bit address registers in 64-bit mode. Suppress suffix
guessing and group all involved logic together, outside of suffix
processing (arguably it doesn't even belong in process_suffix()).

Also, since no AddrPrefixOpReg template permits any suffixes, move the
No_*Suf specifiers for them to a central place. Along with this drop
the no longer relevant NoRex64 from there.
2020-02-17 08:59:07 +01:00
Jan Beulich eedb0f2cfd x86/Intel: don't swap operands of MONITOR{,X} and MWAIT{,X}
Generally, the documentation doesn't allow for any explicit operands
to be specified with MONITOR/MWAIT. To permit the more legible
overriding of the address size via specifying operands, the option is
being retained even in Intel mode, but operand swapping is being
suppressed by this patch. This is both because it makes no sense here
(all of the operands are inputs) and because, as a result, old gcc
(prior to 4.8) actually expects it this way with -mintel-syntax (and
hence gets fixed by this change rather than, as claimed by a reply in
the bug report, broken).
2020-02-17 08:57:54 +01:00
Jan Beulich b9915cbc7d x86/Intel: improve diagnostics for ambiguous VCVT* operands
Conversions which shrink element size and which have a memory source
can't be disambiguated between their 128- and 256-bit variants by
looking at the register operand. "operand size mismatch", however, is a
pretty misleading diagnostic. Generalize the logic introduced for
VFPCLASSP{S,D} such that, with suitable similar adjustments to the
respective templates, it'll cover these cases too.

For VCVTNEPS2BF16 also fold the two previously separate AVX512VL
templates to achieve the intended effect. This is then also accompanied
by a respective addition to the inval-avx512f testcase.
2020-02-17 08:56:18 +01:00
H.J. Lu af5c13b01e x86: Don't disable SSE4a when disabling SSE4
commit 7deea9aad8 changed nosse4 to include CpuSSE4a.  But AMD SSE4a is
a superset of SSE3 and Intel SSE4 is a superset of SSSE3.  Disable Intel
SSE4 shouldn't disable AMD SSE4a.  This patch restores nosse4.  It also
adds .sse4a and nosse4a.

gas/

	* config/tc-i386.c (cpu_arch): Add .sse4a and nosse4a.  Restore
	nosse4.
	* doc/c-i386.texi: Document sse4a and nosse4a.

opcodes/

	* i386-gen.c (cpu_flag_init): Add CPU_ANY_SSE4A_FLAGS.  Remove
	CPU_ANY_SSE4_FLAGS.
2020-02-16 08:45:34 -08:00
H.J. Lu 07d9838745 Remove the old movsx and movzx documentation for AT&T syntax
* doc/c-i386.texi: Remove the old movsx and movzx documentation
	for AT&T syntax.
2020-02-14 06:09:28 -08:00
Jan Beulich 65fca0597f x86: replace adhoc (partly wrong) ambiguous operand checking for MOVSX/MOVZX
For these to get treatment consistent with other operand size checking
the special logic shouldn't live in md_assemble(), but process_suffix().
And there's more logic involved than simply zapping the suffix.

Note however that MOVS[BW]* and MOVZ[BW]* still won't be fully
consistent, due to the objection to fold MOVS* templates just like was
done for MOVZ* in c07315e0c6 ("x86: allow suffix-less movzw and 64-bit
movzb").

Note further that it is against my own intentions to have MOVSX/MOVZX
silently default to a byte source in AT&T mode. This should happen only
when the destination register is a 16-bit one. In all other cases there
is an ambiguity, and the user should be warned. But it was explicitly
requested for this to be done in a way inconsistent with everything
else.

Note finally that the assembler change points out (and this patch fixes)
a wrong Intel syntax test introduced by bc31405ebb ("x86-64: Properly
encode and decode movsxd"): When source code specifies a 16-bit
destination register, disassembly expectations shouldn't have been to
find a 32-bit one.
2020-02-14 14:27:28 +01:00
Jan Beulich b677388436 x86: adjust segment override prefix emission
Since we already suppress the prefix altogether when it's the default
one for the chosen addressing mode, let's do so also when instruction
prefix and override specified with the memory operand match. (Note that
insn prefix specified segment overrides never get discarded.)
2020-02-14 14:04:23 +01:00
Jan Beulich 92334ad2c6 x86: optimize away pointless segment overrides
When optimizing there's no point keeping the segment overrides when we
warn about their presence in the first place.
2020-02-14 14:03:19 +01:00
Jan Beulich 514a8bb031 x86: extend LEA's segment override warning
For one both possible forms should be warned about. And then, to guard
against future surprises, qualify the original opcode check by excluding
VEX/EVEX-like templates.
2020-02-14 14:02:05 +01:00
H.J. Lu 0e6724dee4 x86: Document movsx/movsxd/movzx for AT&T syntax
Document different mnemonics of movsx, movsxd and movzx in AT&T syntax.

	PR gas/25438
	* doc/c-i386.texi: Document movsx, movsxd and movzx for AT&T
	syntax.
2020-02-14 04:57:16 -08:00
H.J. Lu 292676c15a x86: Resolve PLT32 reloc aganst local symbol to section
Since PLT entry isn't needed for branch to local symbol, we can resolve
R_386_PLT32/R_X86_64_PLT32 relocation aganst local symbol to section,
similar to R_386_PC32/R_X86_64_PC32.

2020-02-13  Fangrui Song   <maskray@google.com>
	    H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/25551
	* config/tc-i386.c (tc_i386_fix_adjustable): Don't check
	BFD_RELOC_386_PLT32 nor BFD_RELOC_X86_64_PLT32.
	* testsuite/gas/i386/i386.exp: Run relax-5 and x86-64-relax-4.
	* testsuite/gas/i386/relax-5.d: New file.
	* testsuite/gas/i386/relax-5.s: Likewise.
	* testsuite/gas/i386/x86-64-relax-4.d: Likewise.
	* testsuite/gas/i386/x86-64-relax-4.s: Likewise.
2020-02-13 13:44:29 -08:00
Jan Beulich 7deea9aad8 x86: fix SSE4a dependencies of ".arch .nosse*"
Since ".arch .sse4a" enables SSE3 and earlier, disabling SSE3 should
also disable SSE4a. And as per its name, ".arch .nosse4" should also do
so.
2020-02-13 10:19:28 +01:00
Jan Beulich 6c0946d0d2 x86: correct VFPCLASSP{S,D} operand size handling
With AVX512VL disabled (e.g. when writing code for the Knights family
of processors) these insns aren't ambiguous when used with a memory
source, and hence should be accepted without suffix or operand size
specifier. When AVX512VL is enabled, to be consistent with this as
well as other ambiguous operand size handling it would seem better to
just warn about the ambiguity in AT&T mode, and still default to 512-bit
operands (on the assumption that the code may have been written without
AVX512VL in mind yet), but it was requested to leave AT&T syntax mode
alone here.
2020-02-12 16:20:56 +01:00
Jan Beulich 5990e377e5 x86-64: Intel64 adjustments for insns dealing with far pointers
AMD and Intel differ in their handling of far indirect branches as well
as LFS/LGS/LSS: AMD CPUs ignore REX.W while Intel ones honors it. (Note
how the latter three were hybrids so far, while far branches were fully
AMD-like.)
2020-02-12 16:19:03 +01:00
Jan Beulich 9706160abd x86: also disallow non-byte/-word registers with byte/word suffix
Along the lines of be4c5e58bd ("x86: Always disallow double word suffix
with word general register") also adjust check_{byte,word}_reg(), to make
overall behavior consistent again in this regard.
2020-02-12 10:59:32 +01:00
Jan Beulich 5de4d9ef71 x86/Intel: improve diagnostics
The diagnostics issued by check_*_reg() are pretty AT&T-centric. Re-use
logic already used for SIMD memory operand size checking also for ones
where GPRs would alternatively also be allowed. (There's certainly room
for further improvement here.)
2020-02-12 10:58:42 +01:00
Jan Beulich 50128d0cab x86: drop ShortForm attribute
It is very simple to derive from other template properties, and hence
there's little point wasting storage for it.
2020-02-11 11:20:55 +01:00
Matthew Malcomson 1ed818b4dd [binutils][gas] Fix build failure with -std=c89
My previous patch introduced the use of a C99 feature.  C99 standard is
not required for gas, so this feature should be removed.

Committed as obvious.

gas/ChangeLog:

2020-02-11  Matthew Malcomson  <matthew.malcomson@arm.com>

	* config/tc-arm.c (vcx_handle_register_arguments): Remove `for`
	loop initial declaration.
2020-02-11 10:17:33 +00:00
Matthew Malcomson 5aae9ae97f [binutils][arm] Implement Custom Datapath Extensions for MVE
Here we implement the custom datapath extensions for MVE.

This required the following changes:

- Adding a new register argument type (that takes either an MVE vector or
  a Neon S or D register).
- Adding two new immediate operands types (0-127 and 0-4095).
- Using the Neon type machinery to distinguish between instruction
  types.  This required the introduction of new neon shapes to account
  for the coprocessor operands to these instructions.
- Adding a new disassembly character to `print_insn_cde` to handle the
  new register types.

Specification can be found at
https://developer.arm.com/docs/ddi0607/latest

Successfully regression tested on arm-none-eabi, and arm-wince-pe.

gas/ChangeLog:

2020-02-10  Matthew Malcomson  <matthew.malcomson@arm.com>

	* config/tc-arm.c (NEON_MAX_TYPE_ELS): Increment to account for
	instructions that can have 5 arguments.
	(enum operand_parse_code): Add new operands.
	(parse_operands): Account for new operands.
	(S5): New macro.
	(enum neon_shape_el): Introduce P suffixes for coprocessor.
	(neon_select_shape): Account for P suffix.
	(LOW1): Move macro to global position.
	(HI4): Move macro to global position.
	(vcx_assign_vec_d): New.
	(vcx_assign_vec_m): New.
	(vcx_assign_vec_n): New.
	(enum vcx_reg_type): New.
	(vcx_get_reg_type): New.
	(vcx_size_pos): New.
	(vcx_vec_pos): New.
	(vcx_handle_shape): New.
	(vcx_ensure_register_in_range): New.
	(vcx_handle_register_arguments): New.
	(vcx_handle_insn_block): New.
	(vcx_handle_common_checks): New.
	(do_vcx1): New.
	(do_vcx2): New.
	(do_vcx3): New.
	* testsuite/gas/arm/cde-missing-fp.d: New test.
	* testsuite/gas/arm/cde-missing-fp.l: New test.
	* testsuite/gas/arm/cde-missing-mve.d: New test.
	* testsuite/gas/arm/cde-missing-mve.l: New test.
	* testsuite/gas/arm/cde-mve-or-neon.d: New test.
	* testsuite/gas/arm/cde-mve-or-neon.s: New test.
	* testsuite/gas/arm/cde-mve.s: New test.
	* testsuite/gas/arm/cde-warnings.l:
	* testsuite/gas/arm/cde-warnings.s:
	* testsuite/gas/arm/cde.d:
	* testsuite/gas/arm/cde.s:

opcodes/ChangeLog:

2020-02-10  Matthew Malcomson  <matthew.malcomson@arm.com>

	* arm-dis.c (print_insn_cde): Define 'V' parse character.
	(cde_opcodes): Add VCX* instructions.
2020-02-10 16:50:14 +00:00
Matthew Malcomson 4934a27c8c [binutils][arm] arm support for ARMv8.m Custom Datapath Extension
This patch is part of a series that adds support for the Armv8.m
ARMv8.m Custom Datapath Extension to binutils.

This patch introduces the Custom Instructions Class 1/2/3 (Single/
Dual, Accumulator/Non-accumulator varianats) to the arm backend.

The following Custom Instructions are added: cx1, cx1a,
cx1d, cx1da, cx2, cx2a, cx2d, cx2da, cx3, cx3a, cx3d, cx3da.

Specification can be found at
https://developer.arm.com/docs/ddi0607/latest

This patch distinguishes between enabling CDE for different coprocessor
numbers by defining multiple architecture flags.  This means that the
parsing of the architecture extension flags is kept entirely in the
existing code path.

We introduce a new IT block state to indicate the behaviour of these
instructions.  This new state allows being used in an IT block or
outside an IT block, but does not allow the instruction to be used
inside a VPT block.
We need this since the CX*A instruction versions can be used in IT
blocks, but they aren't to have the conditional suffixes on them.  Hence
we need to mark an instruction as allowed in either position.

We also need a new flag to objdump, in order to determine whether to
disassemble an instruction as CDE related or not.

Successfully regression tested on arm-none-eabi, and arm-wince-pe.

gas/ChangeLog:

2020-02-10  Stam Markianos-Wright  <stam.markianos-wright@arm.com>
	    Matthew Malcomson  <matthew.malcomson@arm.com>

	* config/tc-arm.c (arm_ext_cde*): New feature sets for each
	CDE coprocessor that can be enabled.
	(enum pred_instruction_type): New pred type.
	(BAD_NO_VPT): New error message.
	(BAD_CDE): New error message.
	(BAD_CDE_COPROC): New error message.
	(enum operand_parse_code): Add new immediate operands.
	(parse_operands): Account for new immediate operands.
	(check_cde_operand): New.
	(cde_coproc_enabled): New.
	(cde_coproc_pos): New.
	(cde_handle_coproc): New.
	(cxn_handle_predication): New.
	(do_custom_instruction_1): New.
	(do_custom_instruction_2): New.
	(do_custom_instruction_3): New.
	(do_cx1): New.
	(do_cx1a): New.
	(do_cx1d): New.
	(do_cx1da): New.
	(do_cx2): New.
	(do_cx2a): New.
	(do_cx2d): New.
	(do_cx2da): New.
	(do_cx3): New.
	(do_cx3a): New.
	(do_cx3d): New.
	(do_cx3da): New.
	(handle_pred_state): Define new IT block behaviour.
	(insns): Add newn CX*{,d}{,a} instructions.
	(CDE_EXTENSIONS,armv8m_main_ext_table,armv8_1m_main_ext_table):
	Define new cdecp extension strings.
	* doc/c-arm.texi: Document new cdecp extension arguments.
	* testsuite/gas/arm/cde-scalar.d: New test.
	* testsuite/gas/arm/cde-scalar.s: New test.
	* testsuite/gas/arm/cde-warnings.d: New test.
	* testsuite/gas/arm/cde-warnings.l: New test.
	* testsuite/gas/arm/cde-warnings.s: New test.
	* testsuite/gas/arm/cde.d: New test.
	* testsuite/gas/arm/cde.s: New test.

include/ChangeLog:

2020-02-10  Stam Markianos-Wright  <stam.markianos-wright@arm.com>
	    Matthew Malcomson  <matthew.malcomson@arm.com>

	* opcode/arm.h (ARM_EXT2_CDE): New extension macro.
	(ARM_EXT2_CDE0): New extension macro.
	(ARM_EXT2_CDE1): New extension macro.
	(ARM_EXT2_CDE2): New extension macro.
	(ARM_EXT2_CDE3): New extension macro.
	(ARM_EXT2_CDE4): New extension macro.
	(ARM_EXT2_CDE5): New extension macro.
	(ARM_EXT2_CDE6): New extension macro.
	(ARM_EXT2_CDE7): New extension macro.

opcodes/ChangeLog:

2020-02-10  Stam Markianos-Wright  <stam.markianos-wright@arm.com>
	    Matthew Malcomson  <matthew.malcomson@arm.com>

	* arm-dis.c (struct cdeopcode32): New.
	(CDE_OPCODE): New macro.
	(cde_opcodes): New disassembly table.
	(regnames): New option to table.
	(cde_coprocs): New global variable.
	(print_insn_cde): New
	(print_insn_thumb32): Use print_insn_cde.
	(parse_arm_disassembler_options): Parse coprocN args.
2020-02-10 16:50:14 +00:00
H.J. Lu 4b5aaf5f69 x86: Accept Intel64 only instruction by default
Commit d835a58baa disabled sysenter/sysenter in 64-bit mode by
default.  By default, assembler should accept common, Intel64 only
and AMD64 ISAs since there are no conflicts.

gas/

	PR gas/25516
	* config/tc-i386.c (intel64): Renamed to ...
	(isa64): This.
	(match_template): Accept Intel64 only instruction by default.
	(i386_displacement): Updated.
	(md_parse_option): Updated.
	* c-i386.texi: Update -mamd64/-mintel64 documentation.
	* testsuite/gas/i386/i386.exp: Run x86-64-sysenter.  Pass
	-mamd64 to x86-64-sysenter-amd.
	* testsuite/gas/i386/x86-64-sysenter.d: New file.

opcodes/

	PR gas/25516
	* i386-gen.c (opcode_modifiers): Replace AMD64 and Intel64
	with ISA64.
	* i386-opc.h (AMD64): Removed.
	(Intel64): Likewose.
	(AMD64): New.
	(INTEL64): Likewise.
	(INTEL64ONLY): Likewise.
	(i386_opcode_modifier): Replace amd64 and intel64 with isa64.
	* i386-opc.tbl (Amd64): New.
	(Intel64): Likewise.
	(Intel64Only): Likewise.
	Replace AMD64 with Amd64.  Update sysenter/sysenter with
	Cpu64 and Intel64Only.  Remove AMD64 from sysenter/sysenter.
	* i386-tbl.h: Regenerated.
2020-02-10 08:37:36 -08:00
Alan Modra 33176d912a gas: error for section type, attr, or entsize change
* config/obj-elf.c (obj_elf_change_section): Error for section
	type, attr or entsize changes in assembly.
	* testsuite/gas/elf/elf.exp: Pass -Z to gas for section5 test.
	* testsuite/gas/elf/section5.l: Update.
2020-02-10 15:28:23 +10:30
Alan Modra 821948744f gas -Z flag
-Z is supposed to "generate object file even after errors".  It
doesn't do so at the moment, unless you count a zero length object
file as useful output.  Fixed for most targets as follows.
I suspect avr and pru need target patches.

	* output-file.c (output_file_close): Do a normal close when
	flag_always_generate_output.
	* write.c (write_object_file): Don't stop output when
	flag_always_generate_output.
2020-02-10 15:28:23 +10:30
Sergey Belyashov 9fc0b501af Add support for the GBZ80 and Z80N variants of the Z80 architecture, and add DWARF debug info support to the Z80 assembler.
PR 25469
bfd	* archures.c: Add GBZ80 and Z80N machine values.
	* reloc.c: Add BFD_RELOC_Z80_16_BE.
	* coff-z80.c: Add support for new reloc.
	* coffcode.h: Add support for new machine values.
	* cpu-z80.c: Add support for new machine names.
	* elf32-z80.c: Add support for new reloc.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.

binutils* readelf.c (get_machine_flags): Add support for Z80N machine
	number.

gas	* config/tc-z80.c: Add -gbz80 command line option to generate code
	for the GameBoy Z80.  Add support for generating DWARF.
	* config/tc-z80.h: Add support for DWARF debug information
	generation.
	* doc/c-z80.texi: Document new command line option.
	* testsuite/gas/z80/gbz80_all.d: New file.
	* testsuite/gas/z80/gbz80_all.s: New file.
	* testsuite/gas/z80/z80.exp: Run the new tests.
	* testsuite/gas/z80/z80n_all.d: New file.
	* testsuite/gas/z80/z80n_all.s: New file.
	* testsuite/gas/z80/z80n_reloc.d: New file.

include	* coff/internal.h (R_IMM16BE): Define.
	* elf/z80.h (EF_Z80_MACH_Z80N): Define.
	(R_Z80_16_BE): New reloc.

ld	* emulparams/elf32z80.sh: Use z80 emulation.
	* emultempl/z80.em: Make generic to both COFF and ELF Z80 emulations.
	* emultempl/z80elf.em: Delete.
	* testsuite/ld-elf/pr22450.d: Expect to fail for the Z80.
	* testsuite/ld-elf/sec64k.exp: Fix Z80 assembly.
	* testsuite/ld-unique/pr21529.s: Avoid register name conflict.
	* testsuite/ld-unique/unique.s: Likewise.
	* testsuite/ld-unique/unique_empty.s: Likewise.
	* testsuite/ld-unique/unique_shared.s: Likewise.
	* testsuite/ld-unique/unique.d: Updated expected output.
	* testsuite/ld-z80/arch_z80n.d: New file.
	* testsuite/ld-z80/comb_arch_z80_z80n.d: New file.
	* testsuite/ld-z80/labels.s: Add more labels.
	* testsuite/ld-z80/relocs.s: Add more reloc tests.
	* testsuite/ld-z80/relocs_f_z80n.d: New file

opcodes	* z80-dis.c: Add support for GBZ80 opcodes.
2020-02-07 14:53:46 +00:00
H.J. Lu b7d0721677 ELF: Support the section flag 'o' in .section directive
As shown in

https://sourceware.org/bugzilla/show_bug.cgi?id=25490

--gc-sections will silently remove __patchable_function_entries section
and generate corrupt result.  This patch adds the section flag 'o' to
.section directive:

.section __patchable_function_entries,"awo",@progbits,foo
.section __patchable_function_entries,"awoG",@progbits,foo,foo,comdat
.section __patchable_function_entries,"awo",@progbits,bar,unique,4
.section __patchable_function_entries,"awoG",@progbits,foo,foo,comdat,unique,1

which specifies the symbol name which the section references.  Assmebler
will set its elf_linked_to_section to a local section where the symbol
is defined.

Linker is updated to call mark_hook if gc_mark of any of its linked-to
sections is set after all sections, except for backend specific ones,
have been garbage collected.

bfd/

	PR gas/25381
	* bfd-in2.h: Regenerated.
	* elflink.c (_bfd_elf_gc_mark_extra_sections): Call mark_hook
	on section if gc_mark of any of its linked-to sections is set
	and don't set gc_mark again.
	* section.c (asection): Add linked_to_symbol_name to map_head
	union.

gas/

	PR gas/25381
	* config/obj-elf.c (get_section): Also check
	linked_to_symbol_name.
	(obj_elf_change_section): Also set map_head.linked_to_symbol_name.
	(obj_elf_parse_section_letters): Handle the 'o' flag.
	(build_group_lists): Renamed to ...
	(build_additional_section_info): This.  Set elf_linked_to_section
	from map_head.linked_to_symbol_name.
	(elf_adjust_symtab): Updated.
	* config/obj-elf.h (elf_section_match): Add linked_to_symbol_name.
	* doc/as.texi: Document the 'o' flag.
	* testsuite/gas/elf/elf.exp: Run PR gas/25381 tests.
	* testsuite/gas/elf/section18.d: New file.
	* testsuite/gas/elf/section18.s: Likewise.
	* testsuite/gas/elf/section19.d: Likewise.
	* testsuite/gas/elf/section19.s: Likewise.
	* testsuite/gas/elf/section20.d: Likewise.
	* testsuite/gas/elf/section20.s: Likewise.
	* testsuite/gas/elf/section21.d: Likewise.
	* testsuite/gas/elf/section21.l: Likewise.
	* testsuite/gas/elf/section21.s: Likewise.

ld/

	PR ld/24526
	PR ld/25021
	PR ld/25490
	* testsuite/ld-elf/elf.exp: Run PR ld/25490 tests.
	* testsuite/ld-elf/pr24526.d: New file.
	* testsuite/ld-elf/pr24526.s: Likewise.
	* testsuite/ld-elf/pr25021.d: Likewise.
	* testsuite/ld-elf/pr25021.s: Likewise.
	* testsuite/ld-elf/pr25490-2-16.rd: Likewise.
	* testsuite/ld-elf/pr25490-2-32.rd: Likewise.
	* testsuite/ld-elf/pr25490-2-64.rd: Likewise.
	* testsuite/ld-elf/pr25490-2.s: Likewise.
	* testsuite/ld-elf/pr25490-3-16.rd: Likewise.
	* testsuite/ld-elf/pr25490-3-32.rd: Likewise.
	* testsuite/ld-elf/pr25490-3-64.rd: Likewise.
	* testsuite/ld-elf/pr25490-3.s: Likewise.
	* testsuite/ld-elf/pr25490-4-16.rd: Likewise.
	* testsuite/ld-elf/pr25490-4-32.rd: Likewise.
	* testsuite/ld-elf/pr25490-4-64.rd: Likewise.
	* testsuite/ld-elf/pr25490-4.s: Likewise.
	* testsuite/ld-elf/pr25490-5-16.rd: Likewise.
	* testsuite/ld-elf/pr25490-5-32.rd: Likewise.
	* testsuite/ld-elf/pr25490-5-64.rd: Likewise.
	* testsuite/ld-elf/pr25490-5.s: Likewise.
	* testsuite/ld-elf/pr25490-6-16.rd: Likewise.
	* testsuite/ld-elf/pr25490-6-32.rd: Likewise.
	* testsuite/ld-elf/pr25490-6-64.rd: Likewise.
	* testsuite/ld-elf/pr25490-6.s: Likewise.
2020-02-06 18:05:10 -08:00
H.J. Lu 5eb617a714 [2.34] Mention x86 assembler options to align branches
* NEWS: Mention x86 assembler options to align branches for
	binutils 2.34.
2020-02-06 07:50:16 -08:00
H.J. Lu 986ac31487 x86: Run unique tests only for ELF targets
* testsuite/gas/i386/i386.exp: Run unique and x86-64-unique
	only for ELF targets.
	* testsuite/gas/i386/unique.d: Don't xfail.
	* testsuite/gas/i386/x86-64-unique.d: Likewise.
2020-02-06 04:44:39 -08:00
Alan Modra 19234a6d36 xfail x86 gas unique test
* testsuite/gas/i386/unique.d: xfail for non-elf targets.
	* testsuite/gas/i386/x86-64-unique.d: Likewise.
2020-02-06 13:58:25 +10:30
Alan Modra 02e0be6901 mbind gas tests and supports_gnu_osabi testsuite infrastructure
With the addition of section16 tests we have multiple tests
advertising themselves as "mbind sections" and "mbind section
contents".  This patch fixes that, and fails on quite a few targets
that force an OSABI value.  It's a pain specifying all the relevant
arm targets on an xfail line, so I wrote supports_gnu_osabi.

binutils/
	* testsuite/lib/binutils-common.exp (match_target): Accept '!' before
	TCL procedure.
	(supports_gnu_osabi): New procedure.
	(is_generic): New, from ld-lib.exp.
	(supports_gnu_unique): Use the above.
gas/
	* testsuite/gas/elf/section12a.d: Use supports_gnu_osabi in
	xfail, and rename test.
	* testsuite/gas/elf/section12b.d: Likewise.
	* testsuite/gas/elf/section16a.d: Likewise.
	* testsuite/gas/elf/section16b.d: Likewise.
ld/
	* testsuite/lib/ld-lib.exp (is_generic): Delete.
	* testsuite/ld-unique/unique.exp: Exclude tic6x.
2020-02-06 13:57:37 +10:30
H.J. Lu a8c4d40b57 ELF: Add support for unique section ID to assembler
Clang's integrated assembler supports multiple section with the same
name:

	.section .text,"ax",@progbits,unique,1
	nop
	.section .text,"ax",@progbits,unique,2
	nop

"unique,N" assigns the number, N, as the section ID, to a section.  The
valid values of the section ID are between 0 and 4294967295.  It can be
used to distinguish different sections with the same section name.

This is useful with -fno-unique-section-names -ffunction-sections.
-ffunction-sections by default generates .text.foo, .text.bar, etc.
Using the same string can save lots of space in .strtab.

This patch adds section_id to bfd_section and reuses the linker
internal bit in BFD section flags, SEC_LINKER_CREATED, for assmebler
internal use to mark valid section_id.  It also updates objdump to
compare section pointers if 2 sections comes from the same file since
2 different sections can have the same section name.

bfd/

	PR gas/25380
	* bfd-in2.h: Regenerated.
	* ecoff.c (bfd_debug_section): Add section_id.
	* section.c (bfd_section): Add section_id.
	(SEC_ASSEMBLER_SECTION_ID): New.
	(BFD_FAKE_SECTION): Add section_id.

binutils/

	PR gas/25380
	* objdump.c (sym_ok): Return FALSE if 2 sections are in the
	same file with different section pointers.

gas/

	PR gas/25380
	* config/obj-elf.c (section_match): Removed.
	(get_section): Also match SEC_ASSEMBLER_SECTION_ID and
	section_id.
	(obj_elf_change_section): Replace info and group_name arguments
	with match_p.  Also update the section ID and flags from match_p.
	(obj_elf_section): Handle "unique,N".  Update call to
	obj_elf_change_section.
	* config/obj-elf.h (elf_section_match): New.
	(obj_elf_change_section): Updated.
	* config/tc-arm.c (start_unwind_section): Update call 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.texi: Document "unique,N" in .section directive.
	* testsuite/gas/elf/elf.exp: Run "unique,N" tests.
	* testsuite/gas/elf/section15.d: New file.
	* testsuite/gas/elf/section15.s: Likewise.
	* testsuite/gas/elf/section16.s: Likewise.
	* testsuite/gas/elf/section16a.d: Likewise.
	* testsuite/gas/elf/section16b.d: Likewise.
	* testsuite/gas/elf/section17.d: Likewise.
	* testsuite/gas/elf/section17.l: Likewise.
	* testsuite/gas/elf/section17.s: Likewise.
	* testsuite/gas/i386/unique.d: Likewise.
	* testsuite/gas/i386/unique.s: Likewise.
	* testsuite/gas/i386/x86-64-unique.d: Likewise.
	* testsuite/gas/i386/i386.exp: Run unique and x86-64-unique.

ld/

	PR gas/25380
	* testsuite/ld-i386/pr22001-1c.S: Use "unique,N" in .section
	directives.
	* testsuite/ld-i386/tls-gd1.S: Likewise.
	* testsuite/ld-x86-64/pr21481b.S: Likewise.
2020-02-02 17:08:01 -08:00
H.J. Lu 575d37aeae elf/section13.s: Replace @nobits with %nobits
* testsuite/gas/elf/section13.s: Replace @nobits with %nobits.
2020-02-02 08:20:18 -08:00
Gitea 2384096c4d moxie: don't force big-endian mode 2020-02-01 20:59:19 -05:00
Sandra Loosemore 95441c43cc nios2: recognize %gotoff relocation in assembler
The nios2 ABI documentation lists %gotoff as assembler syntax for the
R_NIOS2_GOTOFF relocation, used to represent a 32-bit GOT-relative offset
in data sections.  This was previously unimplemented in GAS.

2020-01-31  Sandra Loosemore  <sandra@codesourcery.com>

	gas/
	* config/tc-nios2.c (nios2_cons): Handle %gotoff as well as
	%tls_ldo.
2020-01-31 10:32:48 -08:00
Andre Vieira d465d69579 Add missing ChangeLog for last patch 2020-01-31 17:13:51 +00:00
Andre Vieira 9216914510 arm: PR gas/25472 Enable DSP instructions with +mve
We noticed +mve was not enabling DSP instructions as it should, reported in PR
25472.
The MVE architecture extension for Armv8.1-M Mainline implies DSP extensions.
This patch reflects that in the '+mve' command line option.

gas/ChangeLog:
2020-01-31  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	PR gas/25472
	* config/tc-arm.c (armv8m_main_ext_table): Refactored +dsp adding.
	(armv8_1m_main_ext_table): Refactored +dsp adding and enabled dsp for
	+mve.
	* testsuite/gas/arm/mve_dsp.d: New test.
2020-01-31 17:11:45 +00:00
Nick Clifton d26cc8a9d6 Fix compile time build problem building the s390 assembler.
* config/tc-s390.c (s390_elf_suffix): Return ELF_SUFFIX_NONE
	rather than BFD_RELOC_NONE.
2020-01-31 16:43:57 +00:00
Srinath Parvathaneni 90e9955aef [ARM]: Add support for vldmia/vldmdb/vstmia/vstmdb instructions in MVE.
This patch adds support for assembly instructions vldmia, vldmdb, vstmia
and vstmdb in MVE.  This instructions are already supported for Armv8-M
Floating-point Extension.

gas/ChangeLog:

2020-01-31  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

	* config/tc-arm.c (fldmias): Moved inside "THUMB_VARIANT & arm_ext_v6t2"
	to support VLDMIA instruction for MVE.
	(fldmdbs): Moved inside "THUMB_VARIANT & arm_ext_v6t2" to support VLDMDB
	instruction for MVE.
	(fstmias): Moved inside "THUMB_VARIANT & arm_ext_v6t2" to support VSTMIA
	instruction for MVE.
	(fstmdbs): Moved inside "THUMB_VARIANT & arm_ext_v6t2" to support VSTMDB
	instruction for MVE.
	* testsuite/gas/arm/mve-ldst.d: New test.
	* testsuite/gas/arm/mve-ldst.s: Likewise.
2020-01-31 16:30:02 +00:00
Nick Clifton 53943f32cc Updated translations for some of the binutils sub-directories 2020-01-31 14:45:51 +00:00
Richard Sandiford c3036ed063 aarch64: Fix MOVPRFX markup for bf16 conversions
bfcvt converts a .S input to a .H output, so any predicated movprfx
needs to operate on .S rather than .H.  In common with SVE2 narrowing
top operations, bfcvtnt doesn't accept movprfx.

2020-01-31  Richard Sandiford  <richard.sandiford@arm.com>

opcodes/
	* aarch64-tbl.h (aarch64_opcode): Set C_MAX_ELEM for SVE bfcvt.
	Remove C_SCAN_MOVPRFX for SVE bfcvtnt.

gas/
	* testsuite/gas/aarch64/sve-bfloat-movprfx.s: Use .h rather than
	.s for the movprfx.
	* testsuite/gas/aarch64/sve-bfloat-movprfx.d: Update accordingly.
	* testsuite/gas/aarch64/sve-movprfx_28.d,
	* testsuite/gas/aarch64/sve-movprfx_28.l,
	* testsuite/gas/aarch64/sve-movprfx_28.s: New test.
2020-01-31 13:22:46 +00:00
Jan Beulich 2ae4c7035c x86: prevent undue use of GOT32X and alike relocations
Comparison of i.tm.base_opcode against particular but not sufficiently
specific values needs to be accompanied by other qualification. Exclude
VEX and alike encodings here, and also exclude all forms of prefixes
explicitly specified in the opcodes table. While using @GOT with such
insns may not be very useful, it also isn't with e.g. ADC and SBB, yet
these get explicitly listed in comments as supported.
2020-01-30 17:03:22 +01:00
Jose E. Marchesi bd434cc4d9 cpu,opcodes,gas: fix neg and neg32 instructions in BPF
This patch fixes the neg/neg32 BPF instructions, which have K (=0)
instead of X (=1) in their header source bit, despite operating on
registes.

cpu/ChangeLog:

2020-01-30  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* bpf.cpu (define-alu-insn-un): The unary BPF instructions
	(neg and neg32) use OP_SRC_K even if they operate only in
	registers.

opcodes/ChangeLog:

2020-01-30  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* bpf-opc.c: Regenerate.

gas/ChangeLog:

2020-01-30  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* testsuite/gas/bpf/alu.d: Update expected opcode for `neg'.
	* testsuite/gas/bpf/alu-be.d: Likewise.
	* testsuite/gas/bpf/alu32.d: Likewise for `neg32'.
	* testsuite/gas/bpf/alu32-be.d: Likewise.
2020-01-30 13:59:04 +01:00
Jan Beulich aeab2b26db x86-64: honor vendor specifics for near RET
While vendors agree about default operand size (64 bits) and hence
unavilability of a 32-bit form, AMD honors a 16-bit operand size
override (0x66) while Intel doesn't.
2020-01-30 11:36:33 +01:00
Jan Beulich 873494c89f x86-64: also diagnose far returns / IRET with ambiguous operand size
Other than near returns these default to 32-bit operand size, and hence
it isn't really unlikely that 64-bit forms are meant. Hence these should
have disambiguating suffixes. In Intel mode, however, don't error in
these cases unconditionally - MASM accepts these without suffix _and_
without warning.
2020-01-30 11:35:20 +01:00
Jan Beulich 62b3f54810 x86: drop further pointless/bogus DefaultSize
- 64-bit CALL permitting just a single operand size doesn't need it.
- FLDENV et al should never have had it.

It remains suspicious that a number of 64-bit only insns continue to
have the attribute, despite this being intended for .code16gcc handling
only.
2020-01-30 11:33:53 +01:00
H.J. Lu bc31405ebb x86-64: Properly encode and decode movsxd
movsxd is a 64-bit only instruction.  It supports both 16-bit and 32-bit
destination registers.  Its AT&T mnemonic is movslq which only supports
64-bit destination register.  There is also a discrepancy between AMD64
and Intel64 on movsxd with 16-bit destination register.  AMD64 supports
32-bit source operand and Intel64 supports 16-bit source operand.

This patch updates movsxd encoding and decoding to alow 16-bit and 32-bit
destination registers.  It also handles movsxd with 16-bit destination
register for AMD64 and Intel 64.

gas/

	PR binutils/25445
	* config/tc-i386.c (check_long_reg): Also convert to QWORD for
	movsxd.
	* doc/c-i386.texi: Add a node for AMD64 vs. Intel64 ISA
	differences.  Document movslq and movsxd.
	* testsuite/gas/i386/i386.exp: Run PR binutils/25445 tests.
	* testsuite/gas/i386/x86-64-movsxd-intel.d: New file.
	* testsuite/gas/i386/x86-64-movsxd-intel64-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-movsxd-intel64-inval.l: Likewise.
	* testsuite/gas/i386/x86-64-movsxd-intel64-inval.s: Likewise.
	* testsuite/gas/i386/x86-64-movsxd-intel64.d: Likewise.
	* testsuite/gas/i386/x86-64-movsxd-intel64.s: Likewise.
	* testsuite/gas/i386/x86-64-movsxd-inval.l: Likewise.
	* testsuite/gas/i386/x86-64-movsxd-inval.s: Likewise.
	* testsuite/gas/i386/x86-64-movsxd.d: Likewise.
	* testsuite/gas/i386/x86-64-movsxd.s: Likewise.

opcodes/

	PR binutils/25445
	* i386-dis.c (MOVSXD_Fixup): New function.
	(movsxd_mode): New enum.
	(x86_64_table): Use MOVSXD_Fixup and movsxd_mode on movsxd.
	(intel_operand_size): Handle movsxd_mode.
	(OP_E_register): Likewise.
	(OP_G): Likewise.
	* i386-opc.tbl: Remove Rex64 and allow 32-bit destination
	register on movsxd.  Add movsxd with 16-bit destination register
	for AMD64 and Intel64 ISAs.
	* i386-tbl.h: Regenerated.
2020-01-27 04:38:29 -08:00
Alan Modra e3696f67ab Replace deprecated tcl case statements with switch statements
binutils/
	* testsuite/lib/binutils-common.exp (big_or_little_endian): Replace
	case statement with switch statement.
gas/
	* testsuite/gas/all/gas.exp: Replace case statements with switch
	statements.
	* testsuite/gas/elf/elf.exp: Likewise.
	* testsuite/gas/macros/macros.exp: Likewise.
	* testsuite/lib/gas-defs.exp: Likewise.
ld/
	* testsuite/ld-elfvers/vers.exp: Replace case statements with
	switch statements.
	* testsuite/ld-ifunc/ifunc.exp: Likewise.
	* testsuite/ld-unique/unique.exp: Likewise.
2020-01-27 22:52:15 +10:30
Tamar Christina 7568c93bf9 AArch64: Fix cfinv disassembly issues
This fixes the preferred disassembly for cfinv.  The Armv8.4-a instruction
overlaps with the possible encoding space for msr.  This because msr allows you
to use unallocated encoding space using the general sA_B_cC_cD_E form.

However when an encoding does become allocated then we need to ensure that it's
used as the preferred disassembly.  The problem with cfinv is that its mask has
all bits sets because it has no arguments.

This causes issues for the Alias resolver in gas as it uses the mask to build
alias graph.  In this case it can't do it since it thinks almost everything
would alias with cfinv.  So instead we can only fix this by moving cfinv before
msr.

gas/ChangeLog:

	PR 25403
	* testsuite/gas/aarch64/armv8_4-a.d: Add cfinv.
	* testsuite/gas/aarch64/armv8_4-a.s: Likewise.

opcodes/ChangeLog:

	PR 25403
	* aarch64-tbl.h (struct aarch64_opcode): Re-order cfinv.
	* aarch64-asm-2.c: Regenerate
	* aarch64-dis-2.c: Likewise.
	* aarch64-opc-2.c: Likewise.
2020-01-27 10:55:41 +00:00
Jim Wilson 403d1bd91d RISC-V: Change -march parsing.
bfd/
	2020-01-22  Maxim Blinov  <maxim.blinov@embecosm.com>
	* bfd/elfnn-riscv.c (riscv_skip_prefix): New.
	(riscv_prefix_cmp): Likewise.
	(riscv_non_std_ext_p): Deleted.
	(riscv_std_sv_ext_p): Likewise.
	(riscv_non_std_sv_ext_p): Likewise.
	(riscv_merge_non_std_and_sv_ext): Rename to...
	(riscv_merge_multi_letter_ext): and modified to use riscv_prefix_cmp.
	(riscv_merge_arch_attr_info): Replace 3 calls to
	riscv_merge_non_std_and_sv_ext with single call to
	riscv_merge_multi_letter_ext.
	* bfd/elfxx-riscv.c (riscv_parse_std_ext): Break if we
	encounter a 'z' prefix.
	(riscv_get_prefix_class): New function, return prefix class based
	on first few characters of input string.
	(riscv_parse_config): New structure to factor out minor differences
	in extension class parsing behaviour.
	(riscv_parse_sv_or_non_std_ext): Rename to...
	(riscv_parse_prefixed_ext): and parameterise with
	riscv_parse_config.
	(riscv_std_z_ext_strtab, riscv_std_s_ext_strtab): New.
	(riscv_multi_letter_ext_valid_p): New.
	(riscv_ext_x_valid_p, riscv_ext_z_valid_p, riscv_ext_s_valid_p): New.
	(riscv_parse_subset): Delegate all non-single-letter parsing work
	to riscv_parse_prefixed_ext.
	* bfd/elfxx-riscv.h (riscv_isa_ext_class): New type.
	(riscv_get_prefix_class): Declare.

	gas/
	2020-01-22  Maxim Blinov  <maxim.blinov@embecosm.com>
	* testsuite/gas/riscv/march-ok-s.d: sx is no longer valid and
	s exts must be known, so rename *ok* to *fail*.
	* testsuite/gas/riscv/march-ok-sx.d: Likewise.
	* testsuite/gas/riscv/march-ok-s-with-version: Likewise.
	* testsuite/gas/riscv/march-fail-s.l: Expected error messages for
	above change.
	* testsuite/gas/riscv/march-fail-sx.l: Likewise.
	* testsuite/gas/riscv/march-fail-sx-with-version.l: Likewise.

Change-Id: Ic4d91a13d055a10d30ab28752a380a669b59f29c
2020-01-22 16:45:04 -08:00
H.J. Lu be4c5e58bd x86: Always disallow double word suffix with word general register
In 64-bit mode, double word suffix in mnemonic with word general register
is disallowed.  Otherwise, assembler gives a warning:

$ cat /tmp/x.s
	movl	%ax, %bx
	movl	%ds, %ax
	movl	%ax, %cs
$ gcc -c /tmp/x.s
/tmp/x.s: Assembler messages:
/tmp/x.s:1: Error: incorrect register `%bx' used with `l' suffix
/tmp/x.s:2: Error: incorrect register `%ax' used with `l' suffix
/tmp/x.s:3: Error: incorrect register `%ax' used with `l' suffix
$ gcc -c /tmp/x.s -m32
/tmp/x.s: Assembler messages:
/tmp/x.s: Assembler messages:
/tmp/x.s:1: Warning: using `%ebx' instead of `%bx' due to `l' suffix
/tmp/x.s:1: Warning: using `%eax' instead of `%ax' due to `l' suffix
/tmp/x.s:2: Warning: using `%eax' instead of `%ax' due to `l' suffix
/tmp/x.s:3: Warning: using `%eax' instead of `%ax' due to `l' suffix

This patch makes it a hard error in all modes.  Now we get:

$ gcc -c /tmp/x.s -m32
/tmp/x.s: Assembler messages:
/tmp/x.s:1: Error: incorrect register `%bx' used with `l' suffix
/tmp/x.s:2: Error: incorrect register `%ax' used with `l' suffix
/tmp/x.s:3: Error: incorrect register `%ax' used with `l' suffix

	PR gas/25438
	* config/tc-i386.c (check_long_reg): Always disallow double word
	suffix in mnemonic with word general register.
	* testsuite/gas/i386/general.s: Replace word general register
	with double word general register for movl.
	* testsuite/gas/i386/inval.s: Add tests for movl with word general
	register.
	* testsuite/gas/i386/general.l: Updated.
	* testsuite/gas/i386/inval.l: Likewise.
2020-01-22 09:24:14 -08:00
Alan Modra 9e7028aa1e PowerPC64 __tls_get_addr_desc
This implements register saving and restoring in the __tls_get_addr
call stub, so that when glibc supports the optimized tls call stub gcc
can generate code that assumes only r0, r12 and of course r3 are
changed on a __tls_get_addr call.  When gcc expects __tls_get_addr
calls to preserve registers the call will be to __tls_get_addr_desc,
which will be translated by the linker to a call to __tls_get_addr_opt.

bfd/
	* elf64-ppc.h (struct ppc64_elf_params): Add no_tls_get_addr_regsave.
	* elf64-ppc.c (struct ppc_link_hash_table): Add tga_desc and
	tga_desc_fd.
	(is_tls_get_addr): Match tga_desc and tga_desc_df too.
	(STDU_R1_0R1, ADDI_R1_R1): Define.
	(tls_get_addr_prologue, tls_get_addr_epilogue): New functions.
	(ppc64_elf_tls_setup): Set up tga_desc and tga_desc_fd.  Indirect
	tga_desc_fd to opt_fd, and tga_desc to opt.  Set
	no_tls_get_addr_regsave.
	(branch_reloc_hash_match): Add hash3 and hash4.
	(ppc64_elf_tls_optimize): Handle tga_desc_fd and tga_desc too.
	(ppc64_elf_size_dynamic_sections): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	(plt_stub_size, build_plt_stub): Likewise.  Size regsave
	__tls_get_addr stub.
	(build_tls_get_addr_stub): Build regsave __tls_get_addr stub and
	eh_frame.
	(ppc_size_one_stub): Handle tga_desc_fd and tga_desc too.  Size
	eh_frame for regsave __tls_get_addr.
gas/
	* config/tc-ppc.c (parse_tls_arg): Handle tls arg for
	__tls_get_addr_desc and __tls_get_addr_opt.
ld/
	* emultempl/ppc64elf.em (ppc64_opt, PARSE_AND_LIST_LONGOPTS),
	(PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Support
	--tls-get-addr-regsave and --no-tls-get-addr-regsave.
	(params): Init new field.
	* ld.texi (--tls-get-addr-regsave, --no-tls-get-addr-regsave):
	Document.
	* testsuite/ld-powerpc/tlsdesc.s,
	* testsuite/ld-powerpc/tlsdesc.d,
	* testsuite/ld-powerpc/tlsdesc.wf,
	* testsuite/ld-powerpc/tlsdesc2.d,
	* testsuite/ld-powerpc/tlsdesc2.wf,
	* testsuite/ld-powerpc/tlsexenors.d,
	* testsuite/ld-powerpc/tlsexenors.r,
	* testsuite/ld-powerpc/tlsexers.d,
	* testsuite/ld-powerpc/tlsexers.r,
	* testsuite/ld-powerpc/tlsexetocnors.d,
	* testsuite/ld-powerpc/tlsexetocrs.d,
	* testsuite/ld-powerpc/tlsexetocrs.r,
	* testsuite/ld-powerpc/tlsopt6.d,
	* testsuite/ld-powerpc/tlsopt6.wf: New.
	* testsuite/ld-powerpc/powerpc.exp: Run new tests.
2020-01-22 17:14:08 +10:30
Jan Beulich e3ed17f393 x86: testsuite adjustments after commit 1a0351246a
The odd behavior of certain COFF/PE targets makes necessary some
mechanical adjustments.
2020-01-21 14:41:05 +01:00
Jan Beulich 1a0351246a x86: replace adhoc ambiguous operand checking for CRC32
There's no need (anymore?) to heavily special case this - just make
generic logic consider only its first operand, and deal with the case
of an 'l' suffix not being allowed in a pattern.
2020-01-21 08:30:05 +01:00
Jan Beulich c006a730e9 x86: improve handling of insns with ambiguous operand sizes
Commit b76bc5d54e ("x86: don't default variable shift count insns to
8-bit operand size") pointed out a very bad case, but the underlying
problem is, as mentioned on various occasions, much larger: Silently
selecting a (nowhere documented afaict) certain default operand size
when there's no "sizing" suffix and no suitable register operand(s) is
simply dangerous (for the programmer to make mistakes).

While in Intel syntax mode such mistakes already lead to an error (which
is going to remain that way), AT&T syntax mode now gains warnings in
such cases by default, which can be suppressed or promoted to an error
if so desired by the programmer. Furthermore at least general purpose
insns now consistently have a default applied (alongside the warning
emission), rather than accepting some and refusing others.

No warnings are (as before) to be generated for "DefaultSize" insns as
well as ones acting on selector and other fixed-width values. For
SYSRET, however, the DefaultSize needs to be dropped - it had been
wrongly put there in the first place, as it's unrelated to .code16gcc
(no stack accesses involved).

As set forth as a prereq when I first mentioned this intended change a
few years back, Linux as well as gcc have meanwhile been patched to
avoid (emission of) ambiguous operands (and hence triggering of the new
warning).

Note that I think that in 64-bit mode IRET and far RET would better get
a diagnostic too, as it's reasonably likely that a suffix-less instance
really is meant to be a 64-bit one. But I guess I better make this a
separate follow-on patch.

Note further that floating point operations with integer operands are an
exception for now: They continue to use short (16-bit) operands by
default even in 32- and 64-bit modes.

Finally note that while {,V}PCMPESTR{I,M} would, strictly speaking, also
need to be diagnosed, with their 64-bit forms not being very useful I
think it is better to continue to avoid warning about them (by way of
them carrying IgnoreSize attributes).
2020-01-21 08:28:25 +01:00
Jan Beulich c906a69a1f x86: VCVTNEPS2BF16{X,Y} should permit broadcasting
Just like other VCVT*{X,Y} templates do, and to allow the programmer
flexibility (might be relevant in particular when heavily macro-izing
code), the two templates should also have Broadcast set, just like their
X/Y-suffix-less counterparts. This in turn requires them to also have
* Dword set on their memory operands, to cover the logic added to
  i386gen by 4a1b91eabb ("x86: Expand Broadcast to 3 bits"),
* RegXMM/RegYMM set on their source operands, to satisfy broadcast
  sizing logic in gas itself.
Otherwise ATTSyntax templates wouldn't need such operand size attributes.

While extending the test cases, also add Intel syntax broadcast forms
without explicit size specifiers.
2020-01-21 08:25:31 +01:00
Nick Clifton 26916852e1 Updated translations for various binutils sub-directories 2020-01-20 15:10:23 +00:00
H.J. Lu 14470f0755 x86-64: Fix TLSDESC relaxation for x32
For x32, we must encode "lea x@TLSDESC(%rip), %reg" with a REX prefix
even if it isn't required.  Otherwise linker can’t safely perform
GDesc -> IE/LE optimization.  X32 TLSDESC sequences can be:

40 8d 05 00 00 00 00	rex lea	x@TLSDESC(%rip), %reg
...
67 ff 10		call	*x@TLSCALL(%eax)

or the same sequence as LP64:

48 8d 05 00 00 00 00	lea	foo@TLSDESC(%rip), %reg
...
ff 10			call	*foo@TLSCALL(%rax)

We need to support both sequences for x32.  For both GDesc -> IE/LE
transitions,

67 ff 10		call	*x@TLSCALL(%eax)

should relaxed to

0f 1f 00		nopl	(%rax)

For GDesc -> LE transition,

40 8d 05 00 00 00 00	rex lea	x@TLSDESC(%rip), %reg

should relaxed to

40 c7 c0 fc ff ff ff	rex movl $x@tpoff, %reg

For GDesc -> IE transition,

40 8d 05 00 00 00 00	rex lea	x@TLSDESC(%rip), %reg

should relaxed to

40 8b 05 00 00 00 00	rex movl x@gottpoff(%rip), %eax

bfd/

	PR ld/25416
	* elf64-x86-64.c (elf_x86_64_check_tls_transition): Support
	"rex leal x@tlsdesc(%rip), %reg" and "call *x@tlsdesc(%eax)" in
	X32 mode.
	(elf_x86_64_relocate_section): In x32 mode, for GDesc -> LE
	transition, relax "rex leal x@tlsdesc(%rip), %reg" to
	"rex movl $x@tpoff, %reg", for GDesc -> IE transition, relax
	"rex leal x@tlsdesc(%rip), %reg" to
	"rex movl x@gottpoff(%rip), %eax".  For both transitions, relax
	"call *(%eax)" to "nopl (%rax)".

gas/

	PR ld/25416
	* config/tc-i386.c (output_insn): Add a dummy REX_OPCODE prefix
	for lea with R_X86_64_GOTPC32_TLSDESC relocation when generating
	x32 object.
	* testsuite/gas/i386/ilp32/x32-tls.d: Updated.
	* testsuite/gas/i386/ilp32/x32-tls.s: Add tests for lea with
	R_X86_64_GOTPC32_TLSDESC relocation.

ld/

	PR ld/25416
	* testsuite/ld-x86-64/pr25416-1.s: New file
	* testsuite/ld-x86-64/pr25416-1a.d: Likewise.
	* testsuite/ld-x86-64/pr25416-1b.d: Likewise.
	* testsuite/ld-x86-64/pr25416-1.s: Likewise.
	* testsuite/ld-x86-64/pr25416-2.s: Likewise.
	* testsuite/ld-x86-64/pr25416-2a.d: Likewise.
	* testsuite/ld-x86-64/pr25416-2b.d: Likewise.
	* testsuite/ld-x86-64/pr25416-3.d: Likewise.
	* testsuite/ld-x86-64/pr25416-3.s: Likewise.
	* testsuite/ld-x86-64/pr25416-4.d: Likewise.
	* testsuite/ld-x86-64/pr25416-4.s: Likewise.
	* testsuite/ld-x86-64/pr25416-5a.c: Likewise.
	* testsuite/ld-x86-64/pr25416-5b.s: Likewise.
	* testsuite/ld-x86-64/pr25416-5c.s: Likewise.
	* testsuite/ld-x86-64/pr25416-5d.s: Likewise.
	* testsuite/ld-x86-64/pr25416-5e.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run PR ld/25416 tests.
2020-01-20 07:01:07 -08:00
Nick Clifton 1b1bb2c67b Update version to 2.34.50. Regenerate configure and .pot files. 2020-01-18 14:12:07 +00:00
Nick Clifton ae77468624 Add markers for 2.34 branch to the NEWS files and ChangeLogs. 2020-01-18 13:50:25 +00:00
H.J. Lu 42e04b3601 x86: Add {vex} pseudo prefix
There are 2-byte VEX prefix and 3-byte VEX prefix.  2-byte VEX prefix
can't encode all operands.  By default, assembler tries 2-byte VEX prefix
first.  {vex3} can be used to force 3-byte VEX prefix.  This patch adds
{vex} pseudo prefix and keeps {vex2} for backward compatibility.

gas/

	* config/tc-i386.c (_i386_insn): Replace vex_encoding_vex2
	with vex_encoding_vex.
	(parse_insn): Likewise.
	* doc/c-i386.texi: Replace {vex2} with {vex}.  Update {vex}
	and {vex3} documentation.
	* testsuite/gas/i386/pseudos.s: Replace 3 {vex2} tests with
	{vex}.
	* testsuite/gas/i386/x86-64-pseudos.s: Likewise.

opcodes/

	* i386-opc.tbl: Add {vex} pseudo prefix.
	* i386-tbl.h: Regenerated.
2020-01-17 07:07:55 -08:00
Andre Vieira bd267fd1f9 Forgot to add testcases to commit for [binutils][arm] PR25376 Change MVE ...
The original commit was 2da2eaf4ce
2020-01-17 14:21:59 +00:00
Andre Vieira 2da2eaf4ce [binutils][arm] PR25376 Change MVE into a CORE_HIGH feature
This patch moves MVE feature bits into the CORE_HIGH section.  This makes sure
.fpu and -mfpu does not reset the bits set by MVE. This is important because
.fpu has no option to "set" these same bits and thus, mimic'ing GCC, we choose
to define MVE as an architecture extension rather than put it together with
other the legacy fpu features.

This will enable the following behavior:
.arch armv8.1-m.main
.arch mve
.fpu fpv5-sp-d16               #does not disable mve.
vadd.i32 q0, q1, q2

This patch also makes sure MVE is not taken into account during auto-detect.
This was already the case, but because we moved the MVE bits to the
architecture feature space we must make sure ARM_ANY does not include MVE.

gas/ChangeLog:
2020-01-16  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	PR 25376
	* config/tc-arm.c (mve_ext, mve_fp_ext): Use CORE_HIGH.
	(armv8_1m_main_ext_table): Use CORE_HIGH for mve.
	* testsuite/arm/armv8_1-m-fpu-mve-1.s: New.
	* testsuite/arm/armv8_1-m-fpu-mve-1.d: New.
	* testsuite/arm/armv8_1-m-fpu-mve-2.s: New.
	* testsuite/arm/armv8_1-m-fpu-mve-2.d: New.

include/ChangeLog:
2020-01-16  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	PR 25376
	* opcodes/arm.h (FPU_MVE, FPU_MVE_FPU): Move these features to...
	(ARM_EXT2_MVE, ARM_EXT2_MVE_FP): ... the CORE_HIGH space.
	(ARM_ANY): Redefine to not include any MVE bits.
	(ARM_FEATURE_ALL): Removed.

opcodes/ChangeLog:
2020-01-16  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	PR 25376
	* opcodes/arm-dis.c (coprocessor_opcodes): Use CORE_HIGH for MVE bits.
	(neon_opcodes): Likewise.
	(select_arm_features): Make sure we enable MVE bits when selecting
	armv8.1-m.main.  Make sure we do not enable MVE bits when not selecting
	any architecture.
2020-01-16 14:33:01 +00:00
Jan Beulich 45a4bb2010 x86: drop found_cpu_match local variable
50aecf8c5f could have done so right away; perhaps the variable shouldn't
have been introduced in the first place.
2020-01-16 10:07:36 +01:00
Jan Beulich 4814632e69 x86: VPEXTRQ/VPINSRQ are unavailable outside of 64-bit mode
The AVX512DQ patterns lacking a Cpu64 attribute made the memory operand
forms accepted even outside of 64-bit mode, and this even without any
{evex} pseudo-prefix (otherwise one could argue that this is an attempt
to follow one possible, albeit somewhat odd, interpretation of the SDM
wording to this effect).

For consistency between the various involved templates drop the
* (now) unnecessary IgnoreSize attributes
* unnecessary (due to VexW1) Size64 attributes from VEX encoded forms
* redundant (with Reg64) Qword operand attributes
uniformly.
2020-01-16 10:05:35 +01:00
Jozef Lawrynowicz 131cb553d6 MSP430: Fix relocation overflow when using #lo(EXP) macro
gas/ChangeLog:

2020-01-15  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config/tc-msp430.c (CHECK_RELOC_MSP430): Always generate 430X
	relocations when the target is 430X, except when extracting part of an
	expression.
	(msp430_srcoperand): Adjust comment.
	Initialize the expp member of the msp430_operand_s struct as
	appropriate.
	(msp430_dstoperand): Likewise.
	* testsuite/gas/msp430/msp430.exp: Run new test.
	* testsuite/gas/msp430/reloc-lo-430x.d: New test.
	* testsuite/gas/msp430/reloc-lo-430x.s: New test.

include/ChangeLog:

2020-01-15  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* opcode/msp430.h (enum msp430_expp_e): New.
	(struct msp430_operand_s): Add expp member to struct.

ld/ChangeLog:

2020-01-15  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* testsuite/ld-msp430-elf/msp430-elf.exp: Run new test.
	* testsuite/ld-msp430-elf/reloc-lo-430x.s: New test.
2020-01-15 13:23:06 +00:00
Alan Modra c24d0e8d48 Reinstate gas em=freebsd for sparc-freebsd
In commit c9098af41e I over-simplified the sparc target decoding,
missing the fact that prior to that patch sparc-*-freebsd fell through
to the generic *-*-freebsd match.

	* configure.tgt: Add sparc-*-freebsd case.
2020-01-15 16:25:10 +10:30
Lili Cui e44925ae56 x86: Updated align branch tests for Darwin and i686-pc-elf
1. Update align branch assembler tests to match Darwin disassembler
outputs.
2. Skip unsupported "call *foo" tests in 64-bit mode on Darwin.
3. Update align branch linker test to match any addresses for i686-pc-elf.

gas/

	* testsuite/gas/i386/align-branch-1a.d: Updated for Darwin.
	* testsuite/gas/i386/align-branch-1b.d: Likewise.
	* testsuite/gas/i386/align-branch-1c.d: Likewise.
	* testsuite/gas/i386/align-branch-1d.d: Likewise.
	* testsuite/gas/i386/align-branch-1e.d: Likewise.
	* testsuite/gas/i386/align-branch-1f.d: Likewise.
	* testsuite/gas/i386/align-branch-1g.d: Likewise.
	* testsuite/gas/i386/align-branch-1h.d: Likewise.
	* testsuite/gas/i386/align-branch-1i.d: Likewise.
	* testsuite/gas/i386/align-branch-5.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1e.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1f.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1h.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1i.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-5.d: Likewise.
	* testsuite/gas/i386/i386.exp: Skip x86-64-align-branch-2a,
	x86-64-align-branch-2b and x86-64-align-branch-2c on Darwin.

ld/

	* testsuite/ld-i386/align-branch-1.d: Updated for i686-pc-elf.
2020-01-14 08:59:37 -08:00
Sergey Belyashov 7a6bf3becb Fix various assembler testsuite failures for the Z80 target.
PR 25377
gas	* config/tc-z80.c: Add support for half precision, single
	precision and double precision floating point values.
	* config/tc-z80.h b/gas/config/tc-z80.h: Disable string escapes.
	* doc/as.texi: Add new z80 command line options.
	* doc/c-z80.texi: Document new z80 command line options.
	* testsuite/gas/z80/ez80_pref_dis.s: New test.
	* testsuite/gas/z80/ez80_pref_dis.d: New test driver.
	* testsuite/gas/z80/z80.exp: Run the new test.
	* testsuite/gas/z80/fp_math48.d: Use correct command line option.
	* testsuite/gas/z80/fp_zeda32.d: Likewise.
	* testsuite/gas/z80/strings.d: Update expected output.

opcodes	* z80-dis.c (suffix): Use .db instruction to generate double
	prefix.
2020-01-14 13:13:57 +00:00
Matthew Malcomson 82e9597c9e [gas][aarch64] Turn on SVE when using f32mm or f64mm extensions
There are no instructions under these matrix multiply extensions that
can be used without having SVE enabled.
Since these extensions require SVE, we make that explicit in the options
table.

Tested on aarch64-none-elf without regressions.

gas/ChangeLog:

2020-01-13  Matthew Malcomson  <matthew.malcomson@arm.com>

	* config/tc-aarch64.c (f64mm, f32mm): Add sve as a feature
	dependency.
2020-01-13 15:31:39 +00:00
Claudiu Zissulescu 5e4f7e0518 [ARC][committed] Code cleanup and improvements.
Code clean up and improvements when changing the cpu from command
line. Also, remove unused/old emulations.

gas/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (arc_select_cpu): Re-init the bfd if we change
	the CPU.
	* config/tc-arc.h: Add header if/defs.
	* testsuite/gas/arc/pseudos.d: Improve matching pattern.

ls/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* Makefile.am: Remove earcelf_prof.c and earclinux_prof.c
	emulations.
	* Makefile.in: Regenerate.
	* configure.tgt: Likewise.
	* emulparams/arcelf_prof.sh: Remove file.
	* emulparams/arclinux_prof.sh: Likewise.

opcodes/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-opc.c (C_NE): Make it required.
2020-01-13 11:16:47 +02:00
Alan Modra febda64f15 ubsan: wasm32: signed integer overflow
The signed integer overflow occurred when adding one to target_count
  for (i = 0; i < target_count + 1; i++)
but that's the least of the worries here.  target_count was long and i
int, leading to the possibility of a loop that never ended.

So to avoid this type of vulnerability, this patch uses what I believe
to be the proper types for arguments of various wasm32 opcodes, rather
than using "long" which may change in size.

gas/
	* testsuite/gas/wasm32/allinsn.d: Update expected output.
opcodes/
	* wasm32-dis.c (print_insn_wasm32): Localise variables.  Store
	result of wasm_read_leb128 in a uint64_t and check that bits
	are not lost when copying to other locals.  Use uint32_t for
	most locals.  Use PRId64 when printing int64_t.
2020-01-13 16:44:27 +10:30
Alan Modra 5496abe1c5 tic4x: sign extension using shifts
Don't do that.  Especially don't use shift counts that assume the type
being shifted is 32 bits when the type is long/unsigned long.  Also
reverts part of a change I made on 2019-12-11 to tic4x_print_register
that on closer inspection turns out to be unnecessary.

include/
	* opcode/tic4x.h (EXTR): Delete.
	(EXTRU, EXTRS, INSERTU, INSERTS): Rewrite without zero/sign
	extension using shifts.  Do trim INSERTU value to specified bitfield.
opcodes/
	* tic4x-dis.c (tic4x_print_register): Remove dead code.
gas/
	* config/tc-tic4x.c (tic4x_operands_match): Correct tic3x trap
	insertion.
2020-01-13 12:12:05 +10:30
Alan Modra ec4181f289 HPUX gas testsuite fixes
* testsuite/gas/elf/pr14891.s: Don't start directives in first column.
	* testsuite/gas/elf/pr21661.d: Don't run on hpux.
2020-01-10 17:32:33 +10:30
Sergey Belyashov 40c75bc8b0 Fix compile time warnings about comparisons always being false.
PR 25224
gas	* config/tc-z80.c (emit_ld_m_rr): Use integer types when checking
	opcode byte values.
	(emit_ld_r_r): Likewise.
	(emit_ld_rr_m): Likewise.
	(emit_ld_rr_nn): Likewise.

opcodes	* z80-dis.c (ld_ii_ii): Use character constant when checking
	opcode byte value.
2020-01-09 11:49:18 +00:00
Jan Beulich 72aea32839 x86: refine when to trigger optimizations
Checking just the base opcode without also checking this isn't a VEX
encoding, and without there being other insn properties avoiding a match
once respective VEX/XOP/EXEX-encoded insns would appear, is at least
dangerous. Add respective checks. At the same time there's no real need
to check the extension opcode to be None for the 0xA8 form - there's
nothing it can be confused with, and non-VEX-and-alike forms also can't
appear.
2020-01-09 11:40:04 +01:00
Jan Beulich 3f93af6141 x86-64: assert sane internal state for REX conversions
For the comments about "hi" registers to be really applicable, RegRex
may not be set on the respective registers. Assert this is the case.
2020-01-09 11:39:33 +01:00
Jan Beulich 7697afb662 x86: consistently convert to byte registers for TEST w/ imm optimization
Commit ac0ab1842d ("i386: Also check R12-R15 registers when optimizing
testq to testb") didn't go quite far enough: In order to avoid confusing
other code registers would better be converted to byte ones uniformly.
2020-01-09 11:38:59 +01:00
Jan Beulich d835a58baa x86: SYSENTER/SYSEXIT are unavailable in 64-bit mode on AMD
The disassembler change is such that in default mode we'd disassemble
the insns (for there not ebing any conflicts), but when AMD64 mode was
explicitly requested, we'd show them as "(bad)".
2020-01-09 11:38:01 +01:00
Nick Clifton 915808f652 Document the fact that the assembler's alignment pseudo-ops can be issued without any argumemtns.
PR 25284
	* doc/as.texi (Align): Document the fact that all arguments can be
	omitted.
	(Balign): Likewise.
	(P2align): Likewise.
2020-01-08 17:00:54 +00:00
Nick Clifton f1f28025c3 Make the assembler generate an error if there is an attempt to define a section with the same name as an already defined symbol.
PR 14891
	* config/obj-elf.c (obj_elf_section): Fail if the section name is
	already defined as a different symbol type.
	* testsuite/gas/elf/pr14891.s: New test source file.
	* testsuite/gas/elf/pr14891.d: New test driver.
	* testsuite/gas/elf/pr14891.s: New test expected error output.
	* testsuite/gas/elf/elf.exp: Run the new test.
2020-01-08 16:30:20 +00:00
Alan Modra 030a2e78ac ubsan: z8k: index 10 out of bounds for type 'unsigned int const[10]'
The fix is the additional ARRAY_SIZE test, the rest just tidies
variable types rather than adding a cast to avoid warnings.

opcodes/
	* z8k-dis.c: Include libiberty.h
	(instr_data_s): Make max_fetched unsigned.
	(z8k_lookup_instr): Make nibl_index and tabl_index unsigned.
	Don't exceed byte_info bounds.
	(output_instr): Make num_bytes unsigned.
	(unpack_instr): Likewise for nibl_count and loop.
	* z8kgen.c (gas <opcode_entry_type>): Make noperands, length and
	idx unsigned.
	* z8k-opc.h: Regenerate.
gas/
	* config/tc-z8k.c (md_begin): Make idx unsigned.
	(get_specific): Likewise for this_index.
2020-01-08 21:51:32 +10:30
Claudiu Zissulescu 2a1ebfb221 [ARC] Improve parsing instruction operands.
We use gas' expression function to parse the operands of an
instruction in a generic way. There are situations when we have labels
and registers having the same name as well as the substraction sign
doesn't always stands for the arithmetical operation but for the
register range (e.g. enter instruction). This patch improves parsing
symbols found in a instruction operand, cleans up code and avoids
using default or undefined variables.

gas/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (parse_reloc_symbol): New function.
	(tokenize_arguments): Clean up, use parse_reloc_symbol function.
	(md_operand): Set X_md to absent.
	(arc_parse_name): Check for X_md.
2020-01-07 15:29:31 +02:00
Sergey Belyashov 16d8767399 Allow individual targets to decide if string escapes should be allowed. Disable for PPC and Z80.
PR 25311
	* as.h (TC_STRING_ESCAPES): Provide a default definition.
	* app.c (do_scrub_chars): Use TC_STRING_ESCAPES instead of
	NO_STRING_ESCAPES.
	* read.c (next_char_of_string): Likewise.
	* config/tc-ppc.h (TC_STRING_ESCAPES): Define.
	* config/tc-z80.h (TC_STRING_ESCAPES): Define.
2020-01-03 16:23:19 +00:00
Nick Clifton a2322019f5 Updated Swedish translation for the GAS subdirectory. 2020-01-03 12:59:54 +00:00
Jan Beulich 5437a02abc Arm64: correct address index operands for LD1RO{H,W,D}
Just like their LD1RQ{H,W,D} counterparts, as per the specification the
index registers get scaled by element size.
2020-01-03 10:16:44 +01:00
Jan Beulich 567dfba2be Arm64: correct {su,us}dot SIMD encodings
According to the specification these permit the Q bit to control the
vector length operated on, and hence this bit should not already be set
in the opcode table entries (it rather needs setting dynamically). Note
how the test case output did also not match its input. Besides
correcting the test case also extend it to cover both forms.
2020-01-03 10:14:16 +01:00
Jan Beulich 8c45011acd Arm64: correct uzp{1,2} mnemonics
According to the specification, and in line with the pre-existing
predicate forms, the mnemonics do not include an 'i'.
2020-01-03 10:13:31 +01:00
Jan Beulich f4950f76fa Arm64: correct 64-bit element fmmla encoding
There's just one bit of difference to the 32-bit element form, as
per the documentation.
2020-01-03 10:12:49 +01:00
Sergey Belyashov 6655dba246 Add support for the GBZ80, Z180, and eZ80 variants of the Z80 architecure. Add an ELF based target for these as well.
PR 25224
bfd	* Makefile.am: Add z80-elf target support.
	* configure.ac: Likewise.
	* targets.c: Likewise.
	* config.bfd: Add z80-elf target support and new arches: ez80 and z180.
	* elf32-z80.c: New file.
	* archures.c: Add new z80 architectures: eZ80 and Z180.
	* coffcode.h: Likewise.
	* cpu-z80.c: Likewise.
	* bfd-in2.h: Likewise plus additional Z80 relocations.
	* coff-z80.c: Add new relocations for Z80 target and local label check.

gas	* config/tc-z80.c: Add new architectures: Z180 and eZ80. Add support
	for assembler code generated by SDCC. Add new relocation types. Add
	z80-elf target support.
	* config/tc-z80.h: Add z80-elf target support. Enable dollar local
	labels. Local labels starts from ".L".
	* testsuite/gas/all/fwdexp.d: Fix failure due to symbol conflict.
	* testsuite/gas/all/fwdexp.s: Likewise.
	* testsuite/gas/z80/suffix.d: Fix failure on ELF target.
	* testsuite/gas/z80/z80.exp: Add new tests
	* testsuite/gas/z80/dollar.d: New file.
	* testsuite/gas/z80/dollar.s: New file.
	* testsuite/gas/z80/ez80_adl_all.d: New file.
	* testsuite/gas/z80/ez80_adl_all.s: New file.
	* testsuite/gas/z80/ez80_adl_suf.d: New file.
	* testsuite/gas/z80/ez80_isuf.s: New file.
	* testsuite/gas/z80/ez80_z80_all.d: New file.
	* testsuite/gas/z80/ez80_z80_all.s: New file.
	* testsuite/gas/z80/ez80_z80_suf.d: New file.
	* testsuite/gas/z80/r800_extra.d: New file.
	* testsuite/gas/z80/r800_extra.s: New file.
	* testsuite/gas/z80/r800_ii8.d: New file.
	* testsuite/gas/z80/r800_z80_doc.d: New file.
	* testsuite/gas/z80/z180.d: New file.
	* testsuite/gas/z80/z180.s: New file.
	* testsuite/gas/z80/z180_z80_doc.d: New file.
	* testsuite/gas/z80/z80_doc.d: New file.
	* testsuite/gas/z80/z80_doc.s: New file.
	* testsuite/gas/z80/z80_ii8.d: New file.
	* testsuite/gas/z80/z80_ii8.s: New file.
	* testsuite/gas/z80/z80_in_f_c.d: New file.
	* testsuite/gas/z80/z80_in_f_c.s: New file.
	* testsuite/gas/z80/z80_op_ii_ld.d: New file.
	* testsuite/gas/z80/z80_op_ii_ld.s: New file.
	* testsuite/gas/z80/z80_out_c_0.d: New file.
	* testsuite/gas/z80/z80_out_c_0.s: New file.
	* testsuite/gas/z80/z80_reloc.d: New file.
	* testsuite/gas/z80/z80_reloc.s: New file.
	* testsuite/gas/z80/z80_sli.d: New file.
	* testsuite/gas/z80/z80_sli.s: New file.

ld	* Makefile.am: Add new target z80-elf
	* configure.tgt: Likewise.
	* emultempl/z80.em: Add support for eZ80 and Z180 architectures.
	* emulparams/elf32z80.sh: New file.
	* emultempl/z80elf.em: Likewise.
	* testsuite/ld-z80/arch_ez80_adl.d: Likewise.
	* testsuite/ld-z80/arch_ez80_z80.d: Likewise.
	* testsuite/ld-z80/arch_r800.d: Likewise.
	* testsuite/ld-z80/arch_z180.d: Likewise.
	* testsuite/ld-z80/arch_z80.d: Likewise.
	* testsuite/ld-z80/comb_arch_ez80_z80.d: Likewise.
	* testsuite/ld-z80/comb_arch_z180.d: Likewise.
	* testsuite/ld-z80/labels.s: Likewise.
	* testsuite/ld-z80/relocs.s: Likewise.
	* testsuite/ld-z80/relocs_b_ez80.d: Likewise.
	* testsuite/ld-z80/relocs_b_z80.d: Likewise.
	* testsuite/ld-z80/relocs_f_z80.d: Likewise.
	* testsuite/ld-z80/z80.exp: Likewise.

opcodes	* z80-dis.c: Add support for eZ80 and Z80 instructions.
2020-01-02 14:14:59 +00:00
Szabolcs Nagy a65b5de624 [ARM][gas] fix build breakage with gcc-10 by using correct enum type
Fixes

../../gas/config/tc-arm.c: In function 'parse_reg_list':
../../gas/config/tc-arm.c:1946:35: error: implicit conversion from 'enum reg_list_els' to 'enum arm_reg_type' [-Werror=enum-conversion]
 1946 |        reg = arm_reg_parse (&str, REGLIST_RN);
      |                                   ^~~~~~~~~~

gas/ChangeLog:

	* config/tc-arm.c (parse_reg_list): Use REG_TYPE_RN instead of
	REGLIST_RN.
2020-01-02 13:07:37 +00:00
Alan Modra b14ce8bfe1 Re: Update year range in copyright notice of binutils files
Add the ChangeLog entry.
2020-01-01 18:55:18 +10:30
Alan Modra b3adc24a07 Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
Alan Modra 0b11474080 ChangeLog rotation 2020-01-01 18:12:08 +10:30
Jan Beulich f2810fe00a x86: adjust ignored prefix warning for branches
There's no reason to not also issue them in Intel syntax mode, and it
can be quite helpful to mention the actual insn (after all there can be
multiple on a single line).
2019-12-27 09:39:58 +01:00
Jan Beulich 6cb0a70ef3 x86-64: correct / adjust prefix emission
First and foremost REX must come last. Next JumpInterSegment branches
can't possibly have a REX prefix, as they're consistently CpuNo64. And
finally make BND prefix handling in output_branch() consistent with that
of other prefixes in the same function, and make its placement among
prefixes consistent with output_jump() (which, oddly enough, still isn't
the supposedly canonical order specified by the *_PREFIX definitions).
2019-12-27 09:39:17 +01:00
Jan Beulich 376cd05610 x86-64: fix Intel64 handling of branch with data16 prefix
The expectation of x86-64-branch-3 for "call" / "jmp" with an obvious
direct destination to translate to an indirect _far_ branch is plain
wrong. The operand size prefix should have no effect at all on the
interpretation of the operand. The main underlying issue here is that
the Intel64 templates of the direct branches don't include Disp16, yet
various assumptions exist that it would always be there when there's
also Disp32/Disp32S, toggled by the operand size prefix (which is
being ignored by direct branches in Intel64 mode).

Along these lines it was also wrong to base the displacement width
decision solely on the operand size prefix: REX.W cancels this effect
and hence needs taking into consideration, too.

A disassembler change is needed here as well: XBEGIN was wrongly treated
the same as direct CALL/JMP, which isn't the case - the operand size
prefix does affect displacement size there, it's merely ignored when it
comes to updating [ER]IP.
2019-12-27 09:38:34 +01:00
Jan Beulich 48bcea9f48 x86: consolidate Disp<NN> handling a little
In memory operand addressing, which forms of displacement are permitted
besides Disp8 is pretty clearly limited
- outside of 64-bit mode, Disp16 or Disp32 only, depending on address
  size (MPX being special in not allowing Disp16),
- in 64-bit mode, Disp32s or Disp64 without address size override, and
  solely Disp32 with one.
Adjust assembler and i386-gen to match this, observing that templates
already get adjusted before trying to match them against input depending
on the presence of an address size prefix.

This adjustment logic gets extended to all cases, as certain DispNN
values should also be dropped when there's no such prefix. In fact
behavior of the assembler, perhaps besides the exact diagnostics wording,
should not differ between there being templates applicable to 64-bit and
non-64-bit at the same time, or there being fully separate sets of
templates, with their DispNN settings already reduced accordingly.

This adjustment logic further gets guarded such that there wouldn't be
and Disp<N> conversion based on address size prefix when this prefix
doesn't control the width of the displacement (on branches other than
absolute ones).

These adjustments then also allow folding two MOV templates, which had
been split between 64-bit and non-64-bits variants so far.

Once in this area also
- drop the bogus DispNN from JumpByte templates, leaving just the
  correct Disp8 there (compensated by i386_finalize_displacement()
  now setting Disp8 on their operands),
- add the missing Disp32S to XBEGIN.

Note that the changes make it necessary to temporarily mark a test as
XFAIL; this will get taken care of by a subsequent patch. The failing
parts are entirely bogus and will get replaced.
2019-12-27 09:22:03 +01:00
Alan Modra 5b660084e2 Remove tic80 support
This is one way of fixing ubsan bug reports, just delete the code.

The assembler support was removed back in 2005 along with other
non-BFD assemblers, but somehow the remainder of the port stayed in.

bfd/
	* coff-tic80.c: Delete file.
	* cpu-tic80.c: Delete file.
	* archures.c: Remove tic80 support.
	* coffcode.h: Likewise.
	* coffswap.h: Likewise.
	* targets.c: Likewise.
	* config.bfd: Likewise.
	* configure.ac: Likewise.
	* Makefile.am: Likewise.
	* Makefile.in: Regenerate.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
binutils/
	* testsuite/binutils-all/objcopy.exp: Remove tic80 support.
	* testsuite/binutils-all/objdump.exp: Likewise.
gas/
	* doc/as.texi: Remove mention of tic80.
include/
	* coff/tic80.h: Delete file.
	* opcode/tic80.h: Delete file.
ld/
	* emulparams/tic80coff.sh: Delete file.
	* scripttempl/tic80coff.sc: Delete file.
	* configure.tgt: Remove tic80 support.
	* Makefile.am: Likewise.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
opcodes/
	* tic80-dis.c: Delete file.
	* tic80-opc.c: Delete file.
	* disassemble.c: Remove tic80 support.
	* disassemble.h: Likewise.
	* Makefile.am: Likewise.
	* configure.ac: Likewise.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/POTFILES.in: Regenerate.
2019-12-17 16:36:54 +10:30
H.J. Lu ac0ab1842d i386: Also check R12-R15 registers when optimizing testq to testb
Similar to SP, BP, SI and DI registers, R12-R15 registers must use REX
prefix for the low byte register when optimizing

test $imm7, %r64/%r32/%r16 -> test $imm7, %r8

	PR gas/25274
	* config/tc-i386.c (optimize_encoding): Also check R12-R15
	registers for "test $imm7, %r64/%r32/%r16 -> test $imm7, %r8"
	optimization.
	* testsuite/gas/i386/x86-64-optimize-3.s: Add tests for test
	with r12.
	* testsuite/gas/i386/x86-64-optimize-3.d: Updated.
	* testsuite/gas/i386/x86-64-optimize-3b.d: Likewise.
2019-12-12 12:31:26 -08:00
H.J. Lu 8493b6651a i386: Add tests for -malign-branch-boundary and -malign-branch
Add tests for -malign-branch-boundary, -malign-branch and
-mbranches-within-32B-boundaries.

gas/

	* testsuite/gas/i386/align-branch-1.s: New file.
	* testsuite/gas/i386/align-branch-1a.d: Likewise.
	* testsuite/gas/i386/align-branch-1b.d: Likewise.
	* testsuite/gas/i386/align-branch-1c.d: Likewise.
	* testsuite/gas/i386/align-branch-1d.d: Likewise.
	* testsuite/gas/i386/align-branch-1e.d: Likewise.
	* testsuite/gas/i386/align-branch-1f.d: Likewise.
	* testsuite/gas/i386/align-branch-1g.d: Likewise.
	* testsuite/gas/i386/align-branch-1h.d: Likewise.
	* testsuite/gas/i386/align-branch-2.s: Likewise.
	* testsuite/gas/i386/align-branch-2a.d: Likewise.
	* testsuite/gas/i386/align-branch-2b.d: Likewise.
	* testsuite/gas/i386/align-branch-2c.d: Likewise.
	* testsuite/gas/i386/align-branch-3.d: Likewise.
	* testsuite/gas/i386/align-branch-3.s: Likewise.
	* testsuite/gas/i386/align-branch-4.s: Likewise.
	* testsuite/gas/i386/align-branch-4a.d: Likewise.
	* testsuite/gas/i386/align-branch-4b.d: Likewise.
	* testsuite/gas/i386/align-branch-5.d: Likewise.
	* testsuite/gas/i386/align-branch-5.s: Likewise.
	* testsuite/gas/i386/align-branch-6.d: Likewise.
	* testsuite/gas/i386/align-branch-6.s: Likewise.
	* testsuite/gas/i386/align-branch-7.d: Likewise.
	* testsuite/gas/i386/align-branch-7.s: Likewise.
	* testsuite/gas/i386/align-branch-8.d: Likewise.
	* testsuite/gas/i386/align-branch-8.s: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1.s: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1e.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1f.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1h.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-2.s: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-2a.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-2b.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-2c.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-3.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-3.s: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-4.s: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-4a.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-4b.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-5.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-6.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-7.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-7.s: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-8.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-8.s: Likewise.
	* testsuite/gas/i386/i386.exp: Run new tests.

ld/

	* testsuite/ld-i386/align-branch-1.d: New file.
	* testsuite/ld-i386/align-branch-1.s: Likewise.
	* testsuite/ld-x86-64/align-branch-1.d: Likewise.
	* testsuite/ld-x86-64/align-branch-1.3: Likewise.
	* testsuite/ld-i386/i386.exp: Run the new test.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
2019-12-12 12:03:45 -08:00
H.J. Lu 76cf450b4c i386: Add -mbranches-within-32B-boundaries
Add -mbranches-within-32B-boundaries to enable

-malign-branch-boundary=32
-malign-branch=jcc+fused+jmp
-malign-branch-prefix-size=5

	* config/tc-i386.c (OPTION_MBRANCHES_WITH_32B_BOUNDARIES): New.
	(md_longopts): Add -mbranches-within-32B-boundaries.
	(md_parse_option): Handle -mbranches-within-32B-boundaries.
	(md_show_usage): Add -mbranches-within-32B-boundaries.
2019-12-12 12:03:45 -08:00
H.J. Lu e379e5f385 i386: Align branches within a fixed boundary
Add 3 command-line options to align branches within a fixed boundary
with segment prefixes or NOPs:

1. -malign-branch-boundary=NUM aligns branches within NUM byte boundary.
2. -malign-branch=TYPE[+TYPE...] specifies types of branches to align.
The supported branches are:
  a. Conditional jump.
  b. Fused conditional jump.
  c. Unconditional jump.
  d. Call.
  e. Ret.
  f. Indirect jump and call.
3. -malign-branch-prefix-size=NUM aligns branches with NUM segment
prefixes per instruction.

3 new rs_machine_dependent frag types are added:

1. BRANCH_PADDING.  The variable size frag to insert NOP before branch.
2. BRANCH_PREFIX.  The variable size frag to insert segment prefixes to
an instruction.  The choices of prefixes are:
   a. Use the existing segment prefix if there is one.
   b. Use CS segment prefix in 64-bit mode.
   c. In 32-bit mode, use SS segment prefix with ESP/EBP base register
   and use DS segment prefix without ESP/EBP base register.
3. FUSED_JCC_PADDING.  The variable size frag to insert NOP before fused
conditional jump.

The new rs_machine_dependent frags aren't inserted if the previous item
is a prefix or a constant directive, which may be used to hardcode an
instruction, since there is no clear instruction boundary.  Segment
prefixes and NOP padding are disabled before relaxable TLS relocations
and tls_get_addr calls to keep TLS instruction sequence unchanged.

md_estimate_size_before_relax() and i386_generic_table_relax_frag() are
used to handled BRANCH_PADDING, BRANCH_PREFIX and FUSED_JCC_PADDING frags.
i386_generic_table_relax_frag() grows or shrinks sizes of segment prefix
and NOP to align the next branch frag:

1. First try to add segment prefixes to instructions before a branch.
2. If there is no sufficient room to add segment prefixes, NOP will be
inserted before a branch.

	* config/tc-i386.c (_i386_insn): Add has_gotpc_tls_reloc.
	(tls_get_addr): New.
	(last_insn): New.
	(align_branch_power): New.
	(align_branch_kind): New.
	(align_branch_bit): New.
	(align_branch): New.
	(MAX_FUSED_JCC_PADDING_SIZE): New.
	(align_branch_prefix_size): New.
	(BRANCH_PADDING): New.
	(BRANCH_PREFIX): New.
	(FUSED_JCC_PADDING): New.
	(i386_generate_nops): Support BRANCH_PADDING and FUSED_JCC_PADDING.
	(md_begin): Abort if align_branch_prefix_size <
	MAX_FUSED_JCC_PADDING_SIZE.
	(md_assemble): Set last_insn.
	(maybe_fused_with_jcc_p): New.
	(add_fused_jcc_padding_frag_p): New.
	(add_branch_prefix_frag_p): New.
	(add_branch_padding_frag_p): New.
	(output_insn): Generate a BRANCH_PADDING, FUSED_JCC_PADDING or
	BRANCH_PREFIX frag and terminate each frag to align branches.
	(output_disp): Set i.has_gotpc_tls_reloc to TRUE for GOTPC and
	relaxable TLS relocations.
	(output_imm): Likewise.
	(i386_next_non_empty_frag): New.
	(i386_next_jcc_frag): New.
	(i386_classify_machine_dependent_frag): New.
	(i386_branch_padding_size): New.
	(i386_generic_table_relax_frag): New.
	(md_estimate_size_before_relax): Handle COND_JUMP_PADDING,
	FUSED_JCC_PADDING and COND_JUMP_PREFIX frags.
	(md_convert_frag): Handle BRANCH_PADDING, BRANCH_PREFIX and
	FUSED_JCC_PADDING frags.
	(OPTION_MALIGN_BRANCH_BOUNDARY): New.
	(OPTION_MALIGN_BRANCH_PREFIX_SIZE): New.
	(OPTION_MALIGN_BRANCH): New.
	(md_longopts): Add -malign-branch-boundary=,
	-malign-branch-prefix-size= and -malign-branch=.
	(md_parse_option): Handle -malign-branch-boundary=,
	-malign-branch-prefix-size= and -malign-branch=.
	(md_show_usage): Display -malign-branch-boundary=,
	-malign-branch-prefix-size= and -malign-branch=.
	(i386_target_format): Set tls_get_addr.
	(i386_cons_align): New.
	* config/tc-i386.h (i386_cons_align): New.
	(md_cons_align): New.
	(i386_generic_table_relax_frag): New.
	(md_generic_table_relax_frag): New.
	(i386_tc_frag_data): Add u, padding_address, length,
	max_prefix_length, prefix_length, default_prefix, cmp_size,
	classified and branch_type.
	(TC_FRAG_INIT): Initialize u, padding_address, length,
	max_prefix_length, prefix_length, default_prefix, cmp_size,
	classified and branch_type.
	* doc/c-i386.texi: Document -malign-branch-boundary=,
	-malign-branch= and -malign-branch-prefix-size=.
2019-12-12 12:03:45 -08:00
H.J. Lu b65d68b8d6 gas: Add md_generic_table_relax_frag
Add md_generic_table_relax_frag for TC_GENERIC_RELAX_TABLE targets so
that a backend can extend relax_frag beyond TC_GENERIC_RELAX_TABLE.

	* write.c (md_generic_table_relax_frag): New.  Defined to
	relax_frag if not defined.
	(relax_segment): Call md_generic_table_relax_frag instead of
	relax_frag.
2019-12-12 12:03:45 -08:00
Alan Modra 4f7cc14110 gas signed overflow fixes
* config/tc-aarch64.c (get_aarch64_insn): Avoid signed overflow.
	* config/tc-metag.c (parse_dalu): Likewise.
	* config/tc-tic4x.c (md_pcrel_from): Likewise.
	* config/tc-tic6x.c (tic6x_output_unwinding): Likewise.
	* config/tc-csky.c (parse_fexp): Use an unsigned char temp buffer.
	Don't use register keyword.  Avoid signed overflow and remove now
	unneccesary char masks.  Formatting.
	* config/tc-ia64.c (operand_match): Don't use shifts to sign extend.
	* config/tc-mep.c (mep_apply_fix): Likewise.
	* config/tc-pru.c (md_apply_fix): Likewise.
	* config/tc-riscv.c (load_const): Likewise.
	* config/tc-nios2.c (md_apply_fix): Likewise.  Don't potentially
	truncate fixup before right shift.  Tidy BFD_RELOC_NIOS2_HIADJ16
	calculation.
2019-12-12 21:58:33 +10:30
Alan Modra 84bc4ba816 obj-evax.c tidy
This started out as fixing decode_16, which used a char to index a 256
byte decodings array.  When char is signed that could result in an out
of bounds array access.  The rest of the patch is for consistency and
just general cleanup.

	* config/obj-evax.c (crc32, encode_32, encode_16, decode_16):
	Remove unnecessary prototypes.
	(number_of_codings): Delete, use ARRAY_SIZE instead throughout.
	(codings, decodings): Make arrays of unsigned char.
	(crc32): Use unsigned variables.  Delete unnecessary mask.
	(encode_32, encode_16): Return unsigned char*, and make static
	buffer an unsigned char array.
	(decode_16): Make arg an unsigned char*.  Remove useless casts.
	(shorten_identifier): Use unsigned char crc_chars.
	(is_truncated_identifier): Make ptr an unsigned char*.
2019-12-12 21:58:23 +10:30
Andre Vieira 24f19ccb89 [gas][arm] Add -mwarn-restrict-it
Add a -m{no-}warn-restrict-it option to control IT related warnings in
ARMv8-A and ARMv8-R.  This is disabled by default.

Committed on behalf of Wilco Dijkstra.

gas/ChangeLog:
2019-12-11  Wilco Dijkstra  <wdijkstr@arm.com>

	* config/tc-arm.c (warn_on_restrict_it): Add new variable.
	(it_fsm_post_encode): Check warn_on_restrict_it.
	(arm_option_table): Add -mwarn-restrict-it/-mno-warn-restrict-it.
	* testsuite/gas/arm/armv8-2-fp16-scalar-bad.d: Add -mwarn-restrict-it.
	* testsuite/gas/arm/armv8-2-fp16-scalar-bad-ext.d: Likewise.
	* testsuite/gas/arm/armv8-a-bad.d: Likewise.
	* testsuite/gas/arm/armv8-a-it-bad.d: Likewise.
	* testsuite/gas/arm/armv8-r-bad.d: Likewise.
	* testsuite/gas/arm/armv8-r-it-bad.d: Likewise.
	* testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d: Likewise.
	* testsuite/gas/arm/udf.d: Likewise.
2019-12-11 15:53:26 +00:00
Jan Beulich 569d50f1c6 x86: further refine SSE check (SSE4a, SHA, GFNI)
In  ("x86: extend SSE check to PCLMULQDQ, AES, and GFNI insns") I went
both a little too far and not quite far enough:
- GFNI insns also have AVX512 variants, which also shouldn't get
  diagnosed,
- SSE4a insns should get diagnosed just like SSE4.x ones,
- SHA insns should get diagnosed just like PCLMULQDQ or AES ones.
2019-12-11 09:42:29 +01:00
Andre Vieira 0e7aaa728d [gas][arm] Set context table for '.arch_extension'
This patch fixes .arch_extension behaviour.

Currently, context table for '.arch_extension' is only set while
"-march" processing, but it is not set while .arch processing,
so following code is rejected

  .syntax unified
  .thumb
  .arch armv8.1-m.main
  .arch_extension mve.fp

  unless -march=armv8.1-m.main is given.

Committing on behalf of Vladimir Murzin

gas/ChangeLog:
2019-12-10  Vladimir Murzin  <vladimir.murzin@arm.com>

	* config/tc-arm.c (s_arm_arch): Set selected_ctx_ext_table.
	* testsuite/gas/arm/mve-arch-ext.s: New.
	* testsuite/gas/arm/mve-arch-ext.d: New.
2019-12-10 16:10:17 +00:00
Jan Beulich 7456d03d5b x86/Intel: fold "xmmword" with "oword"
These are full aliases of one another, so there's no real need to use
distinct O_md* values for them.
2019-12-09 13:32:11 +01:00
Jan Beulich f2f5811f76 x86/Intel: support "mmword ptr"
This is an alias of "qword ptr", commonly used with MMX insns.

At this occasion also test (alongside the newly supported "mmword")
- "zmmword" used as expression,
- PADDB with "oword ptr" (aliasing "xmmword ptr").
2019-12-09 13:31:39 +01:00
Jan Beulich 164d49cb1c x86/Intel: fix "near ptr" / "far ptr" handling
Commit dc2be329b9 ("i386: Only check suffix in instruction mnemonic")
broke rejecting of these for floating point insns. Fix this by setting
the "byte" operand attribute, which will now (again) cause an error.

Furthermore the diagnostic for the "far ptr" case in general and for the
"near ptr" case in the non-float cases became "invalid instruction
suffix" instead of the intended "operand size mismatch". Fix this by
also setting the "tbyte" operand attribute (no insn template accepts
both byte and tbyte operands).
2019-12-09 13:31:07 +01:00
Jan Beulich a8f4f6b9bc x86/Intel: drop pointless suffix setting for "tbyte ptr"
There are extremely few insns accepting "tbyte ptr" operand, so the
"tbyte" operand flag checking done by match_operand_size() is already
sufficient; the setting of the suffix has become meaningless anyway
with dc2be329b9 ("i386: Only check suffix in instruction mnemonic").
Fold the code with that setting the "byte" operand flag to force an
error (no insn at all accepts both "byte ptr" and tbyte ptr" operands,
except for AnySize ones where the two (conflicting) recorded types
don't matter (operand_size_match() doesn't call match_operand_size() in
this case).
2019-12-09 13:29:44 +01:00
Jan Beulich 4cbda994e6 x86/Intel: drop pointless suffix setting for "fword ptr"
No floating point insn accepts an "fword ptr" operand, so the "fword"
operand flag checking done by match_mem_size() is already sufficient;
the setting of the suffix has become meaningless anyway with
dc2be329b9 ("i386: Only check suffix in instruction mnemonic").
2019-12-09 13:29:14 +01:00
Jan Beulich 3740438712 x86/Intel: drop pointless special casing of LxS
LDS et al don't accept "word ptr" operands anyway, as per their insn
templates. Hence there's no need to special case this here; the check
has become dysfunctional anyway by dc2be329b9 ("i386: Only check
suffix in instruction mnemonic").
2019-12-09 13:28:43 +01:00
Alan Modra 6f765336bb aarch64*-*-*ilp32 gas tests
The new pac_negate_ra_state test adds yet another failure on aarch64
ipl32 targets.  This patch fixes that particular problem and a few
more that are trivial to fix.

	* testsuite/gas/aarch64/bfloat16.d: Match 32-bit and 64-bit output.
	* testsuite/gas/aarch64/dgh.d: Likewise.
	* testsuite/gas/aarch64/f32mm.d: Likewise.
	* testsuite/gas/aarch64/f64mm.d: Likewise.
	* testsuite/gas/aarch64/i8mm.d: Likewise.
	* testsuite/gas/aarch64/pac_ab_key.d: Likewise.
	* testsuite/gas/aarch64/pac_negate_ra_state.d: Likewise.
	* testsuite/gas/aarch64/reloc-prel_g0.d: Likewise.
	* testsuite/gas/aarch64/reloc-prel_g0_nc.d: Likewise.
	* testsuite/gas/aarch64/reloc-prel_g1.d: Likewise.
	* testsuite/gas/aarch64/sve-bfloat-movprfx.d: Likewise.
	* testsuite/gas/aarch64/sve-movprfx-mm.d: Likewise.
	* testsuite/gas/aarch64/sve2.d: Likewise.
2019-12-08 22:03:53 +10:30
Kyrylo Tkachov e8dc9b5bfd [gas] Implement .cfi_negate_ra_state directive
This patch implements the .cfi_negate_ra_state to be consistent with
LLVM (https://reviews.llvm.org/D50136). The relevant DWARF code DW_CFA_AARCH64_negate_ra_state
is multiplexed on top of DW_CFA_GNU_window_save, as per
https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00753.html

I believe this is the simplest patch implementing this and is needed to
allow users to build, for example, the Linux kernel with Armv8.3-A
pointer authentication support with Clang while using gas as the
assembler, which is a common usecase.

gas/
2019-12-06  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * dw2gencfi.c (cfi_pseudo_table): Add cfi_negate_ra_state.
    * testsuite/gas/aarch64/pac_negate_ra_state.s: New file.
    * testsuite/gas/aarch64/pac_negate_ra_state.d: Likewise.
2019-12-06 10:46:32 +00:00
Jan Beulich 2dc4b12fcd Arm64: simplify Crypto arch extension handling
This, at the assembler level, is just a "brace" feature covering both
AES and SHA2. Hence there's no need for it to have a separate feature
flag, freeing up a bit for future re-use. Along these lines there are
also a number of dead definitions/variables in the opcode table file.
2019-12-05 08:44:22 +01:00
Jan Beulich d4340f89ec Arm64: correct "sha3" arch-extension directive handling
SHA2 is a prereq to SHA3, not part of it aiui. Hence disabling the
latter should not also disable the former.

In the course of adding respective tests also do away with the
duplication of crypto.d's contents in crypto-directive.d.
2019-12-05 08:43:03 +01:00
Jan Beulich 0ba59a2940 x86-64: accept 64-bit LFS/LGS/LSS forms with suffix or operand size specifier
Since we accept these without suffix / operand size specifier, we should
also do so with one. (The fact that we unilaterally accept these, other
than far branches, rather than limiting them to Intel64 mode, will be
taken care of later on.)

Also take the opportunity and make sure "lfs <reg>, tbyte ptr <mem>"
et al get rejected outside of 64-bit mode. This became broken by
dc2be329b9 ("i386: Only check suffix in instruction mnemonic").
Furthermore cover lgdt et al in the Intel syntax handling as well, which
continued to work after said commit just by coincidence.
2019-12-04 10:45:17 +01:00
Jan Beulich d488367a42 x86-64/Intel: fix CALL/JMP with dword operand
While dc2be329b9 ("i386: Only check suffix in instruction mnemonic")
has made the assembler accept these in the first place (they were wrongly
rejected before), the generated code was still wrong in that it lacked
an operand size override. (In 64-bit code, other than in 16- and 32-bit
ones, CALL and JMP with memory operands are all entirely unambiguous: No
operand size can have two meanings.)
2019-12-04 10:44:27 +01:00
Jan Beulich 319ff62c8a x86: consolidate tracking of MMX register use
Just like for XMM/YMM/ZMM don't key this to any Cpu* flags. Instead
include the two special insns (not having register operands) explicitly.
2019-12-04 10:43:50 +01:00
Jan Beulich 77ad80922b x86/Intel: extend MOVDIRI testing
Test also memory operands with operand size specifier, which was broken
prior to dc2be329b9 ("i386: Only check suffix in instruction
mnemonic"), due to the template not permitting any suffixes. Note that
this uncovered a disassembler issue, which is being fixed here as well.
2019-12-04 10:41:43 +01:00
Jan Beulich 13e600d0f5 x86: make sure all PUSH/POP honor DefaultSize
While segment registers are registers, their use doesn't allow sizing
of insns without suffix / explicit operand size specifier. Prevent
PUSH and POP of segment registers from entering that path, instead
allowing them to observe the stackop_size setting just like other
PUSH/POP and alike do.
2019-12-04 10:40:40 +01:00
Jan Beulich 3036c89919 x86: drop some stray/bogus DefaultSize
Insns permitting only GPR operands (and hence implicit sizing when
there's no suffix) don't ever have their DefaultSize attribute
inspected, so it shouldn't be there in the first place.

Additionally XBEGIN is like JMP, not CALL, and hence shouldn't be
converted to 32-bit operand size in .code16gcc mode. While the same is
true for SYSRET, it permitting more than one suffix makes it FLDENV-
like, and hence rather than dropping the attribute, for now add it to
the exclusion list to avoid it getting an operand size prefix emitted
in .code16gcc mode. (This will be dealt with later, perhaps together
with FLDENV and friends.)
2019-12-04 10:40:02 +01:00
Andrew Burgess 0ac2b354ee gas/riscv: Produce version 3 DWARF CIE by default
The flag controlling the default DWARF CIE version to produce now
starts with the value -1.  This can be modified with the command line
flag as before, but after command line flag processing, in
md_after_parse_args targets can, if the global still has the value -1,
override this value.  This gives a target specific default.

If a CIE version is not select either by command line flag, or a
target specific default, then some new code in dwarf2_init now select
a global default.  This remains as version 1 to match previous
behaviour.

This RISC-V has a target specific default of version provided, this
make the return column uleb128, which means we can use all DWARF
registers include CSRs.

I chose to switch to version 3 rather than version 4 as this is most
similar to the global default (version 1).  Switching to version 4
adds additional columns to the CIE header.

gas/ChangeLog:

	* as.c (flag_dwarf_cie_version): Change initial value to -1, and
	update comment.
	* config/tc-riscv.c (riscv_after_parse_args): Set
	flag_dwarf_cie_version if it has not already been set.
	* dwarf2dbg.c (dwarf2_init): Initialise flag_dwarf_cie_version if
	needed.
	* testsuite/gas/riscv/default-cie-version.d: New file.
	* testsuite/gas/riscv/default-cie-version.s: New file.

ld/ChangeLog:

	* testsuite/ld-elf/eh5.d: Accept version 3 DWARF CIE.

Change-Id: Ibbfe8f0979fba480bf0a359978b09d2b3055555e
2019-11-28 00:03:05 +00:00
Andrew Burgess 22eb4a0617 gas: Check for overflow on return column in version 1 CIE DWARF
In version 1 of DWARF CIE format, the return register column is just a
single byte.  For targets with large numbers of DWARF registers, any
use of a register with a high number for the return column
will (currently) silently overflow giving incorrect DWARF.

This commit adds an error when the overflow occurs.

gas/ChangeLog:

	* dw2gencfi.c (output_cie): Error on return column overflow.
	* testsuite/gas/riscv/cie-rtn-col-1.d: New file.
	* testsuite/gas/riscv/cie-rtn-col-3.d: New file.
	* testsuite/gas/riscv/cie-rtn-col.s: New file.

Change-Id: I1809f739ba7771737ec012807f0260e1a3ed5e64
2019-11-28 00:03:05 +00:00
Andrew Burgess 4762fe621e binutils/gas/riscv: Add DWARF register numbers for CSRs
This commit gives DWARF register numbers to the RISC-V CSRs inline
with the RISC-V ELF specification here:

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

The CSRs are defined being numbered from 4096 to 8191.

This adds support to the assembler, required in order to reference
CSRs in, for example .cfi directives.

I have then extended dwarf.c in order to support printing CSR names in
the dumped DWARF output.  As the CSR name space is quite large and
only sparsely populated, I have provided a new function to perform
RISC-V DWARF register name lookup which uses a switch statement rather
than the table base approach that other architectures use.

Any CSR that does not have a known name will return a name based on
'csr%d' with the %d being replaced by the offset of the CSR from 4096.

gas/ChangeLog:

	* config/tc-riscv.c (tc_riscv_regname_to_dw2regnum): Lookup CSR
	names too.
	* testsuite/gas/riscv/csr-dw-regnums.d: New file.
	* testsuite/gas/riscv/csr-dw-regnums.s: New file.

binutils/ChangeLog:

	* dwarf.c (regname_internal_riscv): New function.
	(init_dwarf_regnames_riscv): Use new function.

Change-Id: I3f70bc24fa8b3c75744e6775eeeb87db70c7ecfb
2019-11-28 00:03:05 +00:00
Andrew Burgess b7379eadda gas/riscv: Remove unneeded structure
We build a hash table of all register classes and numbers.  The hash
key is the register name and the hash value is the class and number
encoded into a single value, which is of type 'void *'.

When we pull the values out of the hash we cast them to be a pointer
to a structure, however, we never access the fields of that structure,
we just decode the register class and number from the pointer value
itself.

This commit removes the structure and treats the encoded class and
number as a 'void *' during hash lookup.

gas/ChangeLog:

	* config/tc-riscv.c (struct regname): Delete.
	(hash_reg_names): Handle value as 'void *'.

Change-Id: Ie7d8f46ca3798f56f4af94395279de684f87f9cc
2019-11-28 00:03:02 +00:00
Andrew Pinski 0a821c4f6d Fix "psb CSYNC" and "bti C".
psb CYSNC was not finding that CSYNC was a correct spelling.
The problem was upper case version was being put in the
wrong hashtable.  This fixes the problem by using the
correct hashtable.
Also adds testcases for the upper case versions.

        * config/tc-aarch64.c (md_begin): Use correct
        hash table for uppercase version of hint.
        * testsuite/gas/aarch64/system-2.s: Extend psb case to uppercase.
        * testsuite/gas/aarch64/system-2.d: Update.

Change-Id: If43f8b85cacd24840d596c3092b0345e5f212766
2019-11-25 18:27:26 +00:00
Christian Eggers 618265039f Introduce new section flag: SEC_ELF_OCTETS
All symbols, sizes and relocations in this section are octets instead of
bytes.  Required for DWARF debug sections as DWARF information is
organized in octets, not bytes.

bfd/
	* section.c (struct bfd_section): New flag SEC_ELF_OCTETS.
	* archures.c (bfd_octets_per_byte): New parameter sec.
	If section is not NULL and SEC_ELF_OCTETS is set, one octet es
	returned [ELF targets only].
	* bfd.c (bfd_get_section_limit): Provide section parameter to
	bfd_octets_per_byte.
	* bfd-in2.h: regenerate.
	* binary.c (binary_set_section_contents): Move call to
	bfd_octets_per_byte into section loop. Provide section parameter
	to bfd_octets_per_byte.
	* coff-arm.c (coff_arm_reloc): Provide section parameter
	to bfd_octets_per_byte.
	* coff-i386.c (coff_i386_reloc): likewise.
	* coff-mips.c (mips_reflo_reloc): likewise.
	* coff-x86_64.c (coff_amd64_reloc): likewise.
	* cofflink.c (_bfd_coff_link_input_bfd): likewise.
	(_bfd_coff_reloc_link_order): likewise.
	* elf.c (_bfd_elf_section_offset): likewise.
	(_bfd_elf_make_section_from_shdr): likewise.
	Set SEC_ELF_OCTETS for sections with names .gnu.build.attributes,
	.debug*, .zdebug* and .note.gnu*.
	* elf32-msp430.c (rl78_sym_diff_handler): Provide section parameter
	to bfd_octets_per_byte.
	* elf32-nds.c (nds32_elf_get_relocated_section_contents): likewise.
	* elf32-ppc.c (ppc_elf_addr16_ha_reloc): likewise.
	* elf32-pru.c (pru_elf32_do_ldi32_relocate): likewise.
	* elf32-s12z.c (opru18_reloc): likewise.
	* elf32-sh.c (sh_elf_reloc): likewise.
	* elf32-spu.c (spu_elf_rel9): likewise.
	* elf32-xtensa.c (bfd_elf_xtensa_reloc): likewise
	* elf64-ppc.c (ppc64_elf_brtaken_reloc): likewise.
	(ppc64_elf_addr16_ha_reloc): likewise.
	(ppc64_elf_toc64_reloc): likewise.
	* elflink.c (bfd_elf_final_link): likewise.
	(bfd_elf_perform_complex_relocation): likewise.
	(elf_fixup_link_order): likewise.
	(elf_link_input_bfd): likewise.
	(elf_link_sort_relocs): likewise.
	(elf_reloc_link_order): likewise.
	(resolve_section): likewise.
	* linker.c (_bfd_generic_reloc_link_order): likewise.
	(bfd_generic_define_common_symbol): likewise.
	(default_data_link_order): likewise.
	(default_indirect_link_order): likewise.
	* srec.c (srec_set_section_contents): likewise.
	(srec_write_section): likewise.
	* syms.c (_bfd_stab_section_find_nearest_line): likewise.
	* reloc.c (_bfd_final_link_relocate): likewise.
	(bfd_generic_get_relocated_section_contents): likewise.
	(bfd_install_relocation): likewise.
	For section which have SEC_ELF_OCTETS set, multiply output_base
	and output_offset with bfd_octets_per_byte.
	(bfd_perform_relocation): likewise.
include/
	* coff/ti.h (GET_SCNHDR_SIZE, PUT_SCNHDR_SIZE, GET_SCN_SCNLEN),
	(PUT_SCN_SCNLEN): Adjust bfd_octets_per_byte calls.
binutils/
	* objdump.c (disassemble_data): Provide section parameter to
	bfd_octets_per_byte.
	(dump_section): likewise
	(dump_section_header): likewise. Show SEC_ELF_OCTETS flag if set.
gas/
	* as.h: Define SEC_OCTETS as SEC_ELF_OCTETS if OBJ_ELF.
	* dwarf2dbg.c: (dwarf2_finish): Set section flag SEC_OCTETS for
	.debug_line, .debug_info, .debug_abbrev, .debug_aranges, .debug_str
	and .debug_ranges sections.
	* write.c (maybe_generate_build_notes): Set section flag
	SEC_OCTETS for .gnu.build.attributes section.
	* frags.c (frag_now_fix): Don't divide by OCTETS_PER_BYTE if
	SEC_OCTETS is set.
	* symbols.c (resolve_symbol_value): Likewise.
ld/
	* ldexp.c (fold_name): Provide section parameter to
	bfd_octets_per_byte.
	* ldlang (init_opb): New argument s. Set opb_shift to 0 if
	SEC_ELF_OCTETS for the current section is set.
	(print_input_section): Pass current section to init_opb.
	(print_data_statement,print_reloc_statement,
	print_padding_statement): Likewise.
	(lang_check_section_addresses): Call init_opb for each
	section.
	(lang_size_sections_1,lang_size_sections_1,
	lang_do_assignments_1): Likewise.
	(lang_process): Pass NULL to init_opb.
2019-11-25 14:32:19 +10:30
Christian Eggers e2b9a97eda Reverts patches providing octet support in dwarf
Reverts "dwarf2: Align relocation within .debug_line section"
	commit 204f543cae,
Reverts "dwarf2: Pad size of .debug_line section."
	commit 145c4477d2,
Reverts "dwarf2: Use octets for .debug_line prologue"
	commit 38c24f42c9,
Mostly reverts "dwarf2: Use octets for dwarf2 headers"
	commit 7235427998,
Mostly reverts "Symbols with octets value"
	commit d18d199917.

	* dwarf2dbg.c (out_set_addr): Revert 2019-03-13 change.
	(out_debug_line, out_debug_aranges, out_debug_info): Likewise.
	* symbols.h (symbol_set_value_now_octets, symbol_octets_p): Remove.
	* symbols.c (struct symbol_flags): Remove member sy_octets.
	(symbol_temp_new_now_octets): Don't set symbol_flags::sy_octets.
	(resolve_symbol_value): Revert: Return octets instead of bytes if
	sy_octets is set.
	(symbol_set_value_now_octets): Remove.
	(symbol_octets_p): Remove.
2019-11-25 14:32:20 +10:30
Mihail Ionescu 8b301fbb61 Arm: Change CRC from fpu feature to archititectural extension
This patch changes the CRC extension to use the core feature bits instead
of the coproc/fpu feature bits.
CRC is not an fpu feature and it causes issues with the new fpu reset
patch (f439988037). CRC can be set using
the '.arch_extension' directive, which sets bits in the coproc bitfield. When
a '.fpu' directive is encountered, the CRC feature bit gets removed and
there is no way to set it back using '.fpu'.
With this patch, CRC will be marked in the feature core bits, which prevents
it from getting removed when setting/changing the fpu options.

gas/ChangeLog:

	* config/tc-arm.c (arm_ext_crc): New.
	(crc_ext_armv8): Remove.
	(insns): Rename crc_ext_armv8 to arm_ext_crc.
	(arm_cpus): Replace CRC_EXT_ARMV8 with ARM_EXT2_CRC.
	(armv8a_ext_table, armv8r_ext_table,
	arm_option_extension_value_table): Redefine the crc
	extension in terms of ARM_EXT2_CRC.
	* gas/testsuite/gas/arm/crc-ext.s: New.
	* gas/testsuite/gas/arm/crc-ext.d: New.

include/ChangeLog:

	* opcode/arm.h (ARM_EXT2_CRC): New extension feature
	to replace CRC_EXT_ARMV8.
	(CRC_EXT_ARMV8): Remove and mark bit as unused.
	(ARM_ARCH_V8A_CRC, ARM_ARCH_V8_1A, ARM_ARCH_V8_2A,
	ARM_ARCH_V8_3A, ARM_ARCH_V8_4A, ARM_ARCH_V8_5A,
	ARM_ARCH_V8_6A): Redefine using ARM_EXT2_CRC instead of
	CRC_EXT_ARMV8.

opcodes/ChangeLog:

	* opcodes/arm-dis.c (arm_opcodes, thumb32_opcodes):
	Change the coproc CRC conditions to use the extension
	feature set, second word, base on ARM_EXT2_CRC.
2019-11-22 13:47:26 +00:00
Alan Modra 94c9b9db4b PR24944, gas doesn't read enough digits when parsing a floating point number
PR 24944
	* atof-generic.c (atof_generic): Increase decimal guard digits.
	* testsuite/gas/i386/fp.s: Add more tests.
	* testsuite/gas/i386/fp.d: Update.
2019-11-20 21:59:33 +10:30
Andrew Burgess 66f8b2cbbb gas: Add --gdwarf-cie-version command line flag
Add a flag to control the version of CIE that is generated.  By
default gas produces CIE version 1, and this continues to be the
default after this patch.

However, a user can now provide --gdwarf-cie-version=NUMBER to switch
to either version 3 or version 4 of CIE, version 2 was never released,
and so causes an error as does any number less than 1 or greater than
4.

Producing version 4 CIE requires two new fields to be added to the
CIE, an address size field, and an segment selector field.  For a flat
address space the DWARF specification indicates that the segment
selector should be 0, and the address size fields just contains the
address size in bytes.  For now we support 4 or 8 byte addresses, and
the segment selector is always produced as 0.  At some future time we
might need to allow targets to override this.

gas/ChangeLog:

	* as.c (parse_args): Parse --gdwarf-cie-version option.
	(flag_dwarf_cie_version): New variable.
	* as.h (flag_dwarf_cie_version): Declare.
	* dw2gencfi.c (output_cie): Switch from DW_CIE_VERSION to
	flag_dwarf_cie_version.
	* doc/as.texi (Overview): Document --gdwarf-cie-version.
	* NEWS: Likewise.
	* testsuite/gas/cfi/cfi.exp: Add new tests.
	* testsuite/gas/cfi/cie-version-0.d: New file.
	* testsuite/gas/cfi/cie-version-1.d: New file.
	* testsuite/gas/cfi/cie-version-2.d: New file.
	* testsuite/gas/cfi/cie-version-3.d: New file.
	* testsuite/gas/cfi/cie-version-4.d: New file.
	* testsuite/gas/cfi/cie-version.s: New file.

include/ChangeLog:

	* dwarf2.h (DW_CIE_VERSION): Delete.

Change-Id: I9de19461aeb8332b5a57bbfe802953d0725a7ae8
2019-11-18 10:30:21 +00:00
Jan Beulich 0cfa3eb352 x86: fold individual Jump* attributes into a single Jump one
..., taking just 3 bits instead of 5. No two of them are used together.
2019-11-14 08:47:44 +01:00
Jan Beulich 6f2f06bea8 x86: make JumpAbsolute an insn attribute
... instead of an operand one: There's only ever one operand here
anyway.
2019-11-14 08:47:03 +01:00
Jan Beulich 601e856422 x86: make AnySize an insn attribute
... instead of an operand one. Which operand it applies to can be
determined from other operand properties, but as it turns out the only
place it is actually used at doesn't even need further qualification.
2019-11-14 08:46:19 +01:00
Jan Beulich db4e407b53 x86/Intel: correct CMPSD test cases' regexp closing paren placement
The CMPS test case derivation from their MOVS counterparts I did in
d241b91073 ("x86/Intel: correct MOVSD and CMPSD handling") ended up
with misplaced closing parentheses in som regexps. Correct this.
2019-11-14 08:45:26 +01:00
Jan Beulich b15384304b x86/Intel: extend MOVSD/CMPSD testsuite coverage
This is still in the context of PR/gas 25167.
2019-11-14 08:44:57 +01:00
Jim Wilson 7722d40a9c RISC-V: Support the INSN_CLASS.*F.* classes for .insn directive.
We have to enable the f extension through -march or ELF attribute if we use the
FPR in .insn directive.  The behavior is same as the riscv_opcodes.

	2019-11-12  Nelson Chu  <nelson.chu@sifive.com>
	opcodes/
	* riscv-opc.c (riscv_insn_types): Replace the INSN_CLASS_I with
	INSN_CLASS_F and the INSN_CLASS_C with INSN_CLASS_F_AND_C if we
	use the floating point register (FPR).

	gas/
	* testsuite/gas/riscv/insn.d: Add the f extension to -march option.

Change-Id: I4f59d04c82673ef84c56ecd2659ad8ce164dd626
2019-11-12 16:13:00 -08:00
Mihail Ionescu ef8f595f73 [gas][arm] Enable VLDM, VSTM, VPUSH, VPOP for MVE
This patch enables a few instructions for Armv8.1-M MVE. Currently VLDM,
VSTM, VSTR, VLDR, VPUSH and VPOP are enabled only when the Armv8-M
Floating-point Extension is enabled.  According to the ARMv8.1-M ARM,
section A.1.4.2[1], they can be enabled by having "Armv8-M Floating-point
Extension and/or Armv8.1-M MVE".

[1]https://developer.arm.com/docs/ddi0553/bh/armv81-m-architecture-reference-manual

2019-11-12  Mihail Ionescu  <mihail.ionescu@arm.com>

	* config/tc-arm.c (do_vfp_nsyn_push): Move in order to enable it for
	both fpu_vfp_ext_v1xd and mve_ext and add call to the aliased vstm
	instruction for mve_ext.
	(do_vfp_nsyn_pop): Move in order to enable it for both
	fpu_vfp_ext_v1xd and mve_ext and add call to the aliased vldm
	instruction for mve_ext.
	(do_neon_ldm_stm): Add fpu_vfp_ext_v1 and mve_ext checks.
	(insns): Enable vldm, vldmia, vldmdb, vstm, vstmia, vstmdb, vpop,
	vpush, and fldd, fstd, flds, fsts for arm_ext_v6t2 instead
	of fpu_vfp_ext_v1xd.
	* testsuite/gas/arm/v8_1m-mve.s: New.
	* testsuite/gas/arm/v8_1m-mve.d: New.
2019-11-12 14:01:10 +00:00
Mihail Ionescu ce760a7620 [binutils][arm] Update the decoding of MVE VMOV, VMVN
This patch updates the decoding of the VMOV and VMVN instructions which depend on cmode.
Previously VMOV and VMVN with cmode 1101 were not allowed.
The cmode changes also required updating of the MVE conflict checking.
Now instructions with opcodes 0xef800d50 and 0xef800e70 correctly get decoded as VMOV
and VMVN, respectively.

2019-11-12  Mihail Ionescu  <mihail.ionescu@arm.com>

	* opcodes/arm-dis.c (mve_opcodes): Enable VMOV imm to vec with
	cmode 1101.
	(is_mve_encoding_conflict): Update cmode conflict checks for
	MVE_VMVN_IMM.

2019-11-12  Mihail Ionescu  <mihail.ionescu@arm.com>

	* gas/config/tc-arm.c (do_neon_mvn): Allow mve_ext cmode=0xd.
	* testsuite/gas/arm/mve-vmov-vmvn-vorr-vbic.s: New test.
	* testsuite/gas/arm/mve-vmov-vmvn-vorr-vbic.d: Likewise.
2019-11-12 14:01:04 +00:00
Mihail Ionescu f439988037 [gas][arm] Make .fpu reset the FPU/Coprocessor feature bits
This patch is fixes the '.fpu' behaviour.
Currently, using '.fpu' resets the previously selected '.fpu' options (by overwriting them),
but does not reset previous FPU options selected by other means (ie. when using
'.arch_extension fp' in conjunction with '.fpu <x>', the FPU is not reset).

Example:
.arch armv8-a         @ SET BASE
.arch_extension fp    @ ADD FP-ARMV8
.fpu vfpv2            @ ADD (already existing bits, does not reset)
vfms.f32 s0, s1, s2   @ OK

.arch armv8-a         @ RESET
.fpu fp-armv8         @ ADD FP-ARMV8
vfms.f32 s0, s1, s2   @ OK
.fpu vfpv2            @ RESET to VFPV2
vfms.f32 s0, s1, s2   @ ERROR

After the patch this becomes:
.arch armv8-a         @ SET BASE
.arch_extension fp    @ ADD FP-ARMV8
.fpu vfpv2            @ RESET TO VFPV2
vfms.f32 s0, s1, s2   @ ERROR

.arch armv8-a         @ RESET
.fpu fp-armv8         @ ADD FP-ARMV8
vfms.f32 s0, s1, s2   @ OK
.fpu vfpv2            @ RESET to VFPV2
vfms.f32 s0, s1, s2   @ ERROR

gas/ChangeLog:

2019-11-11  Mihail Ionescu  <mihail.ionescu@arm.com>

        * config/tc-arm.c (s_arm_fpu): Clear selected_cpu fpu bits.
        (fpu_any): Remove OBJ_ELF guards.
        * gas/testsuite/gas/arm/fpu-rst.s: New.
        * gas/testsuite/gas/arm/fpu-rst.d: New.
        * gas/testsuite/gas/arm/fpu-rst.l: New.
2019-11-12 14:00:34 +00:00
Jan Beulich 51c8edf68b x86: fold EsSeg into IsString
EsSeg (a per-operand bit) is used with IsString (a per-insn attribute)
only. Extend the attribute to 2 bits, thus allowing to encode
- not a string insn,
- string insn with neither operand requiring use of %es:,
- string insn with 1st operand requiring use of %es:,
- string insn with 2nd operand requiring use of %es:,
which covers all possible cases, allowing to drop EsSeg.

The (transient) need to comment out the OTUnused #define did uncover an
oversight in the earlier OTMax -> OTNum conversion, which is being taken
care of here.
2019-11-12 09:09:31 +01:00
Jan Beulich 474da251bf x86: eliminate ImmExt abuse
Drop the remaining instances left in place by commit c3949f432f ("x86:
limit ImmExt abuse), now that we have a way to specify specific GPRs.

Take the opportunity and also introduce proper 16-bit forms of
applicable SVME insns as well as 1-operand forms of CLZERO.
2019-11-12 09:08:32 +01:00
Jan Beulich 75e5731b8f x86: introduce operand type "instance"
Special register "class" instances can't be combined with one another
(neither in templates nor in register entries), and hence it is not a
good use of resources (memory as well as execution time) to represent
them as individual bits of a bit field.

Furthermore the generalization becoming possible will allow
improvements to the handling of insns accepting only individual
registers as their operands.
2019-11-12 09:07:34 +01:00
Jan Beulich 91802f3cfe Arm64: SVE2's smaxp/sminp require operands 1 and 3 to be the same register
This is just like for their umaxp/uminp and fmaxp/fminp counterparts.
2019-11-11 13:28:35 +01:00
H.J. Lu dc2be329b9 i386: Only check suffix in instruction mnemonic
We should check suffix in instruction mnemonic when matching instruction.
In Intel syntax, normally we check for memory operand size.  But the same
mnemonic with 2 different encodings can have the same memory operand
size and i.suffix is set to LONG_DOUBLE_MNEM_SUFFIX from memory operand
size in Intel syntax to distinguish them.  When there is no suffix in
mnemonic, we check LONG_DOUBLE_MNEM_SUFFIX in i.suffix for mnemonic
suffix.

gas/

	PR gas/25167
	* config/tc-i386.c (match_template): Don't check instruction
	suffix set from operand.
	* testsuite/gas/i386/code16.d: New file.
	* testsuite/gas/i386/code16.s: Likewise.
	* testsuite/gas/i386/i386.exp: Run code16.
	* testsuite/gas/i386/x86-64-branch-4.l: Updated.

opcodes/

	PR gas/25167
	* i386-opc.tbl: Remove IgnoreSize from cmpsd and movsd.
	* i386-tbl.h: Regenerated.
2019-11-08 09:31:17 -08:00
Jan Beulich f74a630727 x86: convert RegMask and RegBND from bitfield to enumerator
This is to further shrink the operand type representation.
2019-11-08 09:06:24 +01:00
Jan Beulich 3528c362d9 x86: convert RegSIMD and RegMMX from bitfield to enumerator
This is to further shrink the operand type representation.
2019-11-08 09:05:36 +01:00
Jan Beulich 4a5c67ed84 x86: convert Control/Debug/Test from bitfield to enumerator
This is to further shrink the operand type representation.
2019-11-08 09:04:53 +01:00
Jan Beulich 00cee14fba x86: convert SReg from bitfield to enumerator
This is to further shrink the operand type representation.
2019-11-08 09:04:09 +01:00
Jan Beulich bab6aec125 x86: introduce operand type "class"
Many operand types, in particular the various kinds of registers, can't
be combined with one another (neither in templates nor in register
entries), and hence it is not a good use of resources (memory as well as
execution time) to represent them as individual bits of a bit field.
2019-11-08 09:03:23 +01:00
Matthew Malcomson 1f4cd317b6 [gas][aarch64] Add the v8.6 Data Gathering Hint mnemonic [10/X]
Hi,

This patch is part of a series that adds support for Armv8.6-A
to binutils.

In this last patch, the new Data Gathering Hint mnemonic is introduced.

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

	* testsuite/gas/aarch64/dgh.s: New test.
	* testsuite/gas/aarch64/dgh.d: New test.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

	* opcodes/aarch64-tbl.h (V8_6_INSN): New macro for v8.6 instructions.
	(aarch64_opcode_table): Add data gathering hint mnemonic.
	* opcodes/aarch64-dis-2.c: Account for new instruction.

Is it ok for trunk?

Regards,
Mihail
2019-11-07 17:23:53 +00:00
Matthew Malcomson 616ce08e1c [Patch][binutils][arm] Armv8.6-A Matrix Multiply extension [9/10]
Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch introduces the Matrix Multiply (Int8, F32, F64) extensions
to the arm backend.

The following Matrix Multiply instructions are added: vummla, vsmmla,
vusmmla, vusdot, vsudot[1].

[1]https://developer.arm.com/docs/ddi0597/latest/simd-and-floating-point-instructions-alphabetic-order

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

	* config/tc-arm.c (arm_ext_i8mm): New feature set.
	(do_vusdot): New.
	(do_vsudot): New.
	(do_vsmmla): New.
	(do_vummla): New.
	(insns): Add vsmmla, vummla, vusmmla, vusdot, vsudot mnemonics.
	(armv86a_ext_table): Add i8mm extension.
	(arm_extensions): Move bf16 extension to context sensitive table.
	(armv82a_ext_table, armv84a_ext_table, armv85a_ext_table):
	Move bf16 extension to context sensitive table.
	(armv86a_ext_table): Add i8mm extension.
	* doc/c-arm.texi: Document i8mm extension.
	* testsuite/gas/arm/i8mm.s: New test.
	* testsuite/gas/arm/i8mm.d: New test.
	* testsuite/gas/arm/bfloat17-cmdline-bad-3.d: Update test.

include/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

	* opcode/arm.h (ARM_EXT2_I8MM): New feature macro.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

	* arm-dis.c (neon_opcodes): Add i8mm SIMD instructions.

Regression tested on arm-none-eabi.
Is this ok for trunk?

Regards,
Mihail
2019-11-07 17:20:08 +00:00
Matthew Malcomson 8382113fdb [binutils][aarch64] Matrix Multiply extension enablement [8/X]
Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch introduces the Matrix Multiply (Int8, F32, F64) extensions
to the aarch64 backend.

The following instructions are added: {s/u}mmla, usmmla, {us/su}dot,
fmmla, ld1rob, ld1roh, d1row, ld1rod, uzip{1/2}, trn{1/2}.

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

	* config/tc-aarch64.c: Add new arch fetures to suppport the mm extension.
	(parse_operands): Add new operand.
	* testsuite/gas/aarch64/i8mm.s: New test.
	* testsuite/gas/aarch64/i8mm.d: New test.
	* testsuite/gas/aarch64/f32mm.s: New test.
	* testsuite/gas/aarch64/f32mm.d: New test.
	* testsuite/gas/aarch64/f64mm.s: New test.
	* testsuite/gas/aarch64/f64mm.d: New test.
	* testsuite/gas/aarch64/sve-movprfx-mm.s: New test.
	* testsuite/gas/aarch64/sve-movprfx-mm.d: New test.

include/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

	* opcode/aarch64.h (AARCH64_FEATURE_I8MM): New.
	(AARCH64_FEATURE_F32MM): New.
	(AARCH64_FEATURE_F64MM): New.
	(AARCH64_OPND_SVE_ADDR_RI_S4x32): New.
	(enum aarch64_insn_class): Add new instruction class "aarch64_misc" for
	instructions that do not require special handling.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

	* aarch64-tbl.h (aarch64_feature_i8mm_sve, aarch64_feature_f32mm_sve,
	aarch64_feature_f64mm_sve, aarch64_feature_i8mm, aarch64_feature_f32mm,
	aarch64_feature_f64mm): New feature sets.
	(INT8MATMUL_INSN, F64MATMUL_SVE_INSN, F64MATMUL_INSN,
	F32MATMUL_SVE_INSN, F32MATMUL_INSN): New macros to define matrix multiply
	instructions.
	(I8MM_SVE, F32MM_SVE, F64MM_SVE, I8MM, F32MM, F64MM): New feature set
	macros.
	(QL_MMLA64, OP_SVE_SBB): New qualifiers.
	(OP_SVE_QQQ): New qualifier.
	(INT8MATMUL_SVE_INSNC, F64MATMUL_SVE_INSNC,
	F32MATMUL_SVE_INSNC): New feature set for bfloat16 instructions to support
	the movprfx constraint.
	(aarch64_opcode_table): Support for SVE_ADDR_RI_S4x32.
	(aarch64_opcode_table): Define new instructions smmla,
	ummla, usmmla, usdot, sudot, fmmla, ld1rob, ld1roh, ld1row, ld1rod
	uzip{1/2}, trn{1/2}.
	* aarch64-opc.c (operand_general_constraint_met_p): Handle
	AARCH64_OPND_SVE_ADDR_RI_S4x32.
	(aarch64_print_operand): Handle AARCH64_OPND_SVE_ADDR_RI_S4x32.
	* aarch64-dis-2.c (aarch64_opcode_lookup_1, aarch64_find_next_opcode):
	Account for new instructions.
	* opcodes/aarch64-asm-2.c (aarch64_insert_operand): Support the new
	S4x32 operand.
	* aarch64-opc-2.c (aarch64_operands): Support the new S4x32 operand.

Regression tested on arm-none-eabi.

Is it ok for trunk?

Regards,
Mihail
2019-11-07 17:11:52 +00:00
Matthew Malcomson eb5bbc4821 [Patch][binutils][aarch64] .bfloat16 directive for AArch64 [7/10]
Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch implements the '.bfloat' directive for the AArch64 backend.

The syntax for the directive is:
  .bfloat16 <0-n numbers>
e.g.
  .bfloat16 12.0
  .bfloat16 0.123, 1.0, NaN, 5

This is implemented by utilizing the ieee_atof_detail function in order
to encode the slightly
different bfloat16 format.

Added testcases to verify the correct encoding for various bfloat16
values (NaN, Infinity (+ & -), normals, subnormals etc...).

Cross compiled and tested on aarch64-none-elf and aarch64-none-linux-gnu
with no issues.

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-10-29  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-10-29  Barnaby Wilks  <barnaby.wilks@arm.com>

	* config/tc-aarch64.c (md_atof): Add encoding for the bfloat16 format.
	* testsuite/gas/aarch64/bfloat16-directive-le.d: New test.
	* testsuite/gas/aarch64/bfloat16-directive-be.d: New test.
	* testsuite/gas/aarch64/bfloat16-directive.s: New test.

Is it ok for trunk?

Regards,
Mihail
2019-11-07 17:07:32 +00:00
Matthew Malcomson 27cce8667f [Patch][binutils][arm] .bfloat16 directive for Arm [6/X]
Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch implements the '.bfloat16' directive for the Arm backend.

The syntax for the directive is:
  .bfloat16 <0-n numbers>
e.g.
  .bfloat16 12.0
  .bfloat16 0.123, 1.0, NaN, 5

This is implemented by utilizing the ieee_atof_detail function (included
in the previous patch) in order to encode the slightly different
bfloat16 format.

Added testcases to verify the correct encoding for various bfloat16
values (NaN, Infinity (+ & -), normals, subnormals etc...).

Cross compiled and tested on arm-none-eabi and arm-none-linux-gnueabihf
with no issues.

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-10-21  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-10-21  Barnaby Wilks  <barnaby.wilks@arm.com>

	* config/tc-arm.c (md_atof): Add encoding for bfloat16
	* testsuite/gas/arm/bfloat16-directive-le.d: New test.
	* testsuite/gas/arm/bfloat16-directive-be.d: New test.
	* testsuite/gas/arm/bfloat16-directive.s: New test.

Is it ok for trunk?

Regards,
Mihail
2019-11-07 17:03:54 +00:00
Matthew Malcomson c96f148b7b [Patch][binutils] Generic support for parsing numbers in bfloat16 format [5/X]
Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions).

This patch contains some general refactoring of the atof_ieee
function, exposing a function that allows a higher level of control
over the format of IEEE-like floating point numbers.
This has been done in order to be able to add a directive for assembling
floating point literals in the bfloat16 format in the following patches.

Committed on behalf of Mihail Ionescu.

Tested on arm-none-eabi, arm-none-linux-gnueabihf, aarch64-none-elf
and aarch64-none-linux-gnuwith no issues.

gas/ChangeLog:

2019-10-21  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-10-21  Barnaby Wilks  <barnaby.wilks@arm.com>

	* as.h (atof_ieee_detail): Add prototype for atof_ieee_detail function.
	(atof_ieee): Move some code into the atof_ieee_detail function.
	(atof_ieee_detail): Add function that provides a higher level of control over generating
	IEEE-like numbers.

Is it ok for trunk?

Regards,
Mihail
2019-11-07 17:01:04 +00:00
Matthew Malcomson aab2c27d9f [binutils][arm] BFloat16 enablement [4/X]
Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch introduces BFloat16 instructions to the arm backend.
The following BFloat16 instructions are added: vdot, vfma{l/t},
vmmla, vfmal{t/b}, vcvt, vcvt{t/b}.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

	* config/tc-arm.c (arm_archs): Add armv8.6-a option.
	(cpu_arch_ver): Add TAG_CPU_ARCH_V8 tag for Armv8.6-a.
	* doc/c-arm.texi (-march): New armv8.6-a arch.
	* config/tc-arm.c (arm_ext_bf16): New feature set.
	(enum neon_el_type): Add NT_bfloat value.
	(B_MNEM_vfmat, B_MNEM_vfmab): New bfloat16 encoder
	helpers.
	(BAD_BF16): New message.
	(parse_neon_type): Add bf16 type specifier.
	(enum neon_type_mask): Add N_BF16 type.
	(type_chk_of_el_type): Account for NT_bfloat.
	(el_type_of_type_chk): Account for N_BF16.
	(neon_three_args): Split out from neon_three_same.
	(neon_three_same): Part split out into neon_three_args.
	(CVT_FLAVOUR_VAR): Add bf16_f32 cvt flavour.
	(do_neon_cvt_1): Account for vcvt.bf16.f32.
	(do_bfloat_vmla): New.
	(do_mve_vfma): New function to deal with the mnemonic clash between the BF16
	vfmat and the MVE vfma in a VPT block with a 't'rue condition.
	(do_neon_cvttb_1): Account for vcvt{t,b}.bf16.f32.
	(do_vdot): New
	(do_vmmla): New
	(insns): Add vdot and vmmla mnemonics.
	(arm_extensions): Add "bf16" extension.
	* doc/c-arm.texi: Document "bf16" extension.
	* testsuite/gas/arm/attr-march-armv8_6-a.d: New test.
	* testsuite/gas/arm/bfloat16-bad.d: New test.
	* testsuite/gas/arm/bfloat16-bad.l: New test.
	* testsuite/gas/arm/bfloat16-bad.s: New test.
	* testsuite/gas/arm/bfloat16-cmdline-bad-2.d: New test.
	* testsuite/gas/arm/bfloat16-cmdline-bad-3.d: New test.
	* testsuite/gas/arm/bfloat16-cmdline-bad.d: New test.
	* testsuite/gas/arm/bfloat16-neon.s: New test.
	* testsuite/gas/arm/bfloat16-non-neon.s: New test.
	* testsuite/gas/arm/bfloat16-thumb-bad.d: New test.
	* testsuite/gas/arm/bfloat16-thumb-bad.l: New test.
	* testsuite/gas/arm/bfloat16-thumb.d: New test.
	* testsuite/gas/arm/bfloat16-vfp.d: New test.
	* testsuite/gas/arm/bfloat16.d: New test.
	* testsuite/gas/arm/bfloat16.s: New test.

include/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

	* opcode/arm.h (ARM_EXT2_V8_6A, ARM_AEXT2_V8_6A,
	ARM_ARCH_V8_6A): New.
	* opcode/arm.h (ARM_EXT2_BF16): New feature macro.
	(ARM_AEXT2_V8_6A): Include above macro in definition.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

	* arm-dis.c (select_arm_features): Update bfd_march_arm_8 with
	Armv8.6-A.
	(coprocessor_opcodes): Add bfloat16 vcvt{t,b}.
	(neon_opcodes): Add bfloat SIMD instructions.
	(print_insn_coprocessor): Add new control character %b to print
	condition code without checking cp_num.
	(print_insn_neon): Account for BFloat16 instructions that have no
	special top-byte handling.

Regression tested on arm-none-eabi.

Is it ok for trunk?

Regards,
Mihail
2019-11-07 16:56:12 +00:00
Matthew Malcomson df6780137d [binutils][aarch64] Bfloat16 enablement [2/X]
Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch introduces the following BFloat16 instructions to the
aarch64 backend: bfdot, bfmmla, bfcvt, bfcvtnt, bfmlal[t/b],
bfcvtn2.

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

	* config/tc-aarch64.c (vectype_to_qualifier): Special case the
	S_2H operand qualifier.
	* doc/c-aarch64.texi: Document bf16 and bf16mmla4 extensions.
	* testsuite/gas/aarch64/bfloat16.d: New test.
	* testsuite/gas/aarch64/bfloat16.s: New test.
	* testsuite/gas/aarch64/illegal-bfloat16.d: New test.
	* testsuite/gas/aarch64/illegal-bfloat16.l: New test.
	* testsuite/gas/aarch64/illegal-bfloat16.s: New test.
	* testsuite/gas/aarch64/sve-bfloat-movprfx.s: New test.
	* testsuite/gas/aarch64/sve-bfloat-movprfx.d: New test.

include/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

	* opcode/aarch64.h (AARCH64_FEATURE_BFLOAT16): New feature macros.
	(AARCH64_ARCH_V8_6): Include BFloat16 feature macros.
	(enum aarch64_opnd_qualifier): Introduce new operand qualifier
	AARCH64_OPND_QLF_S_2H.
	(enum aarch64_insn_class): Introduce new class "bfloat16".
	(BFLOAT16_SVE_INSNC): New feature set for bfloat16
	instructions to support the movprfx constraint.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

	* aarch64-asm.c (aarch64_ins_reglane): Use AARCH64_OPND_QLF_S_2H
	in reglane special case.
	* aarch64-dis-2.c (aarch64_opcode_lookup_1,
	aarch64_find_next_opcode): Account for new instructions.
	* aarch64-dis.c (aarch64_ext_reglane): Use AARCH64_OPND_QLF_S_2H
	in reglane special case.
	* aarch64-opc.c (struct operand_qualifier_data): Add data for
	new AARCH64_OPND_QLF_S_2H qualifier.
	* aarch64-tbl.h (QL_BFDOT QL_BFDOT64, QL_BFDOT64I, QL_BFMMLA2,
	QL_BFCVT64, QL_BFCVTN64, QL_BFCVTN2_64): New qualifiers.
	(aarch64_feature_bfloat16, aarch64_feature_bfloat16_sve,
	aarch64_feature_bfloat16_bfmmla4): New feature sets.
	(BFLOAT_SVE, BFLOAT): New feature set macros.
	(BFLOAT_SVE_INSN, BFLOAT_BFMMLA4_INSN, BFLOAT_INSN): New macros
	to define BFloat16 instructions.
	(aarch64_opcode_table): Define new instructions bfdot,
	bfmmla, bfcvt, bfcvtnt, bfdot, bfdot, bfcvtn, bfmlal[b/t]
	bfcvtn2, bfcvt.

Regression tested on aarch64-elf.

Is it ok for trunk?

Regards,
Mihail
2019-11-07 16:42:36 +00:00
Matthew Malcomson 8ae2d3d9ea [gas][aarch64] Armv8.6-a option [1/X]
Hi,

This patch is part of a series that adds support for Armv8.6-A
to binutils.
This first patch adds the Armv8.6-A flag to binutils.
No instructions are behind it at the moment.

Commited on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

	* config/tc-aarch64.c (armv8.6-a): New arch.
	* doc/c-aarch64.texi (armv8.6-a): Document new arch.

include/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

	* opcode/aarch64.h (AARCH64_FEATURE_V8_6): New.
	(AARCH64_ARCH_V8_6): New.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

	* aarch64-tbl.h (ARMV8_6): New macro.

Is it ok for trunk?

Regards,
Mihail
2019-11-07 16:21:17 +00:00
Jan Beulich 142861dfd5 x86: support further AMD Zen2 instructions
Both RDPRU and MCOMMIT have been publicly documented meanwhile:
https://www.amd.com/system/files/TechDocs/24594.pdf.
2019-11-07 09:29:14 +01:00
Jan Beulich 081e283faf x86: adjust register names printed for MONITOR/MWAIT
As the comments (here: almost, in the opcode table: fully) correctly
state - all register operands except MONITOR's address one are fixed
at 32 bit size. Don't print 64-bit registers there.

Also adjust x86-64-suffix.d's name such that it wouldn't be identical to
x86-64-rep-suffix.d's, but instead resemble that of its sibling
x86-64-suffix-intel.d.
2019-11-07 09:28:20 +01:00
Jan Beulich 85b80b0f9b x86: re-arrange process_operands()
Alter the sequence of conditions evaluated, without affecting the
overall result. This is going to help subsequent changes (and as a nice
side effect also slightly reduces overall indentation depth).

While doing this take the liberty of simplifying the calculation of the
operand index of the register operand in ShortForm handling.
2019-11-04 15:48:38 +01:00
H.J. Lu f78d04905a i386; Add .code16gcc fldenv tests
* testsuite/gas/i386/general.s: Add .code16gcc fldenv tests.
	* testsuite/gas/i386/general.l: Updated.
2019-10-31 10:42:04 -07:00
Mihail Ionescu e20f9590e7 Add support for context sensitive '.arch_extension' to the ARM assembler.
If the extension is not found in the context sensitive table, the legacy
tables are still checked as a fallback.  This is particularly useful for
Armv8.1-M as it enables  the use of '.arch_extension' with the 'mve' and
'mve.fp' extensions which are not part of the legacy table.

	* config/tc-arm.c (selected_ctx_ext_table) New static variable.
	(arm_parse_arch): Set context sensitive extension table based on the
	chosen base architecture.
	(s_arm_arch_extension): Change to lookup extensions in the new context
	sensitive tables.
	* gas/testsuite/gas/arm/mve-ext.s: New.
	* gas/testsuite/gas/arm/mve-ext.d: New.
	* gas/testsuite/gas/arm/mvefp-ext.s: New.
	* gas/testsuite/gas/arm/mvefp-ext.d: New.
2019-10-31 11:22:58 +00:00
Delia Burduv 1820262bc9 Modify the ARNM assembler to accept the omission of the immediate argument for the writeback form of the LDRAA and LDRAB mnemonics
This is a shorthand for the immediate argument being 0, as described here:
  https://developer.arm.com/docs/ddi0596/latest/base-instructions-alphabetic-order/ldraa-ldrab-load-register-with-pointer-authentication

This is because the instructions still have a use with an immediate
argument of 0, unlike loads without the PAC functionality. Currently,
the mnemonics are

  LDRAA Xt, [Xn, #<simm10>]!
  LDRAB Xt, [Xn, #<simm10>]!

After this patch they become

  LDRAA Xt, [Xn {, #<simm10>}]!
  LDRAB Xt, [Xn {, #<simm10>}]!

gas	* config/tc-aarch64.c (parse_address_main): Accept the omission of
	the immediate argument for ldraa and ldrab as a shorthand for the
	immediate being 0.
	* testsuite/gas/aarch64/ldraa-ldrab-no-offset.d: New test.
	* testsuite/gas/aarch64/ldraa-ldrab-no-offset.s: New test.
	* testsuite/gas/aarch64/illegal-ldraa.s: Modified to accept the
	writeback form with no offset.
	* testsuite/gas/aarch64/illegal-ldraa.s: Removed missing offset
	error.

opcodes	* aarch64-opc.c (print_immediate_offset_address): Don't print the
	immediate for the writeback form of ldraa/ldrab if it is 0.
	* aarch64-tbl.h: Updated the documentation for ADDR_SIMM10.
	* aarch64-opc-2.c: Regenerated.
2019-10-30 13:23:35 +00:00
Jan Beulich a961a1e174 x86: add tests to cover defaulting of operand sizes for ambiguous insns
Prior to changing the logic in the assembler install tests to make sure
the present defaulting of operand sizes won't get broken. There are a
few anomalies pointed out by this:
- arithmetic insns (add, sub, etc) allow defaulting when their immediate
  fits in (signed) 8 bits, but they fail to assemble with larger values,
- mov, other than arithmetic insns, doesn't allow any defaulting,
- movsx/movzx default to byte sources (in AT&T mode), and their special
  casing needs to be adjusted first
- bt and friends allow defaulting, while shl and friends don't,
- ambiguous AVX and AVX512 insns don't allow defaulting.
This should ultimately all become consistent (perhaps with the exception
some of the SIMD insns); respective tests will be added to the test
cases here as the issues get addressed.
2019-10-30 09:09:13 +01:00
Jan Beulich 507916b855 x86: drop stray W
The flag is used to indicate opcodes which can be switched between byte
and word/dword/qword forms (in a "canonical" way). Obviously it's quite
odd then to see it on insns not allowing for byte operands in the first
place. As a result the opcode bytes need to be adjusted accordingly,
which includes comparisons done in optimize_encoding().

To make re-introduction of such issues less likely have i386-gen
diagnose it (in a generally non-fatal way for now).
2019-10-30 09:05:46 +01:00
Alan Modra b9d8f5601b Re: Optimise away eh_frame advance_loc 0
If we happen to get the fixed and variable parts of the advance_loc
in different frags, bad things happen when subtracting one from a
fr_fix of zero.

	PR 25125
	* dw2gencfi.c (output_cfi_insn): Don't allow DW_CFA_advance_loc4
	to be placed in a different frag to the rs_cfa.
2019-10-29 12:20:54 +10:30
John David Anglin f612a98f9f Add some missing casts to suppress implicit cast warnings
PR gas/25121
	* config/tc-hppa.c (tc_gen_reloc): Cast some enums to int.
	(md_assemble): Likewise.
2019-10-26 16:48:59 -04:00
Alan Modra 6f69abb049 Optimise away eh_frame advance_loc 0
These can be generated when multiple cfi directives are emitted for an
instruction and the insn frag is closed off between directives, as
happens when listings are enabled.  No doubt the advance_loc of zero
could be avoided by backtracking over frags in dw2gencfi.c before
calling cfi_add_advance_loc, but that seems like more work than
cleaning up afterwards as this patch does.

Noticed when looking at the testcase in PR25125.

	PR 25125
	* dw2gencfi.c (output_cfi_insn): Don't output DW_CFA_advance_loc+0.
	* ehopt.c (eh_frame_estimate_size_before_relax): Return -1 for
	an advance_loc of zero.
	(eh_frame_relax_frag): Translate fr_subtype of 7 to size -1.
	(eh_frame_convert_frag): Handle fr_subtype of 7.  Abort on
	unexpected fr_subtype.
2019-10-26 20:19:28 +10:30
Alan Modra 37a5888387 PR25125, relaxation chooses wrong branch size
The patch I made for PR12049 didn't test for a "negative" branch
properly.  "if (target < address)" ought to have been
"if (target < address + fragP->fr_fix)".  Rather than making that
change, this patch adds fragP->fr_fix into address earlier.  The patch
also avoids running into a bad interaction with the m68k
md_prepare_relax_scan by returning zero growth immediately, since the
adjusted target expression would result in a zero "aim".

	PR gas/25125
	PR gas/12049
	* write.c (relax_frag): Correct calculation of delta for
	positive branches where "stretch" would make the branch
	negative.  Return zero immediately in that case.  Correct
	TC_PCREL_ADJUST comment.
2019-10-25 23:19:24 +10:30
Alan Modra 8ef6decbc1 qsort: tc-xtensa.c tidy
Not much to see here, just reduce the number of calls to S_GET_VALUE
and symbol_symbolS in the comparison functions.

	* config/tc-xtensa.c (xg_order_trampoline_chain_entry): Don't
	call S_GET_VALUE multiple times for a symbol.  Rearrange code
	so it is obvious what is the primary sort key.
	(xg_order_trampoline_chain): Similarly.
2019-10-16 11:03:34 +10:30
Alan Modra 9a73315161 remove more xmalloc in bfd
Also fixes m68hc1x printf arguments which would have bombed when
compiling on a 32-bit host with --enable-64-bit-bfd.

bfd/
	PR 24955
	* elf32-arm.c (set_cmse_veneer_addr_from_implib): Use bfd_malloc
	rather than xmalloc.
	* elf32-m68hc1x.c (reloc_warning): New function.
	(elf32_m68hc11_relocate_section): Use it here.  Cast bfd_vma values
	corresponding to %lx in format strings.
	* elf32-nds32.c (nds32_insertion_sort): Use a stack temporary.
gas/
	* config/tc-nds32.c (nds32_set_section_relocs): Use relocs and n
	parameters rather than equivalent sec->orelocation and
	sec->reloc_count.  Don't sort for n <= 1.  Tidy.
2019-10-15 16:50:32 +10:30
Nick Clifton 1d3787499d Fix the disassembly of the LDS and STS instructions of the AVR architecture.
PR 25041
opcodes	* avr-dis.c (avr_operand): Fix construction of address for lds/sts
	instructions.

gas	* testsuite/gas/avr/pr25041.s: New test.
	* testsuite/gas/avr/pr25041.d: New test driver.
2019-10-09 13:48:06 +01:00
Andreas Krebbel 46e292ab0a S/390: Add support for z15 as CPU name.
So far z15 was identified as arch13. After the machine has been
announced we can now add the real name.

gas/ChangeLog:

2019-10-08  Andreas Krebbel  <krebbel@linux.ibm.com>

	* config/tc-s390.c (s390_parse_cpu): Add z15 as alternate CPU
	name.
	* doc/as.texi: Add z15 to CPU string list.
	* doc/c-s390.texi: Likewise.

opcodes/ChangeLog:

2019-10-08  Andreas Krebbel  <krebbel@linux.ibm.com>

	* s390-mkopc.c (main): Enable z15 as CPU string in the opcode
	table.
2019-10-08 11:24:29 +02:00
Jozef Lawrynowicz c0ea7c52e1 Add support for new functionality in the msp430 backend of GCC.
This functionality will generate a new GNU object attribute for the "data region"
has been added. This object attribute is used
mark whether the compiler has generated code assuming that data could be in the
upper or lower memory regions.

Code which assumes data is always in the lower memory region is incompatible
with code which uses the full memory range for data.

The patch also adds a new assembler directive ".mspabi_attribute" to handle the
existing MSPABI object attributes. GCC will now emit both .gnu_attribute and
.mspabi_attribute directives to indicate what options the source file was
compiled with.

The assembler will now check the values set in these directives against the
options that the it has been invoked with. If there is a discrepancy, the
assembler will exit with an error.

bfd	* elf32-msp430.c (elf32_msp430_merge_mspabi_attributes): Rename to..
	(elf32_msp430_merge_msp430_attributes): Add support for merging the GNU
	object attribute for data region.

binutils* readelf.c (display_msp430_gnu_attribute): New.
	(process_arch_specific): Use msp430 specific handler for GNU
	attributes.

gas	* config/tc-msp430.c (md_parse_option): Set lower_data_region_only to
	FALSE if the data region is set to "upper", "either" or "none".
	(msp430_object_attribute): New.
	(md_pseudo_table): Handle .mspabi_attribute and .gnu_attribute.
	(msp430_md_end): Replace hard-coded attribute values with enums.
	Handle data region object attribute.
	* doc/as.texi: Document MSP430 Data Region object attribute.
	* doc/c-msp430.texi: Document the .mspabi_attribute directive.
	* testsuite/gas/msp430/attr-430-small-bad.d: New test.
	* testsuite/gas/msp430/attr-430-small-bad.l: New test.
	* testsuite/gas/msp430/attr-430-small-good.d: New test.
	* testsuite/gas/msp430/attr-430-small.s: New test.
	* testsuite/gas/msp430/attr-430x-large-any-bad.d: New test.
	* testsuite/gas/msp430/attr-430x-large-any-bad.l: New test.
	* testsuite/gas/msp430/attr-430x-large-any-good.d: New test.
	* testsuite/gas/msp430/attr-430x-large-any.s: New test.
	* testsuite/gas/msp430/attr-430x-large-lower-bad.d: New test.
	* testsuite/gas/msp430/attr-430x-large-lower-bad.l: New test.
	* testsuite/gas/msp430/attr-430x-large-lower-good.d: New test.
	* testsuite/gas/msp430/attr-430x-large-lower.s: New test.
	* testsuite/gas/msp430/msp430.exp: Run new tests.

include	* elf/msp430.h: Add enums for MSPABI and GNU object attribute tag names
	and values.

ld	* testsuite/ld-msp430-elf/attr-gnu-main.s: New test.
	* testsuite/ld-msp430-elf/attr-gnu-obj.s: New test.
	* testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d: New test.
	* testsuite/ld-msp430-elf/attr-gnu-region-lower.d: New test.
	* testsuite/ld-msp430-elf/attr-gnu-region-upper.d: New test.
	* testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests.
2019-10-07 16:34:31 +01:00
Jan Beulich ad7c657b9e add missing ChangeLog entry for d241b91073 2019-10-07 08:40:03 +02:00
Jan Beulich d241b91073 x86/Intel: correct MOVSD and CMPSD handling
First and foremost the EsSeg attribute was misplaced for CMPSD. Then
both it and MOVSD were lacking Dword on both of their operands.
Finally string insns with multiple operands and requiring use of ES:
had the wrong operand number reported in the diagnostic.
2019-10-07 08:38:01 +02:00
Tamar Christina e8f8842d90 Arm: Fix out of range conditional branch (PR/24991)
The fix for PR12848 introduced an off by one error in the mask, this corrected
the negative overflows but not the positive overflows.  As a result the
conditional branch instructions accepted a too wide positive immediate which
resulted in it corrupting the instruction during encoding.

The relocation I believe has been incorrectly named, to be consistent with the
other relocations it should have been named BRANCH21 which is why the masks for
it are confusing.

I've replaced the masks with a function out_of_range_p which should make it
harder to make such mistakes.

The mask for BL/BLX on Armv6t+ is also wrong, the extended range is 25-bits
and so the mask should be checking for 24-bits for positive overflow.

gas/ChangeLog:

	PR gas/24991
	* config/tc-arm.c (out_of_range_p): New.
	(md_apply_fix): Use it in BFD_RELOC_THUMB_PCREL_BRANCH9,
	BFD_RELOC_THUMB_PCREL_BRANCH12, BFD_RELOC_THUMB_PCREL_BRANCH20,
	BFD_RELOC_THUMB_PCREL_BRANCH23, BFD_RELOC_THUMB_PCREL_BRANCH25
	* testsuite/gas/arm/pr24991.d: New test.
	* testsuite/gas/arm/pr24991.l: New test.
	* testsuite/gas/arm/pr24991.s: New test.
2019-09-24 15:00:41 +01:00
Srinath Parvathaneni e449ea97eb [ARM]: Modify assembler to accept floating and signless datatypes for MVE instruction VLDR.
This patch modifies assembler to accept the equivalent sized floating
and signless datatypes for VLDR instruction but as alias for the unsigned version.

gas/ChangeLog:

2019-09-23  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

	* config/tc-arm.c (do_mve_vstr_vldr_RQ): Modify function to allow float
	* and signless datatypes for few cases of VLDR instruction.
	* testsuite/gas/arm/mve-vldr-bad-3.l: Modify.
	* testsuite/gas/arm/mve-vldr-bad-3.s: Likewise.
	* testsuite/gas/arm/mve-vstrldr-1.d: Likewise.
	* testsuite/gas/arm/mve-vstrldr-1.s: Likewise.
2019-09-24 10:29:18 +01:00
Alan Modra 0ba9378a2a ecoff bfd.h tidy
bfd/
	* bfd-in.h: Move ecoff function declarations..
	* ecoff-bfd.h: ..to here, new file.
	* ecoff.c: Include ecoff-bfd.h.
	* ecofflink.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elfxx-mips.c: Likewise.
	* bfd-in2.h: Regenerate.
gas/
	* config/obj-ecoff.c: Include ecoff-bfd.h.
	* config/obj-elf.c: Likewise.
2019-09-23 10:27:22 +09:30
Alan Modra f37164d78b arm bfd.h tidy
bfd/
	* bfd-in.h: Move arm declaraions..
	* cpu-arm.h: ..to here, new file..
	* coff-arm.h: ..and here, new file..
	* elf32-arm.h: ..and here, new file.
	* cpu-arm.c: Include cpu-arm.h.
	* coff-arm.c: Include cpu-arm.h and coff-arm.h.
	* elf32-arm.c: Include cpu-arm.h and elf32-arm.h.
	* pe-arm.c: Move function rename defines later.
	* pe-arm-wince.c: Likewise and include sysdep.h and bfd.h early.
	* bfd-in2.h: Regenerate.
gas/
	* config/tc-arm.c: Include cpu-arm.h.
ld/
	* emultempl/armelf.em: Include elf32-arm.h.
	* emultempl/pe.em: Move func defines later and include coff-arm.h.
2019-09-23 10:27:21 +09:30
Alan Modra 40c9c8deb9 tc-i386.c gcc10 warning fix
.../gas/config/tc-i386.c: In function ‘md_parse_option’:
.../gas/config/tc-i386.c:11441:9: error: implicit conversion from ‘enum <anonymous>’ to ‘enum <anonymous>’ [-Werror=enum-conversion]
11441 |  vexwig = evexw0;
      |         ^
.../gas/config/tc-i386.c:11443:9: error: implicit conversion from ‘enum <anonymous>’ to ‘enum <anonymous>’ [-Werror=enum-conversion]
11443 |  vexwig = evexw1;
      |         ^

	* config/tc-i386.c (md_parse_option): Fix warning on vexwig assignment.
2019-09-21 11:35:39 +09:30
Alan Modra a48931cc2d bfd macro conversion to inline functions, section
This one exposed a bug in tic6x gas, found with inline function
parameter type checking.  struct bfd_section and struct bfd_symbol
both have a flags field, so bfd_is_com_section (symbol) compiled OK
when bfd_is_com_section was a macro but didn't special case common
symbols.

bfd/
	* bfd-in.h (bfd_section_name, bfd_section_size, bfd_section_vma),
	(bfd_section_lma, bfd_section_alignment, bfd_section_flags),
	(bfd_section_userdata, bfd_is_com_section, discarded_section),
	(bfd_get_section_limit_octets, bfd_get_section_limit): Delete macros.
	* bfd.c (bfd_get_section_limit_octets, bfd_get_section_limit),
	(bfd_section_list_remove, bfd_section_list_append),
	(bfd_section_list_prepend, bfd_section_list_insert_after),
	(bfd_section_list_insert_before, bfd_section_removed_from_list):
	New inline functions.
	* section.c (bfd_is_und_section, bfd_is_abs_section),
	(bfd_is_ind_section, bfd_is_const_section, bfd_section_list_remove),
	(bfd_section_list_append, bfd_section_list_prepend),
	(bfd_section_list_insert_after, bfd_section_list_insert_before),
	(bfd_section_removed_from_list): Delete macros.
	(bfd_section_name, bfd_section_size, bfd_section_vma),
	(bfd_section_lma, bfd_section_alignment, bfd_section_flags),
	(bfd_section_userdata, bfd_is_com_section, bfd_is_und_section),
	(bfd_is_abs_section, bfd_is_ind_section, bfd_is_const_section),
	(discarded_section): New inline functions.
	* bfd-in2.h: Regenerate.
gas/
	* config/tc-tic6x.c (tc_gen_reloc): Correct common symbol check.
ld/
	* emultempl/xtensaelf.em (xtensa_get_section_deps): Comment.
	Use bfd_section_userdata.
	(xtensa_set_section_deps): Use bfd_set_section_userdata.
	* ldlang.c (lang_output_section_get): Use bfd_section_userdata.
	(sort_def_symbol): Likewise, and bfd_set_section_userdata.
	(init_os): Use bfd_set_section_userdata.
	(print_all_symbols): Use bfd_section_userdata.
	* ldlang.h (get_userdata): Delete.
2019-09-20 18:04:03 +09:30
Jan Beulich 3f9aad111c x86-64: fix handling of PUSH/POP of segment register
Commit 21df382b91 ("x86: fold SReg{2,3}") went too far: Folding 64-bit
PUSH/POP templates into non-64-bit ones isn't correct, due to the
different operand widths, and hence suffixes permitted. Restore the
separate templates.

Add tests of PUSH/POP with q suffix and %fs/%gs operands to the
testsuite. While doing so also add PUSHF/POPF ones _without_ suffix.
2019-09-20 10:18:15 +02:00
Matthew Malcomson 7738ddb418 [gas][news] NEWS (2.33) note new SVE2 and TME instructions for AArch64
These NEWS entries had been missed when the instructions were added.

gas/ChangeLog:

2019-09-19  Matthew Malcomson  <matthew.malcomson@arm.com>

	* NEWS: Add SVE2 and TME entries.
2019-09-19 14:34:14 +01:00
Alan Modra fd3619828e bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions.  The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections.  Those sections shouldn't be modified
anyway.

The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma.  I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section.  This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.

bfd/
	* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
	(bfd_get_section_lma, bfd_get_section_alignment),
	(bfd_get_section_size, bfd_get_section_flags),
	(bfd_get_section_userdata): Delete.
	(bfd_section_name, bfd_section_size, bfd_section_vma),
	(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
	(bfd_section_flags, bfd_section_userdata): New.
	(bfd_is_com_section): Rename parameter.
	* section.c (bfd_set_section_userdata, bfd_set_section_vma),
	(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
	(bfd_set_section_size): Delete bfd parameter, rename section parameter.
	(bfd_set_section_lma): New.
	* bfd-in2.h: Regenerate.
	* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
	update callers.
	* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
	* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
	* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
	* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
	* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
	* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
	* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
	* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
	* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
	* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
	* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
	* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
	* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
	* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
	* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
	* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
	* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
	* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
	* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
	* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
	* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
	* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
	* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
	* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
	* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
	* xcofflink.c: Update throughout for bfd section macro and function
	changes.
binutils/
	* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
	* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
	* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
	* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
	throughout for bfd section macro and function changes.
gas/
	* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
	* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
	* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
	* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
	* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
	* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
	* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
	* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
	* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
	* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
	* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
	* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
	* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
	* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
	* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
	* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
	* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
	* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
	* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
	* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
	* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
	* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
	* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
	bfd section macro and function changes.
	* write.c (compress_debug): Use bfd_rename_section.
gdb/
	* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
	* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
	* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
	* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
	* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
	* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
	* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
	* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
	* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
	* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
	* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
	* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
	* solib-spu.c, * solib-svr4.c, * solib-target.c,
	* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
	* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
	* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
	* mi/mi-interp.c: Update throughout for bfd section macro and
	function changes.
	* gcore (gcore_create_callback): Use bfd_set_section_lma.
	* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
	* corefile.c, * symtab.c: Update throughout for bfd section
	macro and function changes.
ld/
	* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
	* emultempl/aarch64elf.em, * emultempl/aix.em,
	* emultempl/armcoff.em, * emultempl/armelf.em,
	* emultempl/cr16elf.em, * emultempl/cskyelf.em,
	* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
	* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
	* emultempl/mmo.em, * emultempl/msp430.em,
	* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
	* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
	throughout for bfd section macro and function changes.
libctf/
	* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
	* arc-ext.c: Update throughout for bfd section macro changes.
sim/
	* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
	* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
	* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
	* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
	* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-19 09:40:13 +09:30
Alan Modra e6f7f6d14f bfd_asymbol_* macros
The main point of this patch is to give bfd_get_section a better name,
bfd_asymbol_section.

bfd/
	* bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section.
	(bfd_get_output_section): Delete.
	(bfd_asymbol_base): Delete.
	(bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
	(bfd_asymbol_bfd, bfd_asymbol_flavour): Tidy.
	(bfd_set_asymbol_name): New macro.
	* bfd-in2.h: Regenerate.
	* aout-cris.c: Update throughout to use bfd_asymbol_section.
	* aoutx.h: Likewise.
	* cofflink.c: Likewise.
	* dwarf2.c: Likewise.
	* ecoff.c: Likewise.
	* elf.c: Likewise.
	* elf32-arm.c: Likewise.
	* elf32-mips.c: Likewise.
	* elf32-score.c: Likewise.
	* elf32-score7.c: Likewise.
	* elfn32-mips.c: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elfxx-mips.c: Likewise.
	* linker.c: Likewise.
	* pdp11.c: Likewise.
	* elf64-mmix.c (mmix_elf_reloc): Expand bfd_get_output_section.
binutils/
	* nm.c: Update bfd_get_section to bfd_asymbol_section throughout.
	* objcopy.c: Likewise.
	* objdump.c: Likewise.
	* rdcoff.c: Likewise.
	* objcopy.c (create_new_symbol): Use bfd_set_asymbol_name.
	(filter_symbols): Likewise.
gas/
	* symbols.c (S_IS_LOCAL): Update bfd_get_section to
	bfd_asymbol_section.
gdb/
	* arm-tdep.c (arm_record_special_symbol): Update bfd_get_section
	to bfd_asymbol_section.
ld/
	* ldcref.c (check_reloc_refs): Update bfd_get_section to
	bfd_asymbol_section.
2019-09-18 23:07:31 +09:30
Simon Marchi e0b2a78c83 Re-generate many configure and Makefile.in files
I get some spurious changes when running autoconf/automake for various
projects in the tree.  This is likely because they were generated using
distro-patched tools last time.

I ran `autoreconf -f` in the various automake projects of the
binutils-gdb tree, and this is the result.  The tools I am using have
been compiled from source, from the upstream release.

bfd/ChangeLog:

	* Makefile.in: Re-generate.
	* configure: Re-generate.
	* doc/Makefile.in: Re-generate.

binutils/ChangeLog:

	* Makefile.in: Re-generate.
	* configure: Re-generate.
	* doc/Makefile.in: Re-generate.

gas/ChangeLog:

	* Makefile.in: Re-generate.
	* configure: Re-generate.
	* doc/Makefile.in: Re-generate.

gold/ChangeLog:

	* testsuite/Makefile.in: Re-generate.

gprof/ChangeLog:

	* Makefile.in: Re-generate.
	* configure: Re-generate.

ld/ChangeLog:

	* Makefile.in: Re-generate.
	* configure: Re-generate.

opcodes/ChangeLog:

	* Makefile.in: Re-generate.
	* configure: Re-generate.
2019-09-18 09:09:15 -04:00
Jim Wilson 7e9ad3a35c RISC-V: Gate opcode tables by enum rather than string.
Generalize opcode arch dependencies so that we can support the
overlapping B extension Zb* subsets.

	2019-09-17  Maxim Blinov  <maxim.blinov@embecosm.com>
	gas/
	* config/tc-riscv.c (riscv_multi_subset_supports): Handle
	insn_class enum rather than subset char string.
	(riscv_ip): Update call to riscv_multi_subset_supports.
	include/
	* opcode/riscv.h (riscv_insn_class): New enum.
	* opcode/riscv.h (struct riscv_opcode): Change
	subset field to insn_class field.
	opcodes/
	* riscv-opc.c (riscv_opcodes): Change subset field
	to insn_class field for all instructions.
	(riscv_insn_types): Likewise.
2019-09-17 17:59:08 -07:00
Phil Blundell bb6959602b Update version to 2.33.50 and regenerate configure scripts. 2019-09-16 11:03:53 +01:00
Nick Clifton aebcfb76fc Enhance the disassembler so that it will reliably determine whether a reloc applies to the middle of the next insn.
PR 24907
binutils* objdump.c (null_print): New function.
	(disassemble_bytes): Delete previous_octets local and replace with
	a test of the max_reloc_offset_into_insn field of the
	bfd_arch_info structure.  If a reloc is a potential match for the
	next insn, then perform a dummy disassembly in order to calculate
	its real length.

bfd	* archures.c (bfd_arch_info_type): Add max_reloc_offset_into_insn
	field.
	(bfd_default_arch_struct): Initialise the new field.
	* bfd-in2.h: Regenerate.
	* cpu-aarch64.c: Initialise the new field.
	* cpu-alpha.c: Likewise.
	* cpu-arc.c: Likewise.
	* cpu-arm.c: Likewise.
	* cpu-avr.c: Likewise.
	* cpu-bfin.c: Likewise.
	* cpu-bpf.c: Likewise.
	* cpu-cr16.c: Likewise.
	* cpu-cr16c.c: Likewise.
	* cpu-cris.c: Likewise.
	* cpu-crx.c: Likewise.
	* cpu-csky.c: Likewise.
	* cpu-d10v.c: Likewise.
	* cpu-d30v.c: Likewise.
	* cpu-dlx.c: Likewise.
	* cpu-epiphany.c: Likewise.
	* cpu-fr30.c: Likewise.
	* cpu-frv.c: Likewise.
	* cpu-ft32.c: Likewise.
	* cpu-h8300.c: Likewise.
	* cpu-hppa.c: Likewise.
	* cpu-i386.c: Likewise.
	* cpu-ia64.c: Likewise.
	* cpu-iamcu.c: Likewise.
	* cpu-ip2k.c: Likewise.
	* cpu-iq2000.c: Likewise.
	* cpu-k1om.c: Likewise.
	* cpu-l1om.c: Likewise.
	* cpu-lm32.c: Likewise.
	* cpu-m10200.c: Likewise.
	* cpu-m10300.c: Likewise.
	* cpu-m32c.c: Likewise.
	* cpu-m32r.c: Likewise.
	* cpu-m68hc11.c: Likewise.
	* cpu-m68hc12.c: Likewise.
	* cpu-m68k.c: Likewise.
	* cpu-m9s12x.c: Likewise.
	* cpu-m9s12xg.c: Likewise.
	* cpu-mcore.c: Likewise.
	* cpu-mep.c: Likewise.
	* cpu-metag.c: Likewise.
	* cpu-microblaze.c: Likewise.
	* cpu-mips.c: Likewise.
	* cpu-mmix.c: Likewise.
	* cpu-moxie.c: Likewise.
	* cpu-msp430.c: Likewise.
	* cpu-mt.c: Likewise.
	* cpu-nds32.c: Likewise.
	* cpu-nfp.c: Likewise.
	* cpu-nios2.c: Likewise.
	* cpu-ns32k.c: Likewise.
	* cpu-or1k.c: Likewise.
	* cpu-pdp11.c: Likewise.
	* cpu-pj.c: Likewise.
	* cpu-plugin.c: Likewise.
	* cpu-powerpc.c: Likewise.
	* cpu-pru.c: Likewise.
	* cpu-riscv.c: Likewise.
	* cpu-rl78.c: Likewise.
	* cpu-rs6000.c: Likewise.
	* cpu-rx.c: Likewise.
	* cpu-s12z.c: Likewise.
	* cpu-s390.c: Likewise.
	* cpu-score.c: Likewise.
	* cpu-sh.c: Likewise.
	* cpu-sparc.c: Likewise.
	* cpu-spu.c: Likewise.
	* cpu-tic30.c: Likewise.
	* cpu-tic4x.c: Likewise.
	* cpu-tic54x.c: Likewise.
	* cpu-tic6x.c: Likewise.
	* cpu-tic80.c: Likewise.
	* cpu-tilegx.c: Likewise.
	* cpu-tilepro.c: Likewise.
	* cpu-v850.c: Likewise.
	* cpu-v850_rh850.c: Likewise.
	* cpu-vax.c: Likewise.
	* cpu-visium.c: Likewise.
	* cpu-wasm32.c: Likewise.
	* cpu-xc16x.c: Likewise.
	* cpu-xgate.c: Likewise.
	* cpu-xstormy16.c: Likewise.
	* cpu-xtensa.c: Likewise.
	* cpu-z80.c: Likewise.
	* cpu-z8k.c: Likewise.

gas	* testsuite/gas/arm/pr24907.s: New test.
	* testsuite/gas/arm/pr24907.d: Expected disassembly.
2019-09-10 15:20:58 +01:00
Srinath Parvathaneni efd0b3103f [PATCH][ARM][GAS]: Support to MVE VCTP instruction.
This patch adds support for MVE VCTP instruction in assembler.

gas ChangeLog:

2019-09-10  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

        * config/tc-arm.c (M_MNEM_vctp): Add new Mnemonic.
        (do_mve_vctp): Add function to encode VCTP instruction.
        * testsuite/gas/arm/mve-vctp-bad.d: New test.
        * testsuite/gas/arm/mve-vctp-bad.l: Likewise.
        * testsuite/gas/arm/mve-vctp-bad.s: Likewise.
        * testsuite/gas/arm/mve-vctp.d: Likewise.
        * testsuite/gas/arm/mve-vctp.s: Likewise.
2019-09-10 11:44:54 +01:00
Phil Blundell 60391a255b Add markers for 2.33 branch to NEWS and ChangeLog files. 2019-09-09 10:27:40 +01:00
Alan Modra e47d413a2c PowerPC warning on symbol+offset@got
* config/tc-ppc.c (ppc_elf_suffix): Display the relocation
	operator on GOT reloc warnings/errors.
2019-09-05 15:50:35 +09:30
Srinath Parvathaneni 1c1e0fe58b [PATCH][ARM][GAS]: Assembler support to interpret MVE VMOV instruction correctly.
This patch make changes to the assembler to encode MVE VMOV instruction "a" same as "b".
a: VMOV<c><q> <Dd>, <Dm>
b: VMOV<c><q>.F64 <Dd>, <Dm>

gas/ChangeLog:

2019-08-30  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

	* config/tc-arm.c (do_neon_mov): Modify "if" statement.
	* testsuite/gas/arm/mve-vmov-bad-3.d: New test.
	* testsuite/gas/arm/mve-vmov-bad-3.l: Likewise.
	* testsuite/gas/arm/mve-vmov-bad-3.s: Likewise.
2019-08-30 10:44:32 +01:00
Srinath Parvathaneni c4a23bf878 Add support for the MVE VMOV instruction to the ARM assembler. This instruction copies the value of one vector register to another vector register. The patch also modifies the decoding of VORR instruction which is effecting decoding of VMOV instruction.
gas     * config/tc-arm.c (parse_neon_mov): Add check to accept vector
	register to both the arguments in VMOV instruction.
	* testsuite/gas/arm/mve-vmov-1.d: Modify.
	* testsuite/gas/arm/mve-vmov-1.s: Likewise.
	* testsuite/gas/arm/mve-vorr.d: Likewise.

opcodes	* arm-dis.c (mve_opcodes): Add entry for MVE_VMOV_VEC_TO_VEC.
	(is_mve_undefined): Add case for MVE_VMOV_VEC_TO_VEC.
	(print_insn_mve): Add condition to check Qm==Qn of VORR instruction.
2019-08-27 12:08:21 +01:00
Kito Cheng db3b6ecc28 RISC-V: Improve li expansion for better code density.
li is a pseudo instruction in RISC-V, it might expand to more than one
instructions if the immediate value can't fit addi or lui, but the
assembler will always using 4-byte instructions during expansion.

For example:

 li a0, 0x12345001

will expand into

 12345537 lui a0,0x12345
 00150513 addi a0,a0,1

but addi could be compress into

 0505 addi a0,a0,1

It because load_const use macro_build to emit instructions,
and macro_build call append_insn, and expect it will compress
it if possible, but the fact is append_insn never compress anything,

So this patch redirect the li expansion flow to normal instruction
emission flow via md_assemble, added md_assemblef as an wrapper for
that for easier emit instruction with printf-style argument to build
instruction.

gas/ChangeLog:

	* tc-riscv.c (md_assemblef): New.
	(load_const) Use md_assemblef instead of macro_build to emit
	instructions.
	* testsuite/gas/riscv/li32.d: New.
	* testsuite/gas/riscv/li32.s: Ditto.
	* testsuite/gas/riscv/li64.d: Ditto.
	* testsuite/gas/riscv/li64.s: Ditto.
2019-08-25 19:16:43 -07:00
Nick Clifton fe4b77d9e5 Updated Swedish translation for the gas sub-directory.
2019-08-23  Nick Clifton  <nickc@redhat.com>

	* po/sv.po: Updated Swedish translation.
2019-08-23 10:46:46 +01:00
Dennis Zhang 0535e5d74d Arm: Add support for missing CPUs
This patch adds support for following CPUs:
Cortex-M35P, Cortex-A77, Cortex-A76AE.

Related specifications can be found at https://developer.arm.com/ip-products/processors.

gas/ChangeLog:

	* config/tc-arm.c: New entries for Cortex-M35P, Cortex-A77,
	and Cortex-A76AE.
	* doc/c-arm.texi: Document new processors.
	* testsuite/gas/arm/cpu-cortex-a76ae.d: New test.
	* testsuite/gas/arm/cpu-cortex-a77.d: New test.
	* testsuite/gas/arm/cpu-cortex-m35p.d: New test.

bfd/ChangeLog:

	* cpu-arm.c: New entries for Cortex-M35P, Cortex-A77, Cortex-A76AE.
2019-08-22 15:35:43 +01:00
Bosco Garc?a a3197745b1 Fix the assembler's floating point number parser so that it can correctly handle numbers encoded as a leading decimal point, followed by zeroes, followed by a non-zero sequence.
* atof-generic.c (atof_generic): Do not ignore leading zeros if
	they appear after a decimal point.
	* testsuite/gas/all/float.s: Extend test to include a number with
	a leading decimal point followed by several zeroes.
	* testsuite/gas/i386/fp.s: Likewise.
	* testsuite/gas/i386/fp.d: Update expected output.
2019-08-22 12:54:06 +01:00
Barnaby Wilks b20d385926 Implement a float16 directive for assembling 16 bit IEEE 754 floating point numbers for the AArch64 assembler.
The syntax of the directive is:

     .float16 <0-n decimal numbers>
e.g.
     .float16 0.5
     .float16 10.2, NaN, 452.09

The floats will always be encoded using the binary16 format as described in the
IEEE 754-2008 standard. There is no need to support Arm's alternative half-precision
format since AArch64 only supports the IEEE format.

gas	* config/tc-aarch64.c: Add float16 directive and add "Hh" to
	acceptable float characters.
	* doc/c-aarch64.texi: Documentation for float16 directive.
	* testsuite/gas/aarch64/float16-be.d: New test.
	* testsuite/gas/aarch64/float16-le.d: New test.
	* testsuite/gas/aarch64/float16.s: New test.
	* NEWS: Add NEWS entry.
2019-08-22 11:13:23 +01:00
Kyrylo Tkachov a051e2f3e0 [AArch64][gas] Update MTE system register encodings
The MTE specification adjusted the encoding of the TFSRE0_EL1, TFSR_EL1, TFSR_EL2, TFSR_EL3, TFSR_EL12 system registers.
This patch brings binutils up to date.

The references for the encodings are at:
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsre0_el1 (also contains TFSR_EL12 description)
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el1
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el2
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el3

Tested check-gas for aarch64-none-elf.

opcodes/

	* aarch64-opc.c (aarch64_sys_regs): Update encoding of tfsre0_el1,
	tfsr_el1, tfsr_el2, tfsr_el3, tfsr_el12.
	(aarch64_sys_reg_supported_p): Update checks for the above.

gas/

    * testsuite/gas/aarch64/sysreg-4.d: Update expected disassembly for
    tfsre0_el1, tfsr_el1, tfsr_el2, tfsr_el3, tfsr_el12 system registers.
2019-08-22 10:20:01 +01:00
Nick Clifton 722a298cca Remove test files for a different patch accidentally committed with patch for ARM CPU additions. 2019-08-20 17:33:44 +01:00
Dennis Zhang 546053acfa Adds support for following CPUs to the ARM and Aarch64 assemblers: Cortex-A77, Cortex-A76AE, Cortex-A34, Cortex-A65, and Cortex-A65AE.
Related specifications can be found at
https://developer.arm.com/ip-products/processors.

gas	* NEWS: Mention the Arm and AArch64 new processors.
	* config/tc-aarch64.c: New entries for Cortex-A34, Cortex-A65,
	Cortex-A77, cortex-A65AE, and Cortex-A76AE.
	* doc/c-aarch64.texi: Document new CPUs.
	* testsuite/gas/aarch64/cpu-cortex-a34.d: New test.
	* testsuite/gas/aarch64/cpu-cortex-a65.d: New test.
	* testsuite/gas/aarch64/cpu-cortex-a65ae.d: New test.
	* testsuite/gas/aarch64/cpu-cortex-a76ae.d: New test.
	* testsuite/gas/aarch64/cpu-cortex-a77.d: New test.
	* testsuite/gas/aarch64/nop-asm.s: New test.

bfd	* cpu-aarch64.c: New entries for Cortex-A34, Cortex-A65,
	 Cortex-A77, cortex-A65AE, and Cortex-A76AE.
2019-08-20 17:13:29 +01:00
Faraz Shahbazker 5203173819 MIPS/gas: Fix misaligned address errors to disregard ISA mode bit
gas/
	* config/tc-mips.c (fix_bad_misaligned_address): New function.
	(fix_validate_branch): Call fix_bad_misaligned address_to
	calculate the target address.
	(md_apply_fix): Likewise.
	(md_convert_frag): Update misaligned address calculation to
	disregard ISA mode bit.
2019-08-19 13:43:51 -07:00
Faraz Shahbazker 770c015139 MIPS/gas: Retain ISA mode bit for labels with .insn annotation
gas/
	* config/tc-mips.c (mips_move_labels): Retain ISA mode bit
	when moving labels in text segments.
	(mips_align): Indicate text mode when aligning labels in
	text segments.
	* gas/testsuite/gas/mips/insn-isa-mode.d: New test.
	* gas/testsuite/gas/mips/insn-isa-mode.s: New test source.
	* gas/testsuite/gas/mips/mips.exp: Run the new test.
2019-08-19 13:43:50 -07:00
Barnaby Wilks 72c03e30ae Float16: Fix test failures for non ELF targets
The tests were failing due to md_atof trying to do word-wise endian
switching on the float16 (for little-endian targets sometimes
multi word values have their word order changed).
However since a float16 is only 1 word wide, it would end up writing
incorrect data, as you cannot switch the word order of just one word.

	* config/tc-arm.c (md_atof): Add precision check.  Formatting.
2019-08-19 09:53:22 +09:30
Nick Clifton 6485977b89 Updatesd Swdish translation for the gas sub-directory.
* po/sv.po: Updated Swedish translation.
2019-08-15 12:41:24 +01:00
Srinath Parvathaneni 08132bdd87 Modify the ARM encoding and decoding of SQRSHRL and UQRSHLL MVE instructions.
This is a change to the first published specifications [1][a] but since there is no hardware
out there that uses the old instructions we do not want to support the old variant.
This changes are done based on the latest published specifications [1][b].

[1] https://developer.arm.com/architectures/cpu-architecture/m-profile/docs/ddi0553/latest/armv81-m-architecture-reference-manual
    [a] version bf
    [b] version bh

gas	* config/tc-arm.c (enum operand_parse_code): Add the entry OP_I48_I64.
	(po_imm1_or_imm2_or_fail): Marco to check the immediate is either of
        48 or 64.
	(parse_operands): Add case OP_I48_I64.
	(do_mve_scalar_shift1): Add function to encode the MVE shift
        instructions with 4 arguments.
	* testsuite/gas/arm/mve-shift-bad.l: Modify.
	* testsuite/gas/arm/mve-shift-bad.s: Likewise.
	* testsuite/gas/arm/mve-shift.d: Likewise.
	* testsuite/gas/arm/mve-shift.s: Likewise.

opcodes	* arm-dis.c (struct mopcode32 mve_opcodes): Modify the mask for
	cases MVE_SQRSHRL and MVE_UQRSHLL.
	(print_insn_mve): Add case for specifier 'k' to check
	specific bit of the instruction.
2019-08-12 17:17:18 +01:00
Barnaby Wilks 5312fe52e9 Add generic and ARM specific support for half-precision IEEE 754 floating point numbers to the assembler.
Half precision floating point numbers will be encoded using the IEEE 754
half precision floating point format - 16 bits in total, 1 for sign, 5
for exponent and 10 bits of  mantissa.

This patch implements the float16 directive for both the IEEE 754 format
and the Arm alternative format for the Arm backend.

The syntax of the directive is:

  .float16 <0-n decimal numbers>
e.g.
  .float16 12.0
  .float16 0.23, 433.1, 0.06

The Arm alternative format is almost identical to the IEEE 754 format,
except that it doesn't encode for NaNs or Infinity (instead an exponent
of 0x1F represents a normalized number in the range 65536 to 131008).

The alternative format is documented in the reference manual:

  https://static.docs.arm.com/ddi0487/db/DDI0487D_b_armv8_arm.pdf?_ga=2.72318806.49764181.1561632697-999473562.1560847439

Which format is used is controlled by the .float16_format <format>
directive, where if <format> = ieee, then use the IEEE 754
half-precision format else if <format> = alternative, then use the
Arm alternative format

Or the format can be set on the command line via the -mfp16-format
option that has a similar syntax.  -mfp16-format=<ieee|alternative>.
This also fixes the format and it cannot be changed by any directives.

Once the format has been set (either by the command line option or a directive) it cannot be changed,
and any attempts to change it (i.e. with the float16_format directive) will result in a warning and the
line being ignored.

For ELF targets the appropriate EABI attribute will be written out at the end of assembling
if the format has been explicitly specified. If no format has been explicitly specified then no
EABI attributes will be written.

If the format is not explicitly specified then any float16 directives are encoding using the IEEE 754-2008
format by default until the format is fixed or changed with the float16_format directive.

gas	* config/tc-arm.c (enum fp_16bit_format): Add enum to represent the 2 float16 encodings.
	(md_atof): Set precision for float16 type.
	(arm_is_largest_exponent_ok): Check for whether to encode with the IEEE or alternative
	format.
	(set_fp16_format): Parse a float16_format directive.
	(arm_parse_fp16_opt): Parse the fp16-format command line option.
	(aeabi_set_public_attributes): For ELF encode the FP16 format EABI attribute.
	* config/tc-arm.h (TC_LARGEST_EXPONENT_IS_NORMAL): Macro that expands to
	arm_is_largest_exponent_ok.
	(arm_is_largest_exponent_ok): Add prototype for arm_is_largest_exponent_ok function.
	* doc/c-arm.texi: Add documentation for .float16, .float16_format and -mfp16-format=
	* testsuite/gas/arm/float16-bad.d: New test.
	* testsuite/gas/arm/float16-bad.l: New test.
	* testsuite/gas/arm/float16-bad.s: New test.
	* testsuite/gas/arm/float16-be.d: New test.
	* testsuite/gas/arm/float16-format-bad.d: New test.
	* testsuite/gas/arm/float16-format-bad.l: New test.
	* testsuite/gas/arm/float16-format-bad.s: New test.
	* testsuite/gas/arm/float16-format-opt-bad.d: New test.
	* testsuite/gas/arm/float16-format-opt-bad.l: New test.
	* testsuite/gas/arm/float16-le.d: New test.
	* testsuite/gas/arm/float16.s: New test.
	* testsuite/gas/arm/float16-eabi-alternative-format.d: New test.
	* testsuite/gas/arm/float16-eabi-ieee-format.d: New test.
	* testsuite/gas/arm/float16-eabi-no-format.d: New test.
	* testsuite/gas/arm/float16-eabi.s: New test.

	* config/atof-ieee.c (H_PRECISION): Macro for precision of float16
	type.
	(atof_ieee): Set precision and exponent bits for encoding float16
	types.
	(gen_to_words): NaN and Infinity encoding for float16.
	(ieee_md_atof): Set precision for encoding float16 type.
2019-08-12 11:08:36 +01:00
Alan Modra 9bb9c115cd PR24851, gas/testsuite/gas/epiphany/badrelax.s failure with MALLOC_PERTURB_=1
PR 24851
	* config/tc-epiphany.c (md_estimate_size_before_relax): Clear
	extra opcode bytes when changing from a 2-byte to a 4-byte insn.
2019-08-12 13:10:48 +09:30
Jan Beulich 678581fc78 x86-64: generalize SIMD test expectations
In order to be able to add/remove insns to/from the middle of these
tests, generalize the patterns for the symbol reference comments of RIP-
relative operands.
2019-08-09 09:57:57 +02:00
Nick Clifton dbe15e4e1d Change the output of readelf's note display so that the "Data size" column header is left justified.
PR 24887
binutils* readelf.c (process_notes_at): Left justify the "Data size"
	column heading.
	* testsuite/binutils-all/i386/empty.d: Adjust for new output format.
	* testsuite/binutils-all/i386/ibt.d: Likewise.
	* testsuite/binutils-all/i386/pr21231a.d: Likewise.
	* testsuite/binutils-all/i386/pr21231b.d: Likewise.
	* testsuite/binutils-all/i386/shstk.d: Likewise.
	* testsuite/binutils-all/note-2-32.d: Likewise.
	* testsuite/binutils-all/note-2-64.d: Likewise.
	* testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/empty.d: Likewise.
	* testsuite/binutils-all/x86-64/ibt-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/ibt.d: Likewise.
	* testsuite/binutils-all/x86-64/pr21231a.d: Likewise.
	* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
	* testsuite/binutils-all/x86-64/shstk-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/shstk.d: Likewise.

ld	* testsuite/ld-aarch64/bti-plt-2.d: Adjust for new output format
	from readelf.
	* testsuite/ld-aarch64/bti-plt-4.d: Likewise.
	* testsuite/ld-aarch64/bti-plt-6.d: Likewise.
	* testsuite/ld-aarch64/bti-plt-7.d: Likewise.
	* testsuite/ld-aarch64/bti-warn.d: Likewise.
	* testsuite/ld-aarch64/property-bti-pac1.d: Likewise.
	* testsuite/ld-aarch64/property-bti-pac2.d: Likewise.
	* testsuite/ld-aarch64/property-bti-pac3.d: Likewise.
	* testsuite/ld-elf/x86-feature-1a.rd: Likewise.
	* testsuite/ld-elf/x86-feature-1b.rd: Likewise.
	* testsuite/ld-elf/x86-feature-1c.rd: Likewise.
	* testsuite/ld-elf/x86-feature-1d.rd: Likewise.
	* testsuite/ld-elf/x86-feature-1e.rd: Likewise.
	* testsuite/ld-i386/ibt-plt-2d.d: Likewise.
	* testsuite/ld-i386/ibt-plt-3d.d: Likewise.
	* testsuite/ld-i386/pr23372a.d: Likewise.
	* testsuite/ld-i386/pr23372c.d: Likewise.
	* testsuite/ld-i386/pr23486a.d: Likewise.
	* testsuite/ld-i386/pr23486b.d: Likewise.
	* testsuite/ld-i386/pr23486c.d: Likewise.
	* testsuite/ld-i386/pr23486d.d: Likewise.
	* testsuite/ld-i386/pr24322a.d: Likewise.
	* testsuite/ld-i386/pr24322b.d: Likewise.
	* testsuite/ld-i386/property-x86-3.d: Likewise.
	* testsuite/ld-i386/property-x86-4a.d: Likewise.
	* testsuite/ld-i386/property-x86-5.d: Likewise.
	* testsuite/ld-i386/property-x86-cet1.d: Likewise.
	* testsuite/ld-i386/property-x86-cet2a.d: Likewise.
	* testsuite/ld-i386/property-x86-cet5a.d: Likewise.
	* testsuite/ld-i386/property-x86-cet5b.d: Likewise.
	* testsuite/ld-i386/property-x86-ibt1a.d: Likewise.
	* testsuite/ld-i386/property-x86-ibt1b.d: Likewise.
	* testsuite/ld-i386/property-x86-ibt2.d: Likewise.
	* testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
	* testsuite/ld-i386/property-x86-ibt3b.d: Likewise.
	* testsuite/ld-i386/property-x86-ibt4.d: Likewise.
	* testsuite/ld-i386/property-x86-ibt5.d: Likewise.
	* testsuite/ld-i386/property-x86-shstk1a.d: Likewise.
	* testsuite/ld-i386/property-x86-shstk1b.d: Likewise.
	* testsuite/ld-i386/property-x86-shstk2.d: Likewise.
	* testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
	* testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
	* testsuite/ld-i386/property-x86-shstk4.d: Likewise.
	* testsuite/ld-i386/property-x86-shstk5.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2d.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3d.d: Likewise.
	* testsuite/ld-x86-64/pr23372a-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372a.d: Likewise.
	* testsuite/ld-x86-64/pr23372c-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372c.d: Likewise.
	* testsuite/ld-x86-64/pr23486a-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23486a.d: Likewise.
	* testsuite/ld-x86-64/pr23486b-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23486b.d: Likewise.
	* testsuite/ld-x86-64/pr23486c-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23486c.d: Likewise.
	* testsuite/ld-x86-64/pr23486d-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23486d.d: Likewise.
	* testsuite/ld-x86-64/pr24322a-x32.d: Likewise.
	* testsuite/ld-x86-64/pr24322a.d: Likewise.
	* testsuite/ld-x86-64/pr24322b-x32.d: Likewise.
	* testsuite/ld-x86-64/pr24322b.d: Likewise.
	* testsuite/ld-x86-64/pr24458a-x32.d: Likewise.
	* testsuite/ld-x86-64/pr24458a.d: Likewise.
	* testsuite/ld-x86-64/pr24458b-x32.d: Likewise.
	* testsuite/ld-x86-64/pr24458b.d: Likewise.
	* testsuite/ld-x86-64/pr24458c-x32.d: Likewise.
	* testsuite/ld-x86-64/pr24458c.d: Likewise.
	* testsuite/ld-x86-64/property-1.r: Likewise.
	* testsuite/ld-x86-64/property-1a.r: Likewise.
	* testsuite/ld-x86-64/property-2.r: Likewise.
	* testsuite/ld-x86-64/property-2a.r: Likewise.
	* testsuite/ld-x86-64/property-3.r: Likewise.
	* testsuite/ld-x86-64/property-3a.r: Likewise.
	* testsuite/ld-x86-64/property-4.r: Likewise.
	* testsuite/ld-x86-64/property-4a.r: Likewise.
	* testsuite/ld-x86-64/property-5.r: Likewise.
	* testsuite/ld-x86-64/property-5a.r: Likewise.
	* testsuite/ld-x86-64/property-6.r: Likewise.
	* testsuite/ld-x86-64/property-7.r: Likewise.
	* testsuite/ld-x86-64/property-7a.r: Likewise.
	* testsuite/ld-x86-64/property-x86-3-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-3.d: Likewise.
	* testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-4a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-5-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-5.d: Likewise.
	* testsuite/ld-x86-64/property-x86-cet1-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-cet1.d: Likewise.
	* testsuite/ld-x86-64/property-x86-cet2a-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-cet2a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-cet5a-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-cet5a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-cet5b-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-cet5b.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt1a-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt1a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt1b-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt1b.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt2-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt2.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt4-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt4.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt5-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-ibt5.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk1a-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk1a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk1b-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk1b.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk2-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk2.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk4-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk4.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk5-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-shstk5.d: Likewise.

gas	* testsuite/gas/i386/property-1.d: Adjust for new output format
	from readelf.
	* testsuite/gas/i386/property-2.d: Likewise.
	* testsuite/gas/i386/x86-64-property-1.d: Likewise.
	* testsuite/gas/i386/x86-64-property-2.d: Likewise.
2019-08-08 17:04:31 +01:00
Yoshinori Sato 7b1dd70105 Update the handling of shift rotate and load/store multiple instructions in the H8300 assembler.
incldue	* opcode/h8300.h (EXPAND_UNOP_EXTENDED_B): Add MODEL.
	(EXPAND_UNOP_EXTENDED_W): Likewise.
	(EXPAND_UNOP_EXTENDED_L): Likewise.
	(struct h8_opcode h8_opcodes): Likewise.
	(struct h8_opcode h8_opcodes): tas / ldm / stm supported H8S or
	later.
2019-08-08 13:59:17 +01:00
Yoshinori Sato 8fb49c3c71 Move the h8300 assembler's MOVFPE and MOVTPE tests to the correct location.
* gas/testsuite/gas/h8300/h8300.exp: Fix movfpe and movtpe tests.
	* gas/testsuite/gas/h8300/misc.s: Likewise.
	* gas/testsuite/gas/h8300/misch.s: Likewise.
	* gas/testsuite/gas/h8300/miscs.s: Likewise.
2019-08-08 13:43:13 +01:00
Barnaby Wilks 23d188c74e Removes support in the ARM assembler for the unsigned variants of the VQ(R)DMLAH and VQ(R)DMLASH MVE instructions.
Previously GAS would accept .u32, .u16 and .u8 suffixes to the VQ(R)DMLAH and VQ(R)DMLASH
instructions, however the Armv8.1-M Mainline specification states that these functions only
have signed variations (.s32, .s16 and .s8 suffixes).
This is documented here:
https://static.docs.arm.com/ddi0553/bh/DDI0553B_h_armv8m_arm.pdf?_ga=2.143079093.1892401233.1563295591-999473562.1560847439#page=1183

gas	* config/tc-arm.c (do_mve_vqdmlah): Use N_S_32 macro.
	(do_neon_qrdmlah): Use N_S_32 macro.
	* testsuite/gas/arm/mve-vqdmlah-bad.d: New test.
	* testsuite/gas/arm/mve-vqdmlah-bad.l: New test.
	* testsuite/gas/arm/mve-vqdmlah-bad.s: New test.
	* testsuite/gas/arm/mve-vqdmlah.d: Remove unsigned instruction tests.
	* testsuite/gas/arm/mve-vqdmlah.s: Remove unsigned instruction tests.
	* testsuite/gas/arm/mve-vqdmlash-bad.d: New test.
	* testsuite/gas/arm/mve-vqdmlash-bad.l: New test.
	* testsuite/gas/arm/mve-vqdmlash-bad.s: New test.
	* testsuite/gas/arm/mve-vqdmlash.d: Remove unsigned instruction tests.
	* testsuite/gas/arm/mve-vqdmlash.s: Remove unsigned instruction tests.

opcodes	* arm-dis.c: Only accept signed variants of VQ(R)DMLAH and VQ(R)DMLASH
	instructions.
2019-08-05 12:43:38 +01:00
Jim Wilson c0d6f62fce RISC-V: Fix minor issues with FP csr instructions.
Mel Chen <mel.chen@sifive.com>
	gas/
	* testsuite/gas/riscv/alias-csr.s: Add testcase for CSR-access
	alias instructions.
	* testsuite/gas/riscv/no-aliases-csr.d: Run testcase alias-csr.s with
	-Mno-aliases.
	* testsuite/gas/riscv/alias-csr.d: Run testcase alias-csr.s.
	* testsuite/gas/riscv/priv-reg.d: Update.
	opcodes/
	* riscv-opc.c (riscv_opcodes): Set frsr, fssr, frcsr, fscsr, frrm,
	fsrm, fsrmi, frflags, fsflags, fsflagsi to alias instructions.
	* riscv-opc.c (riscv_opcodes): Adjust order of frsr, frcsr, fssr,
	fscsr.
2019-07-30 14:42:16 -07:00
Nick Clifton dac6552d4a Update the Swedish translation for the gas sub-directory. 2019-07-24 15:21:24 +01:00
Claudiu Zissulescu 0f3f71676a [ARC] Update disassembler opcode selection
New instruction are added, and some of them are overlapping. Update
disassembler to correctly recognize them. Introduce nps400 option.

opcodes/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-dis.c (skip_this_opcode): Check also for 0x07 major opcodes,
	and MPY class instructions.
	(parse_option): Add nps400 option.
	(print_arc_disassembler_options): Add nps400 info.

gas/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/nps400-6.d: Update test.
2019-07-24 16:52:23 +03:00
Alan Modra cc364be6ff Complain about mbind, ifunc, and unique in final_write
It's not as good as complaining in gas/config/obj-elf.c since you lose
any reference to the source file.

bfd/
	* elf-bfd.h (struct elf_backend_data): Return bfd_boolean from
	elf_backend_final_write_processing, don't pass linker arg.
	(_bfd_elf_final_write_processing): Update prototype.
	* elf.c (_bfd_elf_write_object_contents): Adjust call.
	(_bfd_elf_final_write_processing): Return error on incompatible
	OSABI and has_gnu_osabi.  Remove linker arg.
	* elf-nacl.h (nacl_final_write_processing): Update prototype.
	* elf-vxworks.h (elf_vxworks_final_write_processing): Likewise.
	* elfxx-mips.h (_bfd_mips_final_write_processing): Likewise.
	(_bfd_mips_elf_final_write_processing): Likewise.
	* elf-hppa.h (elf_hppa_final_write_processing): Return status
	and remove linker arg.
	* elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise.
	* elf-nacl.c (nacl_final_write_processing): Likewise.
	* elf-vxworks.c (elf_vxworks_final_write_processing): Likewise.
	* elf32-arc.c (arc_elf_final_write_processing): Likewise.
	* elf32-arm.c (arm_final_write_processing): Likewise.
	(elf32_arm_final_write_processing): Likewise.
	(elf32_arm_nacl_final_write_processing): Likewise.
	(elf32_arm_vxworks_final_write_processing): Likewise.
	* elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise.
	* elf32-bfin.c (elf32_bfin_final_write_processing): Likewise.
	* elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise.
	* elf32-cris.c (cris_elf_final_write_processing): Likewise.
	* elf32-h8300.c (elf32_h8_final_write_processing): Likewise.
	* elf32-lm32.c (lm32_elf_final_write_processing): Likewise.
	* elf32-m32r.c (m32r_elf_final_write_processing): Likewise.
	* elf32-m68k.c (elf_m68k_final_write_processing): Likewise.
	* elf32-mips.c (mips_vxworks_final_write_processing): Likewise.
	* elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise.
	* elf32-nds32.c (nds32_elf_final_write_processing): Likewise.
	* elf32-or1k.c (or1k_elf_final_write_processing): Likewise.
	* elf32-pj.c (pj_elf_final_write_processing): Likewise.
	* elf32-ppc.c (ppc_final_write_processing): Likewise.
	(ppc_elf_final_write_processing): Likewise.
	(ppc_elf_vxworks_final_write_processing): Likewise.
	* elf32-sparc.c (sparc_final_write_processing): Likewise.
	(elf32_sparc_final_write_processing): Likewise.
	(elf32_sparc_vxworks_final_write_processing): Likewise.
	* elf32-v850.c (v850_elf_final_write_processing): Likewise.
	* elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise.
	* elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise.
	* elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise.
	* elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise.
	* elfxx-mips.c (_bfd_mips_final_write_processing): Likewise.
	(_bfd_mips_elf_final_write_processing): Likewise.
gas/
	* config/obj-elf.c (obj_elf_section, obj_elf_type): Set has_gnu_osabi.
	* testsuite/gas/elf/section12a.d: Update xfails.
	* testsuite/gas/elf/section12b.d: Likewise.
2019-07-24 16:12:02 +09:30
Alan Modra 7613ca5e38 Define ELF_OSABI for visium
and update expected results for gas mbind tests.

bfd/
	* elf32-visium.c (visium_elf_post_process_headers): Don't set
	EI_OSABI header byte here.
	(ELF_OSABI): Define.
gas/
	* testsuite/gas/elf/section12a.d: xfail visium and cloudabi.
	* testsuite/gas/elf/section12b.d: Likewise.
	* testsuite/gas/elf/section13.d: Likewise.
2019-07-24 16:12:01 +09:30
Kyrylo Tkachov a028026d2f [AArch64] Add support for GMID_EL1 register for +memtag
We're missing support for the GMID_EL1 system register from the Memory Tagging Extension in binutils.
This is specified at:
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/gmid_el1

This simple patch adds the support for this read-only register.
Tested make check on gas.
2019-07-23 15:54:54 +01:00
Alan Modra df3a023bd6 SHF_GNU_MBIND requires ELFOSABI_GNU
When SHF_GNU_MBIND was added in the SHF_LOOS to SHF_HIOS range, it
should have required ELFOSABI_GNU since these flags are already in use
by other OSes.  HPUX SHF_HP_TLS in fact has the same value.  That
means no place in binutils should test SHF_GNU_MBIND without first
checking OSABI, and SHF_GNU_MBIND should not be set without also
setting OSABI.  At least, that's the ideal, but the patch accepts
SHF_GNU_MBIND on ELFOSABI_NONE object files since gas didn't always
set OSABI.  However, to reinforce the fact that SHF_GNU_MBIND isn't
proper without a non-zero OSABI, readelf will display the flag as
LOOS+0 if OSABI isn't set.

The clash with SHF_HP_TLS means that hppa64-linux either has that flag
on .tbss sections or supports GNU_MBIND, not both.  (hppa64-linux
users, if there are any, may have noticed that GNU ld since 2017
mysteriously aligned their .tbss sections to a 4k boundary.  That was
one consequence of SHF_HP_TLS being blindly interpreted as
SHF_GNU_MBIND.)  Since it seems that binutils, gdb, gcc, glibc, and
the linux kernel don't care about SHF_HP_TLS I took that flag out of
.tbss for hppa64-linux.

bfd/
	* elf-bfd.h (enum elf_gnu_osabi): Add elf_gnu_osabi_mbind.
	* elf.c (_bfd_elf_make_section_from_shdr): Set elf_gnu_osabi_mbind.
	(get_program_header_size): Formatting.  Only test SH_GNU_MBIND
	when elf_gnu_osabi_mbind is set.
	(_bfd_elf_map_sections_to_segments): Likewise.
	(_bfd_elf_init_private_section_data): Likewise.
	(_bfd_elf_final_write_processing): Update comment.
	* elf64-hppa.c (elf64_hppa_special_sections): Move .tbss entry.
	(elf_backend_special_sections): Define without .tbss for linux.
binutils/
	* readelf.c (get_parisc_segment_type): Split off hpux entries..
	(get_ia64_segment_type): ..and these..
	(get_hpux_segment_type): ..to here.
	(get_segment_type): Condition GNU_MBIND on osabi.  Use
	get_hpux_segment_type.
	(get_symbol_binding): Do not print UNIQUE for ELFOSABI_NONE.
	(get_symbol_type): Do not print IFUNC for ELFOSABI_NONE.
gas/
	* config/obj-elf.c (obj_elf_change_section): Don't emit a fatal
	error for non-SHF_ALLOC SHF_GNU_MBIND here.
	(obj_elf_parse_section_letters): Return SHF_GNU_MBIND in new
	gnu_attr param.
	(obj_elf_section): Adjust obj_elf_parse_section_letters call.
	Formatting.  Set SHF_GNU_MBIND and elf_osabi from gnu_attr.
	Emit normal error for non-SHF_ALLOC SHF_GNU_MBIND and wrong osabi.
	(obj_elf_type): Set elf_osabi for ifunc.
	* testsuite/gas/elf/section12a.d: xfail msp430 and hpux.
	* testsuite/gas/elf/section12b.d: Likewise.
	* testsuite/gas/elf/section13.d: Likewise.
	* testsuite/gas/elf/section13.l: Adjust expected error.
ld/
	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Condition
	SHF_GNU_MBIND on osabi.  Set output elf_gnu_osabi_mbind.
2019-07-23 18:22:02 +09:30
Alan Modra 89ebb345e7 gas "mbind sections" test
Doesn't fail on rx-elf

	* testsuite/gas/elf/section12a.d: Don't skip for rx.
2019-07-23 18:22:01 +09:30
Barnaby Wilks 236ab0c60c This patch addresses the change in the June Armv8.1-M Mainline specification, that marks certain MVE instructions as no longer UNPREDICTABLE when a source operand is the same as a destination operand for a 32-bit element size.
The instructions that this change apply to are:

  VQDMLADH, VQRDMLADH, VQDMLSDH, VQRDMLSDH

The updated documentation is here: https://static.docs.arm.com/ddi0553/bh/DDI0553B_h_armv8m_arm.pdf

Fixed this by removing the check for this warning from GAS as well as opcodes.

Added testcases to test that the warning is not generated for the instructions that have a 32-bit element size
and the same source and destination operand. Also fixed tests that would previously check for this warning.

gas	* config/tc-arm.c (do_mve_vqdmladh): Remove check for UNPREDICTABLE.
	* testsuite/gas/arm/mve-vqdmladh-bad.l: Remove tests.
	* testsuite/gas/arm/mve-vqdmladh-bad.s: Remove tests.
	* testsuite/gas/arm/mve-vqdmladh.d: New tests.
	* testsuite/gas/arm/mve-vqdmladh.s: New tests.
	* testsuite/gas/arm/mve-vqdmlsdh-bad.l: Remove tests.
	* testsuite/gas/arm/mve-vqdmlsdh-bad.s: Remove tests.
	* testsuite/gas/arm/mve-vqdmlsdh.d: New tests.
	* testsuite/gas/arm/mve-vqdmlsdh.s: New tests.

opcodes	* arm-dis.c (is_mve_unpredictable): Stop marking some MVE
	instructions as UNPREDICTABLE.
2019-07-22 13:18:27 +01:00
H.J. Lu ec38ac465d x86: Pass -O0 to assembler in noextreg.d
* testsuite/gas/i386/noextreg.d: Pass -O0 to assembler.
2019-07-19 11:07:59 -07:00
Jose E. Marchesi 231097b03a cpu,opcodes,gas: use %r0 and %r6 instead of %a and %ctf in eBPF disassembler
This patch changes the eBPF CPU description to prefer the register
names %r0 and %r6 instead of %a and %ctx when disassembling.  This
matches better with the current practice, vs. cBPF.

It also updates the GAS tests in order to reflect this change.
Tested in a x86_64 host.

cpu/ChangeLog:

2019-07-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* bpf.cpu (h-gpr): when disassembling, use %r0 and %r6 instead of
	%a and %ctx.

opcodes/ChangeLog:

2019-07-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* bpf-desc.c: Regenerated.

gas/ChangeLog:

2019-07-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* testsuite/gas/bpf/alu.d: Use %r6 instead of %ctx.
	* testsuite/gas/bpf/lddw-be.d: Likewise.
	* testsuite/gas/bpf/lddw.d: Likewise.
	* testsuite/gas/bpf/alu-be.d: Likewise.
	* testsuite/gas/bpf/alu32.d: Likewise.
2019-07-19 15:35:43 +02:00
Jose E. Marchesi 1802aae844 gas: make .lcomm to accept an optional aligmnet in eBPF targets
Tested in a x86_64 host.

gas/ChangeLog:

2019-07-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-bpf.c (pe_lcomm_internal): Adapted from tc-i386.c.
	(pe_lcomm): Likewise.
	(md_pseudo_table): Use pe_lcomm to implement .lcomm.
2019-07-19 15:35:02 +02:00
Richard Sandiford ccbdd22fb9 [AArch64] Rename +bitperm to +sve2-bitperm
After some discussion, we've decided to rename the +bitperm feature
flag to +sve2-bitperm, so that it's consistent with the other SVE2
feature flags.  The associated internal macros already used
"SVE2_BITPERM", so only the feature flag itself needs to change.

2019-07-19  Richard Sandiford  <richard.sandiford@arm.com>

gas/
	* doc/c-aarch64.texi: Remame the +bitperm extension to +sve2-bitperm.
	* config/tc-aarch64.c (aarch64_features): Likewise.
	* testsuite/gas/aarch64/illegal-sve2-aes.d: Update accordingly.
	* testsuite/gas/aarch64/illegal-sve2-sha3.d: Likewise.
	* testsuite/gas/aarch64/illegal-sve2-sm4.d: Likewise.
	* testsuite/gas/aarch64/illegal-sve2.d: Likewise.
	* testsuite/gas/aarch64/sve2.d: Likewise.
2019-07-19 12:18:02 +01:00
Alan Modra c213164ad2 [PowerPC64] pc-relative TLS relocations
This patch supports using pcrel instructions in TLS code sequences.  A
number of new relocations are needed, gas operand modifiers to
generate those relocations, and new TLS optimisation.  For
optimisation it turns out that the new pcrel GD and LD sequences can
be distinguished from the non-pcrel GD and LD sequences by there being
different relocations on the new sequence.  The final "add ra,rb,13"
on IE sequences similarly needs a new relocation, or as I chose, a
modification of R_PPC64_TLS.  On pcrel IE code, the R_PPC64_TLS points
one byte into the "add" instruction rather than being on the
instruction boundary.

GD:
 pla 3,z@got@tlsgd@pcrel	  # R_PPC64_GOT_TLSGD34
 bl __tls_get_addr@notoc(z@tlsgd) # R_PPC64_TLSGD and R_PPC64_REL24_NOTOC
  edited to IE
   pld 3,z@got@tprel@pcrel
   add 3,3,13
  edited to LE
   paddi 3,13,z@tprel
   nop

LD:
 pla 3,z@got@tlsld@pcrel	  # R_PPC64_GOT_TLSLD34
 bl __tls_get_addr@notoc(z@tlsld) # R_PPC64_TLSLD and R_PPC64_REL24_NOTOC
 ..
 paddi 9,3,z2@dtprel
 pld 10,z3@got@dtprel@pcrel
 add 10,10,3
  edited to LE
   paddi 3,13,0x1000
   nop

IE:
 pld 9,z@got@tprel@pcrel	  # R_PPC64_GOT_TPREL34
 add 3,9,z@tls@pcrel		  # R_PPC64_TLS at insn+1
 ldx 4,9,z@tls@pcrel
 lwax 5,9,z@tls@pcrel
 stdx 5,9,z@tls@pcrel
  edited to LE
  paddi 9,13,z@tprel
  nop
  ld 4,0(9)
  lwa 5,0(9)
  std 5,0(9)

LE:
 paddi 10,13,z@tprel

include/
	* elf/ppc64.h (R_PPC64_TPREL34, R_PPC64_DTPREL34),
	(R_PPC64_GOT_TLSGD34, R_PPC64_GOT_TLSLD34),
	(R_PPC64_GOT_TPREL34, R_PPC64_GOT_DTPREL34): Define.
	(IS_PPC64_TLS_RELOC): Include new tls relocs.
bfd/
	* reloc.c (BFD_RELOC_PPC64_TPREL34, BFD_RELOC_PPC64_DTPREL34),
	(BFD_RELOC_PPC64_GOT_TLSGD34, BFD_RELOC_PPC64_GOT_TLSLD34),
	(BFD_RELOC_PPC64_GOT_TPREL34, BFD_RELOC_PPC64_GOT_DTPREL34),
	(BFD_RELOC_PPC64_TLS_PCREL): New pcrel tls relocs.
	* elf64-ppc.c (ppc64_elf_howto_raw): Add howtos for pcrel tls relocs.
	(ppc64_elf_reloc_type_lookup): Translate pcrel tls relocs.
	(must_be_dyn_reloc, dec_dynrel_count): Add R_PPC64_TPREL64.
	(ppc64_elf_check_relocs): Support pcrel tls relocs.
	(ppc64_elf_tls_optimize, ppc64_elf_relocate_section): Likewise.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
gas/
	* config/tc-ppc.c (ppc_elf_suffix): Map "tls@pcrel", "got@tlsgd@pcrel",
	"got@tlsld@pcrel", "got@tprel@pcrel", and "got@dtprel@pcrel".
	(fixup_size, md_assemble): Handle pcrel tls relocs.
	(ppc_force_relocation, ppc_fix_adjustable): Likewise.
	(md_apply_fix, tc_gen_reloc): Likewise.
ld/
	* testsuite/ld-powerpc/tlsgd.d,
	* testsuite/ld-powerpc/tlsgd.s,
	* testsuite/ld-powerpc/tlsie.d,
	* testsuite/ld-powerpc/tlsie.s,
	* testsuite/ld-powerpc/tlsld.d,
	* testsuite/ld-powerpc/tlsld.s: New tests.
	* testsuite/ld-powerpc/powerpc.exp: Run them.
2019-07-19 18:01:25 +09:30
Jose E. Marchesi d0044bac9e gas: .lcomm gets an alignment argument in eBPF
gas/ChangeLog:

2019-07-17  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-bpf.c: Make .lcomm to get a third argument with the
	alignment.
2019-07-18 13:12:33 +02:00
Jose E. Marchesi e0b989a6d7 gas: support .half, .word and .dword directives in eBPF
This little patch adds support to the eBPF port of GAS for a few data
directives.  The names for the directives have been chosen to be
coherent with the suffixes used in eBPF instructions: b, h, w and dw
for 8, 16, 32 and 64-bit values respectively.

Documentation and tests included.
Tested in a x86_64 host.

gas/ChangeLog:

2019-07-17  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-bpf.c (md_pseudo_table): .half, .word and .dword.
	* testsuite/gas/bpf/data.s: New file.
	* testsuite/gas/bpf/data.d: Likewise.
	* testsuite/gas/bpf/data-be.d: Likewise.
	* testsuite/gas/bpf/bpf.exp: Run data and data-be.
	* doc/c-bpf.texi (BPF Directives): New section.
2019-07-17 22:57:23 +02:00