Age | Commit message (Collapse) | Author | Files | Lines |
|
Like with segment overrides on LEA, optimize away such a redundant
instruction prefix.
|
|
Swapping operands for commutative insns occurs outside of
optimize_encoding() and hence needs explicit checking for a request to
avoid any optimizations.
|
|
Dropping a meaningless segment prefix occurs outside of
optimize_encoding() and hence needs explicit checking for a request to
avoid any optimizations.
|
|
The alternative encoding is valid for MOV, but there's no such thing for
MOVABS.
|
|
Insn width granularity being 16 bits, producing byte granular output
isn't very useful. With there being a way to specific otherwise
unknown insns to the assembler, use that same representation (to be
precise: its <length>,<encoding> flavor) for disassembly.
|
|
I noticed that a comment in gas/dwarf2dbg.c describing .loc syntax was missing
the "view VALUE" option.
Fix this by adding the missing option.
|
|
SFrame format is meant for generating stack traces only.
gas/
* as.c: Replace the use of "unwind" with "stack trace".
* config/tc-aarch64.c: Likewise.
* config/tc-aarch64.h: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-i386.h: Likewise.
* gen-sframe.c: Likewise.
* gen-sframe.h: Likewise.
* testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.s: Likewise.
* testsuite/gas/cfi-sframe/cfi-sframe-common-8.s: Likewise.
* testsuite/gas/cfi-sframe/common-empty-2.s: Likewise.
* testsuite/gas/cfi-sframe/common-empty-3.s: Likewise.
|
|
Don't define this. It is defined just before elf-bfd.h is included,
but doesn't have any relevance there. Instead is for aout64.h where
the default is 4 anyway.
|
|
Provide a way for config/obj-* to clean up at end of assembly, and do
so for ELF.
* obj.h (struct format_ops): Add "end".
* config/obj-aout.c (aout_format_ops): Init new field.
* config/obj-coff.c (coff_format_ops): Likewise.
* config/obj-ecoff.c (ecoff_format_ops): Likewise.
* config/obj-elf.c (elf_format_ops): Likewise.
(elf_begin): Move later in file. Clear some more variables.
(comment_section): Make file scope.
(free_section_idx): Rewrite.
(elf_adjust_symtab): Expand str_htab_create call and use
free_section_idx as delete function.
(elf_frob_file_after_relocs): Don't clean up groups.indexes here.
(elf_end): New function.
* config/obj-elf.h (obj_end): Define.
* config/obj-multi.h (obj_end): Define.
* output-file.c (output_file_close): Call obj_end.
|
|
* dwarf2dbg.c (emit_inc_line_addr): Use unsigned constants when checking addr_delta.
|
|
This function has a gas_assert, ie. possible call to as_abort, which
calls as_report_context, which calls as_info_where.
* messages.c (as_info_where): Don't gas_assert.
|
|
Currently, when using -gdwarf-2, gas emits a v3 .debug_line contribution.
Fix this by emitting a v2 .debug_line contribution instead.
gas/ChangeLog:
2023-01-31 Tom de Vries <tdevries@suse.de>
PR 23941
* dwarf2dbg.c (DWARF2_LINE_VERSION): Set to 2 for -gdwarf-2.
(DWARF2_LINE_OPCODE_BASE): Handle DWARF2_LINE_VERSION == 2.
(dwarf2_directive_loc): Bump dwarf_level when encountering
v3 .loc options.
(out_debug_line): Don't output v3 standard opcodes for v2.
* testsuite/gas/i386/debug1.d: Update.
* testsuite/gas/i386/dwarf2-line-1.d: Update.
* testsuite/gas/i386/dwarf2-line-4.d: Update.
|
|
I noticed that some of the Power6 DFP instructions were not covered by
the assembler tests. I've added a new test file which I believe
covers all the DFP Power6 instructions.
The existing gas/testsuite/gas/ppc/power6.d test is called:
POWER6 tests (includes DFP and Altivec)
And does cover some of the DFP instructions. But, given the number of
additional instructions I'm adding I opted to add a whole new test
file. I've left the original power6.d unchanged, so there is now some
overlap, but I don't think that should hurt much.
|
|
Along with the normal JAL alias, the C-extension one should have been
moved as well by 839189bc932e ("RISC-V: re-arrange opcode table for
consistent alias handling"), for the assembler to actually be able to
use it where/when possible.
Since neither this nor any other compressed branch insn was being tested
so far, take the opportunity and introduce a new testcase covering those.
|
|
Ideally we'd do away with this somewhat questionable adjustment (leaving
i.types[] untouched). That's non-trivial though as it looks, so only
- move the logic into process_operands(), putting it closer to related
logic and eliminating a conditional for operand-less insns,
- make it consistent (i.e. also affect %xmm0), eliminating an ugly
special case later in the function.
|
|
All (there are just two) SSE2AVX templates with %xmm0 as first operand
also specify VEX3SOURCES. Hence there's no need for an "else" to the
respective if(), and the if() itself can become an assertion.
|
|
This is the correct way of expressing things; encoding the ModR/M byte
directly in base_opcode has always been bogus.
|
|
Now that we have identifiers for the mnemonic strings we can avoid
opcode based comparisons, for (in many cases) being more expensive and
(in a few cases) being a little fragile and not self-documenting.
|
|
bfd_cache_close_all is good for closing file descriptors, but doesn't
do the cleanup of bfd memory as in bfd_close_all_done.
PR 13056
* output-file.c (output_file_close): Call bfd_close_all_done,
not bfd_cache_close_all.
|
|
This tidies memory allocated for entries in macro_hash. Freeing the
macro name requires a little restructuring of the define_macro
interface due to the name being used in the error message, and exposed
the fact that the name and other fields were not initialised by the
iq2000 backend.
There is also a fix for
.macro .macro
.endm
.macro .macro
.endm
which prior to this patch reported
mac.s:1: Warning: attempt to redefine pseudo-op `.macro' ignored
mac.s:3: Error: Macro `.macro' was already defined
rather than reporting the attempt to redefine twice.
* macro.c (macro_del_f): New function.
(macro_init): Use it when creating macro_hash.
(free_macro): Free macro name too.
(define_macro): Return the macro_entry, remove idx, file, line and
namep params. Call as_where. Report errors here. Delete macro
from macro_hash on attempt to redefined pseudo-op.
(delete_macro): Don't call free_macro.
* macro.h (define_macro): Update prototype.
* read.c (s_macro): Adjust to suit.
* config/tc-iq2000.c (iq2000_add_macro): Init all fields of
macro_entry.
|
|
This is a copy of the x86 gas -gcodeview test, with changes made for the
differing instruction lengths between x86 and aarch64.
|
|
Adds the correct constant to the S_COMPILE3 CodeView record when
assembling aarch64-w64-mingw32 with the -gcodeview flag.
|
|
Entries are allocated with xmemdup0.
* dwarf2dbg.c (dwarf2_cleanup): Free dirs entries.
|
|
There's a comment a few lines earlier saying that demand_copy_C_string
has already reported an error if it returns NULL. Given the proximity
I decided not to duplicate the comment.
* dwarf2dbg.c (dwarf2_directive_filename): Check return of
demand_copy_C_string for file.
|
|
* expr.c (resolve_expression <O_left_shift, O_right_shift>): Resolve
shifts exceeding bits in a valueT to zero.
|
|
This patch adds support for the .secidx directive and its corresponding
relocation to aarch64-w64-mingw32. As with x86, this is a two-byte LE
integer which gets filled in with the 1-based index of the output
section that a symbol ends up in.
This is needed for PDBs, which represent addresses as a .secrel32,
.secidx pair.
The test is substantially the same as for amd64, but with changes made
for padding and alignment.
|
|
|
|
Now that we have identifiers for the mnemonic strings we can avoid
strcmp() in a number of places, comparing the offsets into the mnemonic
string table instead. While doing this also
- convert a leftover strncmp() to startswith() (apparently an oversight
when rebasing the original patch introducing the startswith() uses),
- use the new shorthand for current_templates->start also elsewhere in
md_assemble() (valid up to the point where match_template() is
called).
|
|
Using full pointers to reference the insn mnemonic strings is not very
efficient. With overall string size presently just slightly over 20k,
even a 16-bit value would suffice. Use "unsigned int" for now, as
there's no good use we could presently make of the otherwise saved 16
bits.
For 64-bit builds this reduces table size by 6.25% (prior to the recent
ISA extension additions it would have been 12.5%), with a similar effect
on cache occupation of table entries accessed. For PIE builds of gas
this also reduces the number of base relocations quite a bit (obviously
independent of bitness).
|
|
In preparation for changing the representation of the "name" field
introduce a wrapper function. This keeps the mechanical change separate
from the functional one.
|
|
* input-scrub.c (input_scrub_begin): Init macro_nest.
|
|
architecture revision
We noticed that a warning message about the use of scalar fp16
instructions being UNPREDICTABLE when conditionalized in an IT
block referenced the specific A-class architecture revision
ARMv8.2-A.
Many of these instructions are now also part of ARMv8.1-M, so
the warning message had become misleading. Here we just change
the message to not specify an architecture revision at all and
update all testing accordingly. This was done with a simple
find-n-replace within the binutils sources. No tests have
regressed for the arm target.
gas/ChangeLog:
* config/tc-arm.c (do_scalar_fp16_v82_encode): Remove
ARMv8.2-A from the warning message.
(do_neon_movhf): Likewise
* testsuite/gas/arm/armv8-2-fp16-scalar-bad.l: Likewise
* testsuite/gas/arm/mve-vaddsub-it-bad.l: Likewise
* testsuite/gas/arm/mve-vcvtne-it-bad.l: Likewise
* testsuite/gas/arm/mve-vcvtne-it.d: Likewise
|
|
Previously we had experienced issues with assembling a "VCVTNE" instruction
in the presence of the MVE architecture extension, because it could be
interpreted both as:
* The base instruction VCVT + NE for IT predication when inside an IT block.
* The MVE instruction VCVTN + E in the Else of a VPT block.
Given a C reproducer of:
```
int test_function(float value)
{
int ret_val = 10;
if (value != 0.0)
{
ret_val = (int) value;
}
return ret_val;
}
```
GCC generates a VCVTNE instruction based on the `truncsisf2_vfp`
pattern, which will look like:
`vcvtne.s32.f32 s-reg, s-reg`
This still triggers an error due to being misidentified as "vcvtn+e"
Similar errors were found with other type combinations and instruction
patterns (these have all been added to the testing of this patch).
This class of errors was previously worked around by:
https://sourceware.org/pipermail/binutils/2020-August/112728.html
which addressed this by looking at the operand types, however,
that isn't adequate to cover all the extra cases that have been
found. Instead, we add some special-casing logic earlier when
the instructions are parsed that is conditional on whether we are
in a VPT block or not, when the instruction is parsed.
gas/ChangeLog:
* config/tc-arm.c (opcode_lookup): Add special vcvtn handling.
* testsuite/gas/arm/mve-vcvtne-it-bad.l: Add further testing.
* testsuite/gas/arm/mve-vcvtne-it-bad.s: Likewise.
* testsuite/gas/arm/mve-vcvtne-it.d: Likewise.
* testsuite/gas/arm/mve-vcvtne-it.s: Likewise.
|
|
* expr.c (seen, nr_seen): Make file scope.
(expr_begin): Clear seen, nr_seen, and expr_symbol_lines.
(expr_end): New function.
* expr.h (expr_end): Declare.
* output-file.c (output_file_close): Call expr_end.
* config/tc-hppa.c (expr_end): Rename to expr_parse_end.
* config/tc-mips.c: Likewise.
* config/tc-riscv.c: Likewise.
* config/tc-sparc.c: Likewise.
|
|
PR 29991
* config/tc-mips.c (s_align): Call file_mips_check_options and
mips_mark_labels.
* testsuite/gas/mips/align-after-label.s,
* testsuite/gas/mips/mips-align-after-label.d,
* testsuite/gas/mips/micromips-align-after-label.d: New test.
* testsuite/gas/mips/mips.exp: Run it.
|
|
|
|
We already use C99's __func__ in places, use it more generally. This
patch doesn't change uses in the testsuite. I've also left one in
gold.h that is protected by GCC_VERSION < 4003. If any of the
remaining uses bothers anyone I invite patches.
bfd/
* bfd-in.h: Replace __FUNCTION__ with __func__.
* elf32-bfin.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfxx-sparc.c: Likewise.
* bfd-in2.h: Regenerate.
gas/
* config/tc-cris.c: Replace __FUNCTION__ with __func__.
* config/tc-m68hc11.c: Likewise.
* config/tc-msp430.c: Likewise.
gold/
* dwp.h: Replace __FUNCTION__ with __func__.
* gold.h: Likewise, except for use inside GCC_VERSION < 4003.
ld/
* emultempl/pe.em: Replace __FUNCTION__ with __func__.
* emultempl/pep.em: Likewise.
* pe-dll.c: Likewise.
|
|
PR gas/29940
With the single-operand JAL entry now sitting ahead of the two-operand
one, the parsing of a two-operand insn would first try to parse an 'a'-
style operand, resulting in the insertion of bogus (and otherwise
unused) undefined symbols in the symbol table, having register names.
Since 'a' is used as 1st operand only with J and JAL, and since JAL is
the only insn _also_ allowing for a register as 1st operand (and then
there being a 2nd one), special case this parsing aspect right there.
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
|
|
* subsegs.c (subsegs_end): Clear abs and und userdata.
|
|
now_seg, a pointer into the output file sections, isn't valid after
the output file is closed. gas doesn't and shouldn't use now_seg
after this point of course, but let's be safe.
* output-file.c (output_file_close): Clear now_seg and now_subseg.
|
|
Restores tc_pe_dwarf2_emit_offset in tc-aarch64.c, which is needed to
make sure that DWARF offsets are encoded correctly (they're secrels in
COFF). There were remnants of this there before, but they were removed
by Jedidiah's original patch - presumably because we didn't yet have
.secrel32.
|
|
This adds a mingw target for aarch64, including windres and dlltool.
Note that the old value of jmp_aarch64_bytes was wrong, and this does
the same thing as MSVC does.
|
|
Adds the .secrel32 pseudo-directive and its corresponding relocation.
|
|
This adds the remaining pe-aarch64 relocations, and gets them working.
It also brings in the constant directives from ELF, as otherwise .word
would be 2 rather than 4 bytes, and .xword and .dword wouldn't be
defined.
|
|
An earlier commit 3f107464 defined the SFRAME_FRE_TYPE_*_LIMIT
constants. These constants are used (by gas and libsframe) to pick an
SFrame FRE type based on the function size. Those constants, however,
were buggy, causing the generated SFrame sections to be bloated as
SFRAME_FRE_TYPE_ADDR2/SFRAME_FRE_TYPE_ADDR4 got chosen more often than
necessary.
gas/
* sframe-opt.c (sframe_estimate_size_before_relax): Use
typecast.
(sframe_convert_frag): Likewise.
libsframe/
* sframe.c (sframe_calc_fre_type): Use a more appropriate type
for argument. Adjust the check for SFRAME_FRE_TYPE_ADDR4_LIMIT
to keep it warning-free but meaningful.
include/
* sframe-api.h (sframe_calc_fre_type): Use a more appropriate
type for the argument.
* sframe.h (SFRAME_FRE_TYPE_ADDR1_LIMIT): Correct the constant.
(SFRAME_FRE_TYPE_ADDR2_LIMIT): Likewise.
(SFRAME_FRE_TYPE_ADDR4_LIMIT): Likewise.
|
|
PR 29952
* config/tc-i386.c (md_assemble): Avoid constructing translatable
strings.
|
|
|
|
Delete a few files only used for obsolete targets, and tidy config,
xfails and other pieces of support specific to those targets. And
since I was editing target triplets in test files, fix the nm
alpha-linuxecoff fails.
|
|
The newer update-copyright.py fixes file encoding too, removing cr/lf
on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and
embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
|
|
|