Commit Graph

5632 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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