Commit Graph

9552 Commits

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