aboutsummaryrefslogtreecommitdiff
path: root/gas
AgeCommit message (Collapse)AuthorFilesLines
2022-04-07Arm32: arrange for line number emission for .instJan Beulich2-0/+23
Just like insns encoded the more conventional way these should have line number info associated with them.
2022-04-07RISC-V: add testcase to check line number emission for .insnJan Beulich1-0/+71
Since no such test looks to exist, derive one from insn.s.
2022-04-07IBM zSystems: Add support for z16 as CPU name.Andreas Krebbel4-5/+12
So far z16 was identified as arch14. After the machine has been announced we can now add the real name. gas/ChangeLog: * config/tc-s390.c (s390_parse_cpu): Add z16 as alternate CPU name. * doc/as.texi: Add z16 and arch14 to CPU string list. * doc/c-s390.texi: Add z16 to CPU string list. opcodes/ChangeLog: * s390-mkopc.c (main): Enable z16 as CPU string in the opcode table.
2022-04-06Add code to display the contents of .debug_loclists sections which contain ↵Nick Clifton2-1/+6
offset entry tables. PR 28981 * dwarf.c (fetch_indexed_value): Rename to fecth_indexed_addr and return the address, rather than a string. (fetch_indexed_value): New function - returns a value indexed by a DW_FORM_loclistx or DW_FORM_rnglistx form. (read_and_display_attr_value): Add support for DW_FORM_loclistx and DW_FORM_rnglistx. (process_debug_info): Load the loclists and rnglists sections. (display_loclists_list): Add support for DW_LLE_base_addressx, DW_LLE_startx_endx, DW_LLE_startx_length and DW_LLE_default_location. (display_offset_entry_loclists): New function. Displays a .debug_loclists section that contains offset entry tables. (display_debug_loc): Call the new function. (display_debug_rnglists_list): Add support for DW_RLE_base_addressx, DW_RLE_startx_endx and DW_RLE_startx_length. (display_debug_ranges): Display the contents of the section's header. * dwarf.h (struct debug_info): Add loclists_base field. * testsuite/binutils-all/dw5.W: Update expected output. * testsuite/binutils-all/x86-64/pr26808.dump: Likewise.
2022-04-04gas: copy st_size only if unsetFangrui Song4-14/+48
For ``` .size foo1, 1 foo1: .set bar1, foo1 .size bar1, 2 .size bar2, 2 .set bar2, foo1 .set bar3, foo2 .size bar3, 2 .size bar4, 2 .set bar4, foo2 .size foo2, 1 foo2: ``` bar1's size is 2 while bar2, bar3, bar4's is 1. The behavior of bar1 makes sense (generally directives on the new symbol should win) and is relied upon by glibc stdio-common/errlist.c: ``` .hidden _sys_errlist_internal .globl _sys_errlist_internal .type _sys_errlist_internal, @object .size _sys_errlist_internal, 1072 _sys_errlist_internal: .globl __GLIBC_2_1_sys_errlist .set __GLIBC_2_1_sys_errlist, _sys_errlist_internal .type __GLIBC_2_1_sys_errlist, %object .size __GLIBC_2_1_sys_errlist, 125 * (64 / 8) // glibc expects that .size __GLIBC_2_1_sys_errlist, 125 * (64 / 8) wins. ``` The behavior of bar2/bar3/bar4 seems brittle. To avoid the reordering of the two code blocks which will result in the bar3 situation, glibc compiles errlist.c with gcc -fno-toplevel-reorder (previously -fno-unit-at-a-time). To fix the inconsistency and improve robustness, make bar2/bar3/bar4 match bar1, removing the directive order sensitivity. There is a pity that `.size dest, 0` is indistinguishable from the case where dest is unset, but the compromise seems fine. PR gas/29012 * config/obj-elf.c (elf_copy_symbol_attributes): don't copy if src's size has been set. * testsuite/gas/elf/elf.exp: New test. * testsuite/gas/elf/size.d: New file. * testsuite/gas/elf/size.s: Likewise.
2022-03-31aarch64: Relax check for RNG system registersRichard Sandiford2-0/+13
FEAT_RNG is an optional Armv8.5-A extension, but it can be backported to earlier architectures as well. GAS previously made the RNG registers conditional on having both armv8.5-a and +rng, but only +rng should be required. This seems to be the only feature that was handled like this. opcodes/ * aarch64-opc.c (SR_RNG): Don't require V8_5. gas/ * testsuite/gas/aarch64/rng-1.s, testsuite/gas/aarch64/rng-1.d: New test.
2022-03-29gas/Dwarf: special-case .linefile only for macrosJan Beulich3-1/+29
Restrict the PR gas/16908 workaround to just macros, matching the original intention as well as the comment there. For constructs like .irp or .rept the reasoning doesn't apply, as there's no separate "invocation" point which may be of interest to record (for, as said there, short macros).
2022-03-29RISC-V: correct FCVT.Q.L[U]Jan Beulich1-2/+2
While the spec isn't explicit about this, it pointing out the similarity with the D extension ought to extend to the ignoring of a meaningless rounding mode: "Note FCVT.D.W[U] always produces an exact result and is unaffected by rounding mode." Hence the chosen encodings also ought to match. Note that to avoid breaking existing code the forms with a 3rd operand are not removed, which means there continues to be a difference to FCVT.D.W[U].
2022-03-29asan: heap buffer overflow in pa_chk_field_selectorAlan Modra1-16/+29
The buffer overflow showed up running the gas "all macro" test. PR 29005 * config/tc-hppa.c (pa_chk_field_selector): Don't read past end of line.
2022-03-25libtool.m4: fix the NM="/nm/over/here -B/option/with/path" caseNick Alcock1-7/+13
My previous nm patch handled all cases but one -- if the user set NM in the environment to a path which contained an option, libtool's nm detection tries to run nm against a copy of nm with the options in it: e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle". This is unlikely to be desirable: in this case we should run "/usr/bin/nm --blargle /usr/bin/nm". Furthermore, as part of this nm has to detect when the passed-in $NM contains a path, and in that case avoid doing a path search itself. This too was thrown off if an option contained something that looked like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run "nm -B../prev-gcc nm" which rarely works well (and indeed it looks to see whether that nm exists, finds it doesn't, and wrongly concludes that nm -p or whatever does not work). Fix all of these by clipping all options (defined as everything including and after the first " -") before deciding whether nm contains a path (but not using the clipped value for anything else), and then removing all options from the path-modified nm before looking to see whether that nm existed. NM=my-nm now does a path search and runs e.g. /usr/bin/my-nm -B /usr/bin/my-nm NM=/usr/bin/my-nm now avoids a path search and runs e.g. /usr/bin/my-nm -B /usr/bin/my-nm NM="my-nm -p../wombat" now does a path search and runs e.g. /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search: ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm This seems to be all combinations, including those used by GCC bootstrap (which, before this commit, fails to bootstrap when configured --with-build-config=bootstrap-lto, because the lto plugin is now using --export-symbols-regex, which requires libtool to find a working nm, while also using -B../prev-gcc to point at the lto plugin associated with the GCC just built.) Regenerate all affected configure scripts. * libtool.m4 (LT_PATH_NM): Handle user-specified NM with options, including options containing paths.
2022-03-25Re: gas/Dwarf: improve debug info generation from .irp and alike blocksAlan Modra1-2/+2
am33_2.0-linux is a mn10300 target. * testsuite/gas/elf/dwarf-5-irp.d: xfail am33.
2022-03-24x86: mention dropped L1OM/K1OM support in ld/ as wellJan Beulich1-2/+0
This amends e961c696dcb2 ("x86: drop L1OM/K1OM support from ld"). Also remove the marker that I mistakenly added in c085ab00c7b2 ("x86: drop L1OM/K1OM support from gas").
2022-03-23x86: reject relocations involving registersJan Beulich2-0/+17
To prevent fatal or even internal errors, add a simple check to i386_validate_fix(), rejecting relocations when their target symbol is an equate of a register (or resolved to reg_section for any other reason).
2022-03-23x86: improve resolution of register equatesJan Beulich4-2/+29
Allow transitive (or recursive) equates to work in addition to direct ones. The only requirements are that - the equate being straight of a register, i.e. no expressions involved (albeit I'm afraid something like "%eax + 0" will be viewed as %eax), - at the point of use there's no forward ref left which cannot be resolved, yet.
2022-03-23Revert "PR28977 tc-i386.c internal error in parse_register"Jan Beulich1-10/+9
This reverts commit 5fac3f02edacfca458f7eeaaaa33a87e26e0e332, which was superceeded / replaced by 4faaa10f3fab.
2022-03-23x86: don't attempt to resolve equates and alike from i386_parse_name()Jan Beulich5-2/+39
PR gas/28977 Perhaps right from its introduction in 4d1bb7955a8b it was wrong for i386_parse_name() to call parse_register(). This being a hook from the expression parser, it shouldn't be resolving e.g. equated symbols. That's relevant only for all other callers of parse_register(). To compensate, in Intel syntax mode check_register() needs calling; perhaps not doing so was an oversight right when the function was introduced. This is necessary in particular to force EVEX encoding when VRex registers are used (but of course also to reject bad uses of registers, i.e. fully matching what parse_register() needs it for).
2022-03-23gas/Dwarf5: re-use file 0 line string table entry when faking file 0Jan Beulich1-2/+10
No need to emit the same string a 2nd time for file 1 in this case.
2022-03-23gas/Dwarf5: adjust .debug_line file 0 checkingJan Beulich1-11/+10
First of all when a table entry has a NULL filename, the two inner if()s are better done the other way around: The 2nd doesn't depend on what the first does. This then renders redundant half of the conditions of the other if() and clarifies that subsequently only entry 0 is dealt with (indicating that part of the comment was wrong). Finally for there to be a usable name in slot 1, files_in_use needs to be larger than 1 and slot 1's (rather than slot 0's) name needs to be non-NULL.
2022-03-23gas/Dwarf5: drop dead codeJan Beulich1-11/+3
Commit 3417bfca676f ("GAS: DWARF-5: Ensure that the 0'th entry in the directory table contains the current... ") added a "dwarf_level < 5" check to out_dir_and_file_list(). This rendered dead that branch of the construct, due to the enclosing if()'s "DWARF2_LINE_VERSION >= 5". Delete that code as well as the corresponding part of the comment. While there also drop a redundant "dirs != NULL": "dirs" will always be non-NULL when dirs_in_use is not zero.
2022-03-23gas/Dwarf: improve debug info generation from .irp and alike blocksJan Beulich4-5/+116
Tying the bumping of the logical line number to reading from the original source file looks wrong: Upon finishing of the processing of an sb the original values will be restored anyway. Yet without bumping the line counter uses of .line inside e.g. an .irp construct won't have the intended effect: Such uses may be necessary to ensure proper debug info is emitted in particular when switching sections inside the .irp body, as dwarf2_gen_line_info() would bail without doing anything when it finds the line number unchanged from what it saw last.
2022-03-23ELF32: don't silently truncate relocation addendsJan Beulich6-9/+23
At least x86-64's x32 sub-mode and RISC-V's 32-bit mode calculate addends as 64-bit values, but store them in signed 32-bit fields when generating the file without encountering any earlier error. When the relocated field is a 64-bit one, the value resulting after processing the relocation record when linking (or the latest when loading) may thus be wrong due to the truncation. With the code change in place, one x32 testcase actually triggers the new diagnostic. That one case of too large a (negative) addend is being adjusted alongside the addition of a new testcase to actually trigger the new error. (Note that due to internal BFD behavior the relocation in .data doesn't get processed anymore after the errors in .text.) Note that in principle it is possible to express 64-bit relocations in ELF32, but this would require .rel relocations, i.e. with the addend stored in the 64-bit field being relocated. But I guess it would be a lot of effort for little gain to actually support this.
2022-03-23gas: retain whitespace between stringsJan Beulich5-3/+67
Macro arguments may be separated by commas or just whitespace. Macro arguments may also be quoted (where one level of quotes is removed in the course of determining the values for the respective formal parameters). Furthermore this quote removal knows _two_ somewhat odd escaping mechanisms: One, apparently in existence forever, is that a pair of quotes counts as the escaping of a quote, with the pair being transformed to a single quote in the course of quote removal. The other (introduced by c06ae4f232e6) looks more usual on the surface in that it deals with \" sequences, but it _retains_ the escaping \. Hence only the former mechanism is suitable when the value to be used by the macro body is to contain a quote. Yet this results in ambiguity of what "a""b" is intended to mean; elsewhere (e.g. for .ascii) it represents two successive string literals. However, in any event is the above different from "a" "b": I don't think this can be viewed the same as "a""b" when processing macro arguments. Change the scrubber to retain such whitespace, by making the processing of strings more similar to that of symbols. And indeed this appears to make sense when taking into account that for quite a while gas has been supporting quoted symbol names. Taking a more general view, however, the change doesn't go quite far enough. There are further cases where significant whitespace is removed by the scrubber. The new testcase enumerates a few in its ".if 0" section. I'm afraid the only way that I see to deal with this would be to significantly simplify the scrubber, such that it wouldn't do much more than collapse sequences of unquoted whitespace into a single blank. To be honest problems in this area aren't really surprising when seeing that there's hardly any checking of .macro use throughout the testsuite (and in particular in the [relatively] generic tests under all/).
2022-03-21x86: don't suppress overflow diagnostics in x32 modeJan Beulich3-1/+30
Unlike in 64-bit mode, where values wrap at the 64-bit boundary anyway, there's no wrapping at the 32-bit boundary here, and hence overflow detection shouldn't be suppressed just because rela relocations are going to be used. The extra check against NO_RELOC is actually a result of an ilp32 test otherwise failing. But thinking about it, reporting overflows for not-really-relocations (typically because of earlier errors) makes little sense in general. Perhaps this should even be extended to non- 64-bit modes.
2022-03-21z80 assembler: Fix new unexpected overflow warning in v2.37Nick Clifton4-1/+40
PR 28791 * config/tc-z80.c (emit_data_val): Do not warn about overlarge constants generated by bit manipulation operators. * testsuite/gas/z80/pr28791.s: New test source file. * testsuite/gas/z80/pr28791.d: New test driver file.
2022-03-20RISC-V: Fix misplaced @end tableAndreas Schwab1-1/+1
Move the csr-check and arch items inside the table for the .option directive.
2022-03-20PR28979, internal error in demand_empty_rest_of_lineAlan Modra1-6/+14
The change in read_a_source_file prevents the particular testcase in the PR from triggering the assertion in demand_empty_rest_of_line. I've also removed the assertion. Nothing much goes wrong with gas if something else triggers it, so it's not worthy of an abort. I've also changed my previous patch to ignore_rest_of_line to allow that function to increment input_line_pointer past buffer_limit, like demand_empty_rest_of_line: The two functions ought to behave the same in that respect. Finally, demand_empty_rest_of_line gets a little hardening to prevent accesses past buffer_limit plus one. PR 28979 * read.c (read_a_source_file): Calculate known size for sbuf rather than calling strlen. (demand_empty_rest_of_line): Remove "know" check. Expand comment. Don't dereference input_line_pointer when past buffer_limit. (ignore_rest_of_line): Allow input_line_pointer to increment to buffer_limit plus one. Expand comment.
2022-03-20gas:LoongArch: Fix "make check" pr21884 fail in LoongArch32.liuzhensong2-0/+9
gas/config/ * tc-loongarch.c: Add function to select target mach. * tc-loongarch.h: Define macro TARGET_MACH.
2022-03-20LoongArch: Update ABI eflag in elf header.liuzhensong1-26/+20
Update LoongArch ABI eflag in elf header. ilp32s 0x5 ilp32f 0x6 ilp32d 0x7 lp64s 0x1 lp64f 0x2 lp64d 0x3 bfd/ * elfnn-loongarch.c Check object flags while ld. gas/ * tc-loongarch.c Write eflag to elf header. include/elf * loongarch.h Define ABI number.
2022-03-20gas:LoongArch: Fix wrong line number in .debug_lineliuzhensong1-2/+2
The dwarf2_emit_insn() can create debuginfo of line. But it is called too late in append_fixp_and_insn. It causes extra offs when debuginfo of line sets address. gas/config/ * tc-loongarch.c
2022-03-20gas:LoongArch: Fix segment error in compilation due to too long symbol name.liuzhensong1-2/+6
Change "char buffer[8192];" into "char *buffer = (char *) malloc(1000 + 6 * len_str);" in function loongarch_expand_macro_with_format_map. gas/ * config/tc-loongarch.c include/ * opcode/loongarch.h opcodes/ * loongarch-coder.c
2022-03-20LoongArch: Use functions instead of magic numbers.liuzhensong1-104/+28
Replace the magic numbers in gas(tc-loongarch.c) and bfd(elfnn-loongarch.c) with the functions defined in the howto table(elfxx-loongarch.c). gas/ * config/tc-loongarch.c: use functions. bfd/ * elfnn-loongarch.c: use functions. * elfxx-loongarch.c: define functions. * elfxx-loongarch.h
2022-03-18x86: also fold remaining multi-vector-size shift insnsJan Beulich1-7/+9
By slightly relaxing the checking in operand_type_register_match() we can fold the vector shift insns with an XMM source as well. While strictly speaking an overlap in just one size (see the code comment) is not enough (both operands could have multiple sizes with just a single common one), this is good enough for all templates we have, or which could sensibly / usefully appear (within the scope of the present operand matching model). Tightening this a little would be possible, but would require broadcast related information to be passed into the function.
2022-03-18x86: fold certain AVX2 templates into their AVX counterpartsJan Beulich1-0/+23
Like for AVX512VL we can make the handling of operand sizes a little more flexible to allow reducing the number of templates we have.
2022-03-18RISC-V: Cache management instructionsTsukasa OI10-0/+70
This commit adds 'Zicbom' / 'Zicboz' instructions. bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Add handling for new instruction classes. include/ChangeLog: * opcode/riscv-opc.h (MATCH_CBO_CLEAN, MASK_CBO_CLEAN, MATCH_CBO_FLUSH, MASK_CBO_FLUSH, MATCH_CBO_INVAL, MASK_CBO_INVAL, MATCH_CBO_ZERO, MASK_CBO_ZERO): New macros. * opcode/riscv.h (enum riscv_insn_class): Add new instruction classes INSN_CLASS_ZICBOM and INSN_CLASS_ZICBOZ. opcodes/ChangeLog: * riscv-opc.c (riscv_opcodes): Add cache-block management instructions.
2022-03-18RISC-V: Prefetch hint instructions and operand setTsukasa OI6-0/+45
This commit adds 'Zicbop' hint instructions. bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Add handling for new instruction class. gas/ChangeLog: * config/tc-riscv.c (riscv_ip): Add handling for new operand type 'f' (32-byte aligned pseudo S-type immediate for prefetch hints). (validate_riscv_insn): Likewise. include/ChangeLog: * opcode/riscv-opc.h (MATCH_PREFETCH_I, MASK_PREFETCH_I, MATCH_PREFETCH_R, MASK_PREFETCH_R, MATCH_PREFETCH_W, MASK_PREFETCH_W): New macros. * opcode/riscv.h (enum riscv_insn_class): Add new instruction class INSN_CLASS_ZICBOP. opcodes/ChangeLog: * riscv-dis.c (print_insn_args): Add handling for new operand type. * riscv-opc.c (riscv_opcodes): Add prefetch hint instructions.
2022-03-18PR28977 tc-i386.c internal error in parse_registerAlan Modra1-9/+10
PR 28977 * config/tc-i386.c (parse_register): Handle X_op not O_register as for a non-reg_section symbol. Simplify array bounds check.
2022-03-18Tidy gas current_frame before exitAlan Modra1-0/+1
Releases some obstack memory on an error path. * cond.c (cond_finish_check): Call cond_exit_macro.
2022-03-18ubsan: logical_input_line signed integer overflowAlan Modra1-8/+8
To avoid a completely useless fuzzing ubsan "bug" report, I decided to make logical_input_line unsigned. * input-scrub.c (logical_input_line): Make unsigned. (struct input_save): Here too. (input_scrub_reinit, input_scrub_close, bump_line_counters), (as_where): Adjust to suit.
2022-03-17asan: use of uninitialized value in buffer_and_nestAlan Modra1-6/+7
More occurences of the same as commit d12b8d620c6a. * macro.c (buffer_and_nest): Sanity check length in buffer before calling strncasecmp.
2022-03-17asan: buffer overflows after calling ignore_rest_of_lineAlan Modra2-12/+4
operand() is not a place that should be calling ignore_rest_of_line. ignore_rest_of_line shouldn't increment input_line_pointer if already at buffer limit. * expr.c (operand): Don't call ignore_rest_of_line. * read.c (s_mri_common): Likewise. (ignore_rest_of_line): Don't increment input_line_pointer if already at buffer_limit.
2022-03-17x86: don't accept base architectures as extensionsJan Beulich4-1/+5
The -march= intentions are quite clear: A base architecture may be followed by any number of extensions. Accepting a base architecture in place of an extension will at best result in confusion, as the first of the two (or more) items specified simply would not take effect, due to being overridden by the later one(s).
2022-03-17x86: add another IAMCU testcaseJan Beulich2-2/+7
Now that {L,K}1OM support is gone, and with it the brokenness in check_cpu_arch_compatible(), put in place a test making sure that only extensions can be enabled via .arch for IAMCU, and that the base architecture cannot be changed.
2022-03-17x86: drop L1OM/K1OM support from gasJan Beulich11-607/+10
This was only rudimentary support anyway; none of the sub-architecture specific insns were ever supported.
2022-03-17x86: assorted IAMCU CPU checking fixesJan Beulich4-4/+10
The checks done by check_cpu_arch_compatible() were halfway sensible only at the time where only L1OM support was there. The purpose, however, has always been to prevent bad uses of .arch (turning off the base CPU "feature" flag) while at the same time permitting extensions to be enabled / disabled. In order to achieve this (and to prevent regressions when L1OM and K1OM support are removed) - set CpuIAMCU in CPU_IAMCU_FLAGS, - adjust the IAMCU check in the function itself (the other two similarly broken checks aren't adjusted as they're slated to be removed anyway), - avoid calling the function for extentions (which would never have the base "feature" flag set), - add a new testcase actually exercising ".arch iamcu" (which would also regress with the planned removal).
2022-03-16Delete PowerPC macro insn supportAlan Modra1-111/+3
Let's hope this stays dead, but it's here as a patch separate from those that removed use of powerpc_macros just in case it needs to be resurrected. include/ * opcode/ppc.h (struct powerpc_macro): Delete declaration. (powerpc_macros, powerpc_num_macros): Likewise.. opcodes/ * ppc-opc.c (powerpc_macros, powerpc_num_macros): Delete. gas/ * config/tc-ppc.c (ppc_macro): Delete function. (ppc_macro_hash): Delete. (ppc_setup_opcodes, md_assemble): Delete macro support.
2022-03-16PowerPC VLE extended instructions in powerpc_macrosAlan Modra1-5/+5
This moves VLE insn out of the macro table. "e_slwi" and "e_srwi" already exist in vle_opcodes as distinct instructions rather than encodings of e_rlwinm. opcodes/ * ppc-opc.c (vle_opcodes): Typo fix e_rlwinm operand. Add "e_inslwi", "e_insrwi", "e_rotlwi", "e_rotrwi", "e_clrlwi", "e_clrrwi", "e_extlwi", "e_extrwi", and "e_clrlslwi". (powerpc_macros): Delete same. Delete "e_slwi" and "e_srwi" too. gas/ * testsuite/gas/ppc/vle-simple-5.d: Update.
2022-03-16PowerPC32 extended instructions in powerpc_macrosAlan Modra2-17/+17
As for PowerPC64, move instructions to the main opcode table. opcodes/ * ppc-opc.c (insert_crwn, extract_crwn, insert_elwn, extract_elwn), (insert_erwn, extract_erwn, insert_erwb, extract_erwb), (insert_cslwn, extract_cslwb, insert_ilwb, extract_ilwn), (insert_irwb, extract_irwn, insert_rrwn, extract_rrwn), (insert_slwn, extract_slwn, insert_srwn, extract_srwn): New functions. (CRWn, ELWn, ERWn, ERWb, CSLWb, CSLWn, ILWn, ILWb, IRWn, IRWb), (RRWn, SLWn, SRWn): Define and add powerpc_operands entries. (MMB_MASK, MME_MASK, MSHMB_MASK): Define. (powerpc_opcodes): Add "inslwi", "insrwi", "rotrwi", "clrrwi", "slwi", "srwi", "extlwi", "extrwi", "sli", "sri" and corresponding record (ie. dot suffix) forms. (powerpc_macros): Delete same. gas/ * testsuite/gas/ppc/476.d: Update. * testsuite/gas/ppc/simpshft.d: Update.
2022-03-16PowerPC64 extended instructions in powerpc_macrosAlan Modra3-16/+16
The extended instructions implemented in powerpc_macros aren't used by the disassembler. That means instructions like "sldi r3,r3,2" appear in disassembly as "rldicr r3,r3,2,61", which is annoying since many other extended instructions are shown. Note that some of the instructions moved out of the macro table to the opcode table won't appear in disassembly, because they are aliases rather than a subset of the underlying raw instruction. If enabled, rotrdi, extrdi, extldi, clrlsldi, and insrdi would replace all occurrences of rotldi, rldicl, rldicr, rldic and rldimi. (Or many occurrences in the case of clrlsldi if n <= b was added to the extract functions.) The patch also fixes a small bug in opcode sanity checking. include/ * opcode/ppc.h (PPC_OPSHIFT_SH6): Define. opcodes/ * ppc-opc.c (insert_erdn, extract_erdn, insert_eldn, extract_eldn), (insert_crdn, extract_crdn, insert_rrdn, extract_rrdn), (insert_sldn, extract_sldn, insert_srdn, extract_srdn), (insert_erdb, extract_erdb, insert_csldn, extract_csldb), (insert_irdb, extract_irdn): New functions. (ELDn, ERDn, ERDn, RRDn, SRDn, ERDb, CSLDn, CSLDb, IRDn, IRDb): Define and add associated powerpc_operands entries. (powerpc_opcodes): Add "rotrdi", "srdi", "extrdi", "clrrdi", "sldi", "extldi", "clrlsldi", "insrdi" and corresponding record (ie. dot suffix) forms. (powerpc_macros): Delete same from here. gas/ * config/tc-ppc.c (insn_validate): Don't modify value passed to operand->insert for PPC_OPERAND_PLUS1 when calculating mask. Handle PPC_OPSHIFT_SH6. * testsuite/gas/ppc/prefix-reloc.d: Update. * testsuite/gas/ppc/simpshft.d: Update. ld/ * testsuite/ld-powerpc/elfv2so.d: Update. * testsuite/ld-powerpc/notoc.d: Update. * testsuite/ld-powerpc/notoc3.d: Update. * testsuite/ld-powerpc/tlsdesc2.d: Update. * testsuite/ld-powerpc/tlsget.d: Update. * testsuite/ld-powerpc/tlsget2.d: Update. * testsuite/ld-powerpc/tlsopt5.d: Update. * testsuite/ld-powerpc/tlsopt6.d: Update.
2022-03-09Constant fold view increment expressionsAlan Modra2-6/+14
The idea here is to replace expressions like v + 1 + 1 + 1 with v + 3. * dwarf2dbg.c (set_or_check_view): Remove useless assertion. Resolve multiple view increments. * testsuite/gas/elf/dwarf2-18.d: Don't xfail mep.
2022-03-09Reduce duplicated symbol_clone_if_forward_ref workAlan Modra1-3/+8
* symbol.c (struct symbol_flags): Add forward_resolved. (symbol_entry_find): Update needle initialisation. (symbol_clone_if_forward_ref): Do no work when forward_resolved is already set. Set forward_resolved.