aboutsummaryrefslogtreecommitdiff
path: root/gas/config
AgeCommit message (Collapse)AuthorFilesLines
2025-03-07C-Sky: use is_end_of_stmt()Jan Beulich1-8/+8
... instead of open-coding it.
2025-03-07cris: use is_end_of_stmt()Jan Beulich1-1/+1
Fix use of is_end_of_line[] directly instead of through the is_end_of_stmt() macro.
2025-03-07aarch64: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it.
2025-03-07Arm: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it. This also fixes an array underrun issue: The wrong casting to plain int could have yielded negative values when plain char is a signed type.
2025-03-07Alpha: use is_end_of_stmt()Jan Beulich1-1/+1
... instead of open-coding it. Note that writes to the array need to be left alone; they can only be converted when the array is folded into lex_type[].
2025-03-07Mach-O: use is_end_of_stmt()Jan Beulich1-4/+4
... instead of open-coding it.
2025-03-07ELF: use is_end_of_stmt()Jan Beulich1-2/+2
... instead of open-coding it.
2025-03-07{,E}COFF: use is_end_of_stmt()Jan Beulich1-2/+2
... instead of open-coding it. Convert a variable's type to plain char then as well, as that's what it's really holding (and how it's used everywhere else).
2025-03-03RISC-V: Support ssqosid extension with version 1.0.Kito Cheng1-0/+4
It only add one new CSR: `srmcfg`. Ref: https://github.com/riscv/riscv-ssqosid/releases/tag/v1.0
2025-03-03RISC-V: Stop generating mapping symbol $x, replace with $x<isa>.Nelson Chu1-24/+27
The psABI defined $x to the architecture which is same as the file elf attribute. But GNU defined it to that is same as the previous $x<isa>, and always generated $x<isa> at the begining of each section. That is because considering two objects have different architecture in their elf attributes, then $x will always be wrong after linking since the merged arch string will be changed. For example, object A with rv32ic and object B with rv32ia, $x from A is rv32ic and $x from B is rv32ia, but the final output is rv32ica, so $x from A and B need to be updated to rv32ic and rv32ia by linker respectively. I think let linker to do this is not good, so in order to follow the psABI, we will stop generating the $x for now. Instead, all $x will be replaced with the corresponding $x<isa>. The dis-assembler will also treat $x like what psABI defined.
2025-02-21x86: GOT is an ELF-only entityJan Beulich2-1/+4
Make md_undefined_symbol() conditional upon dealing with ELF, much like other architectures (e.g. Arm32 and Arm64) have it. This avoids errors in gas and even assertions in libbfd when "accidentally" e.g. a COFF- targeting source file uses "_GLOBAL_OFFSET_TABLE_" for whatever reason. While there also convert the final return statement to properly use NULL. NB: In principle 64-bit Mach-O knows GOT, too. Yet only an i?86-macho assembler can be built right now, as per configure.tgt. Pretty clearly adjustments to gotrel[] would also be necessary before these targets could actually work reasonably cleanly.
2025-02-21ix86: restrict use of GOT32X relocsJan Beulich1-1/+4
The ELF linker rejects use of this reloc type without a base register for PIC code. Suppress its use by gas in such cases. To keep things building for non-ELF, include the entire containing if() in an #ifdef: All consumers of ->fx_tcbit* live in such conditionals as well, hence there's no reason to keep the producer active.
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 Modra1-1/+1
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-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 Beulich1-14/+20
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-14x86/APX: make .insn extended-EVEX capableJan Beulich1-15/+151
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 OP_VE for .insnKito Cheng1-1/+1
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-14gas: replace bfd_alloc with notes_allocAlan Modra1-7/+2
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 Modra3-25/+29
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 Cheng1-1/+2
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. Rozycki1-4/+7
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-oc1-1/+4
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-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-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.