aboutsummaryrefslogtreecommitdiff
path: root/gas
AgeCommit message (Collapse)AuthorFilesLines
2025-02-21x86: widen @got{,pcrel} support to PUSH and APX IMULJan Beulich1-5/+11
With us doing the transformation to an immediate operand for MOV and various ALU insns, there's little reason to then not support the same conversion for the other two insns which have respective immediate operand forms. Unfortunately for IMUL (due to the 0F opcode prefix) there's no suitable relocation, so the pre-APX forms cannot be marked for relaxation in the assembler.
2025-02-20PR 32721, internal error in tc-i386.c:parse_registerAlan Modra1-3/+2
pr30117 showed one of the assertions added by 4d1bb7955a8b was too strict. oss-fuzz also found the second assertion to be too strict, with this testcase distilled from 7k of garbage source: A=%eax%%! Y=A Z=A or $6,Z PR 32721 * config/tc-i386.c (parse_register): Move "know" into condition. Simplify.
2025-02-19gas/config/tc-avr.c: Fix an indentation glitch.Georg-Johann Lay1-2/+2
gas/ * config/tc-avr.c (md_assemble): Fix indentation.
2025-02-16score-elf gas SEGVAlan Modra4-2/+18
Commit 3fb6f5457e5b typoed an array subscript. * config/tc-score7.c (s7_gen_reloc): Correct array subscript. * testsuite/gas/score/pr32700.d, * testsuite/gas/score/pr32700.s: New test. * testsuite/gas/score/relax.exp: Run it.
2025-02-15MIPS objdump: Add `eabi32` and `eabi64` ABI optionsAnghelo Carvajal5-0/+96
Extend gpr and fpr register names with names suitable for both EABIs. Heavily inspired by the EABI documenation written by Eric Christopher, which can be read at https://sourceware.org/legacy-ml/binutils/2003-06/msg00436.html 2025-02-15 Anghelo Carvajal <angheloalf95@gmail.com> * mips-dis.c (mips_fpr_names_eabi32): New variable. (mips_fpr_names_eabi64): New variable. (mips_abi_choices): Add "eabi32" and "eabi64" options. Signed-off-by: Anghelo Carvajal <angheloalf95@gmail.com>
2025-02-15MIPS/GAS/testsuite: Reuse n64 GPR disassembly for n32Maciej W. Rozycki1-39/+1
The MIPS ABI register names are the same between n64 and n32, so remove duplication and use n64 GPR disassembly output for the n32 test as well. The tests were developed long before we gained output reuse support.
2025-02-15MIPS/GAS: Fix comment about "img" vendor configurationsMaciej W. Rozycki2-2/+2
Adjust a comment about "img" vendor configurations to comply with the GNU coding standards.
2025-02-15MIPS/GAS: Set default CPU to MIPS64r6 for 64-bit "img" configurationsMaciej W. Rozycki3-2/+9
Fix broken commit 070961b377b3 ("MIPS: Set r6 as default arch if vendor is img") that sets up GAS in an inconsistent way where "img" vendor has been used with a 64-bit configuration, such as `mips64-img-linux-gnu'. In that case GAS is set up to use a 64-bit ABI by default combined with the MIPS32r6 CPU, which is 32-bit. Consequently GAS always fails to assemble even trivial input, producing a message such as: Assembler messages: Error: -march=mips32r6 is not compatible with the selected ABI .../gas/testsuite/gas/all/nop.s:2: Error: `gp=32' used with a 64-bit ABI unless the defaults have been suitably overridden either for the ABI or the CPU. Set the default CPU to MIPS64r6 for 64-bit "img" vendor configurations then and adjust the GAS testsuite accordingly, removing 1048 FAIL and 3 ERROR regression test results for the `mips64-img-linux-gnu' and `mips64el-img-linux-gnu' targets each.
2025-02-15MIPS/GAS/testsuite: Support negated targets for default architectureMaciej W. Rozycki1-5/+13
Add support for giving negated targets in the list of targets passed to `mips_arch_create' for the purpose of setting the default architecture. This is so that a subset of targets can be excluded from matching within a broader set of targets.
2025-02-14x86: drop redundant i.operands checks from output_disp()Jan Beulich1-3/+0
The opcode space, major opcode, and - where applicable - opcode extension checks fully qualify the insns we're after; operand matching has been done far earlier, so wrong operand counts cannot occur here.
2025-02-14x86: drop redundant checks from ISA-used version determinationJan Beulich1-2/+0
All F16C and all FMA insns are VEX-encoded; there's no need to check for their Cpu* attributes.
2025-02-14x86: correct ISA-used version recordingJan Beulich2-15/+21
Updating should be based solely on the current instruction. For example, recording of VEX-encoded insns as v3 should be independent of there being earlier AMX insns. Further for BASELINE only a very limited set of the GNU_PROPERTY_X86_FEATURE_2_* bits should actually be taken into account: Most of the bits represent advanced (later) features (XSAVE, XSAVEOPT, and XSAVEC for example being part of v3).
2025-02-14gas: fix rs_fill_nop listingJan Beulich4-2/+14
In commit a0094f1a70e1 ("gas: make .nops output visible in listing") I was wrongly assuming fr_fix would be zero for rs_fill_nop, when that's only a side effect of listing_newline() inserting dummy frags, but only when file/line did actually change from the previous invocation. This is in particular not going to be true when the .nops directive isn't the first statement on a line.
2025-02-14x86/APX: make .insn extended-EVEX capableJan Beulich6-25/+197
So far tricks had to be played to use .insn to encode extended-EVEX insns; the X4 bit couldn't be controlled at all. Extend the syntax just enough to cover all features, taking care to reject invalid feature combinations (albeit aiming at being as lax there as possible, to offer users as much flexibility as we can - we don't, after all, know what future will bring). In a pre-existing testcase replace all but one .byte; the one that needs to remain wants to have EVEX.U clear in a way that's neither controllable via AVX10/256 embedded rounding (would otherwise also set EVEX.ND), nor via the index register (EVEX.X4), as there's no memory operand. For one of the converted instances ModR/M.mod needs correcting: An 8-bit displacement requires that to be 1, not 2. Also adjust source comments to better represent what the bad insns mimic.
2025-02-14RISC-V: Add missing doc for OP_VKito Cheng1-0/+3
2025-02-14RISC-V: Add OP_VE for .insnKito Cheng6-4/+12
OP_VE is the opcode space for crypto vector instructions. Ref: https://github.com/riscv/riscv-isa-manual/blob/main/src/vector-crypto.adoc#crypto-vector-cryptographic-instructions
2025-02-14RISC-V: Make SSAMOSWAP.W available for rv64Hau Hsu2-0/+16
Previously we limited SSAMOSWAP.W only available on RV32, but it should be available on RV64 as well. See https://github.com/riscv/riscv-cfi/blob/main/src/cfi_backward.adoc https://github.com/riscv/riscv-isa-manual/blob/702a3e6e843235a2a13b918ae6938b04f8974ffc/src/unpriv-cfi.adoc#L789
2025-02-14gas: replace bfd_alloc with notes_allocAlan Modra2-9/+3
bfd_alloc can return NULL on out-of-memory so code needs to check the return value and print an error. That check was missing in write.c. notes_alloc won't return NULL, instead the underlying obstack_alloc prints an OOM message and the process exits. This is more convenient, and when the bfd_alloc memory is attached to the gas output bfd it is released only slightly before the notes obstack. * config/obj-macho.c (obj_mach_o_set_indirect_symbols): Use notes_calloc rather than bfd_zalloc. * write.c (set_symtab): Use notes_alloc.
2025-02-14gas obj-coff memory leaksAlan Modra4-25/+40
This patch addresses memory leaks in gas that show up when running the testsuite on x86_64-w64-mingw32. The seh_ctx_cur, and weak sym naming leaks can occur many times during assembly. The symbol hook and section leaks are not so important since this memory needs to persist until closing the output bfd. * config/obj-coff-seh.c (do_seh_endproc): Free seh_ctx_cur and its fields. * config/obj-coff-seh.h (struct seh_context): Remove unused "next" field. * config/obj-coff.c (coff_obj_symbol_new_hook): Use notes_alloc for aux entries. (coff_obj_symbol_clone_hook): Likewise. (obj_coff_def): Don't strdup name unless we need to do so for tc_canonicalize_symbol_name. Free after making symbol. (weak_name2altname, weak_altname2name): Return a char*. (weak_uniquify): Use notes_concat. (pecoff_obj_set_weak_hook, pecoff_obj_clear_weak_hook): Free name returned by weak_name2altname. (coff_frob_symbol): Similarly for weak_altname2name. (obj_coff_section): Use notes_memdup0. * symbols.h: Add include guard. (notes_memdup0): New inline function.
2025-02-11RISC-V: Add .bfloat16 directiveKito Cheng5-1/+53
RISC-V already support bfloat16 instruciton like Zfbfmin, Zvfbfmin and Zvfbfwma, so I think it's reasonable to add .bfloat16 directive to support bfloat16 data type. And the code logic mostly support by common code already.
2025-02-10MIPS16/GAS: Streamline forced size suffix handling codeMaciej W. Rozycki1-17/+6
Clean up after commit 112cf77b1855 ("MIPS: use is_whitespace()") and untangle the code flow in the handling of forced size suffixes, noting that owing to the loop right above the only data `c' can hold at this point is '\0', '.', or a white-space character. No functional change.
2025-02-10MIPS16/GAS: Reject instructions that end with a dotMaciej W. Rozycki5-4/+39
Fix a regression from commit 3fb49709438e ("MIPS16/GAS: Fix forced size suffixes with argumentless instructions") and reject MIPS16 instructions that end with a dot and no forced size suffix following, e.g.: $ cat test.s .set mips16 foo: break. entry. addiu. $2, 0x7fff addiu. $3, $2, 0 .align 8, 0 $ as -32 -o test.o test.s $ objdump -d test.o test.o: file format elf32-tradbigmips Disassembly of section .text: 00000000 <foo>: 0: e805 break 2: e809 entry 4: f7ef 4a1f addiu v0,32767 8: 4260 addiu v1,v0,0 ... $ Add a test accordingly, also verifying invalid forced size suffixes.
2025-02-10tc-i386.c fix for oss-fuzz gas fuzzingAlan Modra1-0/+1
oss-fuzz fuzz_as is seriously broken with respect to gas static variables, so much so that most fuzz_as reports should simply be ignored. This patch is a fix for https://oss-fuzz.com/testcase-detail/6268463220654080 * config/tc-i386.c (i386_md_end): Clear GOT_symbol.
2025-02-07x86: Support x86 Zhaoxin PadLock XMODX instructionsMayShao-oc6-2/+32
The CPUID EDX bit[28] indicates its enablement, and it includes REP XMODEXP and REP MONTMUL2. XMODX stands for modular exponentiation, it indicates the support of modular exponentiation feature, both REP XMODEXP and REP MONTMUL2 use it. gas/ChangeLog: * NEWS: Support Zhaoxin PadLock XMODX instructions. * config/tc-i386.c (add_branch_prefix_frag_p): Don't add prefix to PadLockXMODX instructions. (output_insn): Handle PadLockXMODX instructions. * doc/c-i386.texi: Document PadLockXMODX. * testsuite/gas/i386/i386.exp: Add PadLockXMODX test. * testsuite/gas/i386/padlockxmodx.d: Ditto. * testsuite/gas/i386/padlockxmodx.s: Ditto. opcodes/ChangeLog: * i386-dis.c: Add PadLockXMODX. * i386-gen.c: Ditto * i386-opc.h (CpuPadLockXMODX): New. * i386-opc.tbl: Add Zhaoxin PadLock XMODX instructions. * i386-tbl.h: Regenerated. * i386-mnem.h: Ditto. * i386-init.h: Ditto.
2025-02-07gas: suppress use of ISSPACE() / ISBLANK()Jan Beulich1-0/+4
We want is_whitespace() to be used uniformly, no matter what this then expands to.
2025-02-05gas MMIX: Use more of is_... framework like is_whitespace and is_end_of_stmtJan Beulich1-40/+30
Convert uses of ISSPACE() and testing for specific characters into calls to is_whitespace and is_end_of_stmt. While doing that, also remove some redundant tests, like ';' together with is_end_of_line[] and is_whitespace and !is_end_of_line. Note the invalid casts being fixed as part of moving to is_... macros; there were (unsigned int) where there should have been (unsigned char) applied on char as index to is_end_of_line[]. Beware that the input language changes slightly: some constructs with whitespace characters other than space and TAB are now invalid.
2025-02-04gas: Skip SFrame FDE if .cfi_val_offset specifies non-default offsetJens Remus1-5/+5
Unwinding of the stack pointer (SP) is performed using the assumed default rule ".cfi_val_offset <SP-reg>, 0", so that SP unwinds as: SP = CFA Warn if the CFI directive .cfi_val_offset is encountered for the SP register with a different offset. gas/ * gen-sframe.c (sframe_xlate_do_val_offset): Skip SFrame FDE if non-default SP value offset. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-02-04gas: sframe: Use appropriate struct cfi_insn_data union membersJens Remus1-9/+9
Use the appropriate struct cfi_insn_data union members to access fields when generating SFrame information from CFI directives. gas/ * gen-sframe.c (sframe_xlate_do_def_cfa, sframe_xlate_do_offset, sframe_xlate_do_val_offset): Access ri fields, as .cfi_def_cfa, .cfi_offset, and .cfi_val_offset define a register and offset value. * (sframe_xlate_do_def_cfa_register): Access r field, as .cfi_def_cfa_register defines a register. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-02-03Z8k: use is_whitespace()Jan Beulich1-12/+12
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input). At the same time use is_end_of_stmt() instead of an open-coded check in adjacent code.
2025-02-03Z80: use is_whitespace()Jan Beulich1-4/+4
Replace an open-coded check and convert ISSPACE() uses.
2025-02-03Xtensa: use is_whitespace()Jan Beulich1-4/+5
Convert an open-coded check.
2025-02-03xgate: use is_whitespace()Jan Beulich1-1/+1
Convert an open-coded check.
2025-02-03x86: use is_whitespace()Jan Beulich2-49/+48
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input).
2025-02-03wasm32: use is_whitespace()Jan Beulich1-1/+1
Convert an open-coded check.
2025-02-03Visium: use is_whitespace()Jan Beulich1-2/+2
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input). Also convert an open-coded check.
2025-02-03VAX: use is_whitespace()Jan Beulich1-9/+9
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input).
2025-02-03v850: use is_whitespace()Jan Beulich1-9/+8
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input). Also convert open-coded checks as well as ISSPACE() uses. At the same time use is_end_of_stmt() instead of a kind-of-open- coded check in adjacent code.
2025-02-03C6x: use is_whitespace()Jan Beulich1-6/+7
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input). Also convert an ISSPACE() use. At the same time use is_end_of_stmt() instead of open-coded checks in adjacent code.
2025-02-03C54x: use is_whitespace()Jan Beulich1-17/+18
Convert ISSPACE() uses. At the same time use is_end_of_stmt() instead of open-coded checks in adjacent code. The function also needs using in next_line_shows_parallel().
2025-02-03C4x: use is_whitespace()Jan Beulich1-3/+3
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input). At the same time use is_end_of_stmt() instead of kind-of-open-coded checks in adjacent code.
2025-02-03C30: use is_whitespace()Jan Beulich1-1/+1
Convert an open-coded check.
2025-02-03spu: use is_whitespace()Jan Beulich1-4/+4
Convert ISSPACE() uses. At the same time use is_end_of_stmt() instead of a kind-of-open-coded check in adjacent code.
2025-02-03Sparc: use is_whitespace()Jan Beulich1-14/+20
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input).
2025-02-03SH: use is_whitespace()Jan Beulich1-8/+8
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input). Also convert open-coded checks as well as an ISSPACE() use. At the same time use is_end_of_stmt() instead of (kind-of-)open-coded checks in adjacent code.
2025-02-03Score: use is_whitespace()Jan Beulich2-9/+9
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input).
2025-02-03S/390: use is_whitespace()Jan Beulich1-4/+4
Convert ISSPACE() uses. At the same time use is_end_of_stmt() instead of kind-of-open-coded checks in adjacent code.
2025-02-03s12z: use is_whitespace()Jan Beulich1-3/+3
Convert open-coded checks. At the same time use is_end_of_stmt() instead of open-coded checks in adjacent code. This then also fixes the prior use of a wrong cast for an array index: Plain char may, after all, be signed.
2025-02-03rx: use is_whitespace()Jan Beulich2-8/+9
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input). Also convert open-coded checks as well as ISSPACE() uses. At the same time use is_end_of_stmt() instead of an open-coded check in adjacent code.
2025-02-03rl78: use is_whitespace()Jan Beulich2-6/+5
Replace open-coded checks and convert ISSPACE() uses. At the same time use is_end_of_stmt() instead of an open-coded check in adjacent code.
2025-02-03RISC-V: use is_whitespace()Jan Beulich1-8/+9
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input). Switch places already checking for tabs to use the macro, too.