aboutsummaryrefslogtreecommitdiff
path: root/gas
AgeCommit message (Collapse)AuthorFilesLines
37 hoursaarch64 tests: escape dot in regex pattern to really match a dotMatthieu Longo3-3/+3
47 hourss390: Add support for z17 as CPU nameJens Remus3-4/+6
So far IBM z17 was identified as arch15. Add the real name, as it has been announced. [1] [1]: IBM z17 announcement letter, AD25-0015, https://www.ibm.com/docs/en/announcements/z17-makes-more-possible gas/ * config/tc-s390.c (s390_parse_cpu): Add z17 as alternate CPU name for arch15. * doc/c-s390.texi: Likewise. * doc/as.texi: Likewise. opcodes/ * s390-mkopc.c (main): Add z17 as alternate CPU name for arch15. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
3 daysLoongArch: Warn about right shifts of negative numbersLulu Cai5-0/+89
The GNU Assembler User Guide says that the right shift operator ">>" in an expression is the same as the C operator. On LoongArch the assembler directives and instructions do not treat negative numbers ">>" the same way. The directives treats negative numbers ">>" as logical right shifts while the instructions treats them as arithmetic right shifts. The right shift of negative numbers in the instructions may be changed from an arithmetic right shift to a logical right shift in the future, and a warning is issued for this.
4 daysnm: also retrieve size for COFF function symbolsJan Beulich1-2/+2
Like ELF for all symbols, COFF can record size for at least function ones. Use that - if available - in preference to the distance-to-next- symbol heuristic. To be able to use the new test there, make TI C54x follow TI C4x in providing .sdef to cover for .def already having different meaning.
13 daysx86: Add {noimm8s} pseudo prefixH.J. Lu6-0/+142
Instruction templates with only sign-extended 8-bit immediate operand also have a second template with full-operand-size immediate operand under a different opcode. Add {noimm8s} pseudo prefix to exclude templates with only sign-extended 8-bit immediate operand. gas/ PR gas/32811 * config/tc-i386.c (pseudo_prefixes): Add no_imm8s. (operand_size_match): Return false for templates with only sign- extended 8-bit immediate operand if {noimm8s} is used. (parse_insn): Handle Prefix_NoImm8s. * doc/c-i386.texi: Document {noimm8s}. * testsuite/gas/i386/pseudos.s: Add tests for {noimm8s}. * testsuite/gas/i386/x86-64-pseudos.s: Likewise. * testsuite/gas/i386/pseudos.d: Updated. * testsuite/gas/i386/x86-64-pseudos.d: Likewise. opcodes/ PR gas/32811 * opcodes/i386-opc.h (Prefix_NoImm8s): New. * i386-opc.tbl: Add {noimm8s} pseudo prefix. * i386-mnem.h: Regenerated. * i386-tbl.h: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-27x86: Remove AVX10.2 256 bit rounding supportHaochen Jiang33-2733/+11
Since we will support 512 bit on both P-core and E-core for AVX10, 256 bit rounding is not that useful because we currently have rounding feature directly on E-core now and no need to use 256-bit rounding as somehow a workaround. This patch will remove all the support and backport to Binutils 2.44. gas/ChangeLog: * NEWS: Mention support removal. * config/tc-i386.c (build_evex_prefix): Remove U bit encode. (check_VecOperands): Remove ymm check for rounding. (s_insn): Revise .insn comment. * testsuite/gas/i386/avx10_2-256-cvt-intel.d: Remove ymm rounding related test. * testsuite/gas/i386/avx10_2-256-cvt.d: Ditto. * testsuite/gas/i386/avx10_2-256-cvt.s: Ditto. * testsuite/gas/i386/avx10_2-256-miscs-intel.d: Ditto. * testsuite/gas/i386/avx10_2-256-miscs.d: Ditto. * testsuite/gas/i386/avx10_2-256-miscs.s: Ditto. * testsuite/gas/i386/avx10_2-256-satcvt-intel.d: Ditto. * testsuite/gas/i386/avx10_2-256-satcvt.d: Ditto. * testsuite/gas/i386/avx10_2-256-satcvt.s: Ditto. * testsuite/gas/i386/evex.d: Ditto. * testsuite/gas/i386/evex.s: Ditto. * testsuite/gas/i386/i386.exp: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-cvt-intel.d: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-cvt.d: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-cvt.s: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-miscs-intel.d: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-miscs.d: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-miscs.s: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-satcvt-intel.d: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-satcvt.d: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-satcvt.s: Ditto. * testsuite/gas/i386/x86-64-evex.d: Ditto. * testsuite/gas/i386/x86-64.exp: Ditto. * testsuite/gas/i386/avx10_2-rounding-intel.d: Removed. * testsuite/gas/i386/avx10_2-rounding-inval.l: Removed. * testsuite/gas/i386/avx10_2-rounding-inval.s: Removed. * testsuite/gas/i386/avx10_2-rounding.d: Removed. * testsuite/gas/i386/avx10_2-rounding.s: Removed. * testsuite/gas/i386/x86-64-avx10_2-rounding-intel.d: Removed. * testsuite/gas/i386/x86-64-avx10_2-rounding.d: Removed. * testsuite/gas/i386/x86-64-avx10_2-rounding.s: Removed. opcodes/ChangeLog: * i386-dis.c (struct instr_info): Remove U bit. (get_valid_dis386): Roll back to APX condition. * i386-opc.tbl: Remove ymm rounding support. * i386-tbl.h: Regenerated.
2025-03-26RISC-V: add Smrnmi 1.0 instruction supportJerry Zhang Jian2-0/+11
Add instruction `mnret' support Ref: https://github.com/riscv/riscv-isa-manual/blob/bb8b9127f81965eeff2d150c211d1c89376591c4/src/rnmi.adoc https://github.com/riscv/riscv-opcodes/blob/946eb673874b3a0f2474d1424dc28bc7ee53c306/extensions/rv_smrnmi bfd/ChangeLog: * elfxx-riscv.c: Add new Smrnmi instruction class handling gas/ChangeLog: * testsuite/gas/riscv/smrnmi.s: New test for mnret * testsuite/gas/riscv/rmrnmi.d: Likewise include/ChangeLog: * opcode/ricsv-opc.h: Add MATCH_MNRET, MASK_MNRET * opcode/riscv.h: Add new instruction class opcodes/ChangeLog: * riscv-opc.c: Add `mnret' instruction Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
2025-03-24aarch64: Add missing FEAT_MEC dc encodings and gate sysregsEzra Sitorus5-0/+31
FEAT_MEC support was introduced in [1]. However, the dc instruction was missing these encodings: - DC CIPAE - DC CIGDPAE Furthermore, the Arm ARM states that FEAT_MEC is an optional extension, introduced for v9.2-a. Therefore, these sysregs: - MECIDR_EL2 - MECID_P0_EL2 - MECID_A0_EL2 - MECID_P1_EL2 - MECID_A1_EL2 - VMECID_P_EL2 - VMECID_A_EL2 - MECID_RL_A_EL3 which were introduced in that commit now require -march=armv9.2-a at the very least to be enabled, as well as the dc encodings. opcodes/ChangeLog: * aarch64-opc.c (aarch64_sys_regs_dc): Add "cipae" and "cigdpae". * aarch64-sys-regs.def: Add V8_7A as a requirement for the above system registers. gas/testsuite/gas/ChangeLog * aarch64/mec-invalid.s: Add .arch directive. * aarch64/mec.d: Add .arch directive and check for cipae, cigdpae. * aarch64/mec.s: Add MEC data cache operations test. * aarch64/mec-arch-bad.d: New test to check for bad arch version. * aarch64/mec-arch-bad.l: Above. [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31f2faf5cf112931cfb8c0564a2b78477c907fe3 Regression tested on aarch64-none-elf
2025-03-21aarch64: simplify RCPC3 unpredictable logicJan Beulich5-66/+32
The original observation was that STILP is warned about when everything is fine. Documentation, not just for STILP, says explicitly that behavior is identical to respective pre-existing insns (for STILP in particular that's STP). With that it's unclear why distinct logic was added: Other code can be re-used, simply distinguishing by the number of operands. This was diagnostics also end up more consistent. Along with adding some STILP uses to the (positive) testcase, also add a pair of STLR to similarly demonstrate that the register overlap goes without warning when there's no write-back.
2025-03-18RISC-V: Support pointer masking extension 1.0Jerry Zhang Jian4-1/+15
- Adding Ssnpm, Smnpm, Smmpm, Sspm, and Supm - No new CSR added - Pointer masking only applies to RV64 - Ref: https://github.com/riscv/riscv-j-extension/releases/download/pointer-masking-ratified/pointer-masking-ratified.pdf Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
2025-03-18gas/NEW: Updated news related to mapping symbol and extensions for risc-vNelson Chu1-0/+11
2025-03-18RISC-V: Add extension XTheadVdot for T-Head VECTOR vendor extension [1]Jin Ma4-0/+67
T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds the additional extension "XTheadVdot" based on the "V" extension, and it provides four 8-bit multiply and add with 32-bit instructions for the "v" extension. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([2]). Co-Authored-By: Lifang Xia <lifang_xia@linux.alibaba.com> [1] https://github.com/XUANTIE-RV/thead-extension-spec/tree/master/xtheadvdot [2] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Add support for "XTheadVdot" extension. (riscv_multi_subset_supports_ext): Likewise. gas/ChangeLog: * doc/c-riscv.texi: Likewise. * testsuite/gas/riscv/march-help.l: Likewise. * testsuite/gas/riscv/x-thead-vdot.d: New test. * testsuite/gas/riscv/x-thead-vdot.s: New test. include/ChangeLog: * opcode/riscv-opc.h (MATCH_TH_VMAQA_VV): New. * opcode/riscv.h (enum riscv_insn_class): Add insn class for XTheadVdot. opcodes/ChangeLog: * riscv-opc.c: Likewise.
2025-03-18RISC-V: Avoid parsing arch string repeatedly for dis-assemblerNelson Chu1-18/+5
Since we now always generate $x+isa for now, these would increase the dis-assemble time by parsing the same architecture string repeatedly. We already have `arch_str' field into `subset_list' to record the current architecture stirng, but it's only useful for assembler, since dis-assembler and linker don't need it before. Now for dis-assembler, we just need to update the `arch_str' after parsing the architecture stirng, and then avoid parsing repeatedly if the strings are the same.
2025-03-14gas: permit wider-than-byte operands for .cfi_escapeJan Beulich5-7/+53
Some DW_CFA_* and DW_OP_* take wider than byte, but non-LEB128 operands. Having to hand-encode such when needing to resort to .cfi_escape isn't very helpful.
2025-03-14gas: permit LEB128 operands for .cfi_escapeJan Beulich6-7/+87
Many DW_CFA_* and DW_OP_* take LEB128 operands. Having to hand-encode such when needing to resort to .cfi_escape isn't very helpful.
2025-03-14gas: make NO_LISTING work againJan Beulich3-54/+20
Presumably since no target enables this and there's also no configure control, builds with NO_LISTING defined didn't really work anymore. Convert fallback functions to macros and add #ifndef in a few places. (Behavior is different for affected command line options vs directives: The former are rejected as unrecognized, while the latter are silently ignored. I think that's fair enough.)
2025-03-14gas: include .cfi_* generated data in listingJan Beulich9-7/+162
These are data generating directives not overly different from e.g. .byte and .long. Whatever (directly) results from should also be represented in the listing, if one was requested. It's just that the output data is generated much later than the parsing of the directive arguments.
2025-03-14gas: deal with the need for relocations from .cfi_{escape,fde_data}Jan Beulich8-10/+49
Ignoring return values often isn't a good idea. The Sparc assembler in particular would report an internal error if an expression with relocation specifier is used with .cfi_escape, when the same works fine with .byte. Propagate the relocation indicator up from do_parse_cons_expression(), and eventually into emit_expr_with_reloc(). dot_cfi_fde_data(), only retaining the expression's X_add_number, would require further work. Simply report the lack of support there. While there, also check that what we were dealt is actually a constant.
2025-03-10gas: Use SFrame header and FDE field sizes when generating .sframeJens Remus1-16/+13
The use of SFRAME_RELOC_SIZE in generation of SFrame stack trace information from CFI directives erroneously suggested that this could be used to configure a different relocation size. But in practice it is tied to the SFrame field sizes it is used for and therefore cannot be changed. Replace the uses of SFRAME_RELOC_SIZE by the size of the respective SFrame header and FDE fields when emitting SFrame information. While at it enhance some comments. gas/ * gen-sframe.c (SFRAME_RELOC_SIZE): Delete. (sizeof_member): Define. (output_sframe_funcdesc): Use size of SFrame FDE fields instead of SFRAME_RELOC_SIZE. (output_sframe_internal): Use size of SFrame header fields instead of SFRAME_RELOC_SIZE. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-03-07AVR: gas/32704 - Improve code generation for __gcc_isr.Georg-Johann Lay1-54/+122
The prologue generated by __gcc_isr can be improved in situations where: * ZERO_REG is needed, and * SREG is not clobbered by the ISR, and * avr-gcc provides a GPR >= R16 with the Done chunk, and * Code generation is for ordinary AVRs (not AVRrc). For example, the prologue for volatile char var; __attribute__((signal)) void __vector_1 (void) { var = 1; var = 0; } may be 00000000 <__vector_1>: 0: 8f 93 push r24 2: 1f 92 push r1 4: 80 e0 ldi r24, 0 6: 18 2e mov r1, r24 instead of the code as currently generated by GAS: 00000000 <__vector_1>: 0: 1f 92 push r1 2: 1f b6 in r1, SREG 4: 1f 92 push r1 6: 11 24 clr r1 8: 8f 93 push r24 which consumes more stack, time and code than needed. gas/ PR gas/32704 PR gas/21683 * config/tc-avr.c (avr_isr): bool-ize. (avr_emit_insn): Emit "mov" code as MOV R1,<reg>. (avr_isr_stack_t): New typedef. (avr_emit_push, avr_emit_pop): New static functions. (avr_patch_gccisr_frag): Overhaul prologue and epilogue generation.
2025-03-07Fix imm20 range check in MSP430 port of gasNick Clifton7-11/+45
2025-03-07gas: don't permit "repeat" expressions with .cfi_{escape,fde_data}Jan Beulich1-8/+14
Repeat counts greater than 1 will emit data directly into the current (sub-)section. That's wrong with .cfi_*, which defer data emission until much later: N-1 instances of the specified data would not end up in .eh_frame (or whatever the section that CFI data was specified to go into). Simply disallow "repeat" expressions in such cases.
2025-03-07gas/listing: drop forward declarationsJan Beulich1-11/+0
These aren't needed (anymore); all static functions are defined before their first use.
2025-03-07gas: centralize declaration of listing_tailJan Beulich4-6/+3
Besides it being somewhat off to have three decls scattered across the code base, it is generally bad practice for the definition of a symbol to not also observe its declaration (making sure the two won't go out of sync).
2025-03-07gas: leave expression symbols alone when processing equatesJan Beulich6-5/+46
PR gas/32721 In this bogus piece of code distilled from fuzzing and slightly edited: A=%eax|%! Y=A Z=A or $6,Z the first of the equates with A on the rhs changes A's section (due to the use of S_GET_VALUE()), from expression to register, thus yielding Y in the expression section (and X_op being O_symbol), but Z in the register section (and X_op being O_register with X_add_value being -1). There shouldn't be random O_register expressions, though, for targets setting md_register_arithmetic to false. Plus both Y and Z would better be exchangeable. In pseudo_set() wire handling of O_symbol expressions referencing a symbol in the expression section to that of other stuff ending up in this section. Also avoid bogus O_register expressions to be created, for targets setting md_register_arithmetic to false: S_GET_VALUE() would resolve any arithmetic, which must not happen for such targets. To be on the safe side for such targets, also amend resolve_register(). Correct another earlier oversight there too (affecting at least Z80), by using the new expr_copy() helper there as well. Undo 46b9f07dfe79 ("PR 32721, internal error in tc-i386.c:parse_register"), albeit without losing the simplification it did.
2025-03-07gas: fold is_end_of_line[] into lex_type[]Jan Beulich6-73/+46
... by way of introducing LEX_EOL and LEX_EOS. As a prereq convert the remaining open-coded accesses. The Alpha change is actually a functional one: The array slot for '!' having been set to 1 is very unlikely to have been correct. 1 means "end of line", when surely "end of statement" was always meant.
2025-03-07rl78: drop redundant statement separator checkJan Beulich1-2/+1
With the switch to the use of is_end_of_stmt() in 2dd0370c433d ("rl78: use is_whitespace()") the open-coded checking against line_separator_chars[] can be dropped.
2025-03-07Z8k: use is_end_of_stmt()Jan Beulich1-5/+5
... instead of open-coding it.
2025-03-07x86: use is_end_of_stmt()Jan Beulich2-7/+7
... instead of open-coding it.
2025-03-07VAX: use is_end_of_stmt()Jan Beulich1-2/+2
... instead of open-coding it. This also fixes two array underrun issues, when plain char is a signed type.
2025-03-07TILEPro: use is_end_of_stmt()Jan Beulich1-4/+4
... instead of open-coding it. Also convert a variable to plain char (allowing to drop two casts), which is how it's actually used.
2025-03-07Tile-Gx: use is_end_of_stmt()Jan Beulich1-4/+4
... instead of open-coding it. Also convert a variable to plain char (allowing to drop two casts), which is how it's actually used.
2025-03-07C6x: use is_end_of_stmt()Jan Beulich1-13/+13
... instead of open-coding it.
2025-03-07C54x: use is_end_of_stmt()Jan Beulich1-19/+19
... instead of open-coding it. In tic54x_stringer() this also fixes an array overrun issue: Converting plain char to unsigned int could have yielded huge values when plain char is a signed type. In subsym_substitute() also convert a local variable to plain char, as that's what it's really holding (and how it's used everywhere else).
2025-03-07C4x: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it.
2025-03-07C30: use is_end_of_stmt()Jan Beulich1-3/+3
... instead of open-coding it.
2025-03-07Sparc: use is_end_of_stmt()Jan Beulich1-3/+3
... instead of open-coding it. This also fixes two array underrun issues, when plain char is a signed type.
2025-03-07SH: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it.
2025-03-07Score: use is_end_of_stmt()Jan Beulich2-8/+8
... instead of open-coding it.
2025-03-07RISC-V: use is_end_of_stmt()Jan Beulich1-2/+2
... instead of open-coding it.
2025-03-07pru: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it.
2025-03-07PPC: use is_end_of_stmt()Jan Beulich1-2/+2
... instead of open-coding it.
2025-03-07MMIX: use is_end_of_stmt()Jan Beulich1-2/+2
... instead of open-coding it.
2025-03-07MIPS: use is_end_of_stmt()Jan Beulich1-7/+7
... instead of open-coding it.
2025-03-07MicroBlaze: use is_end_of_stmt()Jan Beulich1-4/+4
... instead of open-coding it.
2025-03-07M68k: use is_end_of_stmt()Jan Beulich1-21/+21
... instead of open-coding it.
2025-03-07M68HC1x: use is_end_of_stmt()Jan Beulich1-7/+7
... instead of open-coding it. With this there's no need for op_end (and hence op_start) to be other than pointer to plain char. Which in turn eliminates the need for several questionable casts.
2025-03-07IQ2000: use is_end_of_stmt()Jan Beulich1-2/+2
... instead of open-coding it.
2025-03-07LoongArch: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it.
2025-03-07HP-PA: use is_end_of_stmt()Jan Beulich1-3/+3
... instead of open-coding it.