Commit Graph

9855 Commits

Author SHA1 Message Date
H.J. Lu
6915020bb1 gas: Reuse the input file entry in the file table
Some instructions can be emitted (dwarf2_emit_insn is called) before the
first .file <NUMBER> directive has been seen, which allocates the input
file as the first file entry.  Reuse the input file entry in the file
table.

	PR gas/25878
	PR gas/26740
	* dwarf2dbg.c (file_entry): Remove auto_assigned.
	(assign_file_to_slot): Remove the auto_assign argument.
	(allocate_filenum): Updated.
	(allocate_filename_to_slot): Reuse the input file entry in the
	file table.
	(dwarf2_where): Replace as_where with as_where_physical.
	* testsuite/gas/i386/dwarf5-line-1.d: New file.
	* testsuite/gas/i386/dwarf5-line-1.s: Likewise.
	* testsuite/gas/i386/i386.exp: Run dwarf5-line-1.
2020-10-16 04:07:59 -07:00
Cui,Lili
5739259879 Enhancement for avx-vnni patch
1. Rename CpuVEX_PREFIX to PseudoVexPrefix and
   move it from cpu_flags to opcode_modifiers.
2. Delete {vex2} invalid test.
3. Use VexW0 and VexVVVV in the AVX-VNNI instructions.

gas/
	* config/tc-i386.c: Move Pseudo Prefix check to match_template.
	* testsuite/gas/i386/avx-vnni-inval.l: New file.
	* testsuite/gas/i386/avx-vnni-inval.s: Likewise.
	* testsuite/gas/i386/avx-vnni.d: Delete invalid {vex2} test.
	* testsuite/gas/i386/avx-vnni.s: Likewise.
	* testsuite/gas/i386/i386.exp: Add AVX VNNI invalid tests.
	* testsuite/gas/i386/x86-64-avx-vnni-inval.l: New file.
	* testsuite/gas/i386/x86-64-avx-vnni-inval.s: Likewise.
	* testsuite/gas/i386/x86-64-avx-vnni.d: Delete invalid {vex2} test.
	* testsuite/gas/i386/x86-64-avx-vnni.s: Likewise.

opcodes/
	* i386-opc.tbl: Rename CpuVEX_PREFIX to PseudoVexPrefix
	and move it from cpu_flags to opcode_modifiers.
	Use VexW0 and VexVVVV in the AVX-VNNI instructions.
	* i386-gen.c: Likewise.
	* i386-opc.h: Likewise.
	* i386-opc.h: Likewise.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.
2020-10-16 11:37:09 +08:00
H.J. Lu
58bf9b6a7f x86: Support Intel AVX VNNI
Intel AVX VNNI instructions are marked with CpuVEX_PREFIX.  Without the
pseudo {vex} prefix, mnemonics of Intel VNNI instructions are encoded
with the EVEX prefix.  The pseudo {vex} prefix can be used to encode
mnemonics of Intel VNNI instructions with the VEX prefix.

gas/

	* NEWS: Add Intel AVX VNNI.
	* config/tc-i386.c (cpu_arch): Add .avx_vnni and noavx_vnni.
	(cpu_flags_match): Support CpuVEX_PREFIX.
	* doc/c-i386.texi: Document .avx_vnni, noavx_vnni and how to
	encode Intel VNNI instructions with VEX prefix.
	* testsuite/gas/i386/avx-vnni.d: New file.
	* testsuite/gas/i386/avx-vnni.s: Likewise.
	* testsuite/gas/i386/x86-64-avx-vnni.d: Likewise.
	* testsuite/gas/i386/x86-64-avx-vnni.s: Likewise.
	* testsuite/gas/i386/i386.exp: Run AVX VNNI tests.

opcodes/

	* i386-dis.c (PREFIX_VEX_0F3850): New.
	(PREFIX_VEX_0F3851): Likewise.
	(PREFIX_VEX_0F3852): Likewise.
	(PREFIX_VEX_0F3853): Likewise.
	(VEX_W_0F3850_P_2): Likewise.
	(VEX_W_0F3851_P_2): Likewise.
	(VEX_W_0F3852_P_2): Likewise.
	(VEX_W_0F3853_P_2): Likewise.
	(prefix_table): Add PREFIX_VEX_0F3850, PREFIX_VEX_0F3851,
	PREFIX_VEX_0F3852 and PREFIX_VEX_0F3853.
	(vex_table): Add VEX_W_0F3850_P_2, VEX_W_0F3851_P_2,
	VEX_W_0F3852_P_2 and VEX_W_0F3853_P_2.
	(putop): Add support for "XV" to print "{vex3}" pseudo prefix.
	* i386-gen.c (cpu_flag_init): Clear the CpuAVX_VNNI bit in
	CPU_UNKNOWN_FLAGS.  Add CPU_AVX_VNNI_FLAGS and
	CPU_ANY_AVX_VNNI_FLAGS.
	(cpu_flags): Add CpuAVX_VNNI and CpuVEX_PREFIX.
	* i386-opc.h (CpuAVX_VNNI): New.
	(CpuVEX_PREFIX): Likewise.
	(i386_cpu_flags): Add cpuavx_vnni and cpuvex_prefix.
	* i386-opc.tbl: Add Intel AVX VNNI instructions.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.
2020-10-14 05:02:31 -07:00
Lili Cui
c1fa250ae1 x86: Add support for Intel HRESET instruction
gas/

	* NEWS: Add Intel HRESET.
	* config/tc-i386.c (cpu_arch): Add .hreset.
	(cpu_noarch): Likewise.
	* doc/c-i386.texi: Document .hreset, nohreset.
	* testsuite/gas/i386/i386.exp: Run HRESET tests.
	* testsuite/gas/i386/hreset.d: New file.
	* testsuite/gas/i386/x86-64-hreset.d: Likewise.
	* testsuite/gas/i386/hreset.s: Likewise.

opcodes/

	* i386-dis.c (PREFIX_0F3A0F): New.
	(MOD_0F3A0F_PREFIX_1): Likewise.
	(REG_0F3A0F_PREFIX_1_MOD_3): Likewise.
	(RM_0F3A0F_P_1_MOD_3_REG_0): Likewise.
	(prefix_table): Add PREFIX_0F3A0F.
	(mod_table): Add MOD_0F3A0F_PREFIX_1.
	(reg_table): Add REG_0F3A0F_PREFIX_1_MOD_3.
	(rm_table): Add RM_0F3A0F_P_1_MOD_3_REG_0.
	* i386-gen.c (cpu_flag_init): Add HRESET_FLAGS,
	CPU_ANY_HRESET_FLAGS.
	(cpu_flags): Add CpuHRESET.
	(output_i386_opcode): Allow 4 byte base_opcode.
	* i386-opc.h (enum): Add CpuHRESET.
	(i386_cpu_flags): Add cpuhreset.
	* i386-opc.tbl: Add Intel HRESET instruction.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Likewise.
2020-10-14 04:53:59 -07:00
Lili Cui
f64c42a9fb x86: Support Intel UINTR
gas/

	* NEWS: Add Intel UINTR.
	* config/tc-i386.c (cpu_arch): Add .uintr.
	(cpu_noarch): Likewise.
	* doc/c-i386.texi: Document .uintr and nouintr.
	* testsuite/gas/i386/i386.exp: Run UINTR tests.
	* testsuite/gas/i386/x86-64-uintr.d: Likewise.
	* testsuite/gas/i386/x86-64-uintr.s: Likewise.

opcodes/

	* i386-dis.c (enum): Add
	PREFIX_MOD_3_0F01_REG_5_RM_4,
	PREFIX_MOD_3_0F01_REG_5_RM_5,
	PREFIX_MOD_3_0F01_REG_5_RM_6,
	PREFIX_MOD_3_0F01_REG_5_RM_7,
	X86_64_0F01_REG_5_MOD_3_RM_4_PREFIX_1,
	X86_64_0F01_REG_5_MOD_3_RM_5_PREFIX_1,
	X86_64_0F01_REG_5_MOD_3_RM_6_PREFIX_1,
	X86_64_0F01_REG_5_MOD_3_RM_7_PREFIX_1,
	X86_64_0FC7_REG_6_MOD_3_PREFIX_1.
	(prefix_table): New instructions (see prefixes above).
	(rm_table): Likewise
	* i386-gen.c (cpu_flag_init): Add CPU_UINTR_FLAGS,
	CPU_ANY_UINTR_FLAGS.
	(cpu_flags): Add CpuUINTR.
	* i386-opc.h (enum): Add CpuUINTR.
	(i386_cpu_flags): Add cpuuintr.
	* i386-opc.tbl: Add UINTR insns.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Likewise.
2020-10-14 04:31:54 -07:00
H.J. Lu
8b65b8953a x86: Remove the prefix byte from non-VEX/EVEX base_opcode
Replace the prefix byte in non-VEX/EVEX base_opcode with PREFIX_0X66,
PREFIX_0XF2 or PREFIX_0XF3.

gas/

	* config/tc-i386.c (load_insn_p): Check opcodeprefix == 0 for
	base_opcode == 0xfc7.
	(match_template): Likewise.
	(process_suffix): Check opcodeprefix == PREFIX_0XF2 for CRC32.
	(check_byte_reg): Likewise.
	(output_insn): Don't add the 0xf3 prefix twice for PadLock
	instructions.  Don't add prefix from non-VEX/EVEX base_opcode.

opcodes/

	* i386-gen.c (process_i386_opcode_modifier): Return 1 for
	non-VEX/EVEX/prefix encoding.
	(output_i386_opcode): Fail if non-VEX/EVEX/prefix base_opcode
	has a prefix byte.
	* i386-opc.tbl: Replace the prefix byte in non-VEX/EVEX
	base_opcode with PREFIX_0X66, PREFIX_0XF2 or PREFIX_0XF3.
	* i386-tbl.h: Regenerated.
2020-10-14 04:20:55 -07:00
H.J. Lu
7b47a31256 x86: Rename VexOpcode to OpcodePrefix
Rename VexOpcode to OpcodePrefix so that OpcodePrefix can be used for
regular encoding prefix.

gas/

	* config/tc-i386.c (build_vex_prefix): Replace vexopcode with
	opcodeprefix.
	(build_evex_prefix): Likewise.
	(is_any_vex_encoding): Don't check vexopcode.
	(output_insn): Handle opcodeprefix.

opcodes/

	* i386-gen.c (opcode_modifiers): Replace VexOpcode with
	OpcodePrefix.
	* i386-opc.h (VexOpcode): Renamed to ...
	(OpcodePrefix): This.
	(PREFIX_NONE): New.
	(PREFIX_0X66): Likewise.
	(PREFIX_0XF2): Likewise.
	(PREFIX_0XF3): Likewise.
	* i386-opc.tbl (Prefix_0X66): New.
	(Prefix_0XF2): Likewise.
	(Prefix_0XF3): Likewise.
	Replace VexOpcode= with OpcodePrefix=.  Use Prefix_0X66 on xorpd.
	Use Prefix_0XF3 on cvtdq2pd.  Use Prefix_0XF2 on cvtpd2dq.
	* i386-tbl.h: Regenerated.
2020-10-13 19:29:09 -07:00
H.J. Lu
32930e4edb x86: Support GNU_PROPERTY_X86_ISA_1_V[234] marker
GCC 11 supports -march=x86-64-v[234] to enable x86 micro-architecture ISA
levels:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97250

Update GNU_PROPERTY_X86_ISA_1_XXX macros:

https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/13

in x86 ELF binaries to indicate that micro-architecture ISA levels
required to execute the binary:

 #define GNU_PROPERTY_X86_ISA_1_NEEDED (GNU_PROPERTY_X86_UINT32_OR_LO + 2)
 #define GNU_PROPERTY_X86_ISA_1_USED (GNU_PROPERTY_X86_UINT32_OR_AND_LO + 2)
 #define GNU_PROPERTY_X86_ISA_1_V2 (1U << 0)
 #define GNU_PROPERTY_X86_ISA_1_V3 (1U << 1)
 #define GNU_PROPERTY_X86_ISA_1_V4 (1U << 2)

The previous GNU_PROPERTY_X86_ISA_1_XXX  macros are deprecated and renamed
to GNU_PROPERTY_X86_COMPAT_2_ISA_1_XXX.

In addition to EM_X86_64, GNU_PROPERTY_X86_ISA_1_V[234] marker can be used
by ld.so to detect the x86-64-v4 shared library placed in an x86-64-v2
directory by mistake on an x86-64-v2 machine to avoid crashes on x86-64-v4
instructions.

Add -z x86-64-v[234] linker command line option to mark x86-64-v[234]
ISA level as needed.

Also add

 #define GNU_PROPERTY_X86_FEATURE_2_MASK (1U << 11)

for mask registers.

bfd/

	PR gas/26703
	* elf-linker-x86.h (elf_linker_x86_params): Add isa_level.
	* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Merge
	GNU_PROPERTY_X86_ISA_1_V[234].
	(_bfd_x86_elf_link_setup_gnu_properties): Generate
	GNU_PROPERTY_X86_ISA_1_V[234] for -z x86-64-v[234].

binutils/

	PR gas/26703
	* readelf.c (decode_x86_compat_2_isa): New function.
	(decode_x86_isa): Updated for new X86_ISA_1_XXX bits.
	(decode_x86_feature_1): Handle GNU_PROPERTY_X86_FEATURE_2_MASK.
	(print_gnu_property_note): Handle X86_COMPAT_2_ISA_1_USED,
	and X86_COMPAT_2_ISA_1_NEEDED.
	* testsuite/binutils-all/i386/pr21231b.s: Updated to the current
	GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
	values.
	* testsuite/binutils-all/x86-64/pr21231b.s: Likewise.
	* testsuite/binutils-all/x86-64/pr23494a.s: Likewise.
	* testsuite/binutils-all/x86-64/pr23494b.s: Likewise.
	* testsuite/binutils-all/x86-64/pr23494c.s: Likewise.
	* testsuite/binutils-all/i386/empty.d: Updated.
	* 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/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.

gas/

	PR gas/26703
	* config/tc-i386.c (xstate): Add xstate_mask.
	(md_assemble): Check i.types[j], instead of i.tm.operand_types[j],
	for xstate.  Set xstate_mask, instead of xstate_zmm, for RegMask.
	(output_insn): Update for GNU_PROPERTY_X86_ISA_1_V[234].  Update
	xstate for mask register and VSIB.
	* testsuite/gas/i386/i386.exp: Run more GNU_PROPERTY tests.
	* testsuite/gas/i386/property-1.s: Updated to the current
	GNU_PROPERTY_X86_ISA_1_USED value.
	* testsuite/gas/i386/property-2.s: Only keep cmove.
	* testsuite/gas/i386/property-3.s: Changed to addsubpd.
	* testsuite/gas/i386/property-1.d: Updated.
	* testsuite/gas/i386/property-2.d: Likewise.
	* testsuite/gas/i386/property-3.d: Likewise.
	* testsuite/gas/i386/property-4.d: Likewise.
	* testsuite/gas/i386/property-5.d: Likewise.
	* testsuite/gas/i386/property-6.d: Likewise.
	* testsuite/gas/i386/x86-64-property-1.d: Likewise.
	* testsuite/gas/i386/x86-64-property-2.d: Likewise.
	* testsuite/gas/i386/x86-64-property-3.d: Likewise.
	* testsuite/gas/i386/x86-64-property-4.d: Likewise.
	* testsuite/gas/i386/x86-64-property-5.d: Likewise.
	* testsuite/gas/i386/x86-64-property-6.d: Likewise.
	* testsuite/gas/i386/x86-64-property-7.d: Likewise.
	* testsuite/gas/i386/x86-64-property-8.d: Likewise.
	* testsuite/gas/i386/x86-64-property-9.d: Likewise.
	* testsuite/gas/i386/property-11.d: New file.
	* testsuite/gas/i386/property-11.s: Likewise.
	* testsuite/gas/i386/property-12.d: Likewise.
	* testsuite/gas/i386/property-12.s: Likewise.
	* testsuite/gas/i386/property-13.d: Likewise.
	* testsuite/gas/i386/property-13.s: Likewise.
	* testsuite/gas/i386/x86-64-property-11.d: Likewise.
	* testsuite/gas/i386/x86-64-property-12.d: Likewise.
	* testsuite/gas/i386/x86-64-property-13.d: Likewise.
	* testsuite/gas/i386/x86-64-property-14.d: Likewise.
	* testsuite/gas/i386/x86-64-property-14.s: Likewise.

include/

	PR gas/26703
	* elf/common.h (GNU_PROPERTY_X86_ISA_1_USED): Renamed to ...
	(GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED): This.
	(GNU_PROPERTY_X86_ISA_1_NEEDED): Renamed to ...
	(GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED): This.
	(GNU_PROPERTY_X86_ISA_1_XXX): Renamed to ...
	(GNU_PROPERTY_X86_COMPAT_2_ISA_1_XXX): This.
	(GNU_PROPERTY_X86_ISA_1_NEEDED): New.
	(GNU_PROPERTY_X86_ISA_1_USED): Likewise.
	(GNU_PROPERTY_X86_ISA_1_V2): Likewise.
	(GNU_PROPERTY_X86_ISA_1_V3): Likewise.
	(GNU_PROPERTY_X86_ISA_1_V4): Likewise.
	(GNU_PROPERTY_X86_FEATURE_2_MASK): Likewise.

ld/

	PR gas/26703
	* NEWS: Mention -z x86-64-v[234].
	* ld.texi: Document -z x86-64-v[234].
	* emulparams/elf32_x86_64.sh: Use x86-64-level.sh.
	* emulparams/elf_i386.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.
	* emulparams/x86-64-level.sh: New file.
	* testsuite/ld-elf/x86-feature-1a.rd: Update.
	* 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/pr23372c.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-1a.r: Likewise.
	* testsuite/ld-i386/property-2a.r: Likewise.
	* testsuite/ld-i386/property-3.r: Likewise.
	* testsuite/ld-i386/property-3a.r: Likewise.
	* testsuite/ld-i386/property-4.r: Likewise.
	* testsuite/ld-i386/property-4a.r: Likewise.
	* testsuite/ld-i386/property-5.r: Likewise.
	* testsuite/ld-i386/property-5a.r: Likewise.
	* testsuite/ld-i386/property-7a.r: 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/pr23372c-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372c.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-1a.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-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.
	* testsuite/ld-i386/i386.exp: Run property-x86-6,
	property-x86-isa1, property-x86-isa2 and property-x86-isa3.
	* testsuite/ld-i386/property-x86-1.S: Updated to the current
	GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
	values.
	* testsuite/ld-i386/property-x86-2.S: Likewise.
	* testsuite/ld-i386/property-x86-3.s: Likewise.
	* testsuite/ld-x86-64/pr23372d.s: Likewise.
	* testsuite/ld-x86-64/pr23372e.s: Likewise.
	* testsuite/ld-x86-64/pr23372f.s: Likewise.
	* testsuite/ld-x86-64/pr23486c.s: Likewise.
	* testsuite/ld-x86-64/pr23486d.s: Likewise.
	* testsuite/ld-x86-64/property-x86-1.S: Likewise.
	* testsuite/ld-x86-64/property-x86-2.S: Likewise.
	* testsuite/ld-x86-64/property-x86-3.s: Likewise.
	* testsuite/ld-x86-64/property-x86-5a.s: Likewise.
	* testsuite/ld-x86-64/property-x86-5b.s: Likewise.
	* testsuite/ld-i386/property-x86-6.d: New file.
	* testsuite/ld-i386/property-x86-isa1.d: Likewise.
	* testsuite/ld-i386/property-x86-isa2.d: Likewise.
	* testsuite/ld-i386/property-x86-isa3.d: Likewise.
	* testsuite/ld-x86-64/property-x86-6-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-6.d: Likewise.
	* testsuite/ld-x86-64/property-x86-6.s: Likewise.
	* testsuite/ld-x86-64/property-x86-isa1-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-isa1.d: Likewise.
	* testsuite/ld-x86-64/property-x86-isa1.s: Likewise.
	* testsuite/ld-x86-64/property-x86-isa2-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-isa2.d: Likewise.
	* testsuite/ld-x86-64/property-x86-isa3-x32.d: Likewise.
	* testsuite/ld-x86-64/property-x86-isa3.d: Likewise.
	* testsuite/ld-x86-64/simple.s: Likewise.
	* ld/testsuite/ld-x86-64/x86-64.exp: Run property-x86-6,
	property-x86-6-x32, property-x86-isa1, property-x86-isa1-x32,
	property-x86-isa2, property-x86-isa2-x32, property-x86-isa3-x32
	and property-x86-isa3.
2020-10-09 05:13:26 -07:00
Alex Coplan
05cfb0d8cc aarch64: Fix bogus type punning in parse_barrier() [PR26699]
This patch fixes a bogus use of type punning in parse_barrier() which
was causing an assembly failure on big endian LP64 hosts when attempting
to assemble "isb sy" for AArch64.

The type of the entries in aarch64_barrier_opt_hsh is
aarch64_name_value_pair. We were incorrectly casting this to the
locally-defined asm_barrier_opt which has a wider type (on LP64) for the
second member. This happened to work on little-endian hosts but fails on
LP64 big endian.

The fix is to use the correct type in parse_barrier(). This makes the
locally-defined asm_barrier_opt redundant, so remove it.

gas/ChangeLog:

	* config/tc-aarch64.c (asm_barrier_opt): Delete.
	(parse_barrier): Fix bogus type punning.
	* testsuite/gas/aarch64/system.d: Update disassembly.
	* testsuite/gas/aarch64/system.s: Add isb sy test.
2020-10-06 15:56:44 +01:00
Sergey Belyashav
0ae9445d52 A small set of code improvements for the Z80 assembler.
PR 26692
	* config/tc-z80.c (md_begin): Ensure that xpressions are empty
	before using them.
	(unify_indexed): Likewise.
	(z80_start_line_hook): Improve hash sign handling when SDCC
	compatibility mode enabled.
	(md_parse_exp_not_indexed): Improve indirect addressing
	detection.
	(md_pseudo_table): Accept hd64 as an alias of z810.
2020-10-06 11:58:57 +01:00
Alan Modra
3ce6300ea8 Fix gas sh-link-zero test for hppa64-hpux
* testsuite/gas/elf/sh-link-zero.s: Don't start directives in
	first column.  Don't use numeric labels.
2020-10-06 20:22:43 +10:30
Przemyslaw Wirkus
f9b1d75e91 [PATCH][GAS][AArch64] Update Cortex-X1 feature flags
This is feature flags update for Cortex-X1 CPU.
For more information about this processor, see [0].

[0] : https://www.arm.com/products/cortex-x

gas/ChangeLog:

2020-10-05  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* config/tc-aarch64.c: Update Cortex-X1 feature flags.
2020-10-05 15:43:41 +01:00
Przemyslaw Wirkus
a417e439c2 [PATCH][GAS][arm] Update Cortex-X1 feature flags
This is feature flags update for Cortex-X1 CPU.
For more information about this processor, see [0].

[0] : https://www.arm.com/products/cortex-x

gas/ChangeLog:

2020-10-05  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* config/tc-arm.c: Update Cortex-X1 feature flags.
2020-10-05 15:43:32 +01:00
Kamil Rytarowski
cc8b27f89c Add NetBSD AArch64 GAS support.
gas	* configure.tgt (aarch64*-*-netbsd*): Add target.
2020-10-05 14:54:00 +01:00
Samanta Navarro
0cc79db2b6 Fix spelling mistakes 2020-10-05 14:20:15 +01:00
T.K. Chia
6d96a5946d i386: Allow non-absolute segment values for lcall/ljmp
Allow an unresolved or non-absolute symbol as the segment operand of an
immediate far jump (`ljmp SEG, OFF') or far call (`lcall SEG, OFF').

gas/

2020-10-05  T.K. Chia  <u1049321969@caramail.com>

	PR gas/26694
	* NEWS: Updated for i386 lcall and ljmp change.
	* config/tc-i386.c (output_interseg_jump): Allow non-absolute
	segment operand for immediate lcall and ljmp.
	* testsuite/gas/i386/jump.d,
	* testsuite/gas/i386/jump.s,
	* testsuite/gas/i386/jump16.d,
	* testsuite/gas/i386/jump16.e,
	* testsuite/gas/i386/jump16.s: Add tests for non-absolute
	segment operand for immediate ljmp.

ld/

2020-10-05  T.K. Chia  <u1049321969@caramail.com>

	PR gas/26694
	* testsuite/ld-i386/ljmp.s,
	* testsuite/ld-i386/ljmp1.d,
	* testsuite/ld-i386/ljmp1.s,
	* testsuite/ld-i386/ljmp2.d,
	* testsuite/ld-i386/ljmp2.s,
	* testsuite/ld-x86-64/ljmp1.d,
	* testsuite/ld-x86-64/ljmp2.d: New testcases.
	* testsuite/ld-i386/i386.exp,
	* testsuite/ld-x86-64/x86-64.exp: Run them.
2020-10-05 05:58:33 -07:00
H.J. Lu
5b316d90e4 x86-64: Always display suffix for %LQ in 64bit
In 64bit, assembler generates a warning for "sysret":

$ echo sysret | as --64 -o x.o -
{standard input}: Assembler messages:
{standard input}:1: Warning: no instruction mnemonic suffix given and no register operands; using default for `sysret'

Always display suffix for %LQ in 64bit to display "sysretl".

gas/

	PR binutils/26704
	* testsuite/gas/i386/noreg64-data16.d: Expect sysretl instead of
	sysret.
	* testsuite/gas/i386/noreg64.d: Likewise.
	* testsuite/gas/i386/x86-64-intel64.d: Likewise.
	* testsuite/gas/i386/x86-64-opcode.d: Likewise.

opcodes/

	PR binutils/26704
	* i386-dis.c (putop): Always display suffix for %LQ in 64bit.
2020-10-05 05:28:12 -07:00
H.J. Lu
0e9f3bf126 x86: Clear modrm if not needed
The MODRM byte can be checked to display the instruction name only if the
MODRM byte needed.  Clear modrm if the MODRM byte isn't needed so that
modrm field checks in putop like, modrm.mod == N with N != 0, can be done
without checking need_modrm.

gas/

	PR binutils/26705
	* testsuite/gas/i386/x86-64-suffix.s: Add "mov %rsp,%rbp" before
	sysretq.
	* testsuite/gas/i386/x86-64-suffix-intel.d: Updated.
	* testsuite/gas/i386/x86-64-suffix.d: Likewise.

opcodes/

	PR binutils/26705
	* i386-dis.c (print_insn): Clear modrm if not needed.
	(putop): Check need_modrm for modrm.mod != 3.  Don't check
	need_modrm for modrm.mod == 3.
2020-10-05 05:23:39 -07:00
Nick Clifton
b71702f1c0 GAS: Update the .section directive so that a numeric section index can be provided when the "o" flag is used.
PR 26253
gas	* config/obj-elf.c (obj_elf_section): Accept a numeric value for
	the "o" section flag.  Interpret it as a section index.  Allow an
	index of zero.
	* doc/as.texi: Document the new behaviour.
	* NEWS: Mention the new feature.  Tidy entries.
	* testsuite/gas/elf/sh-link-zero.s: New test.
	* testsuite/gas/elf/sh-link-zero.d: New test driver.
	* testsuite/gas/elf/elf.exp: Run the new test.
	* testsuite/gas/elf/section21.l: Updated expected assembler
	output.

bfd	* elf.c (_bfd_elf_setup_sections): Do not complain about an
	sh_link value of zero when the SLF_LINK_ORDER flag is set.
	(assign_section_numbers): Likewise.
2020-10-05 10:40:07 +01:00
H.J. Lu
b3a3496f83 x86: Update register operand check for AddrPrefixOpReg
When the address size prefix applies to both the memory and the register
operand, we need to extract the address size prefix from the register
operand if the memory operand has no real registers, like symbol, DISP
or symbol(%rip).

NB: GCC always generates symbol(%rip) for RIP-relative addressing for
both x32 and x86-64.

Move the .code16 tests in movdir.s to movdir-16bit to show the correct
output from objdump.

	PR gas/26685
	* config/tc-i386.c (process_suffix): Also check the register
	operand for the address size prefix if the memory operand has
	no real registers.
	* testsuite/gas/i386/enqcmd-16bit.d: New file.
	* testsuite/gas/i386/enqcmd-16bit.s: Likewise.
	* testsuite/gas/i386/movdir-16bit.d: Likewise.
	* testsuite/gas/i386/movdir-16bit.s: Likewise.
	* testsuite/gas/i386/enqcmd.s: Add tests with symbol and DISP.
	* testsuite/gas/i386/x86-64-enqcmd.s: Likewise.
	* testsuite/gas/i386/x86-64-movdir.s: Likewise.
	* testsuite/gas/i386/movdir.s: Add tests with symbol and DISP.
	Remove the .code16 test.
	* testsuite/gas/i386/i386.exp: Run movdir-16bit and enqcmd-16bit.
	* testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated.
	* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir.d: Likewise.
	* testsuite/gas/i386/enqcmd-intel.d: Likewise.
	* testsuite/gas/i386/enqcmd.d: Likewise.
	* testsuite/gas/i386/movdir-intel.d: Likewise.
	* testsuite/gas/i386/movdir.d: Likewise.
	* testsuite/gas/i386/x86-64-enqcmd-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir.d: Likewise.
2020-10-03 04:24:05 -07:00
Przemyslaw Wirkus
42c36b7366 arm: add support for Cortex-A78 and Cortex-A78AE
bfd/ChangeLog:

2020-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* cpu-arm.c: Add cortex-a78 and cortex-a78ae.

gas/ChangeLog:

2020-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* config/tc-arm.c: Add cortex-a78 and cortex-a78ae cores.
	* doc/c-arm.texi: Update docs.
	* NEWS: Update news.
	* testsuite/gas/arm/cpu-cortex-a78.d: New test.
	* testsuite/gas/arm/cpu-cortex-a78ae.d: New test.
2020-10-02 20:44:37 +01:00
Nick Clifton
7bd766ccd8 Fix the mve-vcvtne-it assembler test for the arm-*-pe targets.
* testsuite/gas/arm/mve-vcvtne-it.d: Allow for padding inserted by
	PE based targets.
2020-10-02 11:14:57 +01:00
Nick Clifton
642f545a93 Add new directive to GAS: .attach_to_group.
* config/obj-elf (elf_pseudo_table): Add attach_to_group.
        (obj_elf_attach_to_group): New function.
        * doc/as.texi: Document the new directive.
	* NEWS: Mention the new feature.
        * testsuite/gas/elf/attach-1.s: New test.
        * testsuite/gas/elf/attach-1.d: New test driver.
        * testsuite/gas/elf/attach-2.s: New test.
        * testsuite/gas/elf/attach-2.d: New test driver.
        * testsuite/gas/elf/attach-err.s: New test.
        * testsuite/gas/elf/attach-err.d: New test driver.
        * testsuite/gas/elf/attach-err.err: New test error output.
        * testsuite/gas/elf/elf.exp: Run the new tests.
2020-10-01 16:34:05 +01:00
H.J. Lu
27f134698a x86: Check register operand for AddrPrefixOpReg
If the address prefix changes the register operand, we need to check the
register operand when the memory operand is RIP-relative.

	PR gas/26685
	* config/tc-i386.c (process_suffix): Check the register operand
	for the address size prefix if the memory operand is symbol(%rip).
	* testsuite/gas/i386/x86-64-enqcmd.s: Add tests with RIP-relative
	addressing.
	* testsuite/gas/i386/x86-64-movdir.s: Likewise.
	* testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated.
	* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir.d: Likewise.
2020-09-30 16:33:52 -07:00
Przemyslaw Wirkus
77718e5b7d [GAS][AArch64] Add support for Cortex-A78 and Cortex-A78AE
* config/tc-aarch64.c: Add Cortex-A78 and Cortex-A78AE cores.
	* doc/c-aarch64.texi: Update docs.
	* NEWS: Update news.
2020-09-30 14:52:31 +01:00
Alex Coplan
c81946efc2 NEWS: Mention recent Arm CPU support
Mentions Armv8-R AArch64, Cortex-R82, Neoverse V1, and Neoverse N2.

gas/ChangeLog:

2020-09-30  Alex Coplan  <alex.coplan@arm.com>

	* NEWS: Mention recent Arm processor support.
2020-09-30 12:15:18 +01:00
Alex Coplan
990e5268d2 aarch64: Add support for Neoverse N2 CPU
This patch adds support for Arm's Neoverse N2 CPU to AArch64 binutils.

gas/ChangeLog:

	* config/tc-aarch64.c (aarch64_cpus): Add neoverse-n2.
	* doc/c-aarch64.texi: Document support for Neoverse N2.
2020-09-30 12:11:56 +01:00
Alan Modra
e37c930f9e gcc-4.4.7 warning fixes
* config/obj-elf.c (obj_elf_change_section): Rename variable to
	avoid shadowing warning.
	* symbols.c (symbol_entry_find): Init all symbol_flags fields.
2020-09-30 14:31:15 +09:30
Przemyslaw Wirkus
aeaccbf4c5 Add a note about recent changes to the AArch64 assembler: TRBE, ETE and ETMv4 system registers and Cortex-X1 enablement.
gas	* NEWS: TRBE, ETE, ETMv4 and Cortex-X1 news updates.
2020-09-29 16:43:57 +01:00
Przemyslaw Wirkus
394e9bf642 This patch adds support for Cortex-X1 for ARM.
bfd	* cpu-arm.c: (processors) Add Cortex-X1.

gas	* config/tc-arm.c: (arm_cpus): Add Cortex-X1.
	* doc/c-arm.texi: Document -mcpu=cortex-x1.
	* testsuite/gas/arm/cpu-cortex-x1.d: New test.
2020-09-28 15:52:24 +01:00
Przemyslaw Wirkus
12e35da62f This patch introduces ETMv4 (Embedded Trace Macrocell) system registers for the AArch64 architecture.
gas           * testsuite/gas/aarch64/etm-ro-invalid.d: New test.
              * testsuite/gas/aarch64/etm-ro-invalid.l: New test.
              * testsuite/gas/aarch64/etm-ro-invalid.s: New test.
              * testsuite/gas/aarch64/etm-ro.s: New test.
              * testsuite/gas/aarch64/etm-wo-invalid.d: New test.
              * testsuite/gas/aarch64/etm-wo-invalid.l: New test.
              * testsuite/gas/aarch64/etm-wo-invalid.s: New test.
              * testsuite/gas/aarch64/etm-wo.s: New test.
              * testsuite/gas/aarch64/etm.s: New test.
              * testsuite/gas/aarch64/sysreg.d: system register s2_1_c0_c3_0 disassembled
              now to trcstatr.

opcodes       * aarch64-opc.c: Added ETMv4 system registers TRCACATRn, TRCACVRn,
              TRCAUTHSTATUS, TRCAUXCTLR, TRCBBCTLR, TRCCCCTLR, TRCCIDCCTLR0, TRCCIDCCTLR1,
              TRCCIDCVRn, TRCCIDR0, TRCCIDR1, TRCCIDR2, TRCCIDR3, TRCCLAIMCLR, TRCCLAIMSET,
              TRCCNTCTLRn, TRCCNTRLDVRn, TRCCNTVRn, TRCCONFIGR, TRCDEVAFF0, TRCDEVAFF1,
              TRCDEVARCH, TRCDEVID, TRCDEVTYPE, TRCDVCMRn, TRCDVCVRn, TRCEVENTCTL0R,
              TRCEVENTCTL1R, TRCEXTINSELR, TRCIDR0, TRCIDR1, TRCIDR2, TRCIDR3, TRCIDR4,
              TRCIDR5, TRCIDR6, TRCIDR7, TRCIDR8, TRCIDR9, TRCIDR10, TRCIDR11, TRCIDR12,
              TRCIDR13, TRCIMSPEC0, TRCIMSPECn, TRCITCTRL, TRCLAR WOTRCLSR, TRCOSLAR
              WOTRCOSLSR, TRCPDCR, TRCPDSR, TRCPIDR0, TRCPIDR1, TRCPIDR2, TRCPIDR3,
              TRCPIDR4, TRCPIDR[5,6,7], TRCPRGCTLR, TRCP,CSELR, TRCQCTLR, TRCRSCTLRn,
              TRCSEQEVRn, TRCSEQRSTEVR, TRCSEQSTR, TRCSSCCRn, TRCSSCSRn, TRCSSPCICRn,
              TRCSTALLCTLR, TRCSTATR, TRCSYNCPR, TRCTRACEIDR,  TRCTSCTLR, TRCVDARCCTLR,
              TRCVDCTLR, TRCVDSACCTLR, TRCVICTLR, TRCVIIECTLR, TRCVIPCSSCTLR, TRCVISSCTLR,
              TRCVMIDCCTLR0, TRCVMIDCCTLR1 and TRCVMIDCVRn.
2020-09-28 15:49:11 +01:00
Przemyslaw Wirkus
47e1f9deaa This patch adds support for Cortex-X1
gas	* config/tc-aarch64.c: (aarch64_cpus): Add Cortex-X1.
	* doc/c-aarch64.texi: Document -mcpu=cortex-x1.
2020-09-28 15:43:51 +01:00
Przemyslaw Wirkus
3454861d89 This patch introduces ETE (Embedded Trace Extension) system registers for the AArch64 architecture.
gas           * testsuite/gas/aarch64/ete.d: New test.
              * testsuite/gas/aarch64/ete.s: New test.

opcodes       * aarch64-opc.c: Add ETE system registers TRCEXTINSELR<0-3> and TRCRSR.
2020-09-28 15:41:23 +01:00
Przemyslaw Wirkus
1ff8e40105 This patch introduces TRBE (Trace Buffer Extension) system registers for the AArch64 architecture.
gas           * testsuite/gas/aarch64/trbe-invalid.d: New test.
              * testsuite/gas/aarch64/trbe-invalid.l: New test.
              * testsuite/gas/aarch64/trbe-invalid.s: New test.
              * testsuite/gas/aarch64/trbe.d: New test.
              * testsuite/gas/aarch64/trbe.s: New test.

opcodes       * aarch64-opc.c: Add TRBE system registers TRBIDR_EL1 , TRBBASER_EL1 ,
              TRBLIMITR_EL1 , TRBMAR_EL1 , TRBPTR_EL1, TRBSR_EL1 and TRBTRG_EL1.
2020-09-28 15:37:50 +01:00
Alex Coplan
9bede61ce5 arm: Add missing Neoverse V1 feature
This simple follow-on patch adds a feature bit (FP16) that was missing
from the initial Neoverse V1 support.

gas/ChangeLog:

	* config/tc-arm.c (arm_cpus): Add FP16 to Neoverse V1.
2020-09-28 13:57:09 +01:00
Alex Coplan
c769fd6a32 aarch64: Neoverse V1 tweaks
This simple follow-on patch groups the Neoverse cores together and adds
a missing feature bit (F16) to the entry for Neoverse V1.

gas/ChangeLog:

	* config/tc-aarch64.c (aarch64_cpus): Group Neoverse cores
	together, add missing F16 bit to Neoverse V1.
2020-09-28 13:55:08 +01:00
Alan Modra
0be2fe677c ubsan: opcodes/csky-opc.h:929 shift exponent 536870912
opcodes/
	* csky-opc.h: Formatting.
	(GENERAL_REG_BANK): Correct spelling.  Update use throughout file.
	(get_register_name): Mask arch with CSKY_ARCH_MASK for shift,
	and shift 1u.
	(get_register_number): Likewise.
	* csky-dis.c (get_gr_name, get_cr_name): Don't mask mach_flag.
gas/
	* config/tc-csky.c (parse_type_ctrlreg): Don't mask mach_flag
	for csky_get_control_regno.
	(csky_get_reg_val): Likewise when calling csky_get_general_regno.
2020-09-26 15:28:22 +09:30
Jim Wilson
743f5cfc00 RISC-V: Error for relaxable branch in absolute section.
Emit an error instead of crashing in frag_new, handling this same as the
i386 port.

gas/
	PR 26400
	* config/tc-riscv.c (append_insn): If in absolute section, emit
	error before add_relaxed_insn call.
	* testsuite/gas/riscv/absolute-sec.d: New.
	* testsuite/gas/riscv/absolute-sec.l: New.
	* testsuite/gas/riscv/absolute-sec.s: New.
2020-09-24 15:16:54 -07:00
Mark Wielaard
debd1a62c4 readelf: Show Unit Type for DWARF5
binutils/ChangeLog:

	* dwarf.c (process_debug_info): Print Unit Type for DWARF5.
	* testsuite/binutils-all/dw5.W: Adjust expected output.
	* testsuite/binutils-all/dwarf-attributes.W: Likewise.

gas/ChangeLog:

	* testsuite/gas/elf/dwarf-5-cu.d: Adjust expected output.
2020-09-24 23:13:13 +02:00
Alex Coplan
6eee0315f6 arm: Add support for Neoverse V1 CPU
This patch adds support for Arm's Neoverse V1 CPU to AArch32 binutils.

gas/ChangeLog:

2020-09-24  Alex Coplan  <alex.coplan@arm.com>

	* config/tc-arm.c (arm_cpus): Add Neoverse V1.
	* doc/c-arm.texi: Document Neoverse V1 support.
2020-09-24 15:38:30 +01:00
Alex Coplan
9e980ddcef aarch64: Add support for Neoverse V1 CPU
This adds support for Arm's Neoverse V1 CPU to AArch64 binutils.

gas/ChangeLog:

2020-09-24  Alex Coplan  <alex.coplan@arm.com>

	* config/tc-aarch64.c (aarch64_cpu_option_table): Add Neoverse V1.
	* doc/c-aarch64.texi: Document Neoverse V1 support.
2020-09-24 15:38:19 +01:00
Alex Coplan
f3034e25fa arm: Add support for Neoverse N2 CPU
This adds support for Arm's Neoverse N2 CPU to AArch32 binutils. The
Neoverse N2 CPU builds AArch32 at EL0 and therefore needs support in the
AArch32 assembler.

gas/ChangeLog:

2020-09-24  Alex Coplan  <alex.coplan@arm.com>

	* config/tc-arm.c (arm_cpus): Add Neoverse N2.
	* doc/c-arm.texi: Document -mcpu=neoverse-n2.
2020-09-24 10:10:52 +01:00
Cui,Lili
81d54bb7ae Add support for Intel TDX instructions.
gas/

	* NEWS: Add TDX.
	* config/tc-i386.c (cpu_arch): Add .tdx.
	(cpu_noarch): Likewise.
	* doc/c-i386.texi: Document tdx.
	* testsuite/gas/i386/i386.exp: Run tdx tests.
	* testsuite/gas/i386/tdx.d: Likewise.
	* testsuite/gas/i386/tdx.s: Likewise.
	* testsuite/gas/i386/x86-64-tdx.d: Likewise.
	* testsuite/gas/i386/x86-64-tdx.s: Likewise.

opcodes/

	* i386-dis.c (enum): Add PREFIX_0F01_REG_1_RM_5,
	PREFIX_0F01_REG_1_RM_6, PREFIX_0F01_REG_1_RM_7,
	X86_64_0F01_REG_1_RM_5_P_2, X86_64_0F01_REG_1_RM_6_P_2,
	X86_64_0F01_REG_1_RM_7_P_2.
	(prefix_table): Likewise.
	(x86_64_table): Likewise.
	(rm_table): Likewise.
	* i386-gen.c (cpu_flag_init): Add CPU_TDX_FLAGS
	and CPU_ANY_TDX_FLAGS.
	(cpu_flags): Add CpuTDX.
	* i386-opc.h (enum): Add CpuTDX.
	(i386_cpu_flags): Add cputdx.
	* i386-opc.tbl: Add TDX insns.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Likewise.
2020-09-24 10:38:15 +08:00
Cooper Qu
afdcafe891 CSKY: Add objdump option -M abi-names.
Add option parser for disassembler, and refine the codes of
parse register operand and disassemble register operand.
While strengthen the operands legality check of some instructions.

Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>

gas/
	* config/tc-csky.c (parse_type_ctrlreg): Use function
	csky_get_control_regno to operand.
	(csky_get_reg_val): Likewise.
	(is_reg_sp_with_bracket): Use function csky_get_reg_val
	to parse operand.
	(is_reg_sp): Refine.
	(is_oimm_within_range): Fix, report error when operand
	is not constant.
	(parse_type_cpreg): Refine.
	(parse_type_cpcreg): Refine.
	(get_operand_value): Add handle of OPRND_TYPE_IMM5b_LS.
	(md_assemble): Fix no error reporting somtimes when
	operands number are not fit.
	(csky_addc64): Refine.
	(csky_subc64): Refine.
	(csky_or64): Refine.
	(v1_work_fpu_fo): Refine.
	(v1_work_fpu_read): Refine.
	(v1_work_fpu_writed): Refine.
	(v1_work_fpu_readd): Refine.
	(v2_work_addc): New function, strengthen the operands legality
	check of addc.
	* gas/testsuite/gas/csky/all.d : Use register number format when
	disassemble register name by default.
	* gas/testsuite/gas/csky/cskyv2_all.d : Likewise.
	* gas/testsuite/gas/csky/trust.d: Likewise.
	* gas/testsuite/gas/csky/cskyv2_ck860.d : Fix.
	* gas/testsuite/gas/csky/trust.s : Fix.

opcodes/
	* csky-dis.c (using_abi): New.
	(parse_csky_dis_options): New function.
	(get_gr_name): New function.
	(get_cr_name): New function.
	(csky_output_operand): Use get_gr_name and get_cr_name to
	disassemble and add handle of OPRND_TYPE_IMM5b_LS.
	(print_insn_csky): Parse disassembler options.
	* opcodes/csky-opc.h (OPRND_TYPE_IMM5b_LS): New enum.
	(GENARAL_REG_BANK): Define.
	(REG_SUPPORT_ALL): Define.
	(REG_SUPPORT_ALL): New.
	(ASH): Define.
	(REG_SUPPORT_A): Define.
	(REG_SUPPORT_B): Define.
	(REG_SUPPORT_C): Define.
	(REG_SUPPORT_D): Define.
	(REG_SUPPORT_E): Define.
	(csky_abiv1_general_regs): New.
	(csky_abiv1_control_regs): New.
	(csky_abiv2_general_regs): New.
	(csky_abiv2_control_regs): New.
	(get_register_name): New function.
	(get_register_number): New function.
	(csky_get_general_reg_name): New function.
	(csky_get_general_regno): New function.
	(csky_get_control_reg_name): New function.
	(csky_get_control_regno): New function.
	(csky_v2_opcodes): Prefer two oprerans format for bclri and
	bseti, strengthen the operands legality check of addc, zext
	and sext.
2020-09-23 23:55:36 +08:00
Terry Guo
c4694f172b Enable support to Intel Keylocker instructions
gas/
	* NEWS: Add Key Locker.
	* config/tc-i386.c (cpu_arch): Add .kl and .wide_kl.
	(cpu_noarch): Likewise.
	* doc/c-i386.texi: Document kl and wide_kl.
	* testsuite/gas/i386/i386.exp: Run keylocker tests.
	* testsuite/gas/i386/keylocker-intel.d: New test.
	* testsuite/gas/i386/keylocker.d: Likewise.
	* testsuite/gas/i386/keylocker.s: Likewise.
	* testsuite/gas/i386/x86-64-keylocker-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-keylocker.d: Likewise.
	* testsuite/gas/i386/x86-64-keylocker.s: Likewise.
	* testsuite/gas/i386/x86-64-property-10.d: Likewise.
	* testsuite/gas/i386/property-10.d: Likewise.
	* testsuite/gas/i386/property-10.s: Likewise.

opcodes/
	* i386-dis.c (enum): Add REG_0F38D8_PREFIX_1,
	MOD_0F38FA_PREFIX_1, MOD_0F38FB_PREFIX_1,
	MOD_0F38DC_PREFIX_1, MOD_0F38DD_PREFIX_1,
	MOD_0F38DE_PREFIX_1, MOD_0F38DF_PREFIX_1,
	PREFIX_0F38D8, PREFIX_0F38FA, PREFIX_0F38FB.
	(reg_table): New instructions (see prefixes above).
	(prefix_table): Likewise.
	(three_byte_table): Likewise.
	(mod_table): Likewise
	* i386-gen.c (cpu_flag_init): Add CPU_KL_FLAGS, CPU_WIDE_KL_FLAGS,
	CPU_ANY_KL_FLAGS and CPU_ANY_WIDE_KL_FLAGS.
	(cpu_flags): Likewise.
	(operand_type_init): Likewise.
	* i386-opc.h (enum): Add CpuKL and CpuWide_KL.
	(i386_cpu_flags): Add cpukl and cpuwide_kl.
	* i386-opc.tbl: Add KL and WIDE_KL insns.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Likewise.
2020-09-23 10:47:44 +08:00
Alan Modra
b1b11e922b PR26569, R_RISCV_RVC_JUMP results in buffer overflow
This patch corrects "size" and "bitsize" in R_RISCV_RVC_* reloc howtos
so that elfnn-riscv.c:perform_relocation doesn't access past the end
of a section.  I've also corrected "size" in the R_RISCV_CALL* reloc
howtos since these relocs apply to two consecutive instructions.  That
caused fallout in the assembler with complaints about "fixup not
contained within frag" due to tc-riscv.c:append_insn finishing off a
frag after the auipc insn making up a "call" macro.  Which is a little
rude since the CALL reloc also relocates the following jalr.  Fixed by
changing the frag handling a little.

I've also changed R_RISCV_ALIGN and R_RISCV_TPREL_ADD marker reloc
howtos to look like R_RISCV_NONE, and corrected dst_mask for numerous
relocs, not that it matters very much.

bfd/
	PR 26569
	* elfxx-riscv.c (howto_table): Correct size and bitsize of
	R_RISCV_RVC_BRANCH, R_RISCV_RVC_JUMP, and R_RISCV_RVC_LUI.
	Correct size for R_RISCV_TLS_DTPMOD32, R_RISCV_TLS_DTPREL32,
	R_RISCV_CALL, and R_RISCV_CALL_PLT.  Make R_RISCV_TPREL_ADD and
	R_RISCV_ALIGN like R_RISCV_NONE.  Correct dst_mask many relocs.
gas/
	* config/tc-riscv.c (append_insn): Don't tie off frags at CALL
	relocs.
	(riscv_call): Tie them off after the jalr.
	(md_apply_fix): Zero fx_size of RELAX fixup.
2020-09-21 09:41:05 +09:30
David Faust
6e25f88828 bpf: xBPF SDIV, SMOD instructions
Add gas and opcodes support for two xBPF-exclusive ALU operations:
SDIV (signed division) and SMOD (signed modulo), and add tests for
them in gas.

cpu/
	* bpf.cpu (insn-op-code-alu): Add SDIV and SMOD.
	(define-alu-insn-bin, daib): Take ISAs as an argument.
	(define-alu-instructions): Update calls to daib pmacro with
	ISAs; add sdiv and smod.

gas/
	* testsuite/gas/bpf/alu-xbpf.d: New file.
	* testsuite/gas/bpf/alu-xbpf.s: Likewise.
	* testsuite/gas/bpf/alu32-xbpf.d: Likewise.
	* testsuite/gas/bpf/alu32-xbpf.d: Likewise.
	* testuiste/gas/bpf/bpf.exp: Run new tests.

opcodes/
	* bpf-desc.c: Regenerate.
	* bpf-desc.h: Likewise.
	* bpf-opc.c: Likewise.
	* bpf-opc.h: Likewise.
2020-09-18 10:04:23 -07:00
Nick Clifton
5947daaf75 Ensure that space allocated by assembler directives converts from an octet count to a byte count.
PR 26556
	* read.c (bss_alloc): Convert size parameter from octets to
	bytes.
2020-09-18 13:28:46 +01:00
Alan Modra
848471acef Tidy gas i386.exp
Possibly a quirk of my version of tcl, but I see "nm-new --help" being
run on non-x86 targets.

	* testsuite/gas/i386/i386.exp: Return early if not x86.
2020-09-17 17:42:53 +09:30
Alan Modra
c1229f84a4 Tidy elf_symbol_from
bfd/
	* elf-bfd.h (elf_symbol_from): Remove unused ABFD parameter.
	* elf.c (ignore_section_sym, _bfd_elf_copy_private_symbol_data),
	(swap_out_syms): Adjust elf_symbol_from invocation.
binutils/
	* nm.c (print_symbol): Adjust elf_symbol_from invocation.
	* objcopy.c (is_hidden_symbol): Likewise.
gas/
	* config/obj-elf.c (obj_elf_visibility, elf_frob_symbol): Adjust
	elf_symbol_from invocation.
	* config/tc-aarch64.c (s_variant_pcs): Likewise.
	* config/tc-m68hc11.c (s_m68hc11_mark_symbol): Likewise.
	* config/tc-ppc.c (ppc_elf_localentry, ppc_force_relocation),
	(ppc_fix_adjustable): Likewise.
	* config/tc-xgate.c (xgate_frob_symbol): Likewise.
ld/
	* plugin.c (asymbol_from_plugin_symbol): Adjust elf_symbol_from
	invocation.
opcodes/
	* ppc-dis.c (ppc_symbol_is_valid): Adjust elf_symbol_from invocation.
2020-09-16 16:41:33 +09:30
H.J. Lu
ec6653d824 PE/x86-64: Display PE relocation names
For PE/x86-64, display PE relocation names:

R_X86_64_64   -> IMAGE_REL_AMD64_ADDR64
R_X86_64_32   -> IMAGE_REL_AMD64_ADDR32.
rva32         -> IMAGE_REL_AMD64_ADDR32NB
R_X86_64_PC32 -> IMAGE_REL_AMD64_REL32
DISP32+1      -> IMAGE_REL_AMD64_REL32_1
DISP32+2      -> IMAGE_REL_AMD64_REL32_2
DISP32+3      -> IMAGE_REL_AMD64_REL32_3
DISP32+4      -> IMAGE_REL_AMD64_REL32_4
DISP32+5      -> IMAGE_REL_AMD64_REL32_5
secrel32      -> IMAGE_REL_AMD64_SECREL

bfd/

	* coff-x86_64.c (howto_table): Display PE relocation names.

gas/

	* testsuite/gas/cfi/reloc-pe-i386.d: Updated.
	* testsuite/gas/i386/x86-64-w64-pcrel.d: Likewise.
2020-09-15 13:56:40 -07:00
Alan Modra
7e30b1ebbf PR26610, ARM's "VFPv3 vldr to vmov" gas testcase fail
I removed a few too many parentheses in git commit 7af677524e.  This
patch fixes that problem, rewriting the expression so it won't happen
again.  The patch also avoids more UB with shifts of signed values.

	PR 26610
	* config/tc-arm.c (move_or_literal_pool): Correct extraction of
	bignum.  Use unsigned "v"
	(is_double_a_single): Make "v" and "mantissa" unsigned.  Formatting.
	(double_to_single): Likewise.
2020-09-15 21:03:47 +09:30
Nick Clifton
f36eda1fe3 Fix the assembler's new .nop directive so that the input line pointer is preserved.
* read.c (s_nop): Preserve the input_line_pointer around the call
	to md_assemble.
	* config/tc-s12z.c (md_assemble): Revert previous delta.
2020-09-15 10:53:46 +01:00
David Faust
6db9990640 Change the /nop directive for the BPF port of the assembler to use the encoding expected by the kernel.
* config/tc-bpf.h (md_single_noop_insn): Use 'ja 0' for no-op.
2020-09-15 10:33:49 +01:00
Nick Clifton
2ddc8f011a Fix support for theassembler's new ".nop" directive on the IA64 target.
* config/tc-ia64.h (md_single_noop_insn): Define.
2020-09-14 16:56:41 +01:00
Nick Clifton
b1766e7ce8 Add a new ".nop" directive to the assembler to allow the creation of no-op instructions in an architeture neutral manner.
* read.c (s_nop): New function.  Handles the .nop directive.
	(potable): Add entry for "nop".
	(s_nops): Code tidy.
	* read.h (s_nop): Add prototype.
	* config/tc-bpf.h (md_single_noop_insn): Define.
	* config/tc-mmix.h (md_single_noop_insn): Define.
	* config/tc-or1k.h (md_single_noop_insn): Define.
	* config/tc-s12z.c (md_assemble): Preserve the input line pointer,
	rather than corrupting it.
	* write.c (relax_segment): Update error message regarding
	non-absolute values passed to .fill and .nops.
	* NEWS: Mention the new directive.
	* doc/as.texi: Document the new directive.
	* doc/internals.texi: Document the new internal macros used to
	implement the new directive.
	* testsuite/gas/all/nop.s: New test.
	* testsuite/gas/all/nop.d: New test control file.
	* testsuite/gas/all/gas.exp: Run the new test.
	* testsuite/gas/elf/dwarf-5-nop-for-line-table.s: New test.
	* testsuite/gas/elf/dwarf-5-nop-for-line-table.d: New test
	control file.
	* testsuite/gas/elf/elf.exp: Run the new test.
	* testsuite/gas/i386/space1.l: Adjust expected output.
2020-09-14 16:14:24 +01:00
Cooper Qu
74fea55bb7 CSKY: Set feature flags for default cpu.
Fix floating point instructions not recognized when building GCC.

gas/
	PR 26608
	* config/tc-csky.c (md_begin): Set feature flags for default
	cpu.
2020-09-14 20:26:57 +08:00
Mark Wielaard
edc7a80a9c gas: Don't error when .debug_line already exists, unless .loc was used
When -g was used to generate DWARF gas would error out when a .debug_line
already exists. But when a .debug_info section already exists it would
simply skip generating one without warning or error. Do the same for
.debug_line. It is only an error when the user explicitly uses .loc
directives and also generates the .debug_line table itself.

The tests are unfortunately arch specific because the line table is only
generated when actual instructions have been emitted. Use i386 because
that is probably the most used architecture. Before this patch the new
dwarf-line-2 testcase would fail, with this patch it succeeds (and doesn't
try to add its own line table).

gas/ChangeLog:

    * as.texi (-g): Explicitly mention when .debug_info and .debug_line
    are generated for the DWARF format.
    (Loc): Add that it is an error to both use a .loc directive and
    generate a .debug_line yourself.
    * dwarf2dbg.c (dwarf2_any_loc_directive_seen): New static variable.
    (dwarf2_directive_loc): Set dwarf2_any_loc_directive_seen to TRUE.
    (dwarf2_finish): Check dwarf2_any_loc_directive_seen before emitting
    an error. Only create .debug_line if it is empty (or doesn't exist).
    * testsuite/gas/i386/i386.exp: Add dwarf2-line-{1,2,3,4} when testing
    an elf target.
    * testsuite/gas/i386/dwarf2-line-{1,2,3,4}.{s,d,l}: New test files.
2020-09-11 19:18:44 +02:00
Cooper Qu
89ce8eab23 CSKY: Enable extend lrw by default for CK802, CK803 and CK860.
gas/
	* config/tc-csky.c (md_begin): Enable extend lrw by default for
	CK802, CK803 and CK860.
2020-09-10 17:41:38 +08:00
Cooper Qu
79c8d443b1 CSKY: Add L2Cache instructions for CK860.
opcodes/
	* csky-opc.h (csky_v2_opcodes): Add L2Cache instructions.
	* testsuite/gas/csky/cskyv2_ck860.d : Adjust to icache.iva
	opcode fixing.
2020-09-10 17:41:23 +08:00
Cooper Qu
525a0aa301 CSKY: Add new arches while refine the cpu option process.
Add arches CK804, CK805 and CK800. CK800 is an special arch which
support all instructions for CSKYV2. Refine the cpu tables to
simplify adding a new cpu.

Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>

gas/
	* config/tc-csky.c (struct csky_cpu_info): Add new members
	isa_flag, features and ver.
	(struct csky_cpu_feature): New.
	(struct csky_cpu_version): New.
	(CSKY_FEATURE_MAX): Define.
	(CSKY_CPU_REVERISON_MAX): Define.
	(FEATURE_DSP_EXT, FEATURE_DSP, FEATURE_MMU, FEATURE_VDSP,
	 FEATURE_FLOAT, FEATURE_TRUST, FEATURE_JAVA, FEATURE_SHIELD):
	Define, each standard one collection of instructions.
	(CSKY_FEATURES_DEF_NULL, CSKY_FEATURES_DEF_e,
	 CSKY_FEATURES_DEF_t, CSKY_FEATURES_DEF_f, CSKY_FEATURES_DEF_v,
	 CSKY_FEATURES_DEF_ef, CSKY_FEATURES_DEF_jt,
	 CSKY_FEATURES_DEF_efht, CSKY_FEATURES_DEF_efv,
	 CSKY_FEATURES_DEF_eft, CSKY_FEATURES_DEF_d,
	 CSKY_FEATURES_DEF_df, CSKY_FEATURES_DEF_ft,
	 CSKY_FEATURES_DEF_tv, CSKY_FEATURES_DEF_fv,
	 CSKY_FEATURES_DEF_dft, CSKY_FEATURES_DEF_dfv,
	 CSKY_FEATURES_DEF_ftv, CSKY_FEATURES_DEF_eftv): Define,
	the features combination used by cpu.
	(CSKY_CPU_REVERISON_r0p0, CSKY_CPU_REVERISON_r1p0,
	 CSKY_CPU_REVERISON_r2p0, CSKY_CPU_REVERISON_r3p0,
	 CSKY_CPU_REVERISON_RESERVED, CSKY_CPU_REVERISON_R3):
	Define, version information used by cpu.
	(csky_cpus): Refine, and add CK804, CK805 and CK800.
	(parse_cpu): Refine.
	(parse_arch): Refine.
	(md_show_usage): Refine.
	(md_begin): Refine.

include/
	* opcode/csky.h (CSKY_ARCH_804): Define.
	(CSKY_ARCH_805): Define.
	(CSKY_ARCH_800): Define.
2020-09-10 17:41:11 +08:00
Alan Modra
15a32af52f power10 on ppc32
We don't support power10 on ppc32, mainly because some instructions
have 34-bit fields for which we don't have relocations on ppc32.
If you try to assemble typical code, you'll see errors saying
"reloc ... not supported by object file format".  Also, on 32-bit
hosts with binutils configured without a 64-bit bfd, you'll see errors
saying "bignum invalid" when using large offsets.  But let's not kill
output of prefix insns entirely on 32-bit hosts.

	* config/tc-ppc.c (md_assemble): Emit prefix insn by parts when
	valueT is smaller than 64 bits.
2020-09-09 22:51:07 +09:30
Cooper Qu
6a1ed9106f CSKY: Change mvtc and mulsw's ISA flag.
gas/
	* config/tc-csky.c (CSKYV2_ISA_DSP): CSKY_ISA_DSPE60.
	(CSKY_ISA_860): Likewise.

include/
	* opcode/csky.h (CSKY_ISA_DSPE60): Define.

opcodes/
	* csky-opc.h (csky_v2_opcodes): Change mvtc and mulsw's
	ISA flag.
2020-09-09 19:26:34 +08:00
Cooper Qu
a2061b9f29 CSKY: Support option -mfloat-abi.
The option corresponds to GCC to control the float calling conversion,
and the value will be stored in .csky.attributes section.

Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>

gas/
	* config/tc-csky.c (float_abi): New.
	(md_longopts): Add mfloat-abi.
	(struct sky_option_value_table): New.
	(csky_float_abis): New, the possible values for -mfloat-abi.
	(parse_float_abi): New funtion.
	(md_show_usage): Show help information for -mfloat-abi.
	(set_csky_attribute): Store float-abi value.
2020-09-09 19:26:24 +08:00
Cooper Qu
1feede9b38 CSKY: Add FPUV3 instructions, which supported by ck860f.
Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>

gas/
	* config/tc-csky.c (float_work_fpuv3_fmovi): New function,
	helper function to encode fpuv3 fmovi instructions.
	(float_work_fpuv3_fstore): New function.
	(struct literal): Add new member 'offset'.
	(csky_cpus): New cpu CK860f.
	(enter_literal): Return literal pool pointer instead of offset.
	(parse_rt): Adjust the change of enter_literal.
	(parse_rtf): Likewise.
	(v1_work_lrw): Likewise.
	(v1_work_jbsr): Likewise.
	(v2_work_lrw): Likewise.
	(v2_work_jbsr): Likewise.
	(v2_work_jsri): Likewise.
	(vdsp_work_vlrw): Likewise.
	(is_freglist_legal): Add handler for FPUV3.
	(parse_type_freg): Likewise.
	(is_imm_within_range): Set e.X_add_number if it is a signed and
	negtive number.
	(get_operand_value): Add handler for OPRND_TYPE_IMM9b,
	OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI
	and OPRND_TYPE_DFLOAT_FMOVI.
	(float_to_half): Convert float number to harf float.

opcodes/
	* csky-dis.c (csky_output_operand): Add handlers for
	OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI and
	OPRND_TYPE_DFLOAT_FMOVI. Refine OPRND_TYPE_FREGLIST_DASH
	to support FPUV3 instructions.
	* csky-opc.h (enum operand_type): New enum OPRND_TYPE_IMM9b,
	OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI and
	OPRND_TYPE_DFLOAT_FMOVI.
	(OPRND_MASK_4_5, OPRND_MASK_6, OPRND_MASK_6_7, OPRND_MASK_6_8,
	 OPRND_MASK_7, OPRND_MASK_7_8, OPRND_MASK_17_24,
	 OPRND_MASK_20, OPRND_MASK_20_21, OPRND_MASK_20_22,
	 OPRND_MASK_20_23, OPRND_MASK_20_24, OPRND_MASK_20_25,
	 OPRND_MASK_0_3or5_8, OPRND_MASK_0_3or6_7, OPRND_MASK_0_3or25,
	 OPRND_MASK_0_4or21_24, OPRND_MASK_5or20_21,
	 OPRND_MASK_5or20_22, OPRND_MASK_5or20_23, OPRND_MASK_5or20_24,
	 OPRND_MASK_5or20_25, OPRND_MASK_8_9or21_25,
	 OPRND_MASK_8_9or16_25, OPRND_MASK_4_6or20, OPRND_MASK_5_7or20,
	 OPRND_MASK_4_5or20or25, OPRND_MASK_4_6or20or25,
	 OPRND_MASK_4_7or20or25, OPRND_MASK_6_9or17_24,
	 OPRND_MASK_6_7or20, OPRND_MASK_6or20, OPRND_MASK_7or20,
	 OPRND_MASK_5or8_9or16_25, OPRND_MASK_5or8_9or20_25): Define.
	(csky_v2_opcodes): Add FPUV3 instructions.

include/
	* opcode/csky.h (CSKY_ISA_FLOAT_7E60): Define.
2020-09-09 19:25:40 +08:00
Jozef Lawrynowicz
7d81bc937c MSP430: Support relocations for subtract expressions in .uleb128 directives
Link-time relaxations of branches are common for MSP430, given that GCC
can generate pessimal branch instructions, and the
-mcode-region=either/-mdata-region=either options to shuffle sections
can further change the type of branch instruction required.

These relaxations can result in invalid code when .uleb128
directives, used in the .gcc_except_table section, are used to calculate
the distance between two labels. A value for the .uleb128 directive is
calculated at assembly-time, and can't be updated at link-time, even if
relaxation causes the distance between the labels to change.

This patch adds relocations for subtract expressions in .uleb128
directives, to allow the linker to re-calculate the value of these
expressions after relaxation has been performed.

bfd/ChangeLog:
	* bfd-in2.h (bfd_reloc_code_real): Add
	BFD_RELOC_MSP430_{SET,SUB}_ULEB128.
	* elf32-msp430.c (msp430_elf_ignore_reloc): New.
	(elf_msp430_howto_table): Add R_MSP430{,X}_GNU_{SET,SUB}_ULEB128.
	(msp430_reloc_map): Add R_MSP430_GNU_{SET,SUB}_ULEB128.
	(msp430x_reloc_map): Add R_MSP430X_GNU_{SET,SUB}_ULEB128.
	(write_uleb128): New.
	(msp430_final_link_relocate): Handle R_MSP430{,X}_GNU_{SET,SUB}_ULEB128.
	* libbfd.c (_bfd_write_unsigned_leb128): New.
	* libbfd.h (_bfd_write_unsigned_leb128): New prototype.
	Add BFD_RELOC_MSP430_{SET,SUB}_ULEB128.
	* reloc.c: Document BFD_RELOC_MSP430_{SET,SUB}_ULEB128.

binutils/ChangeLog:
	* readelf.c (target_specific_reloc_handling): Handle
	R_MSP430{,X}_GNU_{SET,SUB}_ULEB128.

gas/ChangeLog:
	* config/tc-msp430.c (msp430_insert_uleb128_fixes): New.
	(msp430_md_end): Call msp430_insert_uleb128_fixes.

include/ChangeLog:
	* elf/msp430.h (elf_msp430_reloc_type): Add
	R_MSP430_GNU_{SET,SUB}_ULEB128.
	(elf_msp430x_reloc_type): Add R_MSP430X_GNU_{SET,SUB}_ULEB128.

ld/ChangeLog:
	* testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests.
	* testsuite/ld-msp430-elf/uleb128.s: New test.
	* testsuite/ld-msp430-elf/uleb128_430.d: New test.
	* testsuite/ld-msp430-elf/uleb128_430x.d: New test.
2020-09-08 16:18:38 +01:00
Alex Coplan
f1363b0fb4 aarch64: Add -mcpu option for Cortex-R82
This adds support for the Arm Cortex-R82 CPU in AArch64 GAS. For more
information about this processor, see [0].

[0] : https://developer.arm.com/ip-products/processors/cortex-r/cortex-r82

gas/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* config/tc-aarch64.c (aarch64_cpus): Add Cortex-R82.
	* doc/c-aarch64.texi: Document -mcpu=cortex-r82.
2020-09-08 14:22:59 +01:00
Alex Coplan
38cf07a6c0 aarch64: Add support for Armv8-R system registers
This patch adds support for the system registers introduced in Armv8-R
AArch64.

gas/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* config/tc-aarch64.c (parse_sys_reg): Also pass sysreg name to
	validation function.
	(parse_sys_ins_reg): Likewise.
	(print_operands): Pass CPU features to aarch64_print_operand().
	* testsuite/gas/aarch64/v8-r-bad-sysregs.d: New test.
	* testsuite/gas/aarch64/v8-r-bad-sysregs.l: Error output.
	* testsuite/gas/aarch64/v8-r-bad-sysregs.s: Input.
	* testsuite/gas/aarch64/v8-r-sysregs-need-arch.d: New test.
	* testsuite/gas/aarch64/v8-r-sysregs-need-arch.l: Error output.
	* testsuite/gas/aarch64/v8-r-sysregs.d: New test.
	* testsuite/gas/aarch64/v8-r-sysregs.s: Input for previous two tests.

include/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* opcode/aarch64.h (aarch64_sys_ins_reg_supported_p): Also take
	system register name in order to simplify validation for v8-R.
	(aarch64_print_operand): Also take CPU feature set, as disassembly for
	system registers now depends on arch variant.

opcodes/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* aarch64-dis.c (print_operands): Pass CPU features to
	aarch64_print_operand().
	* aarch64-opc.c (aarch64_print_operand): Use CPU features to determine
	preferred disassembly of system registers.
	(SR_RNG): Refactor to use new SR_FEAT2 macro.
	(SR_FEAT2): New.
	(SR_V8_1_A): New.
	(SR_V8_4_A): New.
	(SR_V8_A): New.
	(SR_V8_R): New.
	(SR_EXPAND_ELx): New.
	(SR_EXPAND_EL12): New.
	(aarch64_sys_regs): Specify which registers are only on
	A-profile, add R-profile system registers.
	(ENC_BARLAR): New.
	(PRBARn_ELx): New.
	(PRLARn_ELx): New.
	(aarch64_sys_ins_reg_supported_p): Reject EL3 registers for
	Armv8-R AArch64.
2020-09-08 14:21:44 +01:00
Alex Coplan
03fb3142c7 aarch64: Add support for Armv8-R DFB alias
This adds support for the DFB alias introduced in Armv8-R AArch64.

gas/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* testsuite/gas/aarch64/dfb.d: New test.
	* testsuite/gas/aarch64/dfb.s: Input.

opcodes/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* aarch64-tbl.h (aarch64_feature_v8_r): New.
	(ARMV8_R): New.
	(V8_R_INSN): New.
	(aarch64_opcode_table): Add dfb.
	* aarch64-opc-2.c: Regenerate.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Regenerate.
2020-09-08 14:18:38 +01:00
Alex Coplan
95830c988a aarch64: Add base support for Armv8-R
This patch adds the basic infrastructure needed to support Armv8-R in
AArch64 binutils: new command-line flags, new feature bits, a new BFD
architecture, and support for differentiating between architecture
variants in the disassembler.

The new command-line options added by this patch are -march=armv8-r in
GAS and -m aarch64:armv8-r in objdump.

The disassembler support is necessary since Armv8-R AArch64 introduces a
system register (VSCTLR_EL2) which shares an encoding with a different
system register (TTBR0_EL2) in Armv8-A. This also allows us to use the
correct preferred disassembly for the new DFB alias introduced in
Armv8-R.

bfd/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* archures.c (bfd_mach_aarch64_8R): New.
	* bfd-in2.h: Regenerate.
	* cpu-aarch64.c (bfd_aarch64_arch_v8_r): New.
	(bfd_aarch64_arch_ilp32): Update tail pointer.

gas/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* config/tc-aarch64.c (aarch64_archs): Add armv8-r.
	* doc/c-aarch64.texi: Document -march=armv8-r.

include/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* opcode/aarch64.h (AARCH64_FEATURE_V8_A): New.
	(AARCH64_FEATURE_V8_R): New.
	(AARCH64_ARCH_V8): Include new A-profile feature bit.
	(AARCH64_ARCH_V8_R): New.

opcodes/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* aarch64-dis.c (arch_variant): New.
	(determine_disassembling_preference): Disassemble according to
	arch variant.
	(select_aarch64_variant): New.
	(print_insn_aarch64): Set feature set.
2020-09-08 14:14:11 +01:00
Mark Wielaard
d2a5455807 gas: Output directory and file names in .debug_line_str for DWARF5
* dwarf2dbg.c (add_line_strp): New function.
	(out_dir_and_file_list): Take line_seg and sizeof_offset as
	arguments, Use DW_FORM_line_strp for dir and file. Call
	add_line_strp and set symbol offset for DWARF2_LINE_VERSION 5.
	(out_debug_line): Call out_dir_and_file_list with line_seg and
	sizeof_offset.
	* gas/testsuite/gas/elf/dwarf-5-file0.d: Expect indirect line
	strings.
2020-09-07 14:03:20 +01:00
Mark Wielaard
bdd3b953e2 gas: Output .debug_rnglists for DWARF 5.
* dwarf2dbg.c (DWARF2_RNGLISTS_VERSION): New constant.
	(out_debug_ranges): Add ranges_sym argument and set it.
	(out_debug_rnglists): New function.
	(out_debug_info): Change ranges_seg argument to ranges_sym
	and use it to set DW_AT_ranges value.
	(dwarf2_finish): Remove ranges_seg, add ranges_sym. For
	DWARF2_VERSION 5 call out_debug_rnglists.
2020-09-07 13:04:45 +01:00
Mark Wielaard
b0b3ea7e10 gas: Make sure to only add an md5 to a .file when requested.
* dwarf2dbg.c (dwarf2_directive_filename): Initialize with_md5 to
	FALSE.
	* gas/testsuite/gas/elf/dwarf-5-file0.s: Add a random bignum.
2020-09-07 12:08:07 +01:00
Mark Wielaard
dd216e07a1 gas: Use DW_FORM_sec_offset for DWARF version 4 or higher.
Older DWARF versions used DW_FORM_data4 or DW_FORM_data8 for offsets
into sections for e.g. DW_AT_stmt_list ot DW_AT_ranges. But version 4
introduced a dedicated form for such section offsets. Make sure to emit
the proper form for newer DWARF versions.

gas/ChangeLog:

	* dwarf2dbg.c (out_debug_abbrev): Use DW_FORM_sec_offset for DWARF
	version 4 or higher.
2020-09-03 18:00:03 +02:00
Alan Modra
c77a6ef610 ubsan: expr.c:1725,1741 signed integer overflow
* expr.c (add_to_result, subtract_from_result): Use unsigned
	addition and subtraction.
2020-09-02 16:30:43 +09:30
Alan Modra
01a6f9da64 ubsan: tc-z80.c:3656 shift exponent 32 is too large
* config/tc-z80.c (is_overflow): Avoid too large shift.
2020-09-02 16:30:43 +09:30
Alan Modra
6228e2790a ubsan: tc-sparc.c:1146 left shift cannot be represented
* config/tc-sparc.c (in_signed_range): Use an unsigned type for
	sign mask.
2020-09-02 16:30:43 +09:30
Alan Modra
1929210d46 ubsan: tc-nios2.c:1403 shift exponent 32 is too large
* config/tc-nios2.c (md_apply_fix): Avoid too large shift.
2020-09-02 16:30:43 +09:30
Alan Modra
7697028a6c ubsan: tc-mips.c:9606 shift exponent 32 is too large
* config/tc-mips.c (load_register): Avoid too large shift.
2020-09-02 16:30:43 +09:30
Alan Modra
602e9f0ae7 ubsan: tc-d30v.c left shift cannot be represented
* config/tc-d30v.c (parallel_ok): Use 1UL for left shift expression.
2020-09-02 16:30:43 +09:30
Alan Modra
17e782e94f ubsan: rx-parse.y:1743 shift exponent 32 is too large
* config/rx-parse.y (rx_intop): Avoid too large shifts.
	(rx_intop, rx_uintop, rx_disp3op, rx_disp5op, displacement),
	(rtsd_immediate): Use correctly typed unsigned variables.
2020-09-02 16:30:43 +09:30
Alan Modra
4dda287bf6 ubsan: obj-macho.c:503 left shift cannot be represented
* config/obj-macho.c (obj_mach_o_zerofill): Correct type of
	constant shifted left.
2020-09-02 16:30:43 +09:30
Alan Modra
251150adb1 ubsan: bfin-lex.l:503 left shift cannot be represented
* config/bfin-lex.l: Use an unsigned type for "value".
2020-09-02 16:30:42 +09:30
Alan Modra
f6e6b05211 32-bit host pdp11 breakage
If bfd_vma is 32 bits, gcc complains about shift counts exceeding
width of the type.

	* config/tc-pdp11.c (md_number_to_chars): Condition nbytes=8 code
	on BFD64.
2020-09-02 16:30:42 +09:30
Cooper Qu
4211a34001 CSKY: Add CPU CK803r3.
Move divul and divsl to CSKYV2_ISA_3E3R3 instruction set, which is
enabled by ck803r3, and it's still a part of enhance DSP instruction
set.

gas/
	* config/tc-csky.c (csky_cpus): Add ck803r3.
	(CSKY_ISA_803R3): Define.
	(CSKY_ISA_803R2): Refine, use CSKY_ISA_803R1.

include/
	* opcode/csky.h (CSKYV2_ISA_3E3R3): Define.

opcodes/
	* csky-opc.h (csky_v2_opcodes): Move divul and divsl
	to CSKYV2_ISA_3E3R3 instruction set.
2020-09-02 14:21:31 +08:00
Cooper Qu
8119cc3837 CSKY: Fix Encode of mulsws.
gas/
	* testsuite/gas/csky/cskyv2_dsp.d : Fix Encode of mulsws.

opcodes/
	* csky-opc.h (csky_v2_opcodes): Fix Encode of mulsws.
2020-09-02 14:21:21 +08:00
Cooper Qu
e61ef79e3a CSKY: Refine literals pool dump process and float register parser.
gas/
	* config/tc-csky.c (struct literal): New member bignum.
	(dump_literals): Handle big constant.
	(enter_literal): Likewise.
	(parse_type_freg): Handle vector register.
2020-09-02 14:21:02 +08:00
H.J. Lu
4c8584be76 ELF: Document the .tls_common directive
Document the .tls_common directive added by

commit b8871f357f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Feb 22 09:18:52 2016 -0800

    Properly implement STT_COMMON

	* doc/as.texi: Document the .tls_common directive.
2020-09-01 07:47:00 -07:00
Alan Modra
7af677524e PR26420, PR26421, PR26425, PR26427 UBSAN: tc-arm.c left shifts
PR 26420
	PR 26421
	PR 26425
	PR 26427
	* config/tc-arm.c (struct arm_it): Make size, size_req, cond and
	uncond_value unsigned.
	(parse_vfp_reg_list): Make setmask unsigned, vpr_str_len size_t.
	(parse_big_immediate): Cast generic_bignum elements to unsigned.
	(encode_thumb32_immediate): Shift left 0xffU.
	(double_to_single): Make sign unsigned.  Tidy.
	(move_or_literal_pool): Cast LITTLE_NUM elements to uint64_t or
	valueT.
	(vfp_or_neon_is_neon): Adjust inst.uncond_value expression.
	(md_assemble): Likewise.
	(handle_pred_state): Make cond unsigned.
	(thumb32_negate_data_op): Make variables unsigned.
	(md_apply_fix): Make value and newval unsigned, adjust uses.
2020-09-01 16:02:48 +09:30
Alan Modra
06de2e0da2 PR26510 UBSAN: tc-z8k.c left shift of negative value
This also fixes the packing of the nibble buffer, which contains
rubbish in the top 4 bits of each element.

	PR 26510
	* config/tc-z8k.c (buffer): Use unsigned char.
	(apply_fix): Use unsigned char* pointers.
	(build_bytes): Likewise and mask nibbles when packing.
2020-08-31 20:28:13 +09:30
Alan Modra
8e82201777 PR26503 UBSAN: tc-v850.c:1447 left shift cannot be represented
PR 26503
	* config/tc-v850.c (parse_register_list): Shift 1u left.
2020-08-31 20:28:13 +09:30
Alan Modra
94f360ea2f PR26502 UBSAN: tc-tic6x.c left shift of negative value
PR 26502
	* config/tc-tic6x.c (md_apply_fix): Use unsigned variables.
2020-08-31 20:28:12 +09:30
Alan Modra
8659fff005 PR26497 UBSAN: tc-sh.c:2467 left shift cannot be represented
PR 26497
	* config/tc-sh.c (assemble_ppi): Use unsigned variables.
2020-08-31 20:28:12 +09:30
Alan Modra
548c8b2ba7 PR26495 UBSAN: tc-score.c, tc-score7.c left shift of negative value
PR 26495
	* config/tc-score.c (s3_apply_fix): Use unsigned variables.
	* config/tc-score7.c (s7_apply_fix): Likewise.
2020-08-31 20:28:12 +09:30
Alan Modra
51bf29b1f7 PR26480 UBSAN: tc-nios2.c:1634 left shift cannot be represented
PR 26480
	* config/tc-nios2.c (nios2_parse_reglist): Shift 1UL left.
2020-08-31 20:28:12 +09:30
Alan Modra
baeb994f3f PR26479 UBSAN: tc-nios2.c:244 left shift cannot be represented
PR 26479
	* config/tc-nios2.c (md_chars_to_number): Cast buf[i] before shifting.
2020-08-31 20:28:11 +09:30
Alan Modra
e0fd91ef81 PR26472, PR26473, PR26474 UBSAN: tc-mips.c shift left UB
PR 26472
	PR 26473
	PR 26474
	* config/tc-mips.c (operand_reg_mask): Shift 1u left.
	(load_register): Shift 0xffffU left.
2020-08-31 20:28:11 +09:30
Alan Modra
46021a61e4 PR26471 UBSAN: tc-metag.c:7038 left shift cannot be represented
PR 26471
	* config/tc-metag.c (md_chars_to_number): Make retval unsigned.
2020-08-31 20:28:11 +09:30
Alan Modra
7a5dd76f3c PR26468 UBSAN: tc-mep.c:1684 left shift of negative value
PR 26468
	* config/tc-mep.c (md_convert_frag): Use uint32_t for addend and
	other variables.
2020-08-31 20:28:11 +09:30
Alan Modra
169ec51259 PR26493 UBSAN: tc-riscv.c left shift negative and not representable
PR 26493
	* config/tc-riscv.c (riscv_ip): Cast X_add_number passed to
	VALID_* macros to unsigned.
2020-08-31 20:28:11 +09:30
Alan Modra
880fc278ca crx: ubsan: cannot be represented
* config/tc-crx.c: Formatting.
	(CRX_PRINT): Wrap params in parentheses.  Remove parens from uses
	throughout file.
	(reset_vars, get_register, get_copregister, get_optype, get_opbits),
	(get_opflags, get_number_of_operands, parse_operand, gettrap),
	(handle_LoadStor, getconstant, check_range, getreg_image),
	(parse_operands, parse_insn, print_operand, print_constant),
	(exponent2scale, mask_reg, process_label_constant, set_operand),
	(assemble_insn, print_insn): Delete unnecessary forward declaration.
	(print_insn): Make static.
	(print_constant): Make "constant" unsigned.
	(assemble_insn): Tidy REVERSE_MATCH index calc.
	* expr.c (generic_bignum_to_int32): Cast elements to valueT.
2020-08-31 20:28:09 +09:30
Alan Modra
26e3de8e0a PR26509 UBSAN: tc-z80.c:3656 shift exponent is too large
PR 26509
	* config/tc-z80.c (is_overflow): Use 1UL in mask shift expression.
2020-08-31 20:28:09 +09:30
Alan Modra
737d219034 tic4x-coff: ubsan: various shift UB
* config/tc-tic4x.c (tic4x_gen_to_words): Rewrite mantissa
	overflow test without UB.  Avoid other UB shifts by making them
	unsigned.
2020-08-31 20:28:08 +09:30
Cooper Qu
e2e82b115c CSKY: Refine operand format error reporting.
Rename SET_ERROR_NUMBER to SET_ERROR_STRING, and add SET_ERROR_INTEGER
to report error message which pass an integer argument.

gas/
	* config/tc-csky.c (csky_error_state): New member 'arg_int'.
	(SET_ERROR_NUMBER): Rename to SET_ERROR_STRING.
	(SET_ERROR_INTEGER): New.
	(err_formats): Add error format for ERROR_FREG_OVER_RANGE and
	ERROR_VREG_OVER_RANGE.
	(csky_show_error): Pass an integer argument for some error
	numbers.
	(parse_exp): Call SET_ERROR_STRING instead of SET_ERROR_NUMBER.
	(parse_rt): Likewise.
	(parse_type_ctrlreg): Likewise.
	(csky_get_reg_val): Likewise.
	(is_reglist_legal): Likewise.
	(is_freglist_legal): Likewise.
	(is_reglist_dash_comma_legal): Likewise.
	(is_reg_lshift_illegal): Likewise.
	(is_psr_bit): Likewise.
	(parse_type_cpreg): Likewise.
	(parse_type_cpcreg): Likewise.
	(parse_type_areg): Likewise.
	(parse_type_freg): Likewise.
	(parse_ldst_imm): Likewise and call SET_ERROR_INTEGER.
	(get_operand_value): Likewise.
	(parse_operands_op): Likewise and call is_imm_within_range,
	is_imm_within_range_ext and is_oimm_within_range.
	(md_assemble): Likewise.
	(is_imm_within_range): New.
	(is_imm_within_range_ext): Rename from is_imm_over_range.
	(is_oimm_within_range): Rename from is_oimm_over_range.
	(v2_work_add_sub): Call SET_ERROR_INTEGER.
	(csky_rolc): call is_imm_within_range instead of
	is_imm_over_range.

opcodes/
	* csky-dis.c (csky_output_operand): Assign dis_info.value for
	OPRND_TYPE_VREG.
2020-08-31 11:32:18 +08:00
Cooper Qu
dd221981c4 CSKY: Add warning when -mdsp and -mcpu=ck803ern are both added.
gas/
	* config/tc-csky.c (md_begin): Add warning when -mdsp and
 	-mcpu=ck803ern are both added.
 	(parse_ldst_imm): Fix error message.
2020-08-31 11:16:21 +08:00
Alan Modra
d0ed6fddfa changelog PR fix
for the lack of a space
2020-08-30 23:00:26 +09:30
Alan Modra
2781f857e6 cr16 disassembly error of disp20 fields
When looking at the UB errors, I noticed that cbitb_test.d disassembly
wasn't reproducing the input assembly.  That turned out to be an error
in make_argument case arg_cr.  This fixes that and makes some general
tidies.

opcodes/
	* cr16-dis.c: Formatting.
	(parameter): Delete struct typedef.  Use dwordU instead
	throughout file.
	(make_argument <arg_idxr>): Simplify detection of cbitb, sbitb
	and tbitb.
	(make_argument <arg_cr>): Extract 20-bit field not 16-bit.
gas/
	* testsuite/gas/cr16/cbitb_test.d: Update expected output.
	* testsuite/gas/cr16/cbitw_test.d: Likewise.
	* testsuite/gas/cr16/sbitb_test.d: Likewise.
	* testsuite/gas/cr16/sbitw_test.d: Likewise.
	* testsuite/gas/cr16/storb_test.d: Likewise.
	* testsuite/gas/cr16/storw_test.d: Likewise.
	* testsuite/gas/cr16/tbitb_test.d: Likewise.
	* testsuite/gas/cr16/tbitw_test.d: Likewise.
2020-08-30 20:49:32 +09:30
Alan Modra
c930281005 PR26437, PR26438 UBSAN: tc-cr16.c left shifts and overflows
Always use unsigned constants in expressions generating masks.  The
following trys mightily to avoid UB (but hits it anyway with bits=32
and 0x7fffffff << 1), and worse, for 32-bit int, 64-bit long, bits=32
doesn't generate 0xffffffff.
    max = ((((1 << (bits - 1)) - 1) << 1) | 1);
results in -1, or max = 0xffffffffffffffff.

This patch fixes that problem, a possible shift exponent of -1U,
removes some dead code, and makes general tidies.

	PR26437
	PR26438
	* config/tc-cr16.c: Include limits.h, formatting.
	(CR16_PRINT): Wrap params in parentheses.  Remove parens from uses
	throughout file.
	(getconstant): Handle zero nbits.
	(print_operand): Simplify handling of index regs.
	(check_range): Use int32_t variables.  Correct range checks.
2020-08-30 20:49:18 +09:30
Alan Modra
8a267ea847 PR26481 UBSAN: tc-pj.c:281 index out of bounds
PR 26481
	* config/tc-pj.c (md_assemble): Don't loop past end of
	opcode->arg array.
2020-08-29 13:17:13 +09:30
Alan Modra
ed2ed4dcf4 PR26460 UBSAN: tc-ia64.c:6107 index out of bounds
PR 26460
	* config/tc-ia64.c (parse_operands): Don't access past end of
	idesc->operands.
2020-08-28 23:15:21 +09:30
Mark Wielaard
4a5700b62f gas: Handle bad -gdwarf options, just like bad --gdwarf options.
parse_args uses getopt_long_only so it can handle long options both
with double and single dash. But this means that some single dash
options like -gdwarf-1 don't generate an error (unlike --gdwarf-1).

This is especially confusing since there is also --gdwarf2, but no
--gdwarf4 (it is --gdwarf-4). When giving -gdwarf4 the option is
silently interpreted as -g (which set dwarf_version to 2). This causes
some confusion for people who don't expect this and suddenly get
DWARF2 instead of DWARF4 as they might expect.

So make it so that the -gdwarf<unknown> creates an error, just like
--gdwarf<unknown> would.
2020-08-28 15:26:01 +02:00
Cooper Qu
0861f561eb CSKY: Support attribute section.
bfd
        * elf32-csky.c (csky_archs): Fix arch names.
        (csky_find_arch_with_name): New.
        (elf32_csky_merge_attributes): New.
        (csky_elf_merge_private_bfd_data): Add process of merge
        attribute section.
        (elf32_csky_obj_attrs_arg_type): New.
        (elf32_csky_obj_attrs_handle_unknown): New.
        (elf_backend_obj_attrs_vendor): Define.
        (elf_backend_obj_attrs_section): Define.
        (elf_backend_obj_attrs_arg_type): Define.
        (elf_backend_obj_attrs_section_type): Define.

binutils/
        * readelf.c (get_csky_section_type_name): New.
        (get_section_type_name): Add handler for CSKY.
        (display_csky_attribute): New.
        (process_arch_specific): Add handler for CSKY.
        * testsuite/binutils-all/strip-3.d: Remove .csky.attributes
        section.

elfcpp/
        * elfcpp.h (enum SHT): New enum SHT_CSKY_ATTRIBUTES.

gas/
        * gas/config/tc-csky.c (md_begin): Set attributes.
        (isa_flag): Change type to unsigned 64 bits.
        (struct csky_cpu_info): Likewise.
        (struct csky_macro_info): Likewise.
        (set_csky_attribute): New.
        * testsuite/gas/csky/802j.d: Ignore .csky.attributes section.
        * testsuite/gas/csky/all.d: Likewise.
        * testsuite/gas/csky/bsr1.d: Likewise.
        * testsuite/gas/csky/csky_vdsp.d: Likewise.
        * testsuite/gas/csky/cskyv2_all.d: Likewise.
        * testsuite/gas/csky/cskyv2_ck803r2.d: Likewise.
        * testsuite/gas/csky/cskyv2_ck860.d: Likewise.
        * testsuite/gas/csky/cskyv2_dsp.d: Likewise.
        * testsuite/gas/csky/cskyv2_elrw.d: Likewise.
        * testsuite/gas/csky/cskyv2_float.d: Likewise.
        * testsuite/gas/csky/enhance_dsp.d: Likewise.
        * testsuite/gas/csky/java.d: Likewise.
        * testsuite/gas/csky/v1_float.d: Likewise.
        * testsuite/gas/csky/v2_float_part1.d: Likewise.
        * testsuite/gas/csky/v2_float_part2.d: Likewise.
        * testsuite/gas/csky/v2_tls_gd.d: Likewise.
        * testsuite/gas/csky/v2_tls_ie.d: Likewise.
        * testsuite/gas/csky/v2_tls_ld.d: Likewise.
        * testsuite/gas/csky/v2_tls_le.d: Likewise.
        * testsuite/gas/elf/elf.exp: Add handler for CSKY.
        * testsuite/gas/elf/section2.e-csky: New.

include/
        * elf/csky.h (SHT_CSKY_ATTRIBUTES): Define.
        (Tag_CSKY_ARCH_NAME): New enum constant.
        (Tag_CSKY_CPU_NAME): Likewise.
        (Tag_CSKY_ISA_FLAGS): Likewise.
        (Tag_CSKY_DSP_VERSION): Likewise.
        (Tag_CSKY_VDSP_VERSION): Likewise.
        (Tag_CSKY_FPU_VERSION): Likewise.
        (Tag_CSKY_FPU_ABI): Likewise.
        (Tag_CSKY_FPU_ROUNDING): Likewise.
        (Tag_CSKY_FPU_DENORMAL): Likewise.
        (Tag_CSKY_FPU_Exception): Likewise.
        (Tag_CSKY_FPU_NUMBER_MODULE): Likewise.
        (Tag_CSKY_FPU_HARDFP): Likewise.
        (Tag_CSKY_MAX): Likewise.
        (VAL_CSKY_DSP_VERSION_EXTENSION): Likewise.
        (VAL_CSKY_DSP_VERSION_2): Likewise.
        (VAL_CSKY_VDSP_VERSION_1): Likewise.
        (VAL_CSKY_VDSP_VERSION_2): Likewise.
        (VAL_CSKY_FPU_ABI_SOFT): Likewise.
        (VAL_CSKY_FPU_ABI_SOFTFP): Likewise.
        (VAL_CSKY_FPU_ABI_HARD): Likewise.
        (VAL_CSKY_FPU_HARDFP_HALF): Likewise.
        (VAL_CSKY_FPU_HARDFP_SINGLE): Likewise.
        (VAL_CSKY_FPU_HARDFP_DOUBLE): Likewise.
        * opcode/csky.h (CSKY_ISA_VDSP_V2): Define.
        CSKYV1_ISA_E1: Change to long constant type.
        CSKYV2_ISA_E1: Likewise.
        CSKYV2_ISA_1E2: Likewise.
        CSKYV2_ISA_2E3: Likewise.
        CSKYV2_ISA_3E7: Likewise.
        CSKYV2_ISA_7E10: Likewise.
        CSKYV2_ISA_3E3R1: Likewise.
        CSKYV2_ISA_3E3R2: Likewise.
        CSKYV2_ISA_10E60: Likewise.
        CSKY_ISA_TRUST: Likewise.
        CSKY_ISA_CACHE: Likewise.
        CSKY_ISA_NVIC: Likewise.
        CSKY_ISA_CP: Likewise.
        CSKY_ISA_MP: Likewise.
        CSKY_ISA_MP_1E2: Likewise.
        CSKY_ISA_JAVA: Likewise.
        CSKY_ISA_MAC: Likewise.
        CSKY_ISA_MAC_DSP: Likewise.
        CSKY_ISA_DSP: Likewise.
        CSKY_ISA_DSP_1E2: Likewise.
        CSKY_ISA_DSP_ENHANCE: Likewise.
        CSKY_ISA_FLOAT_E1: Likewise.
        CSKY_ISA_FLOAT_1E2: Likewise.
        CSKY_ISA_FLOAT_1E3: Likewise.
        CSKY_ISA_FLOAT_3E4: Likewise.
        CSKY_ISA_VDSP: Likewise.

ld/
        * emulparams/cskyelf.sh: Support attribute section.
        * testsuite/ld-csky/tls-le-v1.d: Match .csky.attributes section.
        * ld/testsuite/ld-csky/tls-le.d: Likewise.
        * testsuite/ld-elf/non-contiguous.ld: Ignore .csky.attributes
        section.

opcodes/
        * csky-dis.c (CSKY_DEFAULT_ISA): Define.
        (csky_dis_info): Add member isa.
        (csky_find_inst_info): Skip instructions that do not belong to
        current CPU.
        (csky_get_disassembler): Get infomation from attribute section.
        (print_insn_csky): Set defualt ISA flag.
        * csky.h (CSKY_ISA_VDSP_2): Rename from CSKY_ISA_VDSP_V2.
        * csky-opc.h (struct csky_opcode): Change isa_flag16 and
        isa_flag32'type to unsigned 64 bits.
2020-08-28 17:23:24 +08:00
Alan Modra
6fbd4a8e8b PR26467 UBSAN: cgen.c:762 shift exponent 18446744073709551615
PR 26467
	* cgen.c (weak_operand_overflow_check): Handle opmask for
	operand length zero.  Use 1UL constant.
2020-08-27 21:56:33 +09:30
Alan Modra
e637b7ba2f PR26508 UBSAN: tc-xtensa.c:7764 null pointer bsearch
PR 26508
	* config/tc-xtensa.c (xg_get_trampoline_chain): Return early
	when n_entries is zero.
2020-08-26 23:23:45 +09:30
Alan Modra
d8d6da137d PR26448 UBSAN: symbols.c:1586 left shift of negative value
Besides avoiding the UB, this also makes right shifts inside
expression symbols unsigned, consistent with the way gas evaluates
expressions in source.

	PR 26448
	* symbols.c: Include limits.h.
	(resolve_symbol_value <O_left_shift, O_right_shift>): Do an
	unsigned shift.  Warn if shift count larger than valueT size.
2020-08-26 23:23:44 +09:30
Alan Modra
b2f386b99c PR26447 UBSAN: expr.c:1936 left shift of negative value
PR 26447
	* expr.c (expr <O_left_shift>): Do an unsigned shift.
2020-08-26 23:23:44 +09:30
David Faust
4449c81a85 bpf: add xBPF ISA
This patch adds support for xBPF, another ISA targetting the BPF
virtual architecture. For now, the primary difference between eBPF
and xBPF is that xBPF supports indirect calls through the
'call %reg' form of the call instruction.

bfd/
	* archures.c (bfd_mach_xbpf): Define.
	* bfd-in2.h: Regenerate.
	* cpu-bpf.c (bfd_xbpf_arch) New.
	(bfd_bpf_arch) Update next in list field to point to xbpf arch.

cpu/
	* bpf.cpu (arch bpf): Add xbpf mach and isas.
	(define-xbpf-isa) New pmacro.
	(all-isas) Add xbpfle,xbpfbe.
	(endian-isas): New pmacro.
	(mach xbpf): New.
	(model xbpf-def): Likewise.
	(h-gpr): Add xbpf mach.
	(f-dstle, f-srcle, dstle, srcle): Add xbpfle isa.
	(f-dstbe, f-srcbe, dstbe, srcbe): Add xbpfbe isa.
	(define-alu-insn-un): Use new endian-isas pmacro.
	(define-alu-insn-bin, define-alu-insn-mov): Likewise.
	(define-endian-insn, define-lddw): Likewise.
	(dlind, dxli, dxsi, dsti): Likewise.
	(define-cond-jump-insn, define-call-insn): Likewise.
	(define-atomic-insns): Likewise.

gas/
	* config/tc-bpf.c: Add option -mxbpf to select xbpf isa.
	* testsuite/gas/bpf/indcall-1.d: New file.
	* testsuite/gas/bpf/indcall-1.s: Likewise.
	* testsuite/gas/bpf/indcall-bad-1.l: Likewise.
	* testsuite/gas/bpf/indcall-bad-1.s: Likewise.
	* testsuite/gas/bpf/bpf.exp: Run new tests.

opcodes/
	* bpf-desc.c: Regenerate.
	* bpf-desc.h: Likewise.
	* bpf-opc.c: Likewise.
	* bpf-opc.h: Likewise.
	* disassemble.c (disassemble_init_for_target): Set bits for xBPF
	ISA when appropriate.
2020-08-26 15:39:00 +02:00
Alan Modra
69ff2100fd PR26501, ASAN: tic54x_undefined_symbol tc-tic54x.c:5015
PR26501
	* gas/config/tc-tic54x.c (tic54x_undefined_symbol): Properly treat
	misc_symbol_hash entries without values.
2020-08-25 23:07:10 +09:30
Alan Modra
1de153a168 PR26500, ASAN: tic4x_inst_make tc-tic4x.c:1247
PR 26500
	* tc-tic4x.c (tic4x_inst_make): Don't die on terminating insn
	with name = "".
2020-08-25 23:07:10 +09:30
Alan Modra
d3e0baddb2 PR26441, ASAN: get_b_cc tc-cr16.c:1521
PR 26441
	* config/tc-cr16.c (get_b_cc): Return NULL early if op isn't
	two or three chars, and don't bother copying.
2020-08-25 23:07:10 +09:30
Alan Modra
250dd99fc9 PR26426, ASAN: neon_quad tc-arm.c:15175
PR 26426
	* config/tc-arm.c (do_neon_mvn, do_neon_swp): Bail out on
	NS_NULL shape.
2020-08-25 23:07:10 +09:30
Alan Modra
30b940a097 PR26410, UBSAN: symbols.c:1818
Don't memset(0,0,0).

	PR 26410
	* symbols.c (dollar_label_count, dollar_label_max): Make size_t.
	(dollar_label_clear): Don't call memset with NULL pointer.
2020-08-25 23:07:10 +09:30
Alan Modra
ca159256b4 gas warning fixes
Some versions of gcc with -Werror=format-overflow complain about using
a perfectly good 7 char buffer for "r%dr%d" when the int is between 0
and 64, apparently not seeing the value range.

note: __builtin___sprintf_chk output between 5 and 24 bytes into a destination of size 7

	* config/tc-arc.c (declare_register_set): Avoid false positive
	format-overflow warning.
	* config/tc-epiphany.c (md_assemble): Likewise.
	* config/tc-mips.c (md_begin): Likewise.
	* config/tc-mmix.c (mmix_md_begin): Likewise.
	* config/tc-nds32.c (nds32_elf_append_relax_relocs): Avoid false
	positive "may be used uninitialized" warning.
2020-08-25 23:06:50 +09:30
Cooper Qu
531c73a37b CSKY: Add new arch CK860.
bfd/
        * bfd-in2.h (bfd_mach_ck860): New.
        * cpu-csky.c (arch_info_struct): Add item for CK860.

gas/
        * config/tc-csky.c (csky_archs): Add item for CK860,
        change ck810 and ck807's arch_flag.
        (csky_cpus): Add item for CK860.
        (md_begin): Enable DSP for CK810 and CK807 by default.
        (md_apply_fix): Fix CKCORE_TLS_IE32 relocation failure.
        * gas/testsuite/gas/csky/cskyv2_all.d: Change 'sync 0'
        to 'sync'.
        * gas/testsuite/gas/csky/cskyv2_all.s: Likewise.
        * gas/testsuite/gas/csky/cskyv2_ck860.d: New.
        * gas/testsuite/gas/csky/cskyv2_ck860.s: New.
        * gas/testsuite/gas/csky/enhance_dsp.d: Change plsli.u16
        to plsli.16.
        * gas/testsuite/gas/csky/enhance_dsp.s: Likewise.

include/
        * opcode/csky.h (CSKYV2_ISA_10E60): New.
        (CSKY_ARCH_860): New.

opcode/
        * csky-dis.c (csky_find_inst_info): Skip CK860's instructions
        in other CPUs to speed up disassembling.
        * csky-opc.h (csky_v2_opcodes): Add CK860's instructions,
        Change plsli.u16 to plsli.16, change sync's operand format.

Change-Id: I80ec1a9c0cc600d668082a9b91ae6d45b33ec0fc
2020-08-24 20:27:07 +08:00
Alan Modra
12c4b9aad5 tic54x fixes
A number of the tic54x tests were failing, and I thought it worth
investigating since the target makes use of a lot of hash tables, and
we've just changed gas hash tables.  It turns out none of the gas
failures were due to hashing.

	* config/tc-tic54x.c (stag_add_field_symbols): Don't free "name"
	in case where it isn't copied.
	* config/tc-tic54x.h (LOCAL_LABELS_FB): Undef.
	* testsuite/gas/tic54x/field.d: Dump section contents and symbols
	rather than disassembling.
	* testsuite/gas/tic54x/set.d: Adjust for newer disassembly.
2020-08-24 21:48:08 +09:30
Alan Modra
f16c3d4f13 Remove "memory exhausted" messages
Since we use xcalloc to set up hash table memory, htab_create won't
ever return a failure.

	* config/tc-aarch64.c (md_begin): Don't bother checking for
	out of memory failure from str_htab_create.
	* config/tc-arc.c (arc_insert_opcode, md_begin): Likewise.
	(arc_extcorereg, arc_stralloc): Likewise.
	* config/tc-arm.c (md_begin): Likewise.
	* config/tc-cr16.c (initialise_reg_hash_table, md_begin): Likewise.
	* config/tc-cris.c (md_begin): Likewise.
	* config/tc-crx.c (md_begin): Likewise.
	* config/tc-pdp11.c (md_begin): Likewise.
	* config/tc-score.c (s3_build_reg_hsh, s3_begin): Likewise.
	* config/tc-score7.c (s7_build_reg_hsh, s7_begin): Likewise.
2020-08-24 13:29:33 +09:30
Alan Modra
f3da8a96ee gcc-4 -Og false positive "may be used uninitialised"
binutils/
	* readelf.c (dump_section_as_strings) Avoid false positive
	"may be used uninitialised".
gas/
	* config/tc-arm.c (move_or_literal_pool): Avoid false positive
	"may be used uninitialised".
	(opcode_lookup): Likewise.
2020-08-24 13:29:22 +09:30
Alan Modra
85d14aaeb7 PR26526, 5014c2d22b breaks compiling the Linux kernel for ARM
PR 26526
	* symbols.c (local_symbol_convert): Clear out xtra.
2020-08-24 13:09:53 +09:30
Cooper Qu
d04aee0f41 CSKY: Add ck803r2 series cpu.
gas/
        * config/tc-csky.c (CSKY_ISA_803R2): New.
        (csky_archs): Add ck803r2 series.
        (md_begin): Fix warning about -medsp.
        (csky_get_freg_val): Support lowercase of fpu register name.
        * testsuite/gas/csky/cskyv2_ck803r2.s: New file.
        * testsuite/gas/csky/cskyv2_ck803r2.d: New file.

include/
        * csky.h (CSKYV2_ISA_3E3R2): New.

opcodes/
        * csky-opc.h (csky_v2_opcodes): Add instruction bnezad.
2020-08-24 10:25:03 +08:00
Alan Modra
fe0e921f00 PR26513, 629310abec breaks assembling PowerPC Linux kernels
Inserting with replacement is wrong for some gas hash table uses.
This patch implements an htab_insert that conditionally replaces, and
similarly for str_hash_insert.  str_hash_insert with replace=0 is
roughly equivalent to the older hash_insert, and str_hash_insert with
replace=1 to the older hash_jam, but return values are different.  I
found it useful to know whether the slot was occupied prior to
inserting/replacing.  I've also reinstated the fatal errors on messing
up opcode tables with duplicates.

	PR 26513
	* hash.h (htab_insert): Update prototype and comment.
	(struct string_tuple): Make "value" a const void*.
	(string_tuple_alloc): Likewise.
	(str_hash_find, str_hash_find_n): Cast returned value.
	(str_hash_insert): Add "replace" parameter, and return slot pointer.
	Free alloc'd element when not inserted.
	* hash.c (htab_insert): Likewise.  Return slot when element exists,
	otherwise return NULL.
	* read.c (pop_insert): Insert into hash table without first searching.
	* config/tc-avr.c (md_begin): Likewise.
	* config/tc-msp430.c (md_begin): Likewise.
	* config/tc-nds32.c (nds32_init_nds32_pseudo_opcodes): Likewise.
	* config/tc-v850.c (md_begin): Likewise.
	* macro.c (do_formals, define_macro, macro_expand_body): Likewise.
	(delete_macro): Delete from hash table.
	* config/tc-tic54x.c (subsym_create_or_replace): Correct logic.

	* symbols.c (local_symbol_make, symbol_table_insert): Allow
	replacement of hash table entries.
	* config/obj-coff-seh.c (seh_hash_insert): Likewise.
	* config/obj-coff.c (tag_insert): Likewise.
	* config/tc-iq2000.c (iq2000_add_macro): Likewise.
	* config/tc-m68k.c (md_begin): Likewise for aliases.
	* config/tc-tic4x.c (tic4x_asg): Likewise.
	* config/tc-tic6x.c (md_begin): Likewise.

	* dw2gencfi.c (dwcfi_hash_find_or_make): Disallow replacement of
	hash table entries.
	* ecoff.c (add_string, get_tag): Likewise.
	* macro.c (expand_irp): Likewise.
	* config/obj-elf.c (build_additional_section_info): Likewise.
	* config/tc-aarch64.c (insert_reg_alias): Likewise.
	(checked_hash_insert): Likewise.
	* config/tc-alpha.c (get_alpha_reloc_tag, md_begin): Likewise.
	* config/tc-arc.c (arc_insert_opcode, declare_register): Likewise.
	(declare_addrtype, md_begin, arc_extcorereg): Likewise.
	* config/tc-arm.c (insert_reg_alias): Likewise.
	(arm_tc_equal_in_insn, md_begin): Likewise.
	* config/tc-cr16.c (initialise_reg_hash_table, md_begin): Likewise.
	* config/tc-cris.c (md_begin): Likewise.
	* config/tc-crx.c (md_begin): Likewise.
	* config/tc-csky.c (md_begin): Likewise.
	* config/tc-d10v.c (md_begin): Likewise.
	* config/tc-dlx.c (md_begin): Likewise.
	* config/tc-ft32.c (md_begin): Likewise.
	* config/tc-h8300.c (md_begin): Likewise.
	* config/tc-hppa.c (md_begin): Likewise.
	* config/tc-i386.c (md_begin): Likewise.
	* config/tc-ia64.c (dot_rot, dot_entry, declare_register): Likewise.
	(md_begin, dot_alias): Likewise.
	* config/tc-m68hc11.c (md_begin): Likewise.
	* config/tc-m68k.c (md_begin): Likewise.
	* config/tc-mcore.c (md_begin): Likewise.
	* config/tc-microblaze.c (md_begin): Likewise.
	* config/tc-mips.c (md_begin): Likewise.
	* config/tc-mmix.c (md_begin): Likewise.
	* config/tc-mn10200.c (md_begin): Likewise.
	* config/tc-mn10300.c (md_begin): Likewise.
	* config/tc-moxie.c (md_begin): Likewise.
	* config/tc-nds32.c (nds32_relax_hint, md_begin): Likewise.
	* config/tc-nios2.c (md_begin): Likewise.
	* config/tc-ns32k.c (md_begin): Likewise.
	* config/tc-pdp11.c (md_begin): Likewise.
	* config/tc-pj.c (fake_opcode, md_begin): Likewise.
	* config/tc-ppc.c (ppc_setup_opcodes): Likewise.
	* config/tc-pru.c (md_begin): Likewise.
	* config/tc-riscv.c (init_ext_version_hash): Likewise.
	(init_opcode_names_hash, hash_reg_name, init_opcode_hash): Likewise.
	(riscv_init_csr_hash): Likewise.
	* config/tc-s390.c (s390_setup_opcodes, md_begin): Likewise.
	* config/tc-score.c (s3_insert_reg): Likewise.
	(s3_build_score_ops_hsh, s3_build_dependency_insn_hsh): Likewise.
	* config/tc-score7.c (s7_build_score_ops_hsh): Likewise.
	(s7_build_dependency_insn_hsh, s7_insert_reg): Likewise.
	* config/tc-sh.c (md_begin): Likewise.
	* config/tc-sparc.c (md_begin): Likewise.
	* config/tc-spu.c (md_begin): Likewise.
	* config/tc-tic30.c (md_begin): Likewise.
	* config/tc-tic4x.c (tic4x_inst_insert): Likewise.
	* config/tc-tic54x.c (stag_add_field_symbols, md_begin): Likewise.
	(tic54x_endstruct, tic54x_var, tic54x_macro_info): Likewise.
	(subsym_substitute): Likewise.
	* config/tc-tilegx.c (md_begin): Likewise.
	* config/tc-tilepro.c (md_begin): Likewise.
	* config/tc-vax.c (vip_begin): Likewise.
	* config/tc-wasm32.c (md_begin): Likewise.
	* config/tc-xgate.c (md_begin): Likewise.
	* config/tc-z8k.c (md_begin): Likewise.
	* testsuite/gas/ppc/dcbt.d,
	* testsuite/gas/ppc/dcbt.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.

	* ecoff.c (add_string): Report fatal error on duplicates.
	* config/tc-alpha.c (md_begin): Likewise.
	* config/tc-arc.c (arc_insert_opcode, declare_register): Likewise.
	(declare_addrtype, md_begin, arc_extcorereg): Likewise.
	* config/tc-cr16.c (initialise_reg_hash_table, md_begin): Likewise.
	* config/tc-cris.c (md_begin): Likewise.
	* config/tc-crx.c (md_begin): Likewise.
	* config/tc-dlx.c (md_begin): Likewise.
	* config/tc-hppa.c (md_begin): Likewise.
	* config/tc-i386.c (md_begin): Likewise.
	* config/tc-ia64.c (dot_rot, dot_entry, declare_register): Likewise.
	(md_begin): Likewise.
	* config/tc-m68k.c (md_begin): Likewise.
	* config/tc-mips.c (md_begin): Likewise.
	* config/tc-nios2.c (md_begin): Likewise.
	* config/tc-ns32k.c (md_begin): Likewise.
	* config/tc-ppc.c (ppc_setup_opcodes): Likewise.
	* config/tc-pru.c (md_begin): Likewise.
	* config/tc-riscv.c (init_ext_version_hash): Likewise.
	(init_opcode_names_hash, hash_reg_name, init_opcode_hash): Likewise.
	* config/tc-s390.c (s390_setup_opcodes, md_begin): Likewise.
	* config/tc-sparc.c (md_begin): Likewise.
	* config/tc-tic30.c (md_begin): Likewise.
	* config/tc-tic4x.c (tic4x_inst_insert): Likewise.
	* config/tc-tilegx.c (md_begin): Likewise.
	* config/tc-tilepro.c (md_begin): Likewise.
	* config/tc-vax.c (vip_begin): Likewise.

	* config/tc-alpha.c,
	* config/tc-arm.c,
	* config/tc-avr.c,
	* config/tc-cr16.c,
	* config/tc-csky.c,
	* config/tc-i386.c,
	* config/tc-m68hc11.c,
	* config/tc-m68k.c,
	* config/tc-microblaze.c,
	* config/tc-ns32k.c,
	* config/tc-pj.c,
	* config/tc-ppc.c,
	* config/tc-score.c,
	* config/tc-score7.c,
	* config/tc-tic4x.c,
	* config/tc-tic54x.c,
	* config/tc-tilegx.c,
	* config/tc-tilepro.c,
	* config/tc-xgate.c: Formatting.
2020-08-23 21:38:05 +09:30
Alan Modra
5014c2d22b Redo gas local symbol support
gas handles local symbols specially in order to save memory, but the
implementation using two separate hash tables is inefficient,
particularly the scheme of duplicating a struct local_symbol when it
needs to be converted to a full struct symbol.  Also, updating symbol
pointers with LOCAL_SYMBOL_CHECK is horrible and has led to some hard
to find bugs.

This changes the implementation to use a single hash table and avoids
another copy of the symbol name in symbol_entry_t.  When converting
local symbols the struct local_symbol memory is reused.  Not only
does that save memory, but there is no need to twiddle symbol pointers
with LOCAL_SYMBOL_CHECK.

Assembling gcc-10 -g -Og gold/powerpc.cc output shows the following:

old:
symbol table hash statistics:
	1371192 searches
	1290398 collisions
	143585 elements
	262139 table size
mini local symbol table hash statistics:
	2966204 searches
	2707489 collisions
	523533 elements
	1048573 table size
523533 mini local symbols created, 140453 converted

new:
symbol table hash statistics:
	2828883 searches
	2453138 collisions
	526665 elements
	1048573 table size
523533 mini local symbols created, 140453 converted

	* symbols.c (struct local_symbol): Add "hash" entry.  Reorder fields.
	Delete union.  Adjust code throughout file.
	(struct symbol): Add "hash", "name" and "x" entries.  Reorder fields.
	Split off some to..
	(struct xsymbol): ..this.  New struct.  Adjust code throughout file
	accessing these fields.
	(struct symbol_entry): Delete.
	(union symbol_entry): New.
	(hash_symbol_entry): Adjust for symbol_entry_t change.
	(symbol_entry_find): Likewise.
	(eq_symbol_entry): Compare hash values too.
	(symbol_entry_alloc): Delete.
	(local_symbol_converted_p, local_symbol_mark_converted): Delete.
	(local_symbol_get_real_symbol, local_symbol_set_real_symbol): Delete.
	(local_hash): Delete.
	(abs_symbol_x, dot_symbol_x): New static var.
	(symbol_init): New function.
	(symbol_create): Rewrite.
	(LOCAL_SYMBOL_CHECK): Delete.  Replace uses throughout with simple
	test of flags.local_symbol.
	(local_symbol_make): Adjust for struct local_symbol changes.
	(local_symbol_convert): Rewrite.  Adjust all callers.
	(symbol_table_insert): Simplify.
	(symbol_clone): Comment on local sym cloning.  Handle split symbol
	struct.
	(get_real_sym): Delete.  Remove all uses.
	(symbol_find_exact_noref): Simplify.
	(resolve_local_symbol): Don't resolve non-locals.
	(S_SET_SEGMENT): Don't special case reg_section.
	(S_SET_NAME): Set both name and bsym->name.
	(symbol_mark_resolved, symbol_resolved_p): Simplify.
	(symbol_symbolS): Update comment.
	(symbol_begin): Don't create local_hash.  Adjust abs_symbol setup.
	(dot_symbol_init): Adjust dot_symbol setup.
	(symbol_print_statistics): Delete local_hash stats.
2020-08-21 18:39:54 +09:30
Alan Modra
3c0d9d71db gas symbol struct field renaming
Get rid of sy_ prefix, and some unused fields.

	* symbols.c (struct symbol_flags): Rename sy_volatile to volatil,
	and remove sy_ from other field names.  Update throughout.
	(struct symbol): Remove sy_ from field names.  Delete unused
	TARGET_SYMBOL_FIELDS.  Update throughout file.  Move after..
	(struct local_symbol): ..here.  Remove lsy_ from field names.
	Delete unused TC_LOCAL_SYMFIELD_TYPE.  Update throughout file.
	(local_symbol_resolved_p, local_symbol_mark_resolved): Delete.
	Expand uses throughout file.
	(local_symbol_get_frag, local_symbol_set_frag): Likewise.
	(symbol_new): Move symbol_table_frozen test to..
	(symbol_append): ..here, and..
	(symbol_insert): ..here.
	(resolve_symbol_value, symbol_relc_make_expr): White space fixes.
	(HANDLE_XADD_OPT1, HANDLE_XADD_OPT2): Likewise.
	* config/obj-coff.h (RESOLVE_SYMBOL_REDEFINITION): Update.
2020-08-21 18:39:23 +09:30
Alan Modra
e01e1cee39 Rearrange symbol_create parameters
These functions take an offset within frag, frag within section, and
section parameter.  So it makes sense to order the parameters as
section, frag, offset.

	* symbols.h (symbol_new, symbol_create, local_symbol_make),
	(symbol_temp_new): Arrange params as section, frag, offset.
	* symbols.c: Adjust to suit.
	* as.c: Likewise.
	* cgen.c: Likewise.
	* dwarf2dbg.c: Likewise.
	* ecoff.c: Likewise.
	* expr.c: Likewise.
	* itbl-ops.c: Likewise.
	* read.c: Likewise.
	* stabs.c: Likewise.
	* subsegs.c: Likewise.
	* config/obj-coff.c: Likewise.
	* config/obj-elf.c: Likewise.
	* config/obj-macho.c: Likewise.
	* config/tc-aarch64.c: Likewise.
	* config/tc-alpha.c: Likewise.
	* config/tc-arc.c: Likewise.
	* config/tc-arm.c: Likewise.
	* config/tc-avr.c: Likewise.
	* config/tc-cr16.c: Likewise.
	* config/tc-cris.c: Likewise.
	* config/tc-csky.c: Likewise.
	* config/tc-dlx.c: Likewise.
	* config/tc-hppa.c: Likewise.
	* config/tc-i386.c: Likewise.
	* config/tc-ia64.c: Likewise.
	* config/tc-m32r.c: Likewise.
	* config/tc-m68k.c: Likewise.
	* config/tc-mips.c: Likewise.
	* config/tc-mmix.c: Likewise.
	* config/tc-mn10200.c: Likewise.
	* config/tc-mn10300.c: Likewise.
	* config/tc-nds32.c: Likewise.
	* config/tc-nios2.c: Likewise.
	* config/tc-ppc.c: Likewise.
	* config/tc-riscv.c: Likewise.
	* config/tc-s390.c: Likewise.
	* config/tc-sh.c: Likewise.
	* config/tc-tic4x.c: Likewise.
	* config/tc-tic54x.c: Likewise.
	* config/tc-xtensa.c: Likewise.
2020-08-21 18:26:35 +09:30
Cooper Qu
d285ba8d06 CSKY: Support two operands form for bloop.
gas/
        * config/tc-csky.c (csky_insn_info): Add member last_isize.
        (md_assemble): Assign value to csky_insn.last_isize.
        * testsuite/gas/csky/enhance_dsp.d: Test bloop's two operands form.
        * testsuite/gas/csky/enhance_dsp.s: Likewise.

opcodes/
        * csky-opc.h (csky_v2_opcodes): Add two operands form for bloop.
2020-08-21 16:50:11 +08:00
Martin Liska
a0522545b6 Remove --reduce-memory-overheads and --hash-size arguments.
* NEWS: Mention --reduce-memory-overheads and --hash-size arguments
	options.
	* as.c: Remove the options from help.
	* doc/as.texi: Remove options.
	* doc/internals.texi: Remove hash from documentation.
	* hash.c (struct hash_entry): Remove.
	(struct hash_control): Likewise.
	(set_gas_hash_table_size): Likewise.
	(hash_new_sized): Likewise.
	(hash_new): Likewise.
	(hash_die): Likewise.
	(hash_lookup): Likewise.
	(hash_insert): Likewise.
	(hash_jam): Likewise.
	(hash_replace): Likewise.
	(hash_find): Likewise.
	(hash_find_n): Likewise.
	(hash_delete): Likewise.
	(hash_traverse): Likewise.
	(hash_print_statistics): Likewise.
	(TABLES): Likewise.
	(STATBUFSIZE): Likewise.
	(main): Likewise.
	(what): Likewise.
	(destroy): Likewise.
	(applicatee): Likewise.
	(whattable): Likewise.
	* hash.h (struct hash_control): Likewise.
	(set_gas_hash_table_size): Likewise.
	(hash_new): Likewise.
	(hash_new_sized): Likewise.
	(hash_die): Likewise.
	(hash_insert): Likewise.
	(hash_jam): Likewise.
	(hash_replace): Likewise.
	(hash_find): Likewise.
	(hash_find_n): Likewise.
	(hash_delete): Likewise.
	(hash_traverse): Likewise.
	(hash_print_statistics): Likewise.
2020-08-20 10:57:52 +09:30
Martin Liska
629310abec Port gas/config/* to str_htab.
* config/obj-coff-seh.c (seh_hash_insert): Port to use new
	str_htab type.
	(seh_hash_find): Likewise.
	(seh_hash_find_or_make): Likewise.
	* config/obj-coff.c (tag_init): Likewise.
	(tag_insert): Likewise.
	(tag_find): Likewise.
	* config/obj-elf.c (struct group_list): Likewise.
	(build_additional_section_info): Likewise.
	(free_section_idx): Likewise.
	(elf_adjust_symtab): Likewise.
	(elf_frob_file_after_relocs): Likewise.
	* config/tc-aarch64.c (INSN_SIZE): Likewise.
	(parse_reg): Likewise.
	(insert_reg_alias): Likewise.
	(create_register_alias): Likewise.
	(s_unreq): Likewise.
	(parse_shift): Likewise.
	(parse_pldop): Likewise.
	(parse_barrier): Likewise.
	(parse_barrier_psb): Likewise.
	(parse_bti_operand): Likewise.
	(parse_sys_reg): Likewise.
	(parse_sys_ins_reg): Likewise.
	(lookup_mnemonic): Likewise.
	(opcode_lookup): Likewise.
	(parse_operands): Likewise.
	(checked_hash_insert): Likewise.
	(sysreg_hash_insert): Likewise.
	(fill_instruction_hash_table): Likewise.
	(md_begin): Likewise.
	* config/tc-alpha.c (struct alpha_reloc_tag): Likewise.
	(get_alpha_reloc_tag): Likewise.
	(assemble_tokens_to_insn): Likewise.
	(assemble_tokens): Likewise.
	(md_begin): Likewise.
	* config/tc-arc.c (arc_find_opcode): Likewise.
	(arc_insert_opcode): Likewise.
	(find_opcode_match): Likewise.
	(declare_register): Likewise.
	(declare_addrtype): Likewise.
	(md_begin): Likewise.
	(arc_parse_name): Likewise.
	(tc_arc_regname_to_dw2regnum): Likewise.
	(arc_extcorereg): Likewise.
	* config/tc-arm.c (MVE_BAD_QREG): Likewise.
	(arm_reg_parse_multi): Likewise.
	(parse_reloc): Likewise.
	(insert_reg_alias): Likewise.
	(create_register_alias): Likewise.
	(s_unreq): Likewise.
	(parse_shift): Likewise.
	(parse_psr): Likewise.
	(parse_cond): Likewise.
	(parse_barrier): Likewise.
	(do_vfp_nsyn_opcode): Likewise.
	(opcode_lookup): Likewise.
	(arm_tc_equal_in_insn): Likewise.
	(md_begin): Likewise.
	* config/tc-avr.c (md_begin): Likewise.
	(avr_ldi_expression): Likewise.
	(md_assemble): Likewise.
	(avr_update_gccisr): Likewise.
	(avr_emit_insn): Likewise.
	* config/tc-cr16.c (get_register): Likewise.
	(get_register_pair): Likewise.
	(get_index_register): Likewise.
	(get_index_register_pair): Likewise.
	(get_pregister): Likewise.
	(get_pregisterp): Likewise.
	(initialise_reg_hash_table): Likewise.
	(md_begin): Likewise.
	(cr16_assemble): Likewise.
	(md_assemble): Likewise.
	* config/tc-cris.c (cris_insn_first_word_frag): Likewise.
	(md_begin): Likewise.
	(cris_process_instruction): Likewise.
	* config/tc-crx.c (get_register): Likewise.
	(get_copregister): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-csky.c (md_begin): Likewise.
	(parse_opcode): Likewise.
	(get_operand_value): Likewise.
	(v1_work_jbsr): Likewise.
	(v2_work_rotlc): Likewise.
	(v2_work_bgeni): Likewise.
	(v2_work_not): Likewise.
	* config/tc-d10v.c (sizeof): Likewise.
	(md_begin): Likewise.
	(do_assemble): Likewise.
	(md_apply_fix): Likewise.
	* config/tc-d30v.c (sizeof): Likewise.
	(md_begin): Likewise.
	(do_assemble): Likewise.
	* config/tc-dlx.c (RELOC_DLX_VTENTRY): Likewise.
	(md_begin): Likewise.
	(machine_ip): Likewise.
	* config/tc-ft32.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-h8300.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-hppa.c (pa_ip): Likewise.
	(md_begin): Likewise.
	* config/tc-i386.c (md_begin): Likewise.
	(i386_print_statistics): Likewise.
	(parse_insn): Likewise.
	(process_operands): Likewise.
	(i386_index_check): Likewise.
	(parse_real_register): Likewise.
	* config/tc-ia64.c (dot_rot): Likewise.
	(dot_entry): Likewise.
	(declare_register): Likewise.
	(md_begin): Likewise.
	(ia64_parse_name): Likewise.
	(md_assemble): Likewise.
	(dot_alias): Likewise.
	(do_alias): Likewise.
	(ia64_adjust_symtab): Likewise.
	(do_secalias): Likewise.
	(ia64_frob_file): Likewise.
	* config/tc-m68hc11.c (m68hc11_print_statistics): Likewise.
	(md_begin): Likewise.
	(print_insn_format): Likewise.
	(md_assemble): Likewise.
	* config/tc-m68k.c (tc_gen_reloc): Likewise.
	(m68k_ip): Likewise.
	(md_begin): Likewise.
	* config/tc-mcore.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-microblaze.c (md_begin): Likewise.
	(md_assemble): Likewise.
	(md_apply_fix): Likewise.
	* config/tc-mips.c (nopic_need_relax): Likewise.
	(md_begin): Likewise.
	(macro_build): Likewise.
	(mips16_macro_build): Likewise.
	(mips_lookup_insn): Likewise.
	(mips_ip): Likewise.
	(mips16_ip): Likewise.
	* config/tc-mmix.c (sizeof): Likewise.
	(mmix_md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-mn10200.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-mn10300.c (HAVE_AM30): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-moxie.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-msp430.c (md_begin): Likewise.
	(msp430_operands): Likewise.
	(md_assemble): Likewise.
	* config/tc-nds32.c (PV_DONT_CARE): Likewise.
	(builtin_isreg): Likewise.
	(builtin_regnum): Likewise.
	(nds32_init_nds32_pseudo_opcodes): Likewise.
	(nds32_lookup_pseudo_opcode): Likewise.
	(nds32_relax_hint): Likewise.
	(md_begin): Likewise.
	(nds32_find_reloc_table): Likewise.
	(nds32_elf_append_relax_relocs_traverse): Likewise.
	(nds32_relax_branch_instructions): Likewise.
	(md_convert_frag): Likewise.
	(nds32_elf_analysis_relax_hint): Likewise.
	(tc_nds32_regname_to_dw2regnum): Likewise.
	* config/tc-nios2.c (nios2_opcode_lookup): Likewise.
	(nios2_reg_lookup): Likewise.
	(nios2_ps_lookup): Likewise.
	(md_begin): Likewise.
	* config/tc-ns32k.c (struct hash_control): Likewise.
	(parse): Likewise.
	(md_begin): Likewise.
	* config/tc-pdp11.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-pj.c (fake_opcode): Likewise.
	(alias): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-ppc.c (ppc_setup_opcodes): Likewise.
	(md_assemble): Likewise.
	* config/tc-pru.c (pru_opcode_lookup): Likewise.
	(pru_reg_lookup): Likewise.
	(md_begin): Likewise.
	(md_end): Likewise.
	* config/tc-riscv.c (init_ext_version_hash): Likewise.
	(riscv_get_default_ext_version): Likewise.
	(riscv_set_arch): Likewise.
	(init_opcode_names_hash): Likewise.
	(opcode_name_lookup): Likewise.
	(enum reg_class): Likewise.
	(hash_reg_name): Likewise.
	(riscv_init_csr_hash): Likewise.
	(reg_csr_lookup_internal): Likewise.
	(reg_lookup_internal): Likewise.
	(init_opcode_hash): Likewise.
	(md_begin): Likewise.
	(DECLARE_CSR): Likewise.
	(macro_build): Likewise.
	(riscv_ip): Likewise.
	* config/tc-s390.c (register_name): Likewise.
	(s390_setup_opcodes): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	(s390_insn): Likewise.
	* config/tc-score.c (struct s3_reg_map): Likewise.
	(s3_score_reg_parse): Likewise.
	(s3_dependency_type_from_insn): Likewise.
	(s3_parse_16_32_inst): Likewise.
	(s3_parse_48_inst): Likewise.
	(s3_insert_reg): Likewise.
	(s3_build_reg_hsh): Likewise.
	(s3_build_score_ops_hsh): Likewise.
	(s3_build_dependency_insn_hsh): Likewise.
	(s3_begin): Likewise.
	* config/tc-score7.c (struct s7_reg_map): Likewise.
	(s7_score_reg_parse): Likewise.
	(s7_dependency_type_from_insn): Likewise.
	(s7_parse_16_32_inst): Likewise.
	(s7_build_score_ops_hsh): Likewise.
	(s7_build_dependency_insn_hsh): Likewise.
	(s7_insert_reg): Likewise.
	(s7_build_reg_hsh): Likewise.
	(s7_begin): Likewise.
	* config/tc-sh.c (EMPTY): Likewise.
	(md_begin): Likewise.
	(find_cooked_opcode): Likewise.
	* config/tc-sparc.c (md_begin): Likewise.
	(sparc_ip): Likewise.
	* config/tc-spu.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-tic30.c (md_begin): Likewise.
	(tic30_operand): Likewise.
	(tic30_parallel_insn): Likewise.
	(md_assemble): Likewise.
	* config/tc-tic4x.c (TIC4X_ALT_SYNTAX): Likewise.
	(tic4x_asg): Likewise.
	(tic4x_inst_insert): Likewise.
	(tic4x_inst_add): Likewise.
	(md_begin): Likewise.
	(tic4x_operand_parse): Likewise.
	(md_assemble): Likewise.
	* config/tc-tic54x.c (MAX_SUBSYM_HASH): Likewise.
	(stag_add_field_symbols): Likewise.
	(tic54x_endstruct): Likewise.
	(tic54x_tag): Likewise.
	(tic54x_remove_local_label): Likewise.
	(tic54x_clear_local_labels): Likewise.
	(tic54x_var): Likewise.
	(tic54x_macro_start): Likewise.
	(tic54x_macro_info): Likewise.
	(tic54x_macro_end): Likewise.
	(subsym_isreg): Likewise.
	(subsym_structsz): Likewise.
	(md_begin): Likewise.
	(is_mmreg): Likewise.
	(is_type): Likewise.
	(encode_condition): Likewise.
	(encode_cc3): Likewise.
	(encode_cc2): Likewise.
	(encode_operand): Likewise.
	(tic54x_parse_insn): Likewise.
	(tic54x_parse_parallel_insn_firstline): Likewise.
	(subsym_create_or_replace): Likewise.
	(subsym_lookup): Likewise.
	(subsym_substitute): Likewise.
	(tic54x_undefined_symbol): Likewise.
	* config/tc-tic6x.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-tilegx.c (O_hw2_last_plt): Likewise.
	(INSERT_SPECIAL_OP): Likewise.
	(md_begin): Likewise.
	(tilegx_parse_name): Likewise.
	(parse_reg_expression): Likewise.
	(md_assemble): Likewise.
	* config/tc-tilepro.c (O_tls_ie_load): Likewise.
	(INSERT_SPECIAL_OP): Likewise.
	(tilepro_parse_name): Likewise.
	(parse_reg_expression): Likewise.
	(md_assemble): Likewise.
	* config/tc-v850.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-vax.c (md_ri_to_chars): Likewise.
	(vip_begin): Likewise.
	(vip): Likewise.
	(main): Likewise.
	(md_begin): Likewise.
	* config/tc-wasm32.c (md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-xgate.c (xgate_parse_operand): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-z8k.c (md_begin): Likewise.
	(md_assemble): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
494b2fc807 Port dw2gencfi.c to str_htab.
* dw2gencfi.c (dwcfi_hash_insert): Use htab_t and str_hash_*
	functions.
	(dwcfi_hash_find): Likewise.
	(dwcfi_hash_find_or_make): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
f7a5981beb Port ecoff.c to str_hash.
* ecoff.c (INIT_VARRAY): Use htab_t.
	(add_string): Likewise.
	(ecoff_read_begin_hook): Use new str_htab_create.
	(get_tag): Use htab_t.
	(add_file): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
8d32ded0b1 Add new string hash table based on htab_t.
* hash.h (struct string_tuple): New.
	(hash_string_tuple): Likewise.
	(eq_string_tuple): Likewise.
	(string_tuple_alloc): Likewise.
	(str_hash_find): Likewise.
	(str_hash_find_n): Likewise.
	(str_hash_delete): Likewise.
	(str_hash_insert): Likewise.
	(str_htab_create): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
d3b740ca99 Use libiberty hash in gas/symbols.c.
* symbols.c (struct symbol_entry): New.
	(hash_symbol_entry): Likewise.
	(eq_symbol_entry): Likewise.
	(symbol_entry_alloc): Likewise.
	(symbol_entry_find): Likewise.
	(local_symbol_make): Use htab hash table.
	(local_symbol_convert): Likewise.
	(symbol_table_insert): Likewise.
	(symbol_find_exact_noref): Likewise.
	(resolve_local_symbol): Likewise.
	(resolve_local_symbol_values): Likewise.
	(symbol_begin): Likewise.
	(symbol_print_statistics): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
32e4c1c2d7 Use libiberty hash in gas/read.c.
* read.c (struct po_entry): New.
	(hash_po_entry): Likewise.
	(eq_po_entry): Likewise.
	(po_entry_alloc): Likewise.
	(po_entry_find): Likewise.
	(pop_insert): Likewise.
	(pobegin): Use htab hash table.
	(read_a_source_file): Likewise.
	(s_macro): Likewise.
	(read_print_statistics): Likewise.
	* config/tc-m68k.c (m68k_conditional_pseudoop): Add const qualifier.
	* config/tc-m68k.h (m68k_conditional_pseudoop): Likewise.
2020-08-20 10:56:07 +09:30
Martin Liska
2b272f449e Use libiberty hash in gas/macro.c.
* config/tc-iq2000.c (iq2000_add_macro): Use htab hash table.
	* macro.c (struct hash_control): Use htab.
	(macro_init): Likewise.
	(do_formals): Likewise.
	(free_macro): Likewise.
	(define_macro): Likewise.
	(sub_actual): Likewise.
	(macro_expand_body): Likewise.
	(macro_expand): Likewise.
	(check_macro): Likewise.
	(delete_macro): Likewise.
	(expand_irp): Likewise.
	* macro.h (struct macro_hash_entry): New struct.
	(hash_macro_entry): New.
	(eq_macro_entry): Likewise.
	(macro_entry_alloc): Likewise.
	(macro_entry_find): Likewise.
	(struct formal_hash_entry): Likewise.
	(hash_formal_entry): Likewise.
	(eq_formal_entry): Likewise.
	(formal_entry_alloc): Likewise.
	(formal_entry_find): Likewise.
2020-08-20 10:53:40 +09:30
Martin Liska
abebb03c3a gas/hash.c: add new functions
The first of a patch series deleting the gas/hash.c hash table
implementation and instead using libiberty/hashtab.c hash tables in
gas.

	* as.h: Include hashtab.h.
	* hash.c (htab_insert): New.
	(htab_print_statistics): Likewise.
	* hash.h (htab_insert): Likewise.
	(htab_print_statistics): Likewise.
2020-08-20 10:51:57 +09:30
Alan Modra
18a8a00ebe Correct vcmpsq, vcmpuq and xvtlsbb BF field
These shouldn't be optional.  The record form of vector instructions
set CR6, giving an expectation that omitting BF should be the same as
specifying CR6.

opcodes/
	* ppc-opc.c (powerpc_opcodes): Replace OBF with BF for vcmpsq,
	vcmpuq and xvtlsbb.
gas/
	* testsuite/gas/ppc/int128.s: Correct vcmpuq.
	* testsuite/gas/ppc/int128.d: Update.
	* testsuite/gas/ppc/xvtlsbb.d: Update.
2020-08-19 08:47:35 +09:30
Peter Bergner
587a437176 Add ChangeLog entries for previous commit. 2020-08-18 12:48:42 -05:00
Peter Bergner
f5fc30d05c PowerPC: Rename xvcvbf16sp to xvcvbf16spn
The xvcvbf16sp mnemonic has been renamed to xvcvbf16spn, to be consistent
with the other non-signaling conversion instructions which all end with "n".

opcodes/
	* ppc-opc.c (powerpc_opcodes) <xvcvbf16sp>: Rename from this...
	<xvcvbf16spn>: ...to this.

gas/
	* testsuite/gas/ppc/vsx4.s: Update test to use new mnemonic.
	* testsuite/gas/ppc/vsx4.d: Likewise.
2020-08-18 12:43:46 -05:00
Alex Coplan
d4d05d13eb gas: Fix internal error in S_SET_SEGMENT
This patch fixes an internal error in GAS when defining a section using
a symbol that has already been named but not defined. For a minimal
reproducer, try the following input:

a=b
.sect a

The problem is that obj_elf_change_section() happily reuses the symbol
"a" created by equals() without clearing the sy_value field: prior to
this patch, it just set bsym. This caused a problem when attempting to
resolve the section symbol, since resolve_symbol_value() ended up
resolving the symbol as if it were the original symbol created by
equals(), which ends up leaving the section symbol in the undefined
section instead of in section a, hence the call to abort() in
S_SET_SEGMENT().

gas/ChangeLog:

	* config/obj-elf.c (obj_elf_change_section): When repurposing an
	existing symbol, ensure that we set sy_value as per other (fresh)
	section symbols.
	* testsuite/gas/elf/elf.exp: Add new test.
	* testsuite/gas/elf/section-symbol-redef.d: New test.
	* testsuite/gas/elf/section-symbol-redef.s: Input for test.
2020-08-17 14:23:14 +01:00
Nick Clifton
8118fd4346 Fix an internal compiler error when attempting to create a second $GDB_DEBUG$ section.
PR 26359
	* config/obj-som.c (obj_som_init_stab_section): Do nothing if the
	$GDB_DEBUG$ section has already been created.
2020-08-13 11:50:13 +01:00
Joe Ramsay
225f168451 [PATCH] gas: arm: Fix IT-predicated MVE vcvt
* config/tc-arm.c (do_neon_cvt_1): Parse vcvtne as vcvt-ne for
	NS_FD shape when MVE is present
	* testsuite/gas/arm/mve-vcvtne-it-bad.d: New test.
	* testsuite/gas/arm/mve-vcvtne-it-bad.l: New test.
	* testsuite/gas/arm/mve-vcvtne-it-bad.s: New test.
	* testsuite/gas/arm/mve-vcvtne-it.d: New test.
	* testsuite/gas/arm/mve-vcvtne-it.s: New test.
2020-08-12 16:44:54 +01:00
Alex Coplan
2e49fd1edf aarch64: Add support for MPAM system registers
This patch adds support for the system registers introduced in the
Armv8-A MPAM extension.

See https://developer.arm.com/documentation/ddi0598/latest for the
Arm ARM supplement documenting this extension.

gas/ChangeLog:

	* testsuite/gas/aarch64/mpam-bad.d: New test.
	* testsuite/gas/aarch64/mpam-bad.l: Error output.
	* testsuite/gas/aarch64/mpam-bad.s: Input.
	* testsuite/gas/aarch64/mpam.d: New test.
	* testsuite/gas/aarch64/mpam.s: Input.

opcodes/ChangeLog:

	* aarch64-opc.c (aarch64_sys_regs): Add MPAM registers.
2020-08-12 13:53:17 +01:00
Nick Clifton
369afd5008 The description for -mno-csr-check talks about "cheching" rather than "checking".
PR 26346
	* doc/c-riscv.texi (RISC-V-Options): Fix typo in the description
	of the -mno-csr-check option.
2020-08-12 13:47:04 +01:00
Nick Clifton
79ddc88496 Updated Serbian and Russian translations for various sub-directories 2020-08-12 11:25:38 +01:00
Alex Coplan
fa63795f40 aarch64: Don't assert on long sysreg names
This patch fixes an assertion failure on long system register operands
in the AArch64 backend. See the new testcase for an input which
reproduces the issue.

gas/ChangeLog:

	* config/tc-aarch64.c (parse_sys_reg): Don't assert when parsing
	a long system register.
	(parse_sys_ins_reg): Likewise.
	(sysreg_hash_insert): New.
	(md_begin): Use sysreg_hash_insert() to ensure all system
	registers are no longer than the maximum length at startup.
	* testsuite/gas/aarch64/invalid-sysreg-assert.d: New test.
	* testsuite/gas/aarch64/invalid-sysreg-assert.l: Error output.
	* testsuite/gas/aarch64/invalid-sysreg-assert.s: Input.

include/ChangeLog:

	* opcode/aarch64.h (AARCH64_MAX_SYSREG_NAME_LEN): New.
2020-08-10 17:44:02 +01:00
Nick Clifton
9546e03d55 Remove spurious text in changelog entry 2020-08-10 17:24:45 +01:00
Przemyslaw Wirkus
f7cb161ea6 [aarch64] GAS doesn't validate the architecture version for any tlbi registers. Fixed with this patch.
* gas/config/tc-aarch64.c (parse_sys_reg): Call to
	aarch64_sys_ins_reg_supported_p instead of aarch64_sys_reg_supported_p.
	(parse_sys_ins_reg): Add aarch64_sys_reg_deprecated_p check.
	* include/opcode/aarch64.h (aarch64_sys_reg_deprecated_p): Functions
	paramaters changed.
	(aarch64_sys_reg_supported_p): Function removed.
	(aarch64_sys_ins_reg_supported_p): Functions paramaters changed.
	* opcodes/aarch64-opc.c (aarch64_print_operand):
	(aarch64_sys_reg_deprecated_p): Functions paramaters changed.
	(aarch64_sys_reg_supported_p): Function removed.
	(aarch64_sys_ins_reg_supported_p): Functions paramaters changed.
	(aarch64_sys_ins_reg_supported_p): Merged aarch64_sys_reg_supported_p
	into this function.
	* gas/testsuite/gas/aarch64/illegal-sysreg-5.d: New test.
	* gas/testsuite/gas/aarch64/illegal-sysreg-5.l: New test.
	* gas/testsuite/gas/aarch64/sysreg-5.s: New test.
2020-08-10 16:20:17 +01:00
Alan Modra
8b2742a156 Implement missing powerpc extended mnemonics
gas/
	* testsuite/gas/ppc/power8.d,
	* testsuite/gas/ppc/power8.s: Add miso.
	* testsuite/gas/ppc/power9.d,
	* testsuite/gas/ppc/power8.s: Add exser, msgsndu, msgclru.
opcodes/
	* ppc-opc.c (powerpc_opcodes): Add exser, msgsndu, msgclru.
	Enable icbt for power5, miso for power8.
2020-08-10 21:52:17 +09:30
Alan Modra
5fbec329ec Prioritise mtfprd and mtvrd over mtvsrd in PowerPC disassembly
gas/
	* testsuite/gas/ppc/power8.d: Update.
	* testsuite/gas/ppc/vsx2.d: Update.
opcodes/
	* ppc-opc.c (powerpc_opcodes): Prioritise mtfprd and mtvrd over
	mtvsrd, and similarly for mfvsrd.
2020-08-10 21:52:17 +09:30
Alan Modra
86c0f617ac Error on lmw, lswi and related PowerPC insns when LE
* config/tc-ppc.c (md_assemble): Error for lmw, stmw, lswi, lswx,
	stswi, or stswx in little-endian mode.
	* testsuite/gas/ppc/476.d,
	* testsuite/gas/ppc/476.s: Delete lmw, stmw, lswi, lswx, stswi, stswx.
	* testsuite/gas/ppc/a2.d,
	* testsuite/gas/ppc/a2.s: Move lmw, stmw, lswi, lswx, stswi, stswx..
	* testsuite/gas/ppc/be.d,
	* testsuite/gas/ppc/be.s: ..to here, new big-endian only test.
	* testsuite/gas/ppc/le_error.d,
	* testsuite/gas/ppc/le_error.l: New little-endian test.
	* testsuite/gas/ppc/ppc.exp: Run new tests.
2020-08-10 21:52:17 +09:30
H.J. Lu
7bb178ecf8 as: Ignore rest of line on overflow error
* read.c (read_a_source_file): Ignore rest of line on overflow
	error.
2020-08-07 06:47:56 -07:00
Alex Coplan
d27aad4ec3 gas: Fix internal error on long local labels
Prior to this commit, on an input such as "88888888888:", GAS hits a
signed integer overflow and likely an assertion failure. I see:

$ echo "88888888888:" | bin/aarch64-none-elf-as
{standard input}: Assembler messages:
{standard input}:1: Internal error in fb_label_name at ../gas/symbols.c:2049.
Please report this bug.

To fix this issue, I've taken two steps:

1. Change the type used for processing local labels in
   read_a_source_file() from int to long, to allow representing more
   local labels, and also since all uses of this variable (temp) are
   actually of type long.

2. Detect if we would overflow and bail out with an error message
   instead of actually overflowing and hitting the assertion in
   fb_label_name().

gas/ChangeLog:

2020-08-06  Alex Coplan  <alex.coplan@arm.com>

	* read.c (read_a_source_file): Use long for local labels, detect
	overflow and raise an error for overly-long labels.
	* testsuite/gas/all/gas.exp: Add local-label-overflow test.
	* testsuite/gas/all/local-label-overflow.d: New test.
	* testsuite/gas/all/local-label-overflow.l: Error output.
	* testsuite/gas/all/local-label-overflow.s: Input.
2020-08-06 17:39:03 +01:00
Christian Groessler
563a322515 Z8k: fix sout/soudb opcodes with direct address
Problem found by Tadashi G. Takaoka.

2020-08-04  Christian Groessler  <chris@groessler.org>
     Tadashi G. Takaoka <tadashi.g.takaoka@gmail.com>

 * z8kgen.c (opt): Fix "sout imm16,rs" and "soutb imm16,rbs"
 opcodes (special "out" to absolute address).
 * z8k-opc.h: Regenerate.

2020-08-04  Christian Groessler  <chris@groessler.org>

 * gas/testsuite/gas/z8k/inout.d: Adapt to correct encoding of
 "sout/soutb #imm,reg"
2020-08-04 22:31:42 +02:00
H.J. Lu
789198ca95 gas/NEWS: Mention {disp16} pseudo prefix
* NEWS: Mention {disp16} pseudo prefix.
2020-08-04 05:55:31 -07:00
H.J. Lu
b0a72f49df gas: Revert an accidental change in x86-64-pseudos.d
Revert an accidental change in

commit 41eb8e8885
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jul 30 16:13:02 2020 -0700

    x86: Add {disp16} pseudo prefix

@@ -304,7 +308,7 @@ Disassembly of section .text:
  +[a-f0-9]+:  40 d3 e0                rex shl %cl,%eax
  +[a-f0-9]+:  40 a0 01 00 00 00 00 00 00 00    rex movabs 0x1,%al
  +[a-f0-9]+:  40 38 ca                rex cmp %cl,%dl
- +[a-f0-9]+:  40 b3 01                rex mov \$(0x)?1,%bl
+ +[a-f0-9]+:  40 b3 01                rex mov \$(0x)1,%bl
  +[a-f0-9]+:  f2 40 0f 38 f0 c1       rex crc32 %cl,%eax
  +[a-f0-9]+:  40 89 c3                rex mov %eax,%ebx
  +[a-f0-9]+:  41 89 c6                mov    %eax,%r14d

	PR gas/26305
	* testsuite/gas/i386/x86-64-pseudos.d: Revert an accidental
	change.
2020-08-04 05:50:23 -07:00
Mark Wielaard
6b9a135d72 gas: Use udata for DW_AT_high_pc when emitting DWARF4
For DWARF4 DW_AT_high_pc can be expressed as constant offset from
DW_AT_low_pc which saves a relocation. Use DW_FORM_udate (uleb128)
to keep the constant value as small as possible.

gas/ChangeLog:

       * dwarf2dbg.c (out_debug_abbrev): When DWARF2_VERSION >= 4, use
       DW_FORM_udata for DW_AT_high_pc.
       (out_debug_info): Use emit_leb128_expr for DW_AT_high_pc, when
       DWARF2_VERSION >= 4.
       * read.c (emit_leb128_exp): No longer static.
       * read.h (emit_leb128_exp): Define.
2020-08-04 11:42:53 +02:00
Mark Wielaard
f63d03dde0 gas: Make sure .debug_line file table contains a zero filename and dir
For DWARF5 the zero file list entry in the .debug_line table represents
the compile unit main file. It can be set with .file 0 when -gdwarf-5
is given. But since this directive is illegal for older versions, this
is almost never set. To make sure it is always set (so DW_AT_name of
the compile unit can be set) use file (and dir) 1 if that is defined
(otherwise fall back to pwd, to match DW_AT_comp_dir).

gas/ChangeLog:

	* gas/dwarf2dbg.c (out_dir_and_file_list): For DWARF5 emit at
	least one directory if there is at least one file. Use dirs[1]
	if dirs[0] is not set, or if there is no dirs[1] the current
	working directory. Use files[1] filename, when files[0] filename
	isn't set.
2020-08-04 11:28:39 +02:00
Mark Wielaard
a3b3e8586d gas: Fix .debug_info CU header for --gdwarf-5
DWARF5 CU headers have a new unit type field and move the abbrev offset
to the end of the header.

gas/ChangeLog:

	* dwarf2dbg.c (out_debug_info): Emit unit type and abbrev offset
	for DWARF5.
	* gas/testsuite/gas/elf/dwarf-4-cu.d: New file.
	* gas/testsuite/gas/elf/dwarf-4-cu.s: Likewise.
	* gas/testsuite/gas/elf/dwarf-5-cu.d: Likewise.
	* gas/testsuite/gas/elf/dwarf-5-cu.s: Likewise.
	* testsuite/gas/elf/elf.exp: Run dwarf-4-cu and dwarf-5-cu.
2020-08-04 11:28:39 +02:00
Mark Wielaard
25b1f10d9b gas: Fix as.texi typo infortmation
gas/ChangeLog:

	* doc/as.texi (--gdwarf-[345]): Fix typo.
2020-08-04 11:28:39 +02:00
Jozef Lawrynowicz
e4ae357fe8 MSP430: Remove unused -md GAS option
The MSP430 GAS option "-md" is supposed to indicate that the CRT startup
code should copy data from ROM to RAM at startup. However, this option
has no effect; GAS handles the related behaviour automatically by
looking for the presence of certain symbols in the input file.

gas/ChangeLog:

	* config/tc-msp430.c (OPTION_MOVE_DATA): Remove.
	(md_parse_option): Remove case for OPTION_MOVE_DATA.
	(md_longopts): Remove "md" entry.
	(md_show_usage): Likewise.
2020-08-03 16:05:48 +01:00
H.J. Lu
41eb8e8885 x86: Add {disp16} pseudo prefix
Use Prefix_XXX for pseudo prefixes.  Add {disp16} pseudo prefix and
replace {disp32} pseudo prefix with {disp16} in 16-bit mode test.
Check invalid {disp16}/{disp32} pseudo prefixes.

gas/

	PR gas/26305
	* config/tc-i386.c (_i386_insn::disp_encoding): Add
	disp_encoding_16bit.
	(parse_insn): Check Prefix_XXX for pseudo prefixes.  Handle
	{disp16}.
	(build_modrm_byte): Handle {disp16}.
	(i386_index_check): Check invalid {disp16} and {disp32} pseudo
	prefixes.
	* doc/c-i386.texi: Update {disp32} documentation and document
	{disp16}.
	* testsuite/gas/i386/i386.exp: Run x86-64-inval-pseudo.
	* testsuite/gas/i386/inval-pseudo.s: Add {disp32}/{disp16}
	tests.
	* testsuite/gas/i386/pseudos.s: Add {disp8}/{disp32} vmovaps
	tests with 128-byte displacement.  Add {disp16} tests.
	* testsuite/gas/i386/x86-64-pseudos.s: Add {disp8}/{disp32}
	vmovaps test.  Add (%r13)/(%r13d) tests.
	* testsuite/gas/i386/x86-64-inval-pseudo.l: New file.
	* testsuite/gas/i386/x86-64-inval-pseudo.s: Likewise.
	* testsuite/gas/i386/inval-pseudo.l: Updated.
	* testsuite/gas/i386/pseudos.d: Likewise.
	* testsuite/gas/i386/x86-64-pseudos.d: Likewise.

opcodes/

	PR gas/26305
	* i386-opc.h (Prefix_Disp8): New.
	(Prefix_Disp16): Likewise.
	(Prefix_Disp32): Likewise.
	(Prefix_Load): Likewise.
	(Prefix_Store): Likewise.
	(Prefix_VEX): Likewise.
	(Prefix_VEX3): Likewise.
	(Prefix_EVEX): Likewise.
	(Prefix_REX): Likewise.
	(Prefix_NoOptimize): Likewise.
	* i386-opc.tbl: Use Prefix_XXX on pseudo prefixes.  Add {disp16}.
	* i386-tbl.h: Regenerated.
2020-07-30 16:13:17 -07:00
Nick Clifton
3f853ba383 Strange - my previous commit to as.c to set the default dwarf level to 3 seems to have disappeared. So here is the commit again. 2020-07-30 16:23:09 +01:00
Nick Clifton
f291783b26 Default to DWARF level 3 for the assembler.
* as.c (dwarf_level): Initialise to 3 in case this is not set on
	the command line.
2020-07-30 14:59:39 +01:00
Rainer Orth
c8693053f8 Unify Solaris procfs and largefile handling
GDB currently doesn't build on 32-bit Solaris:

* On Solaris 11.4/x86:

In file included from /usr/include/sys/procfs.h:26,
                 from /vol/src/gnu/gdb/hg/master/dist/gdb/i386-sol2-nat.c:24:
/usr/include/sys/old_procfs.h:31:2: error: #error "Cannot use procfs in the large file compilation environment"
 #error "Cannot use procfs in the large file compilation environment"
  ^~~~~

* On Solaris 11.3/x86 there are several more instances of this.

The interaction between procfs and large-file support historically has
been a royal mess on Solaris:

* There are two versions of the procfs interface:

** The old ioctl-based /proc, deprecated and not used any longer in
   either gdb or binutils.

** The `new' (introduced in Solaris 2.6, 1997) structured /proc.

* There are two headers one can possibly include:

** <procfs.h> which only provides the structured /proc, definining
   _STRUCTURED_PROC=1 and then including ...

** <sys/procfs.h> which defaults to _STRUCTURED_PROC=0, the ioctl-based
   /proc, but provides structured /proc if _STRUCTURED_PROC == 1.

* procfs and the large-file environment didn't go well together:

** Until Solaris 11.3, <sys/procfs.h> would always #error in 32-bit
   compilations when the large-file environment was active
   (_FILE_OFFSET_BITS == 64).

** In both Solaris 11.4 and Illumos, this restriction was lifted for
   structured /proc.

So one has to be careful always to define _STRUCTURED_PROC=1 when
testing for or using <sys/procfs.h> on Solaris.  As the errors above
show, this isn't always the case in binutils-gdb right now.

Also one may need to disable large-file support for 32-bit compilations
on Solaris.  config/largefile.m4 meant to do this by wrapping the
AC_SYS_LARGEFILE autoconf macro with appropriate checks, yielding
ACX_LARGEFILE.  Unfortunately the macro doesn't always succeed because
it neglects the _STRUCTURED_PROC part.

To make things even worse, since GCC 9 g++ predefines
_FILE_OFFSET_BITS=64 on Solaris.  So even if largefile.m4 deciced not to
enable large-file support, this has no effect, breaking the gdb build.

This patch addresses all this as follows:

* All tests for the <sys/procfs.h> header are made with
  _STRUCTURED_PROC=1, the definition going into the various config.h
  files instead of having to make them (and sometimes failing) in the
  affected sources.

* To cope with the g++ predefine of _FILE_OFFSET_BITS=64,
  -U_FILE_OFFSET_BITS is added to various *_CPPFLAGS variables.  It had
  been far easier to have just

  #undef _FILE_OFFSET_BITS

  in config.h, but unfortunately such a construct in config.in is
  commented by config.status irrespective of indentation and whitespace
  if large-file support is disabled.  I found no way around this and
  putting the #undef in several global headers for bfd, binutils, ld,
  and gdb seemed way more invasive.

* Last, the applicability check in largefile.m4 was modified only to
  disable largefile support if really needed.  To do so, it checks if
  <sys/procfs.h> compiles with _FILE_OFFSET_BITS=64 defined.  If it
  doesn't, the disabling only happens if gdb exists in-tree and isn't
  disabled, otherwise (building binutils from a tarball), there's no
  conflict.

  What initially confused me was the check for $plugins here, which
  originally caused the disabling not to take place.  Since AC_PLUGINGS
  does enable plugin support if <dlfcn.h> exists (which it does on
  Solaris), the disabling never happened.

  I could find no explanation why the linker plugin needs large-file
  support but thought it would be enough if gld and GCC's lto-plugin
  agreed on the _FILE_OFFSET_BITS value.  Unfortunately, that's not
  enough: lto-plugin uses the simple-object interface from libiberty,
  which includes off_t arguments.  So to fully disable large-file
  support would mean also disabling it in libiberty and its users: gcc
  and libstdc++-v3.  This seems highly undesirable, so I decided to
  disable the linker plugin instead if large-file support won't work.

The patch allows binutils+gdb to build on i386-pc-solaris2.11 (both
Solaris 11.3 and 11.4, using GCC 9.3.0 which is the worst case due to
predefined _FILE_OFFSET_BITS=64).  Also regtested on
amd64-pc-solaris2.11 (again on Solaris 11.3 and 11.4),
x86_64-pc-linux-gnu and i686-pc-linux-gnu.

	config:
	* largefile.m4 (ACX_LARGEFILE) <sparc-*-solaris*|i?86-*-solaris*>:
	Check for <sys/procfs.h> incompatilibity with large-file support
	on Solaris.
	Only disable large-file support and perhaps plugins if needed.
	Set, substitute LARGEFILE_CPPFLAGS if so.

	bfd:
	* bfd.m4 (BFD_SYS_PROCFS_H): New macro.
	(BFD_HAVE_SYS_PROCFS_TYPE): Require BFD_SYS_PROCFS_H.
	Don't define _STRUCTURED_PROC.
	(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Likewise.
	* elf.c [HAVE_SYS_PROCFS_H] (_STRUCTURED_PROC): Don't define.
	* configure.ac: Use BFD_SYS_PROCFS_H to check for <sys/procfs.h>.
	* configure, config.in: Regenerate.
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* Makefile.in, doc/Makefile.in: Regenerate.

	binutils:
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* Makefile.in, doc/Makefile.in: Regenerate.
	* configure: Regenerate.

	gas:
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* Makefile.in, doc/Makefile.in: Regenerate.
	* configure: Regenerate.

	gdb:
	* proc-api.c (_STRUCTURED_PROC): Don't define.
	* proc-events.c: Likewise.
	* proc-flags.c: Likewise.
	* proc-why.c: Likewise.
	* procfs.c: Likewise.

	* Makefile.in (INTERNAL_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* configure, config.in: Regenerate.

	gdbserver:
	* configure, config.in: Regenerate.

	gdbsupport:
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* common.m4 (GDB_AC_COMMON): Use BFD_SYS_PROCFS_H to check for
	<sys/procfs.h>.
	* Makefile.in: Regenerate.
	* configure, config.in: Regenerate.

	gnulib:
	* configure.ac: Run ACX_LARGEFILE before gl_EARLY.
	* configure: Regenerate.

	gprof:
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

	ld:
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2020-07-30 15:41:50 +02:00
H.J. Lu
ac2599c447 x86: Pass --gdwarf-3 to assembler
Pass --gdwarf-3 to assembler for

commit 4d8ee86073
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Jul 30 08:39:14 2020 +0100

    Prevent the generation of DWARF level 0 line number tables...

binutils/

	* testsuite/binutils-all/i386/compressed-1a.d: Pass --gdwarf-3
	to assembler.
	* testsuite/binutils-all/i386/compressed-1b.d: Likewise.
	* testsuite/binutils-all/i386/compressed-1c.d: Likewise.
	* testsuite/binutils-all/x86-64/compressed-1a.d: Likewise.
	* testsuite/binutils-all/x86-64/compressed-1b.d: Likewise.
	* testsuite/binutils-all/x86-64/compressed-1c.d: Likewise.

gas/

	* testsuite/gas/elf/dwarf2-3.d:Pass --gdwarf-3 to assembler.
	* testsuite/gas/elf/dwarf2-5.d: Likewise.
	* testsuite/gas/i386/dw2-compress-3a.d: Likewise.
	* testsuite/gas/i386/dw2-compress-3b.d: Likewise.
	* testsuite/gas/i386/dw2-compressed-3a.d: Likewise.
	* testsuite/gas/i386/dw2-compressed-3b.d: Likewise.
2020-07-30 04:56:46 -07:00
Nick Clifton
4d8ee86073 Prevent the generation of DWARF level 0 line number tables...
* as.c (dwarf_level): Initialise to 4 in case this is not set on
	the command line.
2020-07-30 08:39:14 +01:00
Maciej W. Rozycki
c77cb2a09c MIPS: Make the IRIX naming of local section symbols consistent
Make the MIPS/IRIX naming of local section symbols consistent between
files produced by generic ELF code and ELF linker code, complementing
commit 174fd7f955 ("New bfd elf hook: force naming of local section
symbols"), <https://sourceware.org/ml/binutils/2004-02/msg00072.html>.

Local section symbols have no names in the standard ELF gABI, however
the lack of a name causes problems with IRIX's MIPSpro linker.  To work
around the issue we give them names, however we do that in generic ELF
code only, based on what the `elf_backend_name_local_section_symbols'
hook returns if present.  That makes objects created by GAS or `objdump'
work correctly, however not ones created by `ld -r'.  That would not
normally cause issues with IRIX systems using GAS and `objdump' only
with the MIPSpro linker, however if GNU LD was used for whatever reason
in producing objects later fed to IRIX's MIPSpro linker, then things
would break.

Modify ELF linker code accordingly then, using the same hook.  Adjust
the `ld-elf/64ksec-r' test accordingly so that it also accepts a section
symbol with a name.

Also modify the hook itself so that only actual ET_REL objects have
names assigned to local section symbols.  Other kinds of ELF files are
not ever supposed to be relocated with the MIPSpro linker, so we can
afford producing more standard output.

Add suitable GAS, LD and `objcopy' test cases to the relevant testsuites
to keep these tools consistently verified.  This change also fixes:

FAIL: objcopy executable (pr25662)

across MIPS targets using the IRIX compatibility mode.

	bfd/
	* elflink.c (bfd_elf_final_link): Give local symbols a name if
	so requested.
	* elfxx-mips.c (_bfd_mips_elf_name_local_section_symbols): Only
	return TRUE if making ET_REL output.

	binutils/
	* testsuite/binutils-all/mips/global-local-symtab-sort-o32.d:
	New test.
	* testsuite/binutils-all/mips/global-local-symtab-sort-o32t.d:
	New test.
	* testsuite/binutils-all/mips/global-local-symtab-sort-n32.d:
	New test.
	* testsuite/binutils-all/mips/global-local-symtab-sort-n32t.d:
	New test.
	* testsuite/binutils-all/mips/global-local-symtab-sort-n64.d:
	New test.
	* testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d:
	New test.
	* testsuite/binutils-all/mips/global-local-symtab-final-o32.d:
	New test.
	* testsuite/binutils-all/mips/global-local-symtab-final-n32.d:
	New test.
	* testsuite/binutils-all/mips/global-local-symtab-final-n64.d:
	New test.
	* testsuite/binutils-all/mips/mips.exp: Run the new tests.

	gas/
	* testsuite/gas/mips/global-local-symtab-sort-o32.d: New test.
	* testsuite/gas/mips/global-local-symtab-sort-o32t.d: New test.
	* testsuite/gas/mips/global-local-symtab-sort-n32.d: New test.
	* testsuite/gas/mips/global-local-symtab-sort-n32t.d: New test.
	* testsuite/gas/mips/global-local-symtab-sort-n64.d: New test.
	* testsuite/gas/mips/global-local-symtab-sort-n64t.d: New test.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	ld/
	* testsuite/ld-elf/sec64k.exp: Also accept a section symbol with
	a name.
	* testsuite/ld-mips-elf/global-local-symtab-sort-o32.d: New
	test.
	* testsuite/ld-mips-elf/global-local-symtab-sort-o32t.d: New
	test.
	* testsuite/ld-mips-elf/global-local-symtab-sort-n32.d: New
	test.
	* testsuite/ld-mips-elf/global-local-symtab-sort-n32t.d: New
	test.
	* testsuite/ld-mips-elf/global-local-symtab-sort-n64.d: New
	test.
	* testsuite/ld-mips-elf/global-local-symtab-sort-n64t.d: New
	test.
	* testsuite/ld-mips-elf/global-local-symtab-final-o32.d: New
	test.
	* testsuite/ld-mips-elf/global-local-symtab-final-n32.d: New
	test.
	* testsuite/ld-mips-elf/global-local-symtab-final-n64.d: New
	test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2020-07-29 20:56:41 +01:00
Maciej W. Rozycki
3f1b17bbf0 MIPS/LD: Set symtab's `sh_info' correctly for IRIX emulations
Correct ELF linker code so as to set the `sh_info' value of the static
symbol table section according to the section symbols vs other symbols
split where required by the selection of the IRIX compatibility mode for
MIPS target.  Add a `elf_backend_elfsym_local_is_section' hook for that
purpose, returning TRUE if it is only STB_LOCAL/STT_SECTION symbols that
are to be considered local for the purpose of this split rather than all
STB_LOCAL symbols.

We do it already in generic ELF code, and have done it since 1993, with
the `elf_backend_sym_is_global' hook, affecting GAS and `objcopy', so
these tools produce correct ELF output in the IRIX compatibility mode,
however if such output is fed as input to `ld -r', then the linker's
output is no longer valid for that mode.  The relevant changes to
generic ELF code are:

commit 062189c6ea
Author: Ian Lance Taylor <ian@airs.com>
Date:   Thu Nov 18 17:12:47 1993 +0000

and:

commit 6e07e54f1b
Author: Ian Lance Taylor <ian@airs.com>
Date:   Thu Jan 6 20:01:42 1994 +0000

(split across two GIT commits likely due to repository conversion
peculiarities).

The `elf_backend_sym_is_global' hook however operates on BFD rather than
ELF symbols, making it unsuitable for the ELF linker as the linker does
not convert any symbol tables processed into the BFD format.  Converting
the hook to operate on ELF symbols would in principle be possible, but
it would still require a considerable rewrite of `bfd_elf_final_link' to
adapt to the interface.

Therefore, especially given that no new use for the IRIX compatibility
mode is expected, minimize changes made to the ELF linker code and just
add an entirely new hook, and wire it in the o32 and n32 MIPS backends
accordingly; the n64 backend never uses the IRIX compatibility mode.

Since we have no coverage here at all add suitable GAS, LD and `objcopy'
test cases to the relevant testsuites to keep these tools consistently
verified.

	bfd/
	* elf-bfd.h (elf_backend_data): Add
	`elf_backend_elfsym_local_is_section' member.
	* elfxx-target.h (elf_backend_elfsym_local_is_section): New
	macro.
	(elfNN_bed): Add `elf_backend_elfsym_local_is_section' member.
	* elflink.c (bfd_elf_final_link): Use it to determine whether
	set the `.symtab' section's `sh_info' value to the index of the
	first non-local or non-section symbol.
	* elf32-mips.c (mips_elf32_elfsym_local_is_section): New
	function.
	(elf_backend_elfsym_local_is_section): New macro.
	* elfn32-mips.c (mips_elf_n32_elfsym_local_is_section): New
	function.
	(elf_backend_elfsym_local_is_section): New macro.

	binutils/
	* testsuite/binutils-all/mips/global-local-symtab-o32.d: New
	test.
	* testsuite/binutils-all/mips/global-local-symtab-o32t.d: New
	test.
	* testsuite/binutils-all/mips/global-local-symtab-n32.d: New
	test.
	* testsuite/binutils-all/mips/global-local-symtab-n32t.d: New
	test.
	* testsuite/binutils-all/mips/global-local-symtab-n64.d: New
	test.
	* testsuite/binutils-all/mips/mips.exp: Run the new tests.

	gas/
	* testsuite/gas/mips/global-local-symtab-o32.d: New test.
	* testsuite/gas/mips/global-local-symtab-o32t.d: New test.
	* testsuite/gas/mips/global-local-symtab-n32.d: New test.
	* testsuite/gas/mips/global-local-symtab-n32t.d: New test.
	* testsuite/gas/mips/global-local-symtab-n64.d: New test.
	* testsuite/gas/mips/global-local-symtab.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	ld/
	* testsuite/ld-mips-elf/global-local-symtab-o32.d: New test.
	* testsuite/ld-mips-elf/global-local-symtab-o32t.d: New test.
	* testsuite/ld-mips-elf/global-local-symtab-n32.d: New test.
	* testsuite/ld-mips-elf/global-local-symtab-n32t.d: New test.
	* testsuite/ld-mips-elf/global-local-symtab-n64.d: New test.
	* testsuite/ld-mips-elf/global-local-symtab.ld: New test linker
	script.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2020-07-29 20:56:41 +01:00
H.J. Lu
1a02d6b0ff x86: Handle {disp32} for (%bp)/(%ebp)/(%rbp)
Since (%bp)/(%ebp)/(%rbp) are encoded as 0(%bp)/0(%ebp)/0(%rbp), use
disp32/disp16 on 0(%bp)/0(%ebp)/0(%rbp) for {disp32}.

Note: Since there is no disp32 on 0(%bp), use disp16 instead.

	PR gas/26305
	* config/tc-i386.c (build_modrm_byte): Use disp32/disp16 on
	(%bp)/(%ebp)/(%rbp) for {disp32}.
	* doc/c-i386.texi: Update {disp32} documentation.
	* testsuite/gas/i386/pseudos.s: Add (%bp)/(%ebp) tests.
	* testsuite/gas/i386/x86-64-pseudos.s: Add (%ebp)/(%rbp) tests.
	* testsuite/gas/i386/pseudos.d: Updated.
	* testsuite/gas/i386/x86-64-pseudos.d: Likewise.
2020-07-28 03:55:53 -07:00
H.J. Lu
608d61c202 doc: Replace preceeded with preceded
binutils/

	* doc/binutils.texi: Replace preceeded with preceded.

gas/

	* doc/as.texi: Replace preceeded with preceded.
2020-07-27 05:52:14 -07:00
Maciej W. Rozycki
39fdda0744 MIPS/GAS/testsuite: Fix JALR relocation tests for IRIX targets
With IRIX targets the JALR hint relocation is not produced for the o32
ABI, where it is considered a GNU extension.  Consequently several tests
fail as the output produced by GAS fails to match patterns expecting the
relocation to be present where appropriate, even though output produced
is indeed correct.

As the absence of the relocation is expected, fix the tests by providing
respective alternative dump patterns with any JALR relocations removed,
removing numerous failures with `*-*-irix*' targets:

FAIL: MIPS jal-svr4pic (interaptiv-mr2)
FAIL: MIPS jal-svr4pic (micromips)
FAIL: MIPS jal-svr4pic (mips1)
FAIL: MIPS jal-svr4pic (mips2)
FAIL: MIPS jal-svr4pic (mips3)
FAIL: MIPS jal-svr4pic (mips4)
FAIL: MIPS jal-svr4pic (mips5)
FAIL: MIPS jal-svr4pic (mips32)
FAIL: MIPS jal-svr4pic (mips32r2)
FAIL: MIPS jal-svr4pic (mips32r3)
FAIL: MIPS jal-svr4pic (mips32r5)
FAIL: MIPS jal-svr4pic (mips32r6)
FAIL: MIPS jal-svr4pic (mips64)
FAIL: MIPS jal-svr4pic (mips64r2)
FAIL: MIPS jal-svr4pic (mips64r3)
FAIL: MIPS jal-svr4pic (mips64r5)
FAIL: MIPS jal-svr4pic (mips64r6)
FAIL: MIPS jal-svr4pic (octeon)
FAIL: MIPS jal-svr4pic (octeon2)
FAIL: MIPS jal-svr4pic (octeon3)
FAIL: MIPS jal-svr4pic (octeonp)
FAIL: MIPS jal-svr4pic (r3000)
FAIL: MIPS jal-svr4pic (r3900)
FAIL: MIPS jal-svr4pic (r4000)
FAIL: MIPS jal-svr4pic (r5900)
FAIL: MIPS jal-svr4pic (sb1)
FAIL: MIPS jal-svr4pic (vr5400)
FAIL: MIPS jal-svr4pic (xlr)
FAIL: MIPS jal-svr4pic noreorder (interaptiv-mr2)
FAIL: MIPS jal-svr4pic noreorder (micromips)
FAIL: MIPS jal-svr4pic noreorder (mips1)
FAIL: MIPS jal-svr4pic noreorder (mips2)
FAIL: MIPS jal-svr4pic noreorder (mips3)
FAIL: MIPS jal-svr4pic noreorder (mips4)
FAIL: MIPS jal-svr4pic noreorder (mips5)
FAIL: MIPS jal-svr4pic noreorder (mips32)
FAIL: MIPS jal-svr4pic noreorder (mips32r2)
FAIL: MIPS jal-svr4pic noreorder (mips32r3)
FAIL: MIPS jal-svr4pic noreorder (mips32r5)
FAIL: MIPS jal-svr4pic noreorder (mips32r6)
FAIL: MIPS jal-svr4pic noreorder (mips64)
FAIL: MIPS jal-svr4pic noreorder (mips64r2)
FAIL: MIPS jal-svr4pic noreorder (mips64r3)
FAIL: MIPS jal-svr4pic noreorder (mips64r5)
FAIL: MIPS jal-svr4pic noreorder (mips64r6)
FAIL: MIPS jal-svr4pic noreorder (octeon)
FAIL: MIPS jal-svr4pic noreorder (octeon2)
FAIL: MIPS jal-svr4pic noreorder (octeon3)
FAIL: MIPS jal-svr4pic noreorder (octeonp)
FAIL: MIPS jal-svr4pic noreorder (r3000)
FAIL: MIPS jal-svr4pic noreorder (r3900)
FAIL: MIPS jal-svr4pic noreorder (r4000)
FAIL: MIPS jal-svr4pic noreorder (r5900)
FAIL: MIPS jal-svr4pic noreorder (sb1)
FAIL: MIPS jal-svr4pic noreorder (vr5400)
FAIL: MIPS jal-svr4pic noreorder (xlr)
FAIL: MIPS R3000 jal-xgot
FAIL: MIPS -mabi=32 test 2 (SVR4 PIC)
FAIL: gas/mips/jalr2
FAIL: Relax microMIPS branches (pic)
FAIL: Relax microMIPS branches (insn32 mode, pic)

Strictly speaking no MIPSr6 or microMIPS target is supported by IRIX,
but GAS supports such configurations on the basis of uniformity, so
provide the relevant patterns too rather than excluding the combinations
from testing.

	gas/
	* testsuite/gas/mips/jal-svr4pic-irix.d: New file.
	* testsuite/gas/mips/mips1@jal-svr4pic-irix.d: New file.
	* testsuite/gas/mips/mipsr6@jal-svr4pic-irix.d: New file.
	* testsuite/gas/mips/micromips@jal-svr4pic-irix.d: New file.
	* testsuite/gas/mips/r3000@jal-svr4pic-irix.d: New file.
	* testsuite/gas/mips/jal-svr4pic-local-irix.d: New file.
	* testsuite/gas/mips/mips1@jal-svr4pic-local-irix.d: New file.
	* testsuite/gas/mips/micromips@jal-svr4pic-local-irix.d: New
	file.
	* testsuite/gas/mips/r3000@jal-svr4pic-local-irix.d: New file.
	* testsuite/gas/mips/jal-svr4pic-noreorder-irix.d: New file.
	* testsuite/gas/mips/mips1@jal-svr4pic-noreorder-irix.d: New
	file.
	* testsuite/gas/mips/mipsr6@jal-svr4pic-noreorder-irix.d: New
	file.
	* testsuite/gas/mips/micromips@jal-svr4pic-noreorder-irix.d: New
	file.
	* testsuite/gas/mips/r3000@jal-svr4pic-noreorder-irix.d: New
	file.
	* testsuite/gas/mips/jal-xgot-irix.d: New file.
	* testsuite/gas/mips/jalr2-irix.d: New file.
	* testsuite/gas/mips/micromips-branch-relax-insn32-pic-irix.d:
	New file.
	* testsuite/gas/mips/micromips-branch-relax-pic-irix.d: New
	file.
	* testsuite/gas/mips/mips-abi32-pic2-irix.d: New file.
	* testsuite/gas/mips/jal-svr4pic-local.d: Don't exclude
	`*-*-irix*' targets.  Add source file designator.
	* testsuite/gas/mips/mips1@jal-svr4pic-local.d: Don't exclude
	`*-*-irix*' targets.
	* testsuite/gas/mips/r3000@jal-svr4pic-local.d: Likewise.
	* testsuite/gas/mips/micromips@jal-svr4pic-local.d: Likewise.
	* testsuite/gas/mips/jalr2.d: Add name designator.
	* testsuite/gas/mips/mips.exp: Use respective IRIX variants for
	tests involving the JALR relocation throughout.
2020-07-22 12:46:00 +01:00
Maciej W. Rozycki
b83d958fc7 MIPS/GAS/testsuite: Use a helper variable for IRIX/non-IRIX test selection
Define a helper variable for IRIX/non-IRIX test selection and use it
with the PR 14798 test case.

	gas/
	* testsuite/gas/mips/mips.exp: Use a helper variable for
	IRIX/non-IRIX test selection.
2020-07-22 12:46:00 +01:00
Jan Beulich
bf4ba07ca6 Revert "x86: Don't display eiz with no scale"
This reverts commit 04c662e2b6.
In my underlying suggestion I neglected the fact that in those
cases (,%eiz,1) is the only visible indication that 32-bit
addressing is in effect.
2020-07-21 14:20:11 +02:00
Cooper Qu
2b42b0415a Fix Unreasonable arch and cpu conflict warning for ther CSky architecture.
* config/tc-csky.c (md_begin): Fix tests of arch and mach flags.
2020-07-21 11:32:44 +01:00
Jan Beulich
185a798e66 Revert "x86: Replace evex-no-scale.s with evex-no-scale-[32|64].s"
This reverts commit 19449d7c67, addressing
the issue that was run into back then: There was no relationship to i686-*
and/or cross builds on 64-bit hosts. The sole problem was the use of / as
as comment character in certain ELF targets. Instead of division, use a
comparison operation.

At the same time also revert the ELF related part of 99c2d522f7 ("x86:
Update assembler tests for non-ELF targets") by replacing the construct
that's problematic for non-ELF, and by adding the "#pass" patterns to
the expected output files to cover for the tail padding generated into
COFF output.
2020-07-21 11:34:40 +02:00
Maciej W. Rozycki
ec4fcab0ee MIPS/GAS: Remove stale `prev_reloc_op_frag' variable
Ever since commit 4d7206a284 ("Rework MIPS macro relaxation, fix string
merging bug"), <https://sourceware.org/ml/binutils/2004-01/msg00248.html>,
`prev_reloc_op_frag' has only been set and never used.  Remove it then.

	gas/
	* config/tc-mips.c (prev_reloc_op_frag): Remove variable.
	(my_getSmallExpression): Adjust accordingly.
2020-07-21 01:59:24 +01:00
Jan Beulich
b3983e5f53 x86: handle SVR4 escaped binary operators
PR gas/4572

When / is a comment character, its use as binary "divide" operator needs
escaping by a backslash. Besides the scrubber needing to support this
(addressed in an earlier change), there are also a few provisions needed
in target specific operator handling.

As the spec calls for % and * to also be escaped because of being
"overloaded", also recognize these, despite the overloading there not
really preventing their use as operators in most (%) or all (*) cases,
given the way how the rest of the assembler works.

To bring source and testsuite in line, also drop the TE_I386AIX part of
the respective conditional, as i?86-*-aix* support had been removed a
while ago.
2020-07-20 08:57:18 +02:00
Jan Beulich
750e4bf70f gas: generalize comment character escaping recognition
PR gas/4572

Generalize what ab1fadc6b2 ("PR22714, Assembler preprocessor loses
track of \@") did to always honor escaped comment chars. Use this then
to support escaped /, %, and * operators on x86, when / is a comment
char (to match the Sun assembler's behavior).
2020-07-20 08:56:23 +02:00
Jan Beulich
48ef937e91 x86: honor absolute section when emitting code
Various provisions exist for insns to be placed in the absolute section,
yet actually trying to do so didn't work. While data emission (of non-
zero values) is not allowed by generic code, I think this functionality
is useful for the programmer to be able to determine the size of insns.
Therefore, rather than turning the silnet failure into a verbose one,
make things mostly work; the one class of insns not supported (yet) are
branches (JMP and Jcc) with dynamically determined displacement widths.
In this one case, an error now gets reported instead of silently
ignoring the code.

Also avoid recording ISA / feature usage for insns emitted to the
absolute section.
2020-07-20 08:55:48 +02:00
Jan Beulich
693bec1ed6 ix86: enable more ELF tests for VxWorks
The tree-wide is_elf_format predicate excludes VxWorks, but the majority
of ELF specific tests is quite fine for this target.
2020-07-20 08:54:37 +02:00
H.J. Lu
2585b7a5ce x86: Change PLT32 reloc against section to PC32
Commit 292676c1 resolved PLT32 reloc aganst local symbol to section.
Since PLT32 relocation must be against symbols, turn such PLT32
relocation into PC32 relocation.

gas/

	PR gas/26263
	* config/tc-i386.c (i386_validate_fix): Change PLT32 reloc
	against section to PC32 reloc.
	* testsuite/gas/i386/relax-5.d: Updated.
	* testsuite/gas/i386/x86-64-relax-4.d: Likewise.

ld/

	PR gas/26263
	* testsuite/ld-i386/i386.exp: Run PR gas/26263 test.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr26263.d: New file.
	* testsuite/ld-x86-64/pr26263.d: Likewise.
	* testsuite/ld-x86-64/pr26263.s: Likewise.
2020-07-19 06:51:32 -07:00
H.J. Lu
04c662e2b6 x86: Don't display eiz with no scale
Change

67 48 8b 1c 25 ef cd ab 89 	mov    0x89abcdef(,%eiz,1),%rbx

to

67 48 8b 1c 25 ef cd ab 89 	mov    0x89abcdef,%rbx

in AT&T syntax and

67 48 8b 1c 25 ef cd ab 89 	mov    rbx,QWORD PTR [eiz*1+0x89abcdef]

to

67 48 8b 1c 25 ef cd ab 89 	mov    rbx,QWORD PTR ds:0x89abcdef

in Intel syntax.

gas/

	PR gas/26237
	* testsuite/gas/i386/evex-no-scale-64.d: Updated.
	* testsuite/gas/i386/addr32.d: Likewise.
	* testsuite/gas/i386/x86-64-addr32-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-addr32.d: Likewise.

opcodes/

	PR gas/26237
	* i386-dis.c (OP_E_memory): Don't display eiz with no scale
	without base nor index registers.
2020-07-15 06:57:47 -07:00
Nick Clifton
56c1b507aa Fix the generation of relocs for missing build notes.
* write.c (create_note_reloc): Add desc2_size parameter.  Zero out
	the addend field of REL relocations.  Store the full addend into
	the note for REL relocations.
2020-07-15 12:52:53 +01:00
Jan Beulich
e2e018c340 x86-64: adjust stack insn test case
The value chosen for the 16-/32-bit immediate cases didn't work well
with the subsequent insn's REX prefix - we ought to pick a value the
upper two bytes of which evaluate to a 2-byte insn. Bump the values
accordingly, allowing the subsequent insn to actually have the intended
REX.W.
2020-07-15 08:54:40 +02:00
Jan Beulich
36938cabf0 x86: avoid attaching suffixes to unambiguous insns
"Unambiguous" is is in particular taking as reference the assembler,
which also accepts certain insns - despite them allowing for varying
operand size, and hence in principle being ambiguous - without any
suffix. For example, from the very beginning of the life of x86-64 I had
trouble understanding why a plain and simple RET had to be printed as
RETQ. In case someone really used the 16-bit form, RETW disambiguates
the two quite fine.
2020-07-15 08:53:55 +02:00
H.J. Lu
8e58ef803c x86-64: Zero-extend lower 32 bits displacement to 64 bits
Since the addr32 (0x67) prefix zero-extends the lower 32 bits address to
64 bits, change disassembler to zero-extend the lower 32 bits displacement
to 64 bits when there is no base nor index registers.

gas/

	PR gas/26237
	* testsuite/gas/i386/addr32.s: Add tests for 32-bit wrapped around
	address.
	* testsuite/gas/i386/x86-64-addr32.s: Likewise.
	* testsuite/gas/i386/addr32.d: Updated.
	* testsuite/gas/i386/x86-64-addr32-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-addr32.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-addr32-intel.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-addr32.d: Likewise.

opcodes/

	PR gas/26237
	* i386-dis.c (OP_E_memory): Without base nor index registers,
	32-bit displacement to 64 bits.
2020-07-14 09:58:07 -07:00
Jan Beulich
bfbd943845 x86/Intel: debug registers are named DRn
%db<n> is an AT&T invention; the Intel documentation and MASM have only
ever specified DRn (in line with CRn and TRn). (In principle gas also
shouldn't accept the names in Intel mode, but at least for now I've kept
things as they are. Perhaps as a first step this should just be warned
about.)
2020-07-14 10:43:38 +02:00
Jan Beulich
7531c61332 x86: simplify decode of opcodes valid with (embedded) 66 prefix only
The only valid (embedded or explicit) prefix being the data size one
(which is a fairly common pattern), avoid going through prefix_table[].
Instead extend the "required prefix" logic to also handle PREFIX_DATA
alone in a table entry, now used to identify this case. This requires
moving the (adjusted) ->prefix_requirement logic ahead of the printing
of stray prefixes, as the latter needs to observe the new setting of
PREFIX_DATA in used_prefixes.

Also add PREFIX_OPCODE on related entries when previously there was
mistakenly no decode step through prefix_table[].
2020-07-14 10:33:40 +02:00
Jan Beulich
b24d668c07 x86-64: fix {,V}PCMPESTR{I,M} disassembly in Intel mode
The operands don't allow disambiguating the insn in 64-bit mode, and
hence suffixes need to be emitted not just in AT&T mode. Achieve this
by re-using %LQ while dropping PCMPESTR_Fixup().
2020-07-14 10:28:12 +02:00
Jan Beulich
9ab00b61a9 x86: don't disassemble MOVBE with two suffixes
MOVBE_Fixup() is entirely redundant with the S macro already used on the
mnemonics, leading to double suffixes in suffix-always mode. Drop the
function.
2020-07-14 10:26:51 +02:00
Jan Beulich
2875b28aa8 x86: avoid attaching suffix to register-only CRC32
Just like other insns with GPR operands, CRC32 with only register
operands should not get a suffix added unless in suffix-always mode.
Do away with CRC32_Fixup() altogether, using other more generic logic
instead.
2020-07-14 10:25:43 +02:00
Jan Beulich
e184e6110e x86-64: don't hide an empty but meaningless REX prefix
Unlike for non-zero values passed to USED_REX(), where rex_used gets
updated only when the respective bit was actually set in the encoding,
zero getting passed in is not further guarded, yet such a (potentially
"empty") REX prefix takes effect only when there are registers numbered
4 and up.
2020-07-14 10:24:26 +02:00
Jan Beulich
e8b5d5f971 x86: drop dead code from OP_IMREG()
There's only a very limited set of modes that this function gets invoked
with - avoid it being more generic than it needs to be. This may, down
the road, allow actually doing away with the function altogether.

This eliminates a first improperly used "USED_REX (0)".
2020-07-14 10:23:36 +02:00
Jan Beulich
38397794c9 x86-64: fold ILP32 test expectations
Various of the test expectations get adjusted later in this and a
subsequent series, so in order to avoid having to adjust more instances
than necessary fold respective test ILP32 expectations with their main
64-bit counterparts where they're identical anyway.
2020-07-14 10:22:45 +02:00
H.J. Lu
7a70531559 x86: Remove 32-bit sign extension in offset_in_range
When encoding a 32-bit offset, there is no need to sign-extend it to 64
bits since only the lower 32 bits are used.

	* config/tc-i386.c (offset_in_range): Remove 32-bit sign
	extension.
2020-07-13 10:32:15 -07:00
Nick Clifton
0a5c31d1ac Updated French translation for the gas/ and binutils/ sub-directories 2020-07-13 14:49:58 +01:00
Alan Modra
8884c29c0f gas DWARF2 test XPASSes
git commit af2b318648 introduced a number of XPASSes.  This removes
them.  (It also introduces a FAIL on ft32-elf but the comment in the
.d file didn't adequately explain why the failure should be expected.)

	* testsuite/gas/elf/dwarf2-7.d: Remove most xfails.
	* testsuite/gas/elf/dwarf2-12.d: Likewise.
	* testsuite/gas/elf/dwarf2-13.d: Likewise.
	* testsuite/gas/elf/dwarf2-14.d: Likewise.
2020-07-13 22:03:59 +09:30
H.J. Lu
a308b89de7 x86: Support GNU_PROPERTY_X86_FEATURE_2_TMM
Support GNU_PROPERTY_X86_FEATURE_2_TMM in

https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/1

 #define GNU_PROPERTY_X86_FEATURE_2_TMM      (1U << 10)

binutils/

	* readelf.c (decode_x86_feature_2): Handle
	GNU_PROPERTY_X86_FEATURE_2_TMM.

gas/

	* config/tc-i386.c (output_insn): Check i.xstate to set
	GNU_PROPERTY_X86_FEATURE_2_TMM.
	* testsuite/gas/i386/i386.exp: Run x86-64-property-7,
	x86-64-property-8 and x86-64-property-9.
	* testsuite/gas/i386/x86-64-property-7.d: New file.
	* testsuite/gas/i386/x86-64-property-7.s: Likewise.
	* testsuite/gas/i386/x86-64-property-8.d: Likewise.
	* testsuite/gas/i386/x86-64-property-8.s: Likewise.
	* testsuite/gas/i386/x86-64-property-9.d: Likewise.
	* testsuite/gas/i386/x86-64-property-9.s: Likewise.

include/

	* elf/common.h (GNU_PROPERTY_X86_FEATURE_2_TMM): New.
2020-07-11 04:04:20 -07:00
H.J. Lu
921eafeada x86: Extract extended states from instruction template
Extract extended states from operand types in instruction template.  Set
xstate_zmm for master register move.

	* config/tc-i386.c (_i386_insn): Remove has_regmmx, has_regxmm,
	has_regymm, has_regzmm and has_regtmm.  Add xstate.
	(md_assemble): Set i.xstate from operand types in instruction
	template.
	(build_modrm_byte): Updated.
	(output_insn): Check i.xstate.
	* testsuite/gas/i386/i386.exp: Run property-6 and
	x86-64-property-6.
	* testsuite/gas/i386/property-6.d: New file.
	* testsuite/gas/i386/property-6.s: Updated.
	* testsuite/gas/i386/x86-64-property-6.d: Likewise.
2020-07-10 08:43:47 -07:00
H.J. Lu
d249bf8670 gas/i386/property-5.d: Correct test name
* testsuite/gas/i386/property-5.d: Correct test name.
2020-07-10 05:58:42 -07:00
Lili Cui
260cd341da x86: Add support for Intel AMX instructions
gas/

	* doc/c-i386.texi: Document amx_int8, amx_bf16 and amx_tile.
	* config/tc-i386.c (i386_error): Add invalid_sib_address.
	(cpu_arch): Add .amx_int8, .amx_bf16 and .amx_tile.
	(cpu_noarch): Add noamx_int8, noamx_bf16 and noamx_tile.
	(match_simd_size): Add tmmword check.
	(operand_type_match): Add tmmword.
	(type_names): Add rTMM.
	(i386_error): Add invalid_tmm_register_set.
	(check_VecOperands): Handle invalid_sib_address and
	invalid_tmm_register_set.
	(match_template): Handle invalid_sib_address.
	(build_modrm_byte): Handle non-vector SIB and zmmword.
	(i386_index_check): Disallow RegIP for non-vector SIB.
	(check_register): Handle zmmword.
	* testsuite/gas/i386/i386.exp: Add AMX new tests.
	* testsuite/gas/i386/intel-regs.d: Add tmm.
	* testsuite/gas/i386/intel-regs.s: Add tmm.
	* testsuite/gas/i386/x86-64-amx-intel.d: New.
	* testsuite/gas/i386/x86-64-amx-inval.l: New.
	* testsuite/gas/i386/x86-64-amx-inval.s: New.
	* testsuite/gas/i386/x86-64-amx.d: New.
	* testsuite/gas/i386/x86-64-amx.s: New.
	* testsuite/gas/i386/x86-64-amx-bad.d: New.
	* testsuite/gas/i386/x86-64-amx-bad.s: New.

opcodes/

	* i386-dis.c (TMM): New.
	(EXtmm): Likewise.
	(VexTmm): Likewise.
	(MVexSIBMEM): Likewise.
	(tmm_mode): Likewise.
	(vex_sibmem_mode): Likewise.
	(REG_VEX_0F3849_X86_64_P_0_W_0_M_1): Likewise.
	(MOD_VEX_0F3849_X86_64_P_0_W_0): Likewise.
	(MOD_VEX_0F3849_X86_64_P_2_W_0): Likewise.
	(MOD_VEX_0F3849_X86_64_P_3_W_0): Likewise.
	(MOD_VEX_0F384B_X86_64_P_1_W_0): Likewise.
	(MOD_VEX_0F384B_X86_64_P_2_W_0): Likewise.
	(MOD_VEX_0F384B_X86_64_P_3_W_0): Likewise.
	(MOD_VEX_0F385C_X86_64_P_1_W_0): Likewise.
	(MOD_VEX_0F385E_X86_64_P_0_W_0): Likewise.
	(MOD_VEX_0F385E_X86_64_P_1_W_0): Likewise.
	(MOD_VEX_0F385E_X86_64_P_2_W_0): Likewise.
	(MOD_VEX_0F385E_X86_64_P_3_W_0): Likewise.
	(RM_VEX_0F3849_X86_64_P_0_W_0_M_1_R_0): Likewise.
	(PREFIX_VEX_0F3849_X86_64): Likewise.
	(PREFIX_VEX_0F384B_X86_64): Likewise.
	(PREFIX_VEX_0F385C_X86_64): Likewise.
	(PREFIX_VEX_0F385E_X86_64): Likewise.
	(X86_64_VEX_0F3849): Likewise.
	(X86_64_VEX_0F384B): Likewise.
	(X86_64_VEX_0F385C): Likewise.
	(X86_64_VEX_0F385E): Likewise.
	(VEX_LEN_0F3849_X86_64_P_0_W_0_M_0): Likewise.
	(VEX_LEN_0F3849_X86_64_P_0_W_0_M_1_REG_0_RM_0): Likewise.
	(VEX_LEN_0F3849_X86_64_P_2_W_0_M_0): Likewise.
	(VEX_LEN_0F3849_X86_64_P_3_W_0_M_0): Likewise.
	(VEX_LEN_0F384B_X86_64_P_1_W_0_M_0): Likewise.
	(VEX_LEN_0F384B_X86_64_P_2_W_0_M_0): Likewise.
	(VEX_LEN_0F384B_X86_64_P_3_W_0_M_0): Likewise.
	(VEX_LEN_0F385C_X86_64_P_1_W_0_M_0): Likewise.
	(VEX_LEN_0F385E_X86_64_P_0_W_0_M_0): Likewise.
	(VEX_LEN_0F385E_X86_64_P_1_W_0_M_0): Likewise.
	(VEX_LEN_0F385E_X86_64_P_2_W_0_M_0): Likewise.
	(VEX_LEN_0F385E_X86_64_P_3_W_0_M_0): Likewise.
	(VEX_W_0F3849_X86_64_P_0): Likewise.
	(VEX_W_0F3849_X86_64_P_2): Likewise.
	(VEX_W_0F3849_X86_64_P_3): Likewise.
	(VEX_W_0F384B_X86_64_P_1): Likewise.
	(VEX_W_0F384B_X86_64_P_2): Likewise.
	(VEX_W_0F384B_X86_64_P_3): Likewise.
	(VEX_W_0F385C_X86_64_P_1): Likewise.
	(VEX_W_0F385E_X86_64_P_0): Likewise.
	(VEX_W_0F385E_X86_64_P_1): Likewise.
	(VEX_W_0F385E_X86_64_P_2): Likewise.
	(VEX_W_0F385E_X86_64_P_3): Likewise.
	(names_tmm): Likewise.
	(att_names_tmm): Likewise.
	(intel_operand_size): Handle void_mode.
	(OP_XMM): Handle tmm_mode.
	(OP_EX): Likewise.
	(OP_VEX): Likewise.
	* i386-gen.c (cpu_flag_init): Add entries for CpuAMX_INT8,
	CpuAMX_BF16 and CpuAMX_TILE.
	(operand_type_shorthands): Add RegTMM.
	(operand_type_init): Likewise.
	(operand_types): Add Tmmword.
	(cpu_flag_init): Add CPU_AMX_INT8, CpuAMX_BF16 and CpuAMX_TILE.
	(cpu_flags): Add CpuAMX_INT8, CpuAMX_BF16 and CpuAMX_TILE.
	* i386-opc.h (CpuAMX_INT8): New.
	(CpuAMX_BF16): Likewise.
	(CpuAMX_TILE): Likewise.
	(SIBMEM): Likewise.
	(Tmmword): Likewise.
	(i386_cpu_flags): Add cpuamx_int8, cpuamx_bf16 and cpuamx_tile.
	(i386_opcode_modifier): Extend width of fields vexvvvv and sib.
	(i386_operand_type): Add tmmword.
	* i386-opc.tbl: Add AMX instructions.
	* i386-reg.tbl: Add AMX registers.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.
2020-07-10 05:18:34 -07:00
Tom de Vries
af2b318648 [readelf] Fix end_seq entry in -wL. Specifically stop the display of a line number and is_statement/has-view fields for the End of Sequence operator, as these have no meaning.
binutils* dwarf.c (display_debug_lines_decoded): Don't emit meaningless
	information in the end_sequence row.
	* testsuite/binutils-all/dw5.W: Update.
	* testsuite/binutils-all/objdump.WL: Update.

gas	* testsuite/gas/elf/dwarf2-11.d: Update expected output from
	readelf's line table decoding.
	* testsuite/gas/elf/dwarf2-12.d: Likewise.
	* testsuite/gas/elf/dwarf2-13.d: Likewise.
	* testsuite/gas/elf/dwarf2-14.d: Likewise.
	* testsuite/gas/elf/dwarf2-15.d: Likewise.
	* testsuite/gas/elf/dwarf2-16.d: Likewise.
	* testsuite/gas/elf/dwarf2-17.d: Likewise.
	* testsuite/gas/elf/dwarf2-18.d: Likewise.
	* testsuite/gas/elf/dwarf2-19.d: Likewise.
	* testsuite/gas/elf/dwarf2-5.d: Likewise.
	* testsuite/gas/elf/dwarf2-6.d: Likewise.
	* testsuite/gas/elf/dwarf2-7.d: Likewise.
2020-07-10 11:25:44 +01:00
H.J. Lu
39776b1117 x86: Properly set YMM/ZMM features
Since VEX/EVEX vector instructions will always update the full YMM/ZMM
registers, set YMM/ZMM features for VEX/EVEX vector instructions.

	* config/tc-i386.c (output_insn): Set YMM/ZMM features for
	VEX/EVEX vector instructions.
	* testsuite/gas/i386/property-4.d: New file.
	* testsuite/gas/i386/property-4.s: Likewise.
	* testsuite/gas/i386/property-5.d: Likewise.
	* testsuite/gas/i386/property-5.s: Likewise.
	* testsuite/gas/i386/x86-64-property-4.d: Likewise.
	* testsuite/gas/i386/x86-64-property-5.d: Likewise.
2020-07-09 10:33:43 -07:00
H.J. Lu
939b95c77b Linux/x86: Configure gas with --enable-x86-used-note by default
* configure.ac: Configure with --enable-x86-used-note by default
	for Linux/x86.
	* configure: Regenerated.
2020-07-09 08:29:25 -07:00
Alan Modra
fe49679d51 Remove powerpc PE support
Plus some leftover powerpc lynxos support.

bfd/
	* coff-ppc.c: Delete.
	* pe-ppc.c: Delete.
	* pei-ppc.c: Delete.
	* Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Remove PE PPC.
	* coffcode.h (coff_set_arch_mach_hook, coff_set_flags): Remove
	PPCMAGIC code.
	(coff_write_object_contents): Remove PPC_PE code.
	* config.bfd: Move powerpcle-pe to removed targets.
	* configure.ac: Remove powerpc PE entries.
	* libcoff-in.h (ppc_allocate_toc_section): Delete.
	(ppc_process_before_allocation): Delete.
	* peXXigen.c: Remove POWERPC_LE_PE code and comments.
	* targets.c: Remove powerpc PE vectors.
	* po/SRC-POTFILES.in: Regenerate.
	* libcoff.h: Regenerate.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
binutils/
	* dlltool.c: Remove powerpc PE support and comments.
	* configure.ac: Remove powerpc PE dlltool config.
	* configure: Regenerate.
gas/
	* config/obj-coff.h: Remove TE_PE support.
	* config/tc-ppc.c: Likewise.
	* config/tc-ppc.h: Likewise.
	* configure.tgt: Remove powerpc PE and powerpc lynxos.
	* testsuite/gas/cfi/cfi.exp (cfi-common-6): Remove powerpc PE
	condition.
	* testsuite/gas/macros/macros.exp: Don't xfail powerpc PE.
include/
	* coff/powerpc.h: Delete.
ld/
	* emulparams/ppcpe.sh: Delete.
	* scripttempl/ppcpe.sc: Delete.
	* emulparams/ppclynx.sh: Delete.
	* Makefile.am (ALL_EMULATION_SOURCES): Remove ppc PE and lynxos.
	* configure.tgt: Likewise.
	* emultempl/beos.em: Remove powerpc PE support.
	* emultempl/pe.em: Likewise.
	* po/BLD-POTFILES.in: Regenerate.
	* Makefile.in: Regenerate.
2020-07-09 22:58:16 +09:30
Jan Beulich
6384fd9e1d x86: FMA4 scalar insns ignore VEX.L
Just like other VEX-encoded scalar insns do.

Besides a testcase for this behavior also introduce one to verify that
XOP scalar insns don't honor -mavxscalar=256, as they don't ignore
XOP.L.
2020-07-08 11:19:26 +02:00
Claudiu Zissulescu
3128916d88 arc: Improve error messages when assembling
gas/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/tc-arc.c (find_opcode_match): Add error messages.
	* testsuite/gas/arc/add_s-err.s: Update test.
	* testsuite/gas/arc/asm-errors.err: Likewise.
	* testsuite/gas/arc/cpu-em-err.s: Likewise.
	* testsuite/gas/arc/hregs-err.s: Likewise.
	* testsuite/gas/arc/warn.s: Likewise.
2020-07-07 16:01:48 +03:00
Claudiu Zissulescu
f337259fbd arc: Update vector instructions.
Update vadd2, vadd4h, vmac2h, vmpy2h, vsub4h vector instructions
arguments to discriminate between double/single register operands.

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

	* arc-opc.c (insert_rbd): New function.
	(RBD): Define.
	(RBDdup): Likewise.
	* arc-tbl.h (vadd2, vadd4h, vmac2h, vmpy2h, vsub4h): Update
	instructions.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2020-07-07 16:01:48 +03:00
H.J. Lu
dbdba9b04d x86: Remove an incorrect AVX2 entry
The upper 16 vector registers were added by AVX512.

	PR gas/26212
	* doc/c-i386.texi: Remove an incorrect AVX2 entry.
2020-07-07 05:06:38 -07:00
Alan Modra
34e7979860 Use is_xcoff_format in gas testsuite
* testsuite/gas/all/gas.exp: Use is_xcoff_format.
	* testsuite/gas/ppc/ppc.exp: Likewise.
	* testsuite/gas/all/weakref1l.d: Likewise.
2020-07-07 18:26:34 +09:30
Nick Clifton
3c6e74ce51 Fix recent failures in the ARM assembler testsuite due to the correction of a spelling mistake.
* testsuite/gas/arm/cde-missing-fp.l: Fix spelling mistake in
	expected output.
2020-07-07 09:37:38 +01:00
Jan Beulich
e74d9fa9cf x86: AVX512 extract/insert insns need to honor EVEX.L'L
Just like their AVX counterparts do for VEX.L.

At this occasion also make EVEX.W have the same effect as VEX.W on the
printing of VPINSR{B,W}'s operands, bringing them also in sync with
VPEXTR{B,W}.
2020-07-06 13:41:27 +02:00
Jan Beulich
39e0f45682 x86: replace EXqScalarS by EXqVexScalarS
There's only a single user, that that one can do fine with the
alternative, as the "Vex" aspect of the other operand kind is meaningful
only on 3-operand insns.

While doing this I noticed that I didn't need to do the same adjustment
in the EVEX tables, and voilà - there was a bug, which gets fixed at the
same time (see the testsuite changes).
2020-07-06 13:35:38 +02:00
Nick Clifton
ddc73fa987 Fix spelling mistakes in some of the binutils sub-directories.
PR 26204
gas	* config/tc-arm.c: Fix spelling mistake.
	* config/tc-riscv.c: Likewise.
	* config/tc-z80.c: Likewise.
	* po/gas.pot: Regenerate.

ld	* lexsup.c: Fix spelling mistake.
	* po/ld.pot: Regenerate.

opcodes	* arc-dis.c: Fix spelling mistake.
	* po/opcodes.pot: Regenerate.
2020-07-06 10:54:36 +01:00
Nick Clifton
17550be7dd Updated translations for various binutils sub-directories 2020-07-06 10:43:35 +01:00
Nick Clifton
b19d852dcf Update version to 2.35.50 and regenerate files 2020-07-04 10:34:23 +01:00
Nick Clifton
b115b9fd3c Add markers for binutils 2.35 branch 2020-07-04 10:16:22 +01:00
Alan Modra
b657622c3e Re: Change readelf's display of symbol names
Fixes some fallout from git commit 0942c7ab94.

	PR 26028
gas/
	* testsuite/gas/ia64/unwind-ilp32.d: Add -T to readelf options.
gold/
	* testsuite/Makefile.am (file_in_many_sections.stdout): Add -W
	to readelf options.
	* testsuite/Makefile.in: Regenerate.
ld/
	* testsuite/ld-arm/arm-elf.exp (vxworks1): Pass --wide to readelf
	when dumping relocs.
	* testsuite/ld-i386/i386.exp (vxworks1): Likewise.
	* testsuite/ld-sh/sh-vxworks.exp (vxworks1): Likewise.
	* testsuite/ld-sparc/sparc.exp (vxworks1): Likewise.
	* testsuite/ld-arm/vxworks1.rd: Adjust to suit.
	* testsuite/ld-i386/vxworks1.rd: Adjust.
	* testsuite/ld-sh/vxworks1.rd: Adjust.
	* testsuite/ld-sparc/vxworks1.rd: Adjust.
2020-07-03 17:15:16 +09:30
H.J. Lu
c2ecccb33c x86: Add SwapSources
We check register-only source operand to decide if two source operands of
VEX encoded instructions should be swapped.  But source operands in AMX
instructions with two source operands swapped are all register-only
operand.  Add SwapSources to indicate two source operands should be
swapped.

gas/

	* config/tc-i386.c (build_modrm_byte): Check vexswapsources to
	swap two source operands.

opcodes/

	* i386-gen.c (opcode_modifiers): Add VexSwapSources.
	* i386-opc.h (VexSwapSources): New.
	(i386_opcode_modifier): Add vexswapsources.
	* i386-opc.tbl: Add VexSwapSources to BMI2 and BMI instructions
	with two source operands swapped.
	* i386-tbl.h: Regenerated.
2020-07-02 08:46:48 -07:00
Nick Clifton
f436f38e7d Skip fill-1 gas test for MeP targets.
* testsuite/gas/all/fill-1.d: Skip for MeP targets.
2020-07-02 14:08:16 +01:00
Alex Coplan
f405494f21 aarch64: Fix segfault on unicode symbols
This patch fixes a segfault which occurs when the AArch64 backend parses
a symbol operand that begins with a register name and ends with a
unicode byte (byte value > 127).

For example, the following input causes the crash:

x0é: udf x0é

gas/ChangeLog:

2020-07-02  Alex Coplan  <alex.coplan@arm.com>

	* config/tc-aarch64.c (reg_name_p): Fix cast so that we don't
	segfault on negative chars.
	* testsuite/gas/aarch64/reglike-label-unicode-segv.d: New test.
	* testsuite/gas/aarch64/reglike-label-unicode-segv.s: Input.
2020-07-02 13:53:07 +01:00
Nick Clifton
0942c7ab94 Change readelf's display of symbol names (when not in --wide mode) so that if they are going to be truncated then "[...]" is displayed at the end. Add a comment line option to disable this enhancement and restore the old behaviour.
PR 26028
binutils* readelf.c (print_symbol): Handle truncation of symbol names.
	(options): Add -T/--silent-truncation option.
	(parse_args): Handle the option.
	(print_dynamic_symbol): Correct calculation of width available to
	display symbol name.
	* doc/binutils.texi: Document the -T option to readelf.
	* NEWS: Mention the new feature.

gas	* testsuite/gas/ia64/group-2.d: Add -T option to readelf
	command line.
	* testsuite/gas/ia64/unwind.d: Likewise.
	* testsuite/gas/mmix/bspec-1.d: Likewise.
	* testsuite/gas/mmix/bspec-2.d: Likewise.
	* testsuite/gas/mmix/comment-1.d: Likewise.
	* testsuite/gas/tic6x/scomm-directive-4.d: Likewise.

ld	* testsuite/ld-powerpc/powerpc.exp: Add -T option to readelf
	command line when running some tests.
	* testsuite/ld-arm/arm-elf.exp: Likewise.
	* testsuite/ld-mips-elf/mips-elf.exp: Likewise.
	* testsuite/ld-mmix/local1.d: Likewise.
	* testsuite/ld-mmix/local3.d: Likewise.
	* testsuite/ld-mmix/local5.d: Likewise.
	* testsuite/ld-mmix/local7.d: Likewise.
	* testsuite/ld-powerpc/powerpc.exp: Likewise.
2020-07-02 11:30:52 +01:00
Alan Modra
3443489c65 obsolete xc16x
The xc16x md_apply_fix code is just so broken that in my opinion the
target should never have been accepted, and from a quick look at
commit logs for the target it appears that no one has ever contributed
fixes for anything.  This target has just been a 14 year burden on
global binutils and cgen maintainers.  That's not how free software is
supposed to work.

bfd/
	* config.bfd: Obsolete xc16x.
gas/
	* config/tc-xc16x.c (md_apply_fix): Add FIXME.
2020-07-01 10:06:43 +09:30
Alan Modra
054b336d9a gas eqv-dot test fails
* testsuite/gas/all/eqv-dot.d: xfail targets that set linkrelax
	in data sections, and mep.
2020-07-01 10:06:40 +09:30
H.J. Lu
bbd19b19e4 Remove x86 NaCl target support
NaCl has been deprecated:

https://developer.chrome.com/native-client/migration

and NaCl will completely disappear in 2021:

https://lists.llvm.org/pipermail/llvm-dev/2020-April/141107.html

Remove x86 NaCl target support from bfd, binutils, gas and ld.

bfd/

	* archures.c (bfd_mach_i386_nacl): Removed.
	(bfd_mach_i386_i386_nacl): Likewise.
	(bfd_mach_x86_64_nacl): Likewise.
	(bfd_mach_x64_32_nacl): Likewise.
	* config.bfd: Remove *-*-nacl* targets.
	* configure.ac: Remove x86 NaCl target vectors.
	* cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): Removed.
	(bfd_x64_32_nacl_arch): Likewise.
	(bfd_x86_64_nacl_arch): Likewise.
	(bfd_i386_nacl_arch): Likewise.
	(bfd_x64_32_arch_intel_syntax): Updated.
	* elf32-i386.c: Don't include "elf-nacl.h".
	(elf_i386_nacl_plt): Removed.
	(elf_i386_nacl_plt0_entry): Likewise.
	(elf_i386_nacl_plt_entry): Likewise.
	(elf_i386_nacl_pic_plt0_entry): Likewise.
	(elf_i386_nacl_pic_plt_entry): Likewise.
	(elf_i386_nacl_eh_frame_plt): Likewise.
	(elf_i386_nacl_plt): Likewise.
	(elf32_i386_nacl_elf_object_p): Likewise.
	(elf_i386_get_synthetic_symtab): Updated.
	(elf_i386_link_setup_gnu_properties): Likewise.
	* elf64-x86-64.c: Don't include "elf-nacl.h".
	(elf_x86_64_nacl_plt): Removed.
	(elf64_x86_64_nacl_elf_object_p): Likewise.
	(elf_x86_64_nacl_plt0_entry): Likewise.
	(elf_x86_64_nacl_plt_entry): Likewise.
	(elf_x86_64_nacl_eh_frame_plt): Likewise.
	(elf_x86_64_nacl_plt): Likewise.
	(elf32_x86_64_nacl_elf_object_p): Likewise.
	(elf_x86_64_get_synthetic_symtab): Updated.
	(elf_x86_64_link_setup_gnu_properties): Likewise.
	* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
	* targets.c: Remove x86 NaCl target vectors.
	* bfd-in2.h: Regenerated.
	* configure: Likewise.

binutils/

	* NEWS: Mention x86 NaCl target support removal.
	* dwarf.c (init_dwarf_regnames_by_bfd_arch_and_mach): Remove
	x86 NaCl target support.
	* testsuite/binutils-all/elfedit-1.d: Likewise.
	* testsuite/binutils-all/i386/i386.exp: Likewise.
	* testsuite/binutils-all/x86-64/objects.exp: Likewise.
	* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494b.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/x86-64.exp: Likewise.

gas/

	* NEWS: Mention x86 NaCl target support removal.
	* config/tc-i386.c: Remove x86 NaCl target support.
	* config/tc-i386.h: Likewise.
	* configure.tgt: Likewise.
	* testsuite/gas/i386/i386.exp: Likewise.
	* testsuite/gas/i386/iamcu-1.d: Likewise.
	* testsuite/gas/i386/iamcu-2.d: Likewise.
	* testsuite/gas/i386/iamcu-3.d: Likewise.
	* testsuite/gas/i386/iamcu-4.d: Likewise.
	* testsuite/gas/i386/iamcu-5.d: Likewise.
	* testsuite/gas/i386/k1om.d: Likewise.
	* testsuite/gas/i386/l1om.d: Likewise.

ld/

	* Makefile.am (ALL_EMULATION_SOURCES): Remove eelf_i386_nacl.c,
	eelf32_x86_64_nacl.c, eelf_x86_64_nacl.c.
	Remove x86 NaCl dep files.
	* NEWS: Mention x86 NaCl target support removal.
	* configure.tgt: Remove x86 NaCl target support.
	* testsuite/ld-elf/binutils.exp: Likewise.
	* testsuite/ld-elf/elf.exp: Likewise.
	* testsuite/ld-elfvers/vers.exp: Likewise.
	* testsuite/ld-i386/align-branch-1.d: Likewise.
	* testsuite/ld-i386/export-class.exp: Likewise.
	* testsuite/ld-i386/i386.exp: Likewise.
	* testsuite/ld-i386/load1.d: Likewise.
	* testsuite/ld-i386/pie1.d: Likewise.
	* testsuite/ld-i386/pr12570a.d: Likewise.
	* testsuite/ld-i386/pr12570b.d: Likewise.
	* testsuite/ld-i386/pr19636-1d.d: Likewise.
	* testsuite/ld-i386/pr19636-1l.d: Likewise.
	* testsuite/ld-i386/pr19636-2c.d: Likewise.
	* testsuite/ld-i386/pr19636-2d.d: Likewise.
	* testsuite/ld-i386/pr19636-2e.d: Likewise.
	* testsuite/ld-i386/pr20244-1a.d: Likewise.
	* testsuite/ld-i386/pr20244-1b.d: Likewise.
	* testsuite/ld-i386/pr20244-2a.d: Likewise.
	* testsuite/ld-i386/pr20244-2b.d: Likewise.
	* testsuite/ld-i386/pr20244-2c.d: Likewise.
	* testsuite/ld-i386/pr20244-4a.d: Likewise.
	* testsuite/ld-i386/pr20244-4b.d: Likewise.
	* testsuite/ld-i386/pr21884.d: Likewise.
	* testsuite/ld-ifunc/binutils.exp: Likewise.
	* testsuite/ld-ifunc/ifunc-10-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-10-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-11-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-11-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-12-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-12-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-13-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-13-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14c-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14c-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14d-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14d-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14e-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14e-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14f-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14f-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-15-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-15-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-16-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-17a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-17a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-17b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-17b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-18a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-18a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-18b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-18b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-19a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-19a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-19b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-19b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-local-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-20-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-21-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-22-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5a-local-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5a-local-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5b-local-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5b-local-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5r-local-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-6a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-6a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-6b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-6b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-7a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-7a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-7b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-7b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-8-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-8-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-9-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise.
	* testsuite/ld-ifunc/pr17154-i386-now.d: Likewise.
	* testsuite/ld-ifunc/pr17154-i386.d: Likewise.
	* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
	* testsuite/ld-plugin/lto.exp: Likewise.
	* testsuite/ld-x86-64/align-branch-1.d: Likewise.
	* testsuite/ld-x86-64/dwarfreloc.exp: Likewise.
	* testsuite/ld-x86-64/line.exp: Likewise.
	* testsuite/ld-x86-64/load1a.d: Likewise.
	* testsuite/ld-x86-64/load1b.d: Likewise.
	* testsuite/ld-x86-64/load1c.d: Likewise.
	* testsuite/ld-x86-64/load1d.d: Likewise.
	* testsuite/ld-x86-64/pie3.d: Likewise.
	* testsuite/ld-x86-64/pr18160.d: Likewise.
	* testsuite/ld-x86-64/pr19013-x32.d: Likewise.
	* testsuite/ld-x86-64/pr19013.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2d.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1b.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1d.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1f.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1h.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1j.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1l.d: Likewise.
	* testsuite/ld-x86-64/pr21884.d: Likewise.
	* testsuite/ld-x86-64/pr22393-3a.rd: Likewise.
	* testsuite/ld-x86-64/pr22393-3b.rd: Likewise.
	* testsuite/ld-x86-64/tlsgd10.dd: Likewise.
	* testsuite/ld-x86-64/tlsgd5.dd: Likewise.
	* testsuite/ld-x86-64/tlsgd8.dd: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* emulparams/elf32_x86_64_nacl.sh: Removed.
	* emulparams/elf_i386_nacl.sh: Likewise.
	* emulparams/elf_x86_64_nacl.sh: Likewise.
	* testsuite/ld-i386/emit-relocs-nacl.rd: Likewise.
	* testsuite/ld-i386/load1-nacl.d: Likewise.
	* testsuite/ld-i386/pie1-nacl.d: Likewise.
	* testsuite/ld-i386/plt-nacl.pd: Likewise.
	* testsuite/ld-i386/plt-pic-nacl.pd: Likewise.
	* testsuite/ld-i386/pr17709-nacl.rd: Likewise.
	* testsuite/ld-i386/pr19636-1d-nacl.d: Likewise.
	* testsuite/ld-i386/pr19636-2c-nacl.d: Likewise.
	* testsuite/ld-i386/pr19636-2d-nacl.d: Likewise.
	* testsuite/ld-i386/pr19636-2e-nacl.d: Likewise.
	* testsuite/ld-i386/pr19827-nacl.rd: Likewise.
	* testsuite/ld-i386/pr21884-nacl.d: Likewise.
	* testsuite/ld-i386/pr21884-nacl.t: Likewise.
	* testsuite/ld-i386/tlsbin-nacl.rd: Likewise.
	* testsuite/ld-i386/tlsbin2-nacl.rd: Likewise.
	* testsuite/ld-i386/tlsbindesc-nacl.rd: Likewise.
	* testsuite/ld-i386/tlsdesc-nacl.rd: Likewise.
	* testsuite/ld-i386/tlsgdesc-nacl.rd: Likewise.
	* testsuite/ld-i386/tlsnopic-nacl.rd: Likewise.
	* testsuite/ld-i386/tlspic-nacl.rd: Likewise.
	* testsuite/ld-i386/tlspic2-nacl.rd: Likewise.
	* testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise.
	* testsuite/ld-x86-64/load1a-nacl.d: Likewise.
	* testsuite/ld-x86-64/load1b-nacl.d: Likewise.
	* testsuite/ld-x86-64/load1c-nacl.d: Likewise.
	* testsuite/ld-x86-64/load1d-nacl.d: Likewise.
	* testsuite/ld-x86-64/pie3-nacl.d: Likewise.
	* testsuite/ld-x86-64/plt-nacl.pd: Likewise.
	* testsuite/ld-x86-64/pr17709-nacl.rd: Likewise.
	* testsuite/ld-x86-64/pr19013-nacl.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2d-nacl.d: Likewise.
	* testsuite/ld-x86-64/pr19827-nacl.rd: Likewise.
	* testsuite/ld-x86-64/pr21884-nacl.d: Likewise.
	* testsuite/ld-x86-64/pr21884-nacl.t: Likewise.
	* testsuite/ld-x86-64/split-by-file-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlsbin-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlsbin2-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlsbindesc-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlsdesc-nacl.pd: Likewise.
	* testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlsgdesc-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlspic-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlspic2-nacl.rd: Likewise.
	* Makefile.in: Regenerated.
	* po/BLD-POTFILES.in: Likewise.
2020-06-30 08:56:14 -07:00
Nelson Chu
08ccfccf0e RISC-V: Support debug and float CSR as the unprivileged ones.
The unprivileged CSR should be controlled by other specific specs rather
than the privileged spec.  For example, the debug CSR should be controlled
by the debug spec, and the float CSR should be controlled by the float
spec.  User may use assembler options to choose what the debug and other
specs they want, or may encode the versions of specs into the architecture
string directly.  Since we haven't decided which one is better, we set the
defined and aborted versions of unprivileged CSR to PRIV_SPEC_CLASS_NONE
in the include/opcode/riscv-opc.h, to tell assembler don't check priv spec
versions for them.  However, these PRIV_SPEC_CLASS_NONE will be changed
to FLOAT_SPEC_CLASS_* and DEBUG_SPEC_CLASS_* in the future.

	gas/
	* config/tc-riscv.c (riscv_csr_class_check): Removed.  Move the
	checking into riscv_csr_address.
	(riscv_csr_version_check): Likewise.
	(riscv_csr_address): New function.  Return the suitable CSR address
	after checking the ISA dependency and versions.  Issue warnings	if
	we find any conflict and -mcsr-check is set.  CSR_CLASS_F and
	CSR_CLASS_DEBUG are unprivileged CSR for now, so don't check the
	priv spec versions for them.
	(reg_csr_lookup_internal): Call riscv_csr_address to find the
	suitable CSR address.

	* testsuite/gas/riscv/priv-reg-fail-fext.d: Remove -mpriv-spec=1.11.
	* testsuite/gas/riscv/priv-reg-fail-read-only-01.d: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-fext.l:  We don't care the
	priv spec warnings here.  These warnings are added by accident.
	Remove them and only focus on the ISA dependency warnings.
	* testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-read-only-01.l: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-version-1p9.l: Updated since
	dscratch0 and dscratch1 are regarded as the unprivileged CSR rather
	than the privileged ones.
	* testsuite/gas/riscv/priv-reg-fail-version-1p9p1.l: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-version-1p10.l: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-version-1p11.l: Likewise.
	* testsuite/gas/riscv/priv-reg.s: Likewise.  Add missing debug CSR.
	* testsuite/gas/riscv/priv-reg-version-1p9.d: Likewise.
	* testsuite/gas/riscv/priv-reg-version-1p9p1.d: Likewise.
	* testsuite/gas/riscv/priv-reg-version-1p10.d: Likewise.
	* testsuite/gas/riscv/priv-reg-version-1p11.d: Likewise.
	* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
	* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.

	include/
	* opcode/riscv-opc.h: Support the unprivileged CSR.  The versions
	of the unprivileged CSR should be PRIV_SPEC_CLASS_NONE for now.
	* opcode/riscv.h (enum riscv_csr_class): Add CSR_CLASS_DEBUG.

	opcodes/
	* riscv-dis.c (print_insn_args, case 'E'): Updated.  Let the
	unprivileged CSR can also be initialized.
2020-06-30 09:54:55 +08:00
H.J. Lu
8c190ce038 x86: Support VEX base opcode length > 1
Intel AMX instructions with 8-bit immediate opcode extension without
operands:

tilerelease, 0, 0x49c0, None, 2, CpuAMX_TILE|Cpu64, Vex|VexOpcode=1|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }

Update build_vex_prefix to support VEX base opcode length > 1.

	* tc-i386.c (build_vex_prefix): Support VEX base opcode length > 1.
	(md_assemble): Don't process ImmExt without operands.
2020-06-29 06:28:46 -07:00
Hans-Peter Nilsson
4e394b28e3 gas/testsuite: test-case for PR25331 (mmix reloc fixup bug)
The bug manifested "only" for a 64-bit host:

pr25331.c: Assembler messages:
pr25331.c:430: Error: internal error: fixup not contained within frag
failed with: <pr25331.c: Assembler messages:
pr25331.c:430: Error: internal error: fixup not contained within frag>, no expected output
FAIL: gas/mmix/pr25331

gas:
	PR gas/25331
	* testsuite/gas/mmix/pr25331.d, testsuite/gas/mmix/pr25331.s: New test.
2020-06-29 05:38:26 +02:00
Hans-Peter Nilsson
b20e7614da gas: Fix mmix fixups and TC_FX_SIZE_SLACK, PR25331
Finally; sorry for the delay.  There were a few false starts, where I
misinterpreted the error-messages and the comment that Alan added:
it's not the fix size that's too large (and the frag too small), it's
stating the wrong size of what will be "fixed up" - that of the actual
target value, not the size of the field that needs to be adjusted.
Comments added for clarity.

Test-suite committed separately.

gas:
	PR gas/25331
	* config/tc-mmix.c (md_assemble) <fixup for
	BFD_RELOC_MMIX_BASE_PLUS_OFFSET>: This fixup affects 1 byte, not 8.
	Also, set its fx_no_overflow.
	(md_convert_frag) <case ENCODE_RELAX (STATE_PUSHJSTUB, STATE_ZERO)>:
	Similarly this fixup affects 4 bytes, not 8 and needs its
	fx_no_overflow set.
	* config/tc-mmix.h (TC_FX_SIZE_SLACK): Don't define.
2020-06-29 05:32:02 +02:00
Alan Modra
279edac53d C++ comments
binutils isn't c99 (yet).  This replaces or removes some C++ style
comments.

bfd/
	* arc-got.h: Use C style comments.
	* coff-z80.c: Likewise.
	* elf32-csky.c: Likewise.
	* peXXigen.c: Likewise.
	* elf32-m32c.c (m32c_elf_relax_delete_bytes): Remove commented out
	code.
binutils/
	* dwarf.c: Use C style comments.
	* resrc.c: Likewise.
gas/
	* config/tc-s12z.c: Use C style comments.
	* config/tc-z80.c: Likewise.
	* config/tc-xtensa.c (emit_ld_r_n): Remove commented out code.
include/
	* coff/internal.h: Use C style comments.
	* coff/pe.h: Likewise.
	* elf/ppc64.h: Likewise.
opcodes/
	* arm-dis.c: Use C style comments.
	* cr16-opc.c: Likewise.
	* ft32-dis.c: Likewise.
	* moxie-opc.c: Likewise.
	* tic54x-dis.c: Likewise.
	* s12z-opc.c: Remove useless comment.
	* xgate-dis.c: Likewise.
2020-06-29 10:07:56 +09:30
H.J. Lu
b6cd5d100a x86: Process ImmExt without operands
To support Intel AMX instructions with 8-bit immediate opcode extension,
but without operands:

tilerelease, 0, 0x49, 0xc0, 1, CpuAMX_TILE|Cpu64, Vex|VexOpcode=1|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|ImmExt, { 0 }

process ImmExt without operands.

	* config/tc-i386.c (md_assemble): Process ImmExt without
	operands.
2020-06-26 10:25:12 -07:00
H.J. Lu
63112cd67b x86: Rename VecSIB to SIB for Intel AMX
Rename VecSIB to SIB to support Intel Advanced Matrix Extensions which
introduces instructions with a mandatory SIB byte which isn't a vector
SIB (VSIB).

gas/

	* config/tc-i386.c (check_VecOperands): Replace vecsib with sib.
	Replace VecSIB128, VecSIB256 and VecSIB512 with VECSIB128,
	VECSIB256 and VECSIB512, respectively.
	(build_modrm_byte): Replace vecsib with sib.

opcodes/

	* i386-gen.c (opcode_modifiers): Replace VecSIB with SIB.
	(VecSIB128): Renamed to ...
	(VECSIB128): This.
	(VecSIB256): Renamed to ...
	(VECSIB256): This.
	(VecSIB512): Renamed to ...
	(VECSIB512): This.
	(VecSIB): Renamed to ...
	(SIB): This.
	(i386_opcode_modifier): Replace vecsib with sib.
	* i386-opc.tbl (VexSIB128): New.
	(VecSIB256): Likewise.
	(VecSIB512): Likewise.
	Replace VecSIB=1, VecSIB=2 and VecSIB=3 with VexSIB128, VecSIB256
	and VecSIB512, respectively.
2020-06-26 08:24:44 -07:00
Jan Beulich
2a1bb84c67 x86: fix processing of -M disassembler option
Multiple -M options can be specified in any order. Therefore stright
assignment to fields affected needs to be avoided, such that earlier
options' effects won't be discarded. This was in particular a problem
for -Msuffix followed by certain of the other sub-options.

While updating documentation, take the liberty and also drop the
redundant mentioning of being able to comma-separate multiple options.
2020-06-26 16:42:55 +02:00
Pat Bernardi
85f7484a3a m68k: tag floating-point ABI used
This patch adds GNU attribute support to m68k and utilises it to tag the
floating-point calling convention used (hard-float or soft-float). It enables
the linker to ensure linked objects use a consistent floating-point ABI and
allows tools like GDB to infer the ABI used from the ELF file. It is based on
similar work done for PowerPC.

bfd/
	* elf32-m68k.c (m68k_elf_merge_obj_attributes): New function.
	(elf32_m68k_merge_private_bfd_data): Merge GNU attributes.
binutils/
	* readelf.c (display_m68k_gnu_attribute): New function.
	(process_arch_specific): Call display_m68k_gnu_attribute for EM_68K.
gas/
	* config/tc-m68k.c (m68k_elf_gnu_attribute): New function.
	(md_pseudo_table): Handle "gnu_attribute".
	* doc/as.texi: Document GNU attribute for M68K.
include/
	* elf/m68k.h: Add enum for GNU object attribute with floating point
	tag name and values.
ld/
	* testsuite/ld-m68k/attr-gnu-4-0.s: New file.
	* testsuite/ld-m68k/attr-gnu-4-1.s: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-2.s: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-00.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-01.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-02.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-10.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-11.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-12.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-20.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-21.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-22.d: Likewise.
	* testsuite/ld-m68k/m68k.exp: Run the new tests.
2020-06-26 14:42:19 +09:30
Nick Clifton
b59d128a11 Stop the assembler from generating R_ARM_THM_JMP11 relocations as these are not supported by the kernel.
PR 26141
	* config/tc-arm.c (arm_force_relocation): Force resolution of
	BFD_RELOC_THUMB_PCREL_BRANCH12 relocations.
	* testsuite/gas/arm/plt-1.d: Adjust expected disassembly.
2020-06-25 11:11:51 +01:00
Jan Beulich
c423d21a43 x86: move ImmExt processing
With abuses of ImmExt gone, all templates using it have operands. Move
its main invocation into process_operands(), matching its secondary one
for the SSE2AVX case.
2020-06-25 09:30:09 +02:00
Jan Beulich
8bbb3ad806 x86: operand sizing prefixes can disambiguate insns
Use of an explicit data size or REX.W prefix is sufficient indication of
the intended operation when operand size can't be derived from suffix or
register operands. Avoid the ambiguity warning and make in particular
immediate handling (sizing) cope with explicitly specified prefixes.

Extending/reusing the noreg16 test made me notice a few cases of
unintentional 32-bit addressing, which gets corrected at the same time.
2020-06-25 09:29:29 +02:00
Jan Beulich
589958d6ff x86: fix SYSRET disassembly, improve {,V}CVTSI2S{S,D} and PTWRITE
SYSRET can't use the same macro as IRET, since there's no 16-bit operand
size form of it. Re-use LQ for it instead.

Doing so made obvious that outside of 64-bit mode {,V}CVTSI2S{S,D} and
PTWRITE should have an 'l' suffix printed only in suffix-always mode.
2020-06-25 09:27:21 +02:00
Jan Beulich
0b9404fd37 x86-64: REX prefix is invalid with VEX etc
Just like for the data size prefix (see commit 7a8655d2bb ["x86: don't
abort() upon DATA16 prefix on (E)VEX encoded insn"]), any form of REX
prefix is invalid with VEX/XOP/EVEX.
2020-06-25 09:26:28 +02:00
Jan Beulich
a5aeccd9d3 x86-64: honor REX prefixes for SSE2AVX
Legacy encoded insns do so, and their automatic conversion to AVX ones
ought to produce functionally identical code. Therefore explicit REX
prefixes cannot simply be ignored. This is in particular relevant
because at least PCMPESTR{I,M}'s 64-bit forms couldn't be expressed in
older gas by other than using a REX64 prefix.
2020-06-25 09:25:52 +02:00
Jan Beulich
40d231b4fb x86: also refuse data size prefix on SIMD insns
The data size prefix alters the meaning of legacy encoded SIMD insns,
and hence shouldn't be accepted there. Use of it also leads to
inconsistencies in SSE2AVX mode. Don't match insns with data size prefix
against SSE2AVX templates.
2020-06-25 09:25:12 +02:00
Jan Beulich
11abe42647 x86: drop stray assignment from build_evex_prefix()
Unlike in build_vex_prefix() this is not needed here.
2020-06-25 09:24:23 +02:00