Commit Graph

9855 Commits

Author SHA1 Message Date
Nelson Chu
a21b96dd66 Update the ChangeLog, and add the missing entries. 2021-04-16 16:48:27 +08:00
Lifang Xia
a8ab209320 RISC-V: compress "addi d,CV,z" to "c.mv d,CV"
PR 27732
gas/
	* testsuite/gas/riscv/c-zero-imm.d: Compress addi a4,a4,0 to
	c.mv a4,a4.
	* testsuite/gas/riscv/c-zero-imm.s: Likewise.
opcodes/
	* riscv-opc.c (riscv_opcodes): New insn alias for addi. Compress
	"addi d,CV,z" to "c.mv d,CV".
2021-04-16 11:25:15 +08:00
Alan Modra
d20eb46617 Re: PR27723, Internal error in select_cie_for_fde
Let's make sure what we allow in the CIE initial instructions and what
select_cie_for_fde compares for a match is always in sync.  Also
correct the previous patch that allowed DW_CFA_GNU_window_save to be
part of the CIE initial instructions, which was likely a mistake.

	PR 27723
	* dw2gencfi.c (initial_cie_insn): New function, extracted from..
	(select_cie_for_fde): ..here.  Simplify.
2021-04-14 09:37:41 +09:30
Alan Modra
c159f35225 PR27723, Internal error in select_cie_for_fde
PR 27723
	* dw2gencfi.c (select_cie_for_fde): Handle DW_CFA_val_offset,
	DW_CFA_GNU_window_save and DW_CFA_restore_state.
2021-04-14 08:09:46 +09:30
Alan Modra
4bb920c68e m68hc11 gas testsuite wart
Writing to a potentially read-only source directory is not good.

	* testsuite/gas/m68hc11/m68hc11.exp (gas_m68hc11_message): Don't
	write to $srcdir.  Use gas_host_run and read output file rather
	than gas_start/gas_finish.
2021-04-13 01:20:37 +09:30
Alan Modra
32d715691a Power10 bignum operands
When built on a 32-bit host without --enable-64-bit-bfd, powerpc-linux
and other 32-bit powerpc targeted binutils fail to assemble some
power10 prefixed instructions with 34-bit fields.  A typical error
seen when running the testsuite is
.../gas/testsuite/gas/ppc/prefix-pcrel.s:10: Error: bignum invalid
In practice this doesn't matter for addresses:  32-bit programs don't
need or use the top 2 bits of a d34 field when calculating addresses.
However it may matter when loading or adding 64-bit constants with
paddi.  A power10 processor in 32-bit mode still has 64-bit wide GPRs.
So this patch enables limited support for O_big PowerPC operands, and
corrects sign extension of 32-bit constants using X_extrabit.

	* config/tc-ppc.c (insn_validate): Use uint64_t for operand values.
	(md_assemble): Likewise.  Handle bignum operands.
	(ppc_elf_suffix): Handle O_big.  Remove unnecessary input_line_pointer
	check.
	* expr.c: Delete unnecessary forward declarations.
	(generic_bignum_to_int32): Return uint32_t.
	(generic_bignum_to_int64): Return uint64_t.  Compile always.
	(operand): Twiddle X_extrabit for unary '~'.  Set X_unsigned and
	clear X_extrabit for unary '!'.
	* expr.h (generic_bignum_to_int32): Declare.
	(generic_bignum_to_int64): Declare.
	* testsuite/gas/ppc/prefix-pcrel.s,
	* testsuite/gas/ppc/prefix-pcrel.d: Add more instructions.
2021-04-12 11:57:03 +09:30
Nelson Chu
e601909a32 RISC-V: Support to parse the multi-letter prefix in the architecture string.
The original discussion is as follows,
https://github.com/riscv/riscv-isa-manual/issues/637

I never considered the prefixes may have multiple letters, like zxm.
But the ISA spec has been updated for a long time that I haven't noticed.
This patch rewrites the part of architecture parser to support parsing
the multi-letter prefixes.  Besides, I also improve the parser to report
errors in details.  One of the most obvious improvement is - Do not parse
the prefixed extensions according to the orders in the parse_config.
If we do so, then we used to get "unexpected ISA string at end" errors,
but the message is a little bit  hard to know what is happening.  I Remove
the confused message, and let riscv_parse_prefixed_ext to report the details.

bfd/
    * elfxx-riscv.c (riscv_std_z_ext_strtab): Moved forward.
    (riscv_std_s_ext_strtab): Likewise.
    (riscv_std_h_ext_strtab): Likewise.
    (riscv_std_zxm_ext_strtab): Added for the zxm prefix.
    (enum riscv_prefix_ext_class): Moved forward and renamed from
    riscv_isa_ext_class.  Reorder them according to the parsing order,
    since the enum values are used to check the orders in the
    riscv_compare_subsets.
    (struct riscv_parse_prefix_config): Moved forward and renamed from
    riscv_parse_config_t.  Also removed the ext_valid_p field, the
    related functions are replaced by riscv_valid_prefixed_ext.
    (parse_config): Moved forward and updated.  The more letters of the
    prefix string, the more forward it must be defined.  Otherwise, we
    will get the wrong mapping when using strncmp in riscv_get_prefix_class.
    (riscv_get_prefix_class): Moved forward.  Support to parse the
    multi-letter prefix, like zxm.
    (riscv_known_prefixed_ext): New function, check if the prefixed
    extension is supported according to the right riscv_std_*_ext_strtab.
    (riscv_valid_prefixed_ext): New function, used to replace the
    riscv_ext_*_valid_p functions.
    (riscv_init_ext_order): Do not set the values for prefix keywords
    since they may have multiple letters for now.
    (riscv_compare_subsets): Set the order values of prefix keywords
    to negative numbers according to the riscv_prefix_ext_class.
    (riscv_parse_std_ext): Call riscv_get_prefix_class to see if we
    have parsed the prefixed extensions.
    (riscv_parse_prefixed_ext): Updated and removed the parameter config.
    Report error when the prefix is unknown.
    (riscv_parse_subset): Do not parse the prefixed extensions according
    to the orders in the parse_config.  Remove the confused message and
    let riscv_parse_prefixed_ext to report the details.
    * elfxx-riscv.h (enum riscv_isa_ext_class): Moved to elfxx-riscv.c.
    (riscv_get_prefix_class): Removed to static.
gas/
    * testsuite/gas/riscv/march-fail-order-x-std.d: Renamed from
    march-fail-porder-x-std.d.
    * testsuite/gas/riscv/march-fail-order-z-std.d: Renamed from
    march-fail-porder-z-std.d.
    * testsuite/gas/riscv/march-fail-order-x-z.d: Renamed from
    march-fail-porder-x-z.d.
    * testsuite/gas/riscv/march-fail-order-zx-std.l: Added to replace
    march-fail-porder.l.
    * testsuite/gas/riscv/march-fail-order-x-z.l: Likewise.
    * testsuite/gas/riscv/march-fail-order-x.l: Updated.
    * testsuite/gas/riscv/march-fail-order-z.l: Likewise.
    * testsuite/gas/riscv/march-fail-single-prefix-h.d: Renamed from
    march-fail-single-char-h.d.
    * testsuite/gas/riscv/march-fail-single-prefix-s.d: Renamed from
    march-fail-single-char-s.d.
    * testsuite/gas/riscv/march-fail-single-prefix-x.d: Renamed from
    march-fail-single-char-x.d.
    * testsuite/gas/riscv/march-fail-single-prefix-z.d: Renamed from
    march-fail-single-char-z.d.
    * testsuite/gas/riscv/march-fail-single-prefix-zmx.d: Added.
    * testsuite/gas/riscv/march-fail-single-prefix.l: Added to replace
    march-fail-single-prefix.l.
    * testsuite/gas/riscv/march-fail-unknown-zxm.d: Added.
    * testsuite/gas/riscv/march-fail-unknown-std.l: Updated.
    * testsuite/gas/riscv/march-fail-unknown.l: Likewise.
2021-04-12 10:05:37 +08:00
Tejas Belagod
dd17020328 AArch64: Fix Diagnostic messaging for LD/ST Exclusive.
A summary of what this patch set fixes:

For instructions

	STXR w0,x2,[x0]
	STLXR w0,x2,[x0]

The warning we emit currently is misleading:

Warning: unpredictable: identical transfer and status registers --`stlxr w0,x2,[x0]'
Warning: unpredictable: identical transfer and status registers --`stxr w0,x2,[x0]'

it ought to be:

Warning: unpredictable: identical base and status registers --`stlxr w0,x2,[x0]'
Warning: unpredictable: identical base and status registers --`stxr w0,x2,[x0]'

For instructions:

	ldaxp x0,x0,[x0]
	ldxp x0,x0,[x0]

The warning we emit is incorrect

Warning: unpredictable: identical transfer and status registers --`ldaxp x0,x0,[x0]'
Warning: unpredictable: identical transfer and status registers --`ldxp x0,x0,[x0]'

it ought to be:

Warning: unpredictable load of register pair -- `ldaxp x0,x0,[x0]'
Warning: unpredictable load of register pair -- `ldxp x0,x0,[x0]'

For instructions

	stlxp   w0, x2, x2, [x0]
	stxp    w0, x2, x2, [x0]

We don't emit any warning when it ought to be:

Warning: unpredictable: identical base and status registers --`stlxp w0,x2,x2,[x0]'
Warning: unpredictable: identical base and status registers --`stxp w0,x2,x2,[x0]'

gas/ChangeLog:

2021-04-09  Tejas Belagod  <tejas.belagod@arm.com>

	* config/tc-aarch64.c (warn_unpredictable_ldst): Clean-up diagnostic messages
	for LD/ST Exclusive instructions.
	* testsuite/gas/aarch64/diagnostic.s: Add a diagnostic test for STLXP.
	* testsuite/gas/aarch64/diagnostic.l: Fix-up test after message clean-up.
2021-04-09 12:32:00 +01:00
Alan Modra
c3f72de4f5 PowerPC disassembly of pcrel references
This adds some annotation to Power10 pcrel instructions, displaying
the target address (ie. pc + D34 field) plus a symbol if there is one
at exactly that target address.  pld from the .got or .plt will also
look up the entry and display it, symbolically if there is a dynamic
relocation on the entry.

include/
	* dis-asm.h (struct disassemble_info): Add dynrelbuf and dynrelcount.
binutils/
	* objdump.c (struct objdump_disasm_info): Delete dynrelbuf and
	dynrelcount.
	(find_symbol_for_address): Adjust for dynrelbuf and dynrelcount move.
	(disassemble_section, disassemble_data): Likewise.
opcodes/
	* ppc-dis.c (struct dis_private): Add "special".
	(POWERPC_DIALECT): Delete.  Replace uses with..
	(private_data): ..this.  New inline function.
	(disassemble_init_powerpc): Init "special" names.
	(skip_optional_operands): Add is_pcrel arg, set when detecting R
	field of prefix instructions.
	(bsearch_reloc, print_got_plt): New functions.
	(print_insn_powerpc): For pcrel instructions, print target address
	and symbol if known, and decode plt and got loads too.
gas/
	* testsuite/gas/ppc/prefix-pcrel.d: Update expected output.
	* testsuite/gas/ppc/prefix-reloc.d: Likewise.
	* gas/testsuite/gas/ppc/vsx_32byte.d: Likewise.
ld/
	* testsuite/ld-powerpc/inlinepcrel-1.d: Update expected output.
	* testsuite/ld-powerpc/inlinepcrel-2.d: Likewise.
	* testsuite/ld-powerpc/notoc2.d: Likewise.
	* testsuite/ld-powerpc/notoc3.d: Likewise.
	* testsuite/ld-powerpc/pcrelopt.d: Likewise.
	* testsuite/ld-powerpc/startstop.d: Likewise.
	* testsuite/ld-powerpc/tlsget.d: Likewise.
	* testsuite/ld-powerpc/tlsget2.d: Likewise.
	* testsuite/ld-powerpc/tlsld.d: Likewise.
	* testsuite/ld-powerpc/weak1.d: Likewise.
	* testsuite/ld-powerpc/weak1so.d: Likewise.
2021-04-09 16:56:43 +09:30
Alan Modra
97bf40d859 PR27676, PowerPC missing extended dcbt, dcbtst mnemonics
Note that this doesn't implement the ISA to the letter regarding
dcbtds (and dcbtstds), which says that the TH field may be zero.  That
doesn't make sense because allowing TH=0 would mean you no long have a
dcbtds but rather a dcbtct instruction.  I'm interpreting the ISA
wording about allowing TH=0 to mean that the TH field of dcbtds is
optional (in which case the TH value is 0b1000).

opcodes/
	PR 27676
	* ppc-opc.c (DCBT_EO): Move earlier.
	(insert_thct, extract_thct, insert_thds, extract_thds): New functions.
	(powerpc_operands): Add THCT and THDS entries.
	(powerpc_opcodes): Add dcbtstct, dcbtstds, dcbna, dcbtct, dcbtds.
gas/
	* testsuite/gas/ppc/pr27676.d,
	* testsuite/gas/ppc/pr27676.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
	* testsuite/gas/ppc/dcbt.d: Update.
	* testsuite/gas/ppc/power4_32.d: Update.
2021-04-08 08:28:11 +09:30
Alan Modra
b12389f219 Fix pr27217 testcase failure
aarch64_be-linux-gnu_ilp32  +FAIL: PR27212

	PR 27217
	* testsuite/gas/aarch64/pr27217.d: Correct name.  Accept ilp32 relocs.
2021-04-07 18:14:20 +09:30
Nick Clifton
eac4eb8ecb Fix a problem assembling AArch64 sources when a relocation is generated against a symbol that has a defined value.
PR 27217
	* config/tc-aarch64.c (my_get_expression): Rename to
	aarch64_get_expression.  Add a fifth argument to enable deferring
	of expression resolution.
	(parse_typed_reg): Update calls to my_get_expression.
	(parse_vector_reg_list): Likewise.
	(parse_immediate_expression): Likewise.
	(parse_big_immediate): Likewise.
	(parse_shift): Likewise.
	(parse_shifter_operand_imm): Likewise.
	(parse_operands): Likewise.
	(parse_shifter_operand_reloc): Update calls to my_get_expression
	and call aarch64_force_reloc to determine the value of the new
	fifth argument.
	(parse_address_main): Likewise.
	(parse_half): Likewise.
	(parse_adrp): Likewise.
	(aarch64_force_reloc): New function.  Contains code extracted from...
	(aarch64_force_relocation): ... here.
	* testsuite/gas/aarch64/pr27217.s: New test case.
	* testsuite/gas/aarch64/pr27217.d: New test driver.
2021-04-06 13:27:50 +01:00
Jan Beulich
da0835aebe gas: missing (re-)initialization of local variable in fixup_segment()
At the very least this has been causing bogus diagnostics, e.g.

	.text
	.data
	.long .bss - .
	.long -.text
	.bss

yielding

Error: can't resolve `0' {.bss section} - `.text' {.text section}

instead of

Error: can't resolve `0' {*ABS* section} - `.text' {.text section}

In particular for targets overriding any of TC_FORCE_RELOCATION_* & Co
or for ones setting md_register_arithmetic to true the problems may be
worse.
2021-04-06 10:56:30 +02:00
Alan Modra
23d613801d C99 gas configury
Also remove alloca stuff since we don't use alloca in gas nowadays.

	* configure.ac: Don't check for string.h, strings.h, stdlib.h,
	errno.h, limits.h, locale.h or time.h.  Don't check for unlink,
	remove, sbrk (unused) or setlocale.  Adjust gas_test_headers.
	Don't check for errno, free, malloc, realoc, sbrk, strstr, getenv
	strstr, or vsnprintf declarations.
	(AC_ISC_POSIX, AC_FUNC_ALLOCA, AC_C_INLINE): Don't invoke.
	* as.h: Don't include alloca-conf.h, include config.h instead.
	Include string.h, stdlib.h, errno.h unconditionally.  Remove
	various fallback declarations.
	* asintl.h: Don't test HAVE_LOCALE_H.
	* as.c: Don't test HAVE_SETLOCALE.
	* dwarf2dbg.c: Include limits.h unconditionally.
	* expr.c: Likewise.
	* sb.c: Likewise.
	* symbols.c: Likewise.
	* config/tc-cr16.c: Likewise.
	* config/tc-d30v.c: Likewise.
	* config/tc-i386.c: Likewise.
	* config/tc-ia64.c: Likewise.
	* config/tc-tic54x.c (tic54x_mlib): Call remove rather than unlink.
	* config.in: Regenerate.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
2021-04-05 15:31:25 +09:30
Martin Liska
e9b095a538 Remove strneq macro and use startswith.
bfd/ChangeLog:

	* ecoff.c (strneq): Remove strneq and use startswith.
	(_bfd_ecoff_slurp_armap): Likewise.

binutils/ChangeLog:

	* elfcomm.h (strneq): Remove strneq and use startswith.
	* readelf.c (ia64_process_unwind): Likewise.
	(process_note): Likewise.

gas/ChangeLog:

	* config/obj-coff.c (strneq): Remove strneq and use startswith.
	(weak_is_altname): Likewise.
	(obj_coff_section): Likewise.
	* config/tc-cr16.c (process_label_constant): Likewise.
	* config/tc-crx.c (strneq): Likewise.

include/ChangeLog:

	* opcode/cr16.h (strneq): Remove strneq and use startswith.

ld/ChangeLog:

	* ldbuildid.c (strneq): Remove strneq and use startswith.
	(validate_build_id_style): Likewise.
	(compute_build_id_size): Likewise.

opcodes/ChangeLog:

	* arm-dis.c (strneq): Remove strneq and use startswith.
	* cr16-dis.c (print_insn_cr16): Likewise.
	* score-dis.c (streq): Likewise.
	(strneq): Likewise.
	* score7-dis.c (strneq): Likewise.
2021-04-01 15:00:56 +02:00
Martin Liska
d34049e8bb Use startswith in gas subfolder.
gas/ChangeLog:

	* as.c (select_emulation_mode): Use startswith.
	* config/m68k-parse.y: Likewise.
	* config/obj-aout.c (obj_aout_type): Likewise.
	* config/obj-elf.c (elf_common_parse): Likewise.
	(obj_elf_section_type): Likewise.
	(obj_elf_section_word): Likewise.
	(obj_elf_section): Likewise.
	(obj_elf_symver): Likewise.
	(adjust_stab_sections): Likewise.
	* config/obj-evax.c (evax_shorten_name): Likewise.
	* config/obj-macho.c (obj_mach_o_is_frame_section): Likewise.
	* config/tc-aarch64.c (parse_aarch64_imm_float): Likewise.
	(aarch64_parse_features): Likewise.
	(create_register_alias): Likewise.
	(aarch64_data_in_code): Likewise.
	(md_parse_option): Likewise.
	* config/tc-alpha.c (s_alpha_section_word): Likewise.
	(s_alpha_pdesc): Likewise.
	* config/tc-arc.c (tokenize_extregister): Likewise.
	* config/tc-arm.c (create_register_alias): Likewise.
	(create_neon_reg_alias): Likewise.
	(parse_ifimm_zero): Likewise.
	(parse_qfloat_immediate): Likewise.
	(arm_elf_section_type): Likewise.
	(arm_parse_extension): Likewise.
	(aeabi_set_public_attributes): Likewise.
	(s_arm_arch_extension): Likewise.
	(arm_data_in_code): Likewise.
	(start_unwind_section): Likewise.
	* config/tc-avr.c (avr_ldi_expression): Likewise.
	* config/tc-csky.c (is_freglist_legal): Likewise.
	(csky_s_section): Likewise.
	* config/tc-d30v.c (do_assemble): Likewise.
	* config/tc-dlx.c (parse_operand): Likewise.
	* config/tc-epiphany.c (md_assemble): Likewise.
	* config/tc-h8300.c (h8300_elf_section): Likewise.
	(get_operand): Likewise.
	* config/tc-hppa.c (pa_ip): Likewise.
	(pa_level): Likewise.
	(pa_space): Likewise.
	* config/tc-i386.c (i386_mach): Likewise.
	(md_assemble): Likewise.
	(check_VecOperations): Likewise.
	(i386_target_format): Likewise.
	(i386_elf_section_type): Likewise.
	* config/tc-ia64.c (start_unwind_section): Likewise.
	(md_parse_option): Likewise.
	(is_taken_branch): Likewise.
	(idesc->name,): Likewise.
	(note_register_values): Likewise.
	(do_alias): Likewise.
	* config/tc-m32c.c (insn_to_subtype): Likewise.
	* config/tc-m68hc11.c (get_operand): Likewise.
	(md_assemble): Likewise.
	* config/tc-m68k.c (m68k_ip): Likewise.
	(m68k_elf_suffix): Likewise.
	* config/tc-mcore.c (mcore_s_section): Likewise.
	* config/tc-metag.c (parse_get_set): Likewise.
	(md_parse_option): Likewise.
	* config/tc-microblaze.c (parse_imm): Likewise.
	(check_got): Likewise.
	(md_apply_fix): Likewise.
	* config/tc-mips.c (CPU_HAS_MIPS16): Likewise.
	(md_begin): Likewise.
	(s_is_linkonce): Likewise.
	(check_regno): Likewise.
	(match_float_constant): Likewise.
	(classify_vr4120_insn): Likewise.
	(match_insn): Likewise.
	(mips_after_parse_args): Likewise.
	(s_change_sec): Likewise.
	(s_option): Likewise.
	(parse_code_option): Likewise.
	(md_section_align): Likewise.
	(nopic_need_relax): Likewise.
	* config/tc-mmix.c (mmix_handle_mmixal): Likewise.
	* config/tc-mn10300.c (mn10300_fix_adjustable): Likewise.
	(mn10300_end_of_match): Likewise.
	* config/tc-msp430.c (msp430_make_init_symbols): Likewise.
	* config/tc-nds32.c (nds32_parse_option): Likewise.
	* config/tc-nds32.h (md_do_align): Likewise.
	* config/tc-nios2.c (strprefix): Likewise.
	(nios2_special_relocation_p): Likewise.
	(nios2_parse_base_register): Likewise.
	(nios2_cons): Likewise.
	* config/tc-ns32k.c (addr_mode): Likewise.
	* config/tc-pdp11.c (set_option): Likewise.
	(parse_reg): Likewise.
	(parse_ac5): Likewise.
	(parse_op_no_deferred): Likewise.
	(set_cpu_model): Likewise.
	(set_machine_model): Likewise.
	* config/tc-pj.c (md_operand): Likewise.
	* config/tc-ppc.c (ppc_set_cpu): Likewise.
	(ppc_arch): Likewise.
	(ppc_section_type): Likewise.
	* config/tc-s12z.c (tb_reg_rel): Likewise.
	(tb_opr_rel): Likewise.
	* config/tc-s390.c (s390_parse_cpu): Likewise.
	(md_parse_option): Likewise.
	* config/tc-score.c (s3_nopic_need_relax): Likewise.
	(s3_pic_need_relax): Likewise.
	* config/tc-score7.c (s7_nopic_need_relax): Likewise.
	(s7_pic_need_relax): Likewise.
	* config/tc-sh.h (SUB_SEGMENT_ALIGN): Likewise.
	* config/tc-sparc.c (md_parse_option): Likewise.
	(sparc_ip): Likewise.
	(s_reserve): Likewise.
	(s_common): Likewise.
	(s_seg): Likewise.
	(sparc_cons): Likewise.
	* config/tc-tic54x.c (stag_add_field): Likewise.
	(tic54x_endstruct): Likewise.
	* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
	* config/tc-v850.c (v850_comm): Likewise.
	(md_begin): Likewise.
	(md_assemble): Likewise.
	* config/tc-vax.c (vax_cons): Likewise.
	* config/tc-wasm32.c (wasm32_leb128): Likewise.
	* config/tc-xstormy16.c (md_operand): Likewise.
	* config/tc-xtensa.c (get_directive): Likewise.
	(xg_instruction_matches_option_term): Likewise.
	(is_unaligned_label): Likewise.
	(cache_literal_section): Likewise.
	* config/xtensa-relax.c (parse_precond): Likewise.
	(parse_option_cond): Likewise.
	(transition_applies): Likewise.
	(wide_branch_opcode): Likewise.
	* dw2gencfi.c: Likewise.
	* dwarf2dbg.c (dwarf2_directive_filename): Likewise.
	* ehopt.c (get_cie_info): Likewise.
	* input-file.c (input_file_open): Likewise.
	* listing.c (listing_newline): Likewise.
	(debugging_pseudo): Likewise.
	* read.c (read_a_source_file): Likewise.
	* write.c (adjust_reloc_syms): Likewise.
	(compress_debug): Likewise.
	(maybe_generate_build_notes): Likewise.
2021-04-01 15:00:08 +02:00
Alan Modra
fdb21288ca Don't include bfd/sysdep.h for gas files
* itbl-lex-wrapper.c: Include as.h not sysdep.h.
	* config/bfin-lex-wrapper.c: Likewise.
	* itbl-lex.l: Don't include as.h.
	* config/bfin-lex.l: Likewise.
2021-03-31 23:07:51 +10:30
Alan Modra
5b7c81bd8c Use bool in gas
* as.h (POISON_BFD_BOOLEAN): Define.
	* as.c, * as.h, * atof-generic.c, * config/atof-ieee.c,
	* config/bfin-aux.h, * config/obj-coff.c, * config/obj-ecoff.c,
	* config/obj-elf.c, * config/obj-elf.h, * config/obj-som.c,
	* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
	* config/tc-arc.h, * config/tc-arm.c, * config/tc-arm.h,
	* config/tc-avr.c, * config/tc-avr.h, * config/tc-bfin.c,
	* config/tc-bfin.h, * config/tc-bpf.c, * config/tc-cris.c,
	* config/tc-csky.c, * config/tc-csky.h, * config/tc-d10v.c,
	* config/tc-d10v.h, * config/tc-d30v.c, * config/tc-d30v.h,
	* config/tc-dlx.c, * config/tc-dlx.h, * config/tc-epiphany.c,
	* config/tc-epiphany.h, * config/tc-fr30.c, * config/tc-fr30.h,
	* config/tc-frv.c, * config/tc-frv.h, * config/tc-ft32.c,
	* config/tc-ft32.h, * config/tc-h8300.c, * config/tc-hppa.c,
	* config/tc-i386-intel.c, * config/tc-i386.c, * config/tc-ia64.c,
	* config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-iq2000.h,
	* config/tc-lm32.c, * config/tc-lm32.h, * config/tc-m32c.c,
	* config/tc-m32c.h, * config/tc-m32r.c, * config/tc-m32r.h,
	* config/tc-m68hc11.c, * config/tc-m68k.c, * config/tc-mcore.c,
	* config/tc-mcore.h, * config/tc-mep.c, * config/tc-mep.h,
	* config/tc-metag.c, * config/tc-metag.h,
	* config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mips.h,
	* config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c,
	* config/tc-mn10300.h, * config/tc-moxie.c, * config/tc-msp430.c,
	* config/tc-msp430.h, * config/tc-mt.c, * config/tc-mt.h,
	* config/tc-nds32.c, * config/tc-nds32.h, * config/tc-nios2.c,
	* config/tc-ns32k.c, * config/tc-or1k.c, * config/tc-or1k.h,
	* config/tc-pdp11.c, * config/tc-ppc.c, * config/tc-pru.c,
	* config/tc-pru.h, * config/tc-riscv.c, * config/tc-riscv.h,
	* config/tc-rx.c, * config/tc-rx.h, * config/tc-s12z.c,
	* config/tc-s12z.h, * config/tc-s390.c, * config/tc-score.c,
	* config/tc-score.h, * config/tc-score7.c, * config/tc-sh.c,
	* config/tc-sh.h, * config/tc-spu.c, * config/tc-tic54x.c,
	* config/tc-tic6x.c, * config/tc-tic6x.h, * config/tc-tilegx.c,
	* config/tc-tilepro.c, * config/tc-v850.c, * config/tc-v850.h,
	* config/tc-visium.c, * config/tc-visium.h, * config/tc-wasm32.c,
	* config/tc-wasm32.h, * config/tc-xc16x.c, * config/tc-xgate.c,
	* config/tc-xstormy16.c, * config/tc-xstormy16.h,
	* config/tc-xtensa.c, * config/tc-xtensa.h, * config/tc-z80.c,
	* config/tc-z8k.c, * config/xtensa-istack.h,
	* config/xtensa-relax.c, * config/xtensa-relax.h, * dw2gencfi.c,
	* dwarf2dbg.c, * dwarf2dbg.h, * expr.c, * expr.h, * frags.c,
	* frags.h, * listing.c, * macro.c, * output-file.c, * read.c,
	* read.h, * stabs.c, * symbols.c, * write.c: Replace bfd_boolean
	with bool, FALSE with false, and TRUE with true.
2021-03-31 10:49:23 +10:30
Alan Modra
3dfb1b6d34 Remove bfd_stdint.h
If we require C99 for binutils then stdint.h is available.

bfd/
	* .gitignore: Delete bfd_stdint.h entry.
	* Makefile.am (bfdinclude_HEADERS): Delete bfd_stdint.h.
	(BUILD_HFILES, LOCAL_H_DEPS): Likewise.
	* bfd-in.h: Include stdint.h in place of bfd_stdint.h.
	* configure.ac: Don't invoke GCC_HEADER_STDINT.
	* configure.com: Don't create bfd_stdint.h.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* bfd-in2.h: Regenerate.
	* config.in: Regenerate.
	* configure: Regenerate.
	* doc/Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
binutils/
	* coffdump.c: Include stdint.h in place of bfd_stdint.h.
	* dwarf.c: Likewise.
gas/
	* config/tc-aarch64.c: Include stdint.h in place of bfd_stdint.h.
	* config/tc-crx.c: Likewise.
	* config/tc-nds32.h: Likewise.
include/
	* cgen/basic-modes.h: Include stdint.h in place of bfd_stdint.h.
	* elf/nfp.h: Likewise.
	* opcode/aarch64.h: Likewise.
	* opcode/cgen.h: Likewise.
	* opcode/nfp.h: Likewise.
	* opcode/ppc.h: Likewise.
ld/
	* elf-hints-local.h: Include stdint.h in place of bfd_stdint.h.
	* emultempl/nds32elf.em: Likewise.
	* testsuite/ld-elf/mbind2b.c: Likewise.
	* testsuite/ld-elf/pr18718.c: Likewise.
	* testsuite/ld-elf/pr18720a.c: Likewise.
	* testsuite/ld-elf/pr25749-1.c: Likewise.
	* testsuite/ld-elf/pr25749-1a.c: Likewise.
	* testsuite/ld-elf/pr25749-1b.c: Likewise.
	* testsuite/ld-elf/pr25749-1c.c: Likewise.
	* testsuite/ld-elf/pr25749-1d.c: Likewise.
	* testsuite/ld-elf/pr25749-2.c: Likewise.
	* testsuite/ld-elf/pr25754-1a.c: Likewise.
	* testsuite/ld-elf/pr25754-2a.c: Likewise.
	* testsuite/ld-elf/pr25754-3a.c: Likewise.
	* testsuite/ld-elf/pr25754-4a.c: Likewise.
	* testsuite/ld-elf/pr25754-5a.c: Likewise.
	* testsuite/ld-elf/pr25754-6a.c: Likewise.
opcodes/
	* aarch64-dis.c: Include stdint.h in place of bfd_stdint.h.
	* aarch64-dis.h: Likewise.
	* aarch64-opc.c: Likewise.
	* avr-dis.c: Likewise.
	* csky-dis.c: Likewise.
	* nds32-asm.c: Likewise.
	* nds32-dis.c: Likewise.
	* nfp-dis.c: Likewise.
	* riscv-dis.c: Likewise.
	* s12z-dis.c: Likewise.
	* wasm32-dis.c: Likewise.
2021-03-31 10:49:23 +10:30
Jan Beulich
5e0423804a x86: drop seg_entry
Use struct reg_entry instead for most purposes, with a separate array
holding just the respective opcode prefix bytes.
2021-03-30 14:09:41 +02:00
Jan Beulich
3468486226 x86: drop REGNAM_{AL,AX,EAX}
The former two are unused anyway. And having such constants isn't very
helpful either, when they live in a place where updating the register
table wouldn't even allow noticing the need to adjust these constants.
2021-03-30 14:08:48 +02:00
Jan Beulich
6288d05f11 x86: adjust st(<N>) parsing
st(1) ... st(7) will never be looked up in the hash table, so there's no
point inserting the entries. It's also not really necessary to do a 2nd
hash lookup after parsing the register number, nor is there a real
reason for having both st and st(0) entries. Plus we can easily do away
with the need for st to be first in the table.
2021-03-30 14:08:11 +02:00
Jan Beulich
ca5312a241 x86: integrate rc_op into struct _i386_insn
There's no need for the extra level of indirection and the extra storage
needed for the pointer, pointing from one piece of static data to
another. Key checking of rounding being in effect off of the type field
of the structure instead.
2021-03-30 14:06:37 +02:00
Jan Beulich
5273a3cd48 x86: integrate broadcast_op into struct _i386_insn
There's no need for the extra level of indirection and the extra storage
needed for the pointer, pointing from one piece of static data to
another. Key checking of broadcast being in effect off of the type field
of the structure instead.
2021-03-30 14:06:09 +02:00
Jan Beulich
6225c532b4 x86: integrate mask_op into struct _i386_insn
There's no need for the extra level of indirection and the extra storage
needed for the pointer, pointing from one piece of static data to
another. Key checking of masking being in effect off of the register
field of the structure instead.
2021-03-30 14:05:42 +02:00
Jan Beulich
783c187b8c x86: make swap_2_operands() have unsigned parameters
All callers pass unsigned values (in some cases by virtue of passing
non-negative literal numbers).

This in turn requires struct {Mask,RC,Broadcast}_Operation's "operand"
fields to become unsigned, in turn allowing to reduce the amount of
casting needed (the two new casts that are necessary cast _to_
"unsigned" instead of _from_, as that's the form that'll never case
undefined behavior).
2021-03-30 14:05:10 +02:00
Jan Beulich
c8cad9d389 x86: VPSADBW's source operands are also commutative
In commit 79dec6b7ba ("x86-64: optimize certain commutative
VEX-encoded insns") I missed the fact that there being subtraction
involved here doesn't matter, as absolute differences get summed up.
2021-03-29 12:06:09 +02:00
Jan Beulich
389d00a5e5 x86: derive opcode encoding space attribute from base opcode
Just like is already done for VEX/XOP/EVEX encoded insns, record the
encoding space information in the respective opcode modifier field. Do
this again without changing the source table, but rather by deriving the
values from their existing source representation.
2021-03-29 12:02:50 +02:00
Alan Modra
63b4cc53dc TRUE/FALSE simplification
There is really no need to write code like "foo != 0 ? TRUE : FALSE"
unless we had stupidly defined FALSE as something other than 0 or TRUE
as something other than 1.  The simpler "foo != 0" does just as well.
Similarly "(condition == TRUE)" or "(condition == FALSE) can be
simplified to "(condition)" and "(!condition)" respectively.

I'll note that there is reason to use "integer_expression != 0" when
assigning a bfd_boolean rather than the simpler "integer_expression",
if you expect the variable to have 0 or 1 value.  It's probably even a
good idea to not rely on implicit conversion if bfd_boolean were _Bool.

bfd/
	* aoutx.h (aout_link_write_symbols): Don't cast boolean expression
	to bfd_boolean.
	* elf32-or1k.c (or1k_set_got_and_rela_sizes): Dont compare booleans
	against FALSE.
	* elf32-arc.c (name_for_global_symbol): Don't compare boolean to TRUE.
	(is_reloc_PC_relative): Don't use "boolean_condition ? TRUE : FALSE".
	(is_reloc_SDA_relative, is_reloc_for_GOT): Likewise.
	(is_reloc_for_PLT, is_reloc_for_TLS): Likewise.
	* elf32-arm.c (stm32l4xx_need_create_replacing_stub): Likewise.
	* elf32-nds32.c (insert_nds32_elf_blank): Likewise.
	* elf32-rx.c (rx_set_section_contents): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_ignore_undef_symbol): Likewise.
	* mach-o.c (bfd_mach_o_read_command): Likewise.
	* targets.c (bfd_get_target_info): Likewise.
binutils/
	* dlltool.c (main): Don't use "boolean_condition ? TRUE : FALSE".
	* dwarf.c (read_and_display_attr_value): Likewise.
	(display_debug_str_offsets): Likewise.
	* objdump.c (dump_bfd): Likewise.
	* readelf.c (dump_section_as_strings): Likewise.
	(dump_section_as_bytes): Likewise.
gas/
	* atof-generic.c (FALSE, TRUE): Don't define.
	* config/obj-elf.h (FALSE, TRUE): Don't define.
	* config/obj-som.h (FALSE, TRUE): Don't define.
	* config/tc-hppa.h (FALSE, TRUE): Don't define.
	* config/tc-pdp11.c (FALSE, TRUE): Don't define.
	* config/tc-iq2000.h (obj_fix_adjustable): Delete.
	* config/tc-m32r.h (TC_FIX_ADJUSTABLE): Delete.
	* config/tc-mt.h (obj_fix_adjustable): Delete.
	* config/tc-nds32.h (TC_FIX_ADJUSTABLE): Delete.
	* config/tc-arc.c (parse_opcode_flags): Simplify boolean expression.
	(relaxable_flag, relaxable_operand, assemble_insn): Likewise.
	(tokenize_extregister): Likewise.
	* config/tc-csky.c (parse_opcode, get_operand_value): Likewise.
	(parse_operands_op, parse_operands, md_assemble): Likewise.
	* config/tc-d10v.c (build_insn): Likewise.
	* config/tc-score.c (s3_gen_insn_frag): Likewise.
	* config/tc-score7.c (s7_gen_insn_frag, s7_relax_frag): Likewise.
	* config/tc-tic6x.c (tic6x_update_features, md_assemble): Likewise.
	* config/tc-z80.c (emit_byte): Likewise.
include/
	* opcode/aarch64.h (alias_opcode_p): Simplify boolean expression.
	(opcode_has_alias, pseudo_opcode_p, optional_operand_p): Likewise.
	(opcode_has_special_coder): Likewise.
ld/
	* emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Simplify
	boolean expression.
	* lexsup.c (parse_args): Likewise.
	* pe-dll.c (pe_dll_id_target): Likewise.
opcodes/
	* aarch64-opc.c (vector_qualifier_p): Simplify boolean expression.
	(fp_qualifier_p, get_data_pattern): Likewise.
	(aarch64_get_operand_modifier_from_value): Likewise.
	(aarch64_extend_operator_p, aarch64_shift_operator_p): Likewise.
	(operand_variant_qualifier_p): Likewise.
	(qualifier_value_in_range_constraint_p): Likewise.
	(aarch64_get_qualifier_esize): Likewise.
	(aarch64_get_qualifier_nelem): Likewise.
	(aarch64_get_qualifier_standard_value): Likewise.
	(get_lower_bound, get_upper_bound): Likewise.
	(aarch64_find_best_match, match_operands_qualifier): Likewise.
	(aarch64_print_operand): Likewise.
	* aarch64-opc.h (operand_has_inserter, operand_has_extractor): Likewise.
	(operand_need_sign_extension, operand_need_shift_by_two): Likewise.
	(operand_need_shift_by_four, operand_maybe_stack_pointer): Likewise.
	* arm-dis.c (print_insn_mve, print_insn_thumb32): Likewise.
	* tic6x-dis.c (tic6x_check_fetch_packet_header): Likewise.
	(print_insn_tic6x): Likewise.
2021-03-29 11:22:22 +10:30
Alan Modra
854f1e4be9 gas int vs bfd_boolean fixes
* config/tc-arm.c (struct arm_long_option_table <func>): Return
	bfd_boolean.
	* config/tc-arm.h (arm_optimize_expr, arm_data_in_code): Likewise.
	* config/tc-metag.c (parse_mov_port): Replace unsigned int variable
	with bfd_boolean.
	(parse_mmov, parse_mov_ct, parse_alu, parse_shift, parse_bitop),
	(parse_cmp, parse_fmmov, parse_fmov_data, parse_fearith),
	(parse_dget_set, parse_dalu): Likewise, ensuring assignment from
	logical expressions.
	(struct metag_long_option <func>): Return bfd_boolean.
	(metag_parse_cpu, metag_parse_fpu, metag_parse_dsp): Likewise.
	* config/tc-msp430.c (msp430_dstoperand): Correct dummy type.
	* config/tc-s12z.c (parse_operand_func): Return bfd_boolean.
	(no_operands, lex_force_match, lex_reg_list): Likewise.
	(size_from_suffix): Return int.
	(s12z_relax_frag, md_estimate_size_before_relax): Return 0.
	* config/tc-s12z.h (tc_s12z_fix_adjustable): Likewise.
2021-03-29 11:22:21 +10:30
Jan Beulich
c3344b626d x86-64: don't accept supposedly disabled MOVQ forms
While all of MMX, SSE, and SSE2 are included in "generic64", they can be
individually disabled. There are two MOVQ forms lacking respective
attributes. While the MMX one would get refused anyway (due to MMX
registers not recognized with .nommx), the assembler did happily accept
the SSE2 form. Add respective CPU settings to both, paralleling what the
MOVD counterparts have.
2021-03-26 11:43:19 +01:00
Hafiz Abid Qadeer
efa30ac3c5 [NIOS2] Fix disassembly of br.n instruction.
The code was checking wrong bit for sign extension. It caused it
to zero-extend instead of sign-extend the immediate value.

2021-03-25  Abid Qadeer  <abidh@codesourcery.com>

	opcodes/
	* nios2-dis.c (nios2_print_insn_arg): Fix sign extension of
	immediate in br.n instruction.

	gas/
	* testsuite/gas/nios2/brn.s: New.
	* testsuite/gas/nios2/brn.d: New.
2021-03-25 10:52:14 +00:00
Jan Beulich
5e74b4959b x86: fix CMPXCHG8B special case when disallowing q suffix outside of 64-bit mode
In match_template() i.tm hasn't been filled yet, so it is necessarily t
which needs checking. This is only a latent issue as no other templates
with the same base_opcode have an extension_opcode of 1.
2021-03-25 08:20:55 +01:00
Jan Beulich
596a02ff55 x86: flag bad S/G insn operand combinations
For VEX-encoded ones, all three involved vector registers have to be
distinct. For EVEX-encoded ones an actual mask register has to be in use
and zeroing-masking cannot be used (violation of either will #UD).
Additionally both involved vector registers have to be distinct for
EVEX-encoded gathers.
2021-03-25 08:20:19 +01:00
Jan Beulich
5364285240 x86: flag as bad AVX512 insns with EVEX.z set but EVEX.aaa clear
This combination makes no sense and is documented to cause #UD.
2021-03-25 08:19:21 +01:00
Jan Beulich
c0e54661f7 x86: fix AMD Zen3 insns
For INVLPGB the operand count was wrong (besides %edx there's also %ecx
which is an input to the insn). In this case I see little sense in
retaining the bogus 2-operand template. Plus swapping of the operands
wasn't properly suppressed for Intel syntax.

For PVALIDATE, RMPADJUST, and RMPUPDATE bogus single operand templates
were specified. These get retained, as the address operand is the only
one really needed to expressed non-default address size, but only for
compatibility reasons. Proper multi-operand insn get introduced and the
testcases get adjusted / extended accordingly.

While at it also drop the redundant definition of __amd64__ - we already
have x86_64 defined (or not) to distinguish 64-bit and non-64-bit cases.
2021-03-25 08:18:41 +01:00
Jan Beulich
829f3fe1f0 x86-64: limit breakage from gcc movdir64b et al workaround
This is only a partial fix for PR/gas 27419, in that it limits the bad
behavior of accepting mismatched operands to just x32 mode. The full fix
would be to revert commits 27f134698a and b3a3496f83, and to address
the issue in gcc instead.
2021-03-25 08:17:45 +01:00
Alan Modra
5a4037661b PR27647 PowerPC extended conditional branch mnemonics
opcodes/
	PR 27647
	* ppc-opc.c (XLOCB_MASK): Delete.
	(XLBOBB_MASK, XLBOBIBB_MASK, XLBOCBBB_MASK): Define using
	XLBH_MASK.
	(powerpc_opcodes): Accept a BH field on all extended forms of
	bclr, bclrl, bcctr, bcctrl, bctar, bctarl.
gas/
	PR 27647
	* testsuite/gas/ppc/a2.d: Update expected output.
	* testsuite/gas/ppc/power8.d: Likewise.
2021-03-25 11:31:53 +10:30
Jan Beulich
9a182d0461 x86: derive opcode length from opcode value
In the majority of cases we can easily determine the length from the
encoding, irrespective of whether a prefix is specified there as well.
We further don't even need to record the value in the table entries, as
it's easy enough to determine it (without any guesswork, unless an insn
with major opcode 00 appeared that requires a 2nd opcode byte to be
specified explicitly) when installing the chosen template for further
processing.

Should an encoding appear which
- has a major opcode byte of 66, F3, or F2,
- requires a 2nd opcode byte to be specified explicitly,
- doesn't have a mandatory prefix
we'd need to convert all templates presently encoding a mandatory prefix
this way to the Prefix_0X<nn> model to eliminate the respective guessing
i386-gen does.
2021-03-24 08:33:33 +01:00
Jan Beulich
3564871692 x86: derive mandatory prefix attribute from base opcode
Just like is already done for legacy encoded insns, record the mandatory
prefix information in the respective opcode modifier field. Do this
without changing the source table, but rather by deriving the values from
their existing source representation.
2021-03-24 08:32:32 +01:00
Jan Beulich
311845694b x86: don't use opcode_length to identify pseudo prefixes
This is in preparation of opcode_length going away as a field in the
templates. Identify pseudo prefixes by a base opcode of zero instead:
No real prefix has an opcode of zero. This at the same time allows
dropping a curious special case from i386-gen.

Since most attributes are identical for all pseudo prefixes, take the
opportunity and also template them.
2021-03-24 08:31:41 +01:00
Jan Beulich
b933fa4b5d x86: re-number PREFIX_0X<nn>
In preparation to use PREFIX_0X<nn> attributes also in VEX/XOP/EVEX
encoding templates, renumber the pseudo-enumerators such that their
values can then also be used directly in the respective prefix bit
fields.
2021-03-23 17:09:53 +01:00
Jan Beulich
dac10fb0d1 x86: re-order two fields of struct insn_template
To facilitate a subsequent table parser change, re-order CPU flags and
opcode modifier fields. No functional change intended.
2021-03-23 17:09:11 +01:00
Jan Beulich
441f6aca39 x86: split opcode prefix and opcode space representation
Commit 8b65b8953a ("x86: Remove the prefix byte from non-VEX/EVEX
base_opcode") used the opcodeprefix field for two distinct purposes. In
preparation of having VEX/XOP/EVEX and non-VEX templates become similar
in the representatioon of both encoding space and opcode prefixes, split
the field to have a separate one holding an insn's opcode space.
2021-03-23 17:08:39 +01:00
Jan Beulich
70e958370c x86: don't open-code PREFIX_NONE
Use the constant rather than literal zero. While at it fold two
conditionals (using the same base opcode and prefix) in load_insn_p().
2021-03-23 08:44:35 +01:00
Jan Beulich
a152332d17 x86: unbreak certain MPX insn operand forms
Commit 8b65b8953a ("x86: Remove the prefix byte from non-VEX/EVEX
base_opcode") dropped the mandatory prefix bytes from legacy encoded
insn templates, but failed to also adjust affected MPX-specific checks
in two places.

For the expressions to remain halfway readable, introduce local
variables to hold current_templates->start.
2021-03-23 08:44:03 +01:00
Martin Liska
08dedd6631 Add startswith function and use it instead of CONST_STRNEQ.
bfd/ChangeLog:

	* bfd-in.h (startswith): Add startswith function.
	(CONST_STRNEQ): Remove.
	* bfd-in2.h (startswith): Regenerate with make headers.
	* archive.c (bfd_slurp_armap): Replace usage of CONST_STRNEQ with startswith.
	(_bfd_slurp_extended_name_table): Likewise.
	* archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
	* bfd.c (bfd_get_sign_extend_vma): Likewise.
	(bfd_convert_section_size): Likewise.
	(bfd_convert_section_contents): Likewise.
	* coff-stgo32.c (go32exe_create_stub): Likewise.
	(go32exe_check_format): Likewise.
	* coffcode.h (styp_to_sec_flags): Likewise.
	(GNU_DEBUGALTLINK): Likewise.
	* coffgen.c (_bfd_coff_section_already_linked): Likewise.
	(coff_gc_sweep): Likewise.
	(bfd_coff_gc_sections): Likewise.
	* cofflink.c (coff_link_add_symbols): Likewise.
	(process_embedded_commands): Likewise.
	* compress.c (bfd_is_section_compressed_with_header): Likewise.
	(bfd_init_section_decompress_status): Likewise.
	* dwarf2.c (find_debug_info): Likewise.
	(place_sections): Likewise.
	* ecoff.c (_bfd_ecoff_slurp_armap): Likewise.
	* elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise.
	* elf.c (_bfd_elf_make_section_from_shdr): Likewise.
	(assign_section_numbers): Likewise.
	(elfcore_grok_win32pstatus): Likewise.
	* elf32-arm.c (cmse_scan): Likewise.
	(elf32_arm_gc_mark_extra_sections): Likewise.
	(elf32_arm_size_dynamic_sections): Likewise.
	(is_arm_elf_unwind_section_name): Likewise.
	* elf32-bfin.c (bfin_size_dynamic_sections): Likewise.
	* elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
	* elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
	* elf32-csky.c (csky_elf_size_dynamic_sections): Likewise.
	* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
	* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
	* elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
	* elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
	* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
	* elf32-metag.c (elf_metag_size_dynamic_sections): Likewise.
	* elf32-msp430.c (msp430_elf_relax_delete_bytes): Likewise.
	* elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
	* elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
	* elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
	* elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise.
	* elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
	* elf32-tic6x.c (is_tic6x_elf_unwind_section_name): Likewise.
	(elf32_tic6x_size_dynamic_sections): Likewise.
	* elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
	* elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
	(xtensa_is_insntable_section): Likewise.
	(xtensa_is_littable_section): Likewise.
	(xtensa_is_proptable_section): Likewise.
	(xtensa_property_section_name): Likewise.
	(xtensa_callback_required_dependence): Likewise.
	* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
	* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
	* elf64-ia64-vms.c (is_unwind_section_name): Likewise.
	(get_reloc_section): Likewise.
	(elf64_ia64_size_dynamic_sections): Likewise.
	(elf64_ia64_object_p): Likewise.
	* elf64-mmix.c (mmix_elf_add_symbol_hook): Likewise.
	* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
	* elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
	* elflink.c (elf_link_add_object_symbols): Likewise.
	(_bfd_elf_gc_mark_extra_sections): Likewise.
	(bfd_elf_parse_eh_frame_entries): Likewise.
	(_bfd_elf_section_already_linked): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise.
	* elfnn-ia64.c (is_unwind_section_name): Likewise.
	(elfNN_ia64_size_dynamic_sections): Likewise.
	(elfNN_ia64_object_p): Likewise.
	* elfxx-mips.c (FN_STUB_P): Likewise.
	(CALL_STUB_P): Likewise.
	(CALL_FP_STUB_P): Likewise.
	(_bfd_mips_elf_section_from_shdr): Likewise.
	(_bfd_mips_elf_fake_sections): Likewise.
	(_bfd_mips_elf_size_dynamic_sections): Likewise.
	(_bfd_mips_final_write_processing): Likewise.
	(_bfd_mips_elf_final_link): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
	* elfxx-x86.c (elf_i386_is_reloc_section): Likewise.
	(elf_x86_64_is_reloc_section): Likewise.
	* hpux-core.c (thread_section_p): Likewise.
	* libcoff.h (bfd_pei_p): Likewise.
	* linker.c (REAL): Likewise.
	(unwrap_hash_lookup): Likewise.
	(_bfd_generic_link_add_one_symbol): Likewise.
	* mmo.c (mmo_internal_write_section): Likewise.
	* osf-core.c (osf_core_core_file_p): Likewise.
	* pef.c (bfd_pef_print_symbol): Likewise.
	* pei-x86_64.c (pex64_print_all_pdata_sections): Likewise.
	* som.c (som_slurp_symbol_table): Likewise.
	(som_slurp_armap): Likewise.
	* wasm-module.c (wasm_compute_custom_section_file_position): Likewise.

binutils/ChangeLog:

	* dlltool.c (scan_drectve_symbols): Replace usage of CONST_STRNEQ with startswith.
	* emul_aix.c (ar_emul_aix_parse_arg): Likewise.
	* objcopy.c (is_mergeable_note_section): Likewise.
	* objdump.c (dump_dwarf_section): Likewise.
	* prdbg.c (pr_method_type): Likewise.
	(pr_class_baseclass): Likewise.
	(tg_class_baseclass): Likewise.
	* readelf.c (process_lto_symbol_tables): Likewise.
	* stabs.c (ULLHIGH): Likewise.
	(parse_stab_argtypes): Likewise.
	(stab_demangle_function_name): Likewise.

gas/ChangeLog:

	* config/tc-i386.c (md_parse_option): Replace usage of CONST_STRNEQ with startswith.
	(x86_64_section_word): Likewise.
	* config/tc-sparc.c (md_parse_option): Likewise.

gdb/ChangeLog:

	* arm-tdep.c (show_disassembly_style_sfunc): Replace usage of CONST_STRNEQ with startswith.
	(_initialize_arm_tdep): Likewise.

ld/ChangeLog:

	* emultempl/aix.em: Replace usage of CONST_STRNEQ with startswith.
	* emultempl/beos.em: Likewise.
	* emultempl/elf.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/xtensaelf.em: Likewise.
	* ldctor.c (ctor_prio): Likewise.
	* ldelf.c (ldelf_try_needed): Likewise.
	(ldelf_parse_ld_so_conf): Likewise.
	(ldelf_after_open): Likewise.
	(output_rel_find): Likewise.
	(ldelf_place_orphan): Likewise.
	* ldfile.c (ldfile_add_library_path): Likewise.
	* ldlang.c (lang_add_input_file): Likewise.
	* ldmain.c (get_sysroot): Likewise.
	(get_emulation): Likewise.
	(add_archive_element): Likewise.
	* ldwrite.c (unsplittable_name): Likewise.
	(clone_section): Likewise.
	* lexsup.c (parse_args): Likewise.
	* pe-dll.c (is_import): Likewise.
	(pe_implied_import_dll): Likewise.

opcodes/ChangeLog:

	* aarch64-dis.c (parse_aarch64_dis_option): Replace usage of CONST_STRNEQ with startswith.
	* arc-dis.c (parse_option): Likewise.
	* arm-dis.c (parse_arm_disassembler_options): Likewise.
	* cris-dis.c (print_with_operands): Likewise.
	* h8300-dis.c (bfd_h8_disassemble): Likewise.
	* i386-dis.c (print_insn): Likewise.
	* ia64-gen.c (fetch_insn_class): Likewise.
	(parse_resource_users): Likewise.
	(in_iclass): Likewise.
	(lookup_specifier): Likewise.
	(insert_opcode_dependencies): Likewise.
	* mips-dis.c (parse_mips_ase_option): Likewise.
	(parse_mips_dis_option): Likewise.
	* s390-dis.c (disassemble_init_s390): Likewise.
	* wasm32-dis.c (parse_wasm32_disassembler_options): Likewise.
2021-03-22 11:01:43 +01:00
Alan Modra
826b97d42d gas/app.c don't throw away spaces before slash
I don't know really why we should lose a space before a '/'.  Possibly
it would make sense if '/' started a comment, but otherwise no.

	* app.c (do_scrub_chars): Don't lose spaces before a slash.
2021-03-19 20:12:30 +10:30
Christian Groessler
3273f9a19e 2021-03-18 Christian Groessler <chris@groessler.org>
* config/tc-z8k.c (apply_fix): Handle 7-bit relocations correctly.
       Problem found by Tadashi G. Takaoka <tadashi.g.takaoka@gmail.com>.
2021-03-18 21:33:51 +01:00
Kuan-Lin Chen
80d49d6a1b RISC-V : Support bitmanip-0.93 ZBA/ZBB/ZBC instructions
bfd/
	* elfxx-riscv.c (riscv_std_z_ext_strtab): Add zba, zbb and zbc.

gas/
	* config/tc-riscv.c (ext_version_table): Add b, zba, zbb and zbc.
	(riscv_multi_subset_supports): Add INSN_CLASS_ZB*.
	* testsuite/gas/riscv/b-ext-64.s: Bitmanip test case.
	* testsuite/gas/riscv/b-ext-64.d: Likewise.
	* testsuite/gas/riscv/b-ext.s: Likewise.
	* testsuite/gas/riscv/b-ext.d: Likewise.

include/
	* opcode/riscv-opc.h: Support zba, zbb and zbc extensions.
	* opcode/riscv.h (riscv_insn_class): Add INSN_CLASS_ZB*.

opcodes/
	* riscv-opc.c (riscv_opcodes): Add zba, zbb and zbc instructions.
2021-03-16 14:38:19 +08:00