aboutsummaryrefslogtreecommitdiff
path: root/gas
AgeCommit message (Collapse)AuthorFilesLines
2024-01-15gas: dw2gencfi: move some tc_* defines to the header fileIndu Bhagat2-12/+12
Move the following three defines to the header file, so the SCFI machinery can use them: - tc_cfi_frame_initial_instructions - tc_cfi_startproc - tc_cfi_endproc gas/ * dw2gencfi.c: Move from ... * dw2gencfi.h: ... to here.
2024-01-15gas: dw2gencfi: expose a new cfi_set_last_fde APIIndu Bhagat2-3/+12
gas/ * dw2gencfi.c (cfi_set_last_fde): New definition. (dot_cfi_endproc): Use it. (dot_cfi_fde_data): Likewise. (dot_cfi_inline_lsda): Likewise. * dw2gencfi.h (struct fde_entry): New declaration. (cfi_set_last_fde): Likewise.
2024-01-15gas: dw2gencfi: use all_cfi_sections instead of cfi_sectionsIndu Bhagat1-4/+4
The code in dw2gencfi.c was checking variable cfi_sections and all_cfi_sections seemingly randomly. Accessing all_cfi_sections seems to the correct variable to access. The data in cfi_sections has already been propagated to all_cfi_sections once cfi_dot_startproc () has been called. gas/ * dw2gencfi.c (dot_cfi_startproc): Use all_cfi_sections instead. (dot_cfi_endproc): Likewise. (dot_cfi_fde_data): Likewise.
2024-01-15gas: dw2gencfi: minor rejig for cfi_sections_set and all_cfi_sectionsIndu Bhagat1-7/+2
cfi_sections_set is best set to true in cfi_dot_startproc (). Setting it to true again in other APIs (dot_cfi_endproc, dot_cfi_fde_data, and cfi_finish) is unnecessary. Also, move setting the global var all_cfi_sections into cfi_set_sections (). gas/ * dw2gencfi.c (cfi_set_sections): Set cfi_sections_set and cfi_sections here. (dot_cfi_startproc): Remove unnecessarily setting cfi_set_sections to true. (dot_cfi_endproc): Likewise. (dot_cfi_fde_data): Likewise. (cfi_finish): Likewise.
2024-01-12bpf: fix relocation addend incorrect symbol valueDavid Faust3-0/+63
Relocations installed by the BPF ELF backend were sometimes incorrectly adding the symbol value to the relocation entry addend, when the correct relocation value was already stored in the addend. This could lead to a relocation effectively adding the symbol value twice. Fix that by making bpf_elf_generic_reloc () more similar to the flow of bfd_install_relocation in the case where howto->install_addend is set, which is how it ought to behave. bfd/ * bpf-reloc.def (R_BPF_64_ABS32, R_BPF_64_ABS64) (R_BPF_64_NODYLD32): Set partial_inplace to true. * elf64-bpf.c (bpf_elf_generic_reloc): Do not include the value of the symbol when installing relocation. Copy some additional logic from bfd_elf_generic_reloc. gas/ * testsuite/gas/bpf/bpf.exp: Run new test. * testsuite/gas/bpf/elf-relo-1.d: New. * testsuite/gas/bpf/elf-relo-1.s: New.
2024-01-12aarch64: Make FEAT_ASMv8p2 instruction aliases always availableAndrew Carlotti1-1/+1
There's no reason to disallow the aliases when the aliased instructions are always available. The new behaviour matches existing LLVM behaviour.
2024-01-12aarch64: Add +xs flag for existing instructionsAndrew Carlotti3-0/+21
Additionally, change FEAT_XS tlbi variants to be gated on "+xs" instead of "+d128". This is an incremental improvement; there are still some FEAT_XS tlbi variants that are gated incorrectly or missing entirely.
2024-01-12aarch64: Add +wfxt flag for existing instructionsAndrew Carlotti3-0/+133
2024-01-12aarch64: Add +rcpc2 flag for existing instructionsAndrew Carlotti4-1/+2233
2024-01-12aarch64: Add +flagm2 flag for existing instructionsAndrew Carlotti2-0/+2
2024-01-12aarch64: Add +frintts flag for existing instructionsAndrew Carlotti5-4/+16
2024-01-12aarch64: Add +jscvt flag for existing fjcvtzs instructionAndrew Carlotti2-0/+2
2024-01-12aarch64: Fix option parsing to disallow prefixes of valid optionsAndrew Carlotti4-1/+6
Add "+rdm" as an explicit alias for "+rdma", to maintain existing compatibility with Clang.
2024-01-12aarch64: Add +fcma alias for +compnumAndrew Carlotti2-0/+3
2024-01-12aarch64: Fix +lse feature flag dependencyAndrew Carlotti1-1/+1
2024-01-12gas: sframe: warn when skipping SFrame FDE generationIndu Bhagat3-13/+23
Fix PR gas/31213. gas/ PR gas/31213 * gen-sframe.c (sframe_do_cfi_insn): Add new warning. gas/testsuite/ * gas/cfi-sframe/common-empty-1.d: Test the new warning as well. * gas/cfi-sframe/common-empty-2.d: Likewise.
2024-01-12x86: Fix indentation and use true/false instead of 1/0Cui, Lili1-14/+14
gas/ChangeLog: * config/tc-i386.c (establish_rex): Fix indentation. (check_EgprOperands): Use true/false instead of 1/0.
2024-01-11LoongArch: Discard extra spaces in objdump outputLulu Cai6-13/+13
Due to the formatted output of objdump, some instructions that do not require output operands (such as nop/ret) will have extra spaces added after them. Determine whether to output operands through the format of opcodes. When opc->format is an empty string, no extra spaces are output.
2024-01-10gas: aarch64: Add system registers for Debug and PMU extensionsSaurabh Jha3-0/+151
This patch adds support for the new AArch64 system registers that are part of the following extensions: * FEAT_DEBUGv8p9 * FEAT_PMUv3p9 * FEAT_PMUv3_SS * FEAT_PMUv3_ICNTR * FEAT_SEBEP
2024-01-09x86: add missing APX logic to cpu_flags_match()Jan Beulich3-0/+41
As already indicated during review, we can't get away without certain adjustments here: Without these, respective {evex}-prefixed insns are assembled to APX encodings even when APX_F is turned off. While there also extend the respective comment in the opcode table, to explain why this construct is used.
2024-01-09x86: FMA insns aren't eligible to VEX2 encodingJan Beulich8-0/+11
PR gas/31178 In da0784f961d8 ("x86: fold FMA VEX and EVEX templates") I overlooked that C aliases StaticRounding, and hence build_vex_prefix() now needs to be aware of that aliasing. Disambiguation is easy, as StaticRounding is only ever used together with SAE (hence why the overlaying works in the first place).
2024-01-09aarch64: ADD FEAT_THE RCWCAS instructions.Srinath Parvathaneni15-0/+1289
This patch adds support for FEAT_THE doubleword and quadword instructions. doubleword insturctions are enabled by "+the" flag whereas quadword instructions are enabled on passing both "+the and +d128" flags. Support for following sets of instructions is added in this patch. Read check write compare and swap doubleword: (rcwcas, rcwcasa, rcwcasal, rcwcasl) Read check write compare and swap quadword: (rcwcasp,rcwcaspa, rcwcaspal, rcwcaspl) Read check write software compare and swap doubleword: (rcwscas, rcwscasa, rcwscasal, rcwscasl) Read check write software compare and swap quadword: (rcwscasp, rcwscaspa, rcwscaspal, rcwscaspl) Read check write atomic bit clear on doubleword: (rcwclr, rcwclra, rcwclral, rcwclrl) Read check write atomic bit clear on quadword: (rcwclrp, rcwclrpa, rcwclrpal, rcwclrpl) Read check write software atomic bit clear on doubleword: (rcwsclr, rcwsclra, rcwsclral, rcwsclrl) Read check write software atomic bit clear on quadword: (rcwsclrp,rcwsclrpa, rcwsclrpal,rcwsclrpl) Read check write atomic bit set on doubleword: (rcwset,rcwseta, rcwsetal,rcwsetl) Read check write atomic bit set on quadword: (rcwsetp,rcwsetpa,rcwsetpal,rcwsetpl) Read check write software atomic bit set on doubleword: (rcwsset,rcwsseta,rcwssetal,rcwssetl) Read check write software atomic bit set on quadword: (rcwssetp,rcwssetpa,rcwssetpal,rcwssetpl) Read check write swap doubleword: (rcwswp,rcwswpa,rcwswpal,rcwswpl) Read check write swap quadword: (rcwswpp,rcwswppa, rcwswppal,rcwswppl) Read check write software swap doubleword: (rcwsswp,rcwsswpa,rcwsswpal,rcwsswpl) Read check write software swap quadword: (rcwsswpp,rcwsswppa,rcwsswppal,rcwsswppl)
2024-01-09arch64: Add optional operand register pair support testsVictor Do Nascimento5-0/+57
Add tests to cover the full range of behaviors observed around optional register operands for the `tlbip' and `sysp' instructions, namely: * Not all `tlbip' operations take GPR operands. When this is the case, we should check that neither optional operand was supplied. * When a `tlbip' operation is labeled with the `F_HASXT' flag, xzr is not a valid optional operand. In such case, at least the fist optional register needs to be specified with a non-xzr value. * The first operand for both insns should be either xzr or an even-numbered register (n % 2 == 0). In the former scenario, the second operand should default to xzr too, while in the latter, it should default to n + 1.
2024-01-09aarch64: Add support for 128-bit system register mrrs and msrr insnsVictor Do Nascimento6-4/+75
With the addition of 128-bit system registers to the Arm architecture starting with Armv9.4-a, a mechanism for manipulating their contents is introduced with the `msrr' and `mrrs' instruction pair. These move values from one such 128-bit system register into a pair of contiguous general-purpose registers and vice-versa, as for example: msrr ttlb0_el1, x0, x1 mrrs x0, x1, ttlb0_el1 This patch adds the necessary support for these instructions, adding checks for system-register width by defining a new operand type in the form of `AARCH64_OPND_SYSREG128' and the `aarch64_sys_reg_128bit_p' predicate, responsible for checking whether the requested system register table entry is marked as implemented in the 128-bit mode via the F_REG_128 flag.
2024-01-09aarch64: Add TLBIP testsVictor Do Nascimento2-0/+259
2024-01-09aarch64: Implement TLBIP 128-bit instructionVictor Do Nascimento1-0/+1
The addition of 128-bit page table descriptors and, with it, the addition of 128-bit system registers for these means that special "invalidate translation table entry" instructions are needed to cope with the new 128-bit model. This is introduced with the `tlbpi' instruction, implemented here.
2024-01-09aarch64: Apply narrowing of allowed immediate values for SYSPVictor Do Nascimento4-1/+34
While CRn and CRm fields in the SYSP instruction are 4-bit wide and are thus able to accommodate values in the range 0-15, the specifications for the SYSP instructions limit their ranges to 8-9 for CRm and 0-7 in the case of CRn. This led to the need to signal in some way to the operand parser that a given operand is under special restrictions regarding its use. This is done via the new `F_OPD_NARROW' flag, indicating a narrowing in the range of operand values for fields in the instruction tagged with the flag. The flag is then used in `parse_operands' when the instruction is assembled, but needs not be taken into consideration during disassembly.
2024-01-09aarch64: Add support for the SYSP 128-bit system instructionVictor Do Nascimento2-0/+9
Mirroring the use of the `sys' - System Instruction assembly instruction, this implements its 128-bit counterpart, `sysp'. This optionally takes two contiguous general-purpose registers starting at an even number or, when these are omitted, by default sets both of these to xzr. Syntax: sysp #<op1>, <Cn>, <Cm>, #<op2>{, <Xt1>, <Xt2>}
2024-01-09aarch64: Add support for optional operand pairsVictor Do Nascimento1-2/+17
Two of the instructions added by the `+d128' architectural extension add the flexibility to have two optional operands. Prior to the addition of the `tlbip' and `sysp' instructions, no mnemonic allowed more than one such optional operand. With `tlbip' as an example, some TLBIP instruction names do not allow for any optional operands, while others allow for both to be optional. In the latter case, it is possible that either the second operand alone is omitted or both operands are omitted. Therefore, a considerable degree of flexibility needed to be added to the way operands were parsed. It was, however, possible to achieve this with relatively few changes to existing code. it is noteworthy that opcode flags specifying the optional operand number are non-orthogonal. For example, we have: #define F_OPD1_OPT (2 << 12) : 0b10 << 12 #define F_OPD2_OPT (3 << 12) : 0b11 << 12 such that by virtue of the observation that (F_OPD1_OPT | F_OPD2_OPT) == F_OPD2_OPT it is impossible to mark both operands 1 and 2 as optional for an instruction and it is assumed that a maximum of 1 operand can ever be optional. This is not overly-problematic given that, for optional pairs, the second optional operand is always found immediately after the first. Thus, it suffices for us to flag that there is a second optional operand. With this fact, we can infer its position in the mnemonic from the position of the first (e.g. if the second operand in the mnemonic is optional, we know the third is too). We therefore define the `F_OPD_PAIR_OPT' flag and calculate its position in the mnemonic from the value encoded by the `F_OPD<n>_OPT' flag. Another observation is that there is a tight coupling between default values assigned to the two registers when one (or both) are omitted from the mnemonic. Namely, if Xt1 has a value of 0x1f (the zero register is specified), Xt2 defaults to the same value, otherwise Xt2 will be assigned Xt + 1. This meant that where you have default value validation, in checking the second optional operand's value, it is also necessary to look at the value assigned to the previously-processed operand value before deciding its validity. Thus `process_omitted_operand' needs not only access to its `operand' argument, but also to the global `inst' struct.
2024-01-09aarch64: Add support for xzr register in register pair operandsVictor Do Nascimento1-0/+1
Analysis of the allowed operand values for `sysp' and `tlbip' reveals a significant departure from the allowed behavior for operand register pairs (hitherto labeled AARCH64_OPND_PAIRREG) observed for other insns in this category. For instructions `casp', `mrrs' and `msrr' the register pair must always start at an even index and the second register in the pair is the index + 1. This precludes the use of xzr as the first register, given it corresponds to register number 31. This is different in the case of `sysp' and `tlbip', however. These allow the use of xzr and, where the first operand in the pair is omitted, this is the default value assigned to it. When this operand is assigned xzr, it is expected that the second operand will likewise take on a value of xzr. These two instructions therefore "break" two rules of register pairs: * The first of the two registers is odd-numbered. * The index of the second register is equal to that of the first, and not n+1. To allow for this departure from hitherto standard behavior, we extend the functionality of the assembler by defining an extension of the AARCH64_OPND_PAIRREG, called AARCH64_OPND_PAIRREG_OR_XZR. It is used in defining `sysp' and `tlbip' and allows `operand_general_constraint_met_p' to allow the pair to both take on the value of xzr.
2024-01-09aarch64: Add +d128 architectural feature supportVictor Do Nascimento2-0/+4
Indicating the presence of the Armv9.4-a features concerning 128-bit Page Table Descriptors, 128-bit System Registers and Instructions, the "+d128" architectural extension flag is added to the list of possible -march options in Binutils, together with the necessary macro for encoding d128 instructions.
2024-01-08MIPS/GAS: mips.exp, mark all mipsisa32*-linux as addr32YunQiang Su1-1/+1
Currently, only mipsisa32-linux and mipsisa32el-linux is marked as addr32, which make mipsisa32rN(el) not marked. This change can fix 2 test failures on mipsisa32rN(el)-linux: FAIL: MIPS MIPS64 MIPS-3D ASE instructions (-mips3d flag) FAIL: MIPS MIPS64 MDMX ASE instructions (-mdmx flag) These failures don't happen for mipsisa32rN-mti-elf etc, due to that, the output is set as NO_ABI instead of O32, then gas won't warn: `fp=64' used with a 32-bit ABI Maybe, we should change this behaivour in future.
2024-01-08arm: Add support for Armv8.9-A and Armv9.4-Asrinath9-0/+64
This patch adds AArch32 support for -march=armv8.9-a and -march=armv9.4-a. The behaviour of the new options can be expressed using a combination of existing feature flags and tables. The cpu_arch_ver entries for ARM_ARCH_V9_4A and ARM_ARCH_V8_9A are technically redundant but it including them for macro code consistency across architectures.
2024-01-08aarch64: Add ite feature system registers.srinath3-0/+25
This patch adds ite feature (FEAT_ITE) system registers, trcitecr_el1, trcitecr_el12, trcitecr_el2 and trciteedcr.
2024-01-08gas/doc: fix several typosSamuel Tardieu10-18/+18
Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
2024-01-08Add support for the aarch64-gnu target (GNU/Hurd on AArch64)Sergey Bugaev1-0/+1
Also recognized are aarch64-*-gnu tagrets, e.g. aarch64-pc-gnu or aarch64-unknown-gnu. The ld/emulparams/aarch64gnu.sh file is (for now) identical to aarch64fbsd.sh, or to aarch64linux.sh with Linux-specific logic removed; and mainly different from the generic aarch64elf.sh in that it does not set EMBEDDED=yes. Coupled with a corresponding GCC patch, this produces a toolchain that can sucessfully build working binaries targeting aarch64-gnu. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2024-01-08i386: Use .insn describe jmpabs's testcases.Hu, Lin11-5/+5
gas/ChangeLog: * testsuite/gas/i386/x86-64-apx-jmpabs-inval.s: Use .insn instead of .byte to describe test cases.
2024-01-07i386: Correct adcx suffix in disassemblerH.J. Lu4-0/+16
Since 0x66 is the opcode prefix for adcx, it is wrong to use the 'S' prefix: 'S' => print 'w', 'l' or 'q' if suffix_always is true on adcx. Add 'L' => print 'l' or 'q' if suffix_always is true replace S with L on adcx and adox. gas/ PR binutils/31219 * testsuite/gas/i386/suffix.d: Updated. * testsuite/gas/i386/x86-64-suffix.d: Likewise. * testsuite/gas/i386/suffix.s: Add tests for adcx and adox. * testsuite/gas/i386/x86-64-suffix.s: Likewise. opcodes/ PR binutils/31219 * i386-dis.c: Add the 'L' suffix. (prefix_table): Replace S with L on adcx and adox. (putop): Handle the 'L' suffix.
2024-01-06gas: sframe: fix some typos in code commentsIndu Bhagat1-7/+7
2024-01-05x86: relax AMD Zen5 testcase expectationsJan Beulich1-1/+1
One item was too strict for PE/COFF, and there's really no need to check for specific comment contents here.
2024-01-05Add AMD znver5 processor supportTejas Joshi10-1/+60
gas/ * config/tc-i386.c (cpu_arch): Add znver5 ARCH. * doc/c-i386.texi: Add znver5. * testsuite/gas/i386/arch-15.d: New. * testsuite/gas/i386/arch-15.s: Likewise. * testsuite/gas/i386/arch-15-znver5.d: Likewise. * testsuite/gas/i386/i386.exp: Add new znver5 test cases. * testsuite/gas/i386/x86-64.exp: Likewise. * testsuite/gas/i386/x86-64-arch-5.d: Likewise. * testsuite/gas/i386/x86-64-arch-5.s: Likewise. * testsuite/gas/i386/x86-64-arch-5-znver5.d: Likewise. opcodes/ * i386-gen.c (isa_dependencies): Add ZNVER5 dependencies. * i386-init.h: Re-generated.
2024-01-05Arm/doc: separate @code from @item for older makeinfoJan Beulich1-103/+103
At least 4.12 doesn't like the constructs without a separator.
2024-01-05x86: corrections to CPU attribute/flags splittingJan Beulich1-3/+16
There are a number of issues with 734dfd1cc966 ("x86: pack CPU flags in opcode table"): - the condition when two array slots need writing wasn't correct (with enough new Cpu* added an out of bounds array access would validly have been complained about by the compiler), - table generation didn't take into account CpuAttrUnused and CpuUnused being independent, and hence there not always (not) being an "unused" bitfield member in both structures, - cpu_flags_from_attr() wasn't ready for use on big-endian hosts, - there were two style violations.
2024-01-05ELF: test certain .text/.data usagesJan Beulich9-0/+90
Various targets have / had overrides for .text and/or .data. Make sure that in such cases sub-section specifiers are accepted, as mandated by the doc.
2024-01-05ELF: test certain .bss usagesJan Beulich5-0/+47
Various targets have / had overrides for .bss. Make sure that in such cases - .previous still works correctly (requiring such targets to invoke obj_elf_section_change_hook() from their overriding handlers), - sub-section specifiers are accepted as far as feasible (mandated by the doc).
2024-01-05gas: correct .bss documentation for non-ELFJan Beulich1-1/+12
Only ELF permits the specification of a subsection, and even there not consistently: csky, mcore, and spu handle .bss similar to .lcomm.
2024-01-05z80: drop .bss overrideJan Beulich1-10/+0
It doesn't look to be a good idea to override the custom handlers that ELF and COFF have; afaict doing so broke .previous on ELF, and a sub- section specifier wasn't accepted either.
2024-01-05visium: drop .bss and .skip overridesJan Beulich1-22/+1
The comment in s_bss() looks bogus (perhaps simply stale, or wrongly copied from another target). It also doesn't look to be a good idea to override the custom handler that ELF has (afaict doing so broke .previous as well as sub-section specification). The override for .skip is simply pointless, for read.c having exactly the same. While there also drop two adjacent redundant (with read.h) declarations (which would be outright dangerous if read.h wasn't included anyway).
2024-01-05v850: drop .bss overrideJan Beulich1-5/+0
While there doesn't look to be anything wrong with this override, there's also no apparent reason why this override would be needed. Drop it, reducing overall size a tiny bit.
2024-01-05score: drop .bss overrideJan Beulich2-48/+2
The comment looks bogus (perhaps simply stale, or wrongly copied from another target). It also doesn't look to be a good idea to override the custom handler that ELF has (afaict doing so broke .previous as well as sub-section specification). While there also fold the identical handlers for .text (there likely is more room for such folding).