aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-03-12aix: implement TLS relocation for gas and ldClément Chigot30-133/+1039
Add support for TLS in XCOFF. Amongst the things done by this commit: - Update XCOFF auxialiary header to match new version and allow TLS sections. - Add TLS sections (.tdata and .tbss) support in gas and ld. - Add support for the TLS relocations in gas and ld. Two different types BFD_RELOC are created for PPC and PPC64 as the size is a pointer, thus distinct in 32 or 64bit. The addresses given by ld to .tdata and .tbss is a bit special. In XCOFF, these addresses are actually offsets from the TLS pointer computed at runtime. AIX assembly and linker does the same. In top of that, the .tdata must be before .data (this is mandatory for AIX loader). Thus, the aix ld script is recomputing "." before .data to restore its original value. There might be a simpler way, but this one is working. Optimisation linked to TLS relocations aren't yet implemented. bfd/ * reloc.c (BFD_RELOC_PPC_TLS_LE, BFD_RELOC_PPC_TLS_IE, BFD_RELOC_PPC_TLS_M, BFD_RELOC_PPC_TLS_ML, BFD_RELOC_PPC64_TLS_GD, BFD_RELOC_PPC64_TLS_LD, BFD_RELOC_PPC64_TLS_LE, BFD_RELOC_PPC64_TLS_IE, BFD_RELOC_PPC64_TLS_M, BFD_RELOC_PPC64_TLS_ML): New relocations. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * coff-rs6000.c (xcoff_calculate_relocation): Call xcoff_reloc_type_tls for TLS relocations. (xcoff_howto_table): Implement TLS relocations. (_bfd_xcoff_reloc_type_lookup): Add cases TLS relocations. (xcoff_reloc_type_tls): New function. * coff64-rs6000.c (xcoff_calculate_relocation): Likewise. (xcoff_howto_table): Likewise. (_bfd_xcoff_reloc_type_lookup): Likewise. * coffcode.h (sec_to_styp_flags): Handle TLS sections. (styp_to_sec_flags): Likewise. (coff_compute_section_file_positions): Avoid file offset optimisation for .data when the previous section is .tdata. (coff_write_object_contents): Handle TLS sections. * coffswap.h (coff_swap_aouthdr_out): Add support for new fields in aouthdr. * libxcoff.h (xcoff_reloc_type_tls): Add prototype. * xcofflink.c (xcoff_link_add_symbols): Handle XMC_UL. (xcoff_need_ldrel_p): Add cases for TLS relocations. (xcoff_create_ldrel): Add l_symndx for TLS sections. gas/ * config/tc-ppc.c (ppc_xcoff_text_section, ppc_xcoff_data_section, (ppc_xcoff_bss_section, ppc_xcoff_tdata_section, (ppc_xcoff_tbss_section): New variables. (ppc_text_subsegment, ppc_text_csects, ppc_data_subgments, (ppc_data_csects): Removed. (ppc_xcoff_section_is_initialized, ppc_init_xcoff_section, ppc_xcoff_parse_cons): New functions. (md_being): Initialize XCOFF sections. (ppc_xcoff_suffix): Add support for TLS relocations (fixup_size, md_apply_fix): Add support for new BFD_RELOC. (ppc_change_csect): Handle XMC_TL, XMC_UL. Correctly, add XMC_BS to .bss section. Handle new XCOFF section variables. (ppc_comm): Likewise. (ppc_toc): Likewise. (ppc_symbol_new_hook): Likewise. (ppc_frob_symbol): Likewise. (ppc_fix_adjustable): Add tbss support. * config/tc-ppc.h (TC_PARSE_CONS_EXPRESSION): New define. (ppc_xcoff_parse_cons): Add prototype. (struct ppc_xcoff_section): New structure. ld/ * emultempl/aix.em: Ensure .tdata section is removed if empty, even with -r flag. * scripttempl/aix.sc: Handle TLS sections. * testsuite/ld-powerpc/aix52.exp: Add new tests. * testsuite/ld-powerpc/aix-tls-reloc-32.d: New test. * testsuite/ld-powerpc/aix-tls-reloc-64.d: New test. * testsuite/ld-powerpc/aix-tls-reloc.ex: New test. * testsuite/ld-powerpc/aix-tls-reloc.s: New test. * testsuite/ld-powerpc/aix-tls-section-32.d: New test. * testsuite/ld-powerpc/aix-tls-section-64.d: New test. * testsuite/ld-powerpc/aix-tls-section.ex: New test. * testsuite/ld-powerpc/aix-tls-section.s: New test. include/ * coff/internal.h (struct internal_aouthdr): Add new fields. * coff/rs6000.h (AOUTHDRÃ): Add new fields. * coff/rs6k64.h (struct external_filehdr): Likewise. * coff/xcoff.h (_TDATA), _TBSS): New defines (RS6K_AOUTHDR_TLS_LE, RS6K_AOUTHDR_RAS, RS6K_AOUTHDR_ALGNTDATA, RS6K_AOUTHDR_SHR_SYMTAB, RS6K_AOUTHDR_FORK_POLICY, RS6K_AOUTHDR_FORK_COR): New defines. (XMC_TU): Removed. (XMC_UL): New define.
2021-03-12aix: implement R_TOCU and R_TOCL relocationsClément Chigot15-31/+376
Implement support for largetoc on XCOFF. R_TOCU and R_TOCL are referenced by the new BFD defines: BFD_RELOC_PPC_TOC16_HI and BFD_RELOC_PPC_TOC16_LO. A new toc storage class is added XMC_TE. In order to correctly handle R_TOCU, the logic behind xcoff_reloc_type_toc is changed to compute the whole TOC offset instead of just the difference between the "link" offset and the "assembly" offset. In gas, add a function to transform addis format used by AIX "addis RT, D(RA)" into the ELF format "addis RT, RA, SI". bfd/ * reloc.c (BFD_RELOC_PPC_TOC16_HI, BFD_RELOC_PPC_TOC16_LO): New relocations. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * coff-rs6000.c (xcoff_calculate_relocation): Call xcoff_reloc_type_toc for R_TOCU and R_TOCL. (xcoff_howto_table): Remove src_mask for TOC relocations. Add R_TOCU and R_TOCL howtos. (_bfd_xcoff_reloc_type_lookup): Add cases for BFD_RELOC_PPC_TOC16_HI and BFD_RELOC_PPC_TOC16_LO. (xcoff_reloc_type_toc): Compute the whole offset. Implement R_TOCU and R_TOCL. * coff64-rs6000.c (xcoff64_calculate_relocation): Likewise. (xcoff64_howto_table): Likewise. (xcoff64_reloc_type_lookup): Likewise. gas/ * config/tc-ppc.c (ppc_xcoff_suffix): New function. (MAP, MAP32, MAP64): New macros for XCOFF. (ppc_xcoff_fixup_addis): New function. (ppc_is_toc_sym): Handle XMC_TE. (fixup_size): Add cases for BFD_RELOC_PPC_TOC16_HI and BFD_RELOC_PPC_TOC16_LO. (md_assemble): Call ppc_xcoff_fixup_addis for XCOFF. (ppc_change_csect): Handle XMC_TE. (ppc_tc): Enable .tc symbols to have only a XMC_TC or XMC_TE storage class. (ppc_symbol_new_hook): Handle XMC_TE. (ppc_frob_symbol): Likewise. (ppc_fix_adjustable): Likewise. (md_apply_fix): Handle BFD_RELOC_PPC_TOC16_HI and BFD_RELOC_PPC_TOC16_LO. ld/ * scripttempl/aix.sc: Add .te to .data section. * testsuite/ld-powerpc/aix52.exp: Add test structure for AIX7+. Add aix-largetoc-1 test. * testsuite/ld-powerpc/aix-largetoc-1-32.d: New test. * testsuite/ld-powerpc/aix-largetoc-1-64.d: New test. * testsuite/ld-powerpc/aix-largetoc-1.ex: New test. * testsuite/ld-powerpc/aix-largetoc-1.s: New test.
2021-03-12aix: correct HOWTO table and add missing relocationsClément Chigot8-239/+400
Since the last time AIX HOWTO table was modified, IBM has now released an official documentation about XCOFF relocations. This commit corrects the wrong ones and add some missing. For now, the "custom" relocations made for xcoff_rtype2howto have been kept. The new relocations are still set as EMPTY_HOWTO because they will be implemented in later commits. In xcoff[64]_ppc_relocate_section, instead of recreating howto from scratch, it's better to use the existing howto from the table and fixing it according to r_size field. bfd/ * coff-rs6000.c (xcoff_calculate_relocation): Correct and add new relocations. (xcoff_howto_table): Likewise. (xcoff_rtype2howto): Increase r_type maximum value. (xcoff_ppc_relocate_section): Reuse predefined HOWTOs instead of create a new one from scratch. Enable only some relocations to have a changing r_size. * coff64-rs6000.c (xcoff64_calculate_relocation): Likewise. (xcoff64_howto_table): Likewise. (xcoff64_rtype2howto): Likewise. (xcoff64_ppc_relocate_section): Likewise. * libxcoff.h (XCOFF_MAX_CALCULATE_RELOCATION): Fix value. binutils/ * od-xcoff.c: Replace RTB by TRL entry. include/ * coff/xcoff.h (R_RTB): Remove. (R_TRL): Fix value.
2021-03-12bfd: move xcoff64_ppc_relocate_section after the HOWTO tableClément Chigot2-188/+194
This will be needed for later commits, as xcoff64_ppc_relocate_section will use the HOWTO table unlike now. * coff64-rs6000.c (xcoff64_ppc_relocate_section): Move.
2021-03-12bfd: use default coff_write_object_contents for XCOFF64Clément Chigot3-351/+14
There is no need for XCOFF64 to have is own write_object_contents. * coff64-rs6000.c (xcoff64_write_object_contents): Remove. * coffcode.h (coff_write_object_contents): Add bfd_mach_ppc_620 support for o_cputype field. Avoid creating an empty a.out header for XCOFF64.
2021-03-12bfd: add missing smclass when creating csect for xcoff64Clément Chigot2-3/+8
* coff64-rs6000.c (xcoff64_create_csect_from_smclas): Add missing smclass.
2021-03-12Re: x86: correct decoding of nop/reserved space (0f18 ... 0x1f)Alan Modra2-1/+5
* i386-dis.c (print_insn <PREFIX_IGNORED>): Correct typo.
2021-03-12PE image base falloutAlan Modra7-21/+53
Fixes x86_64-w64-mingw32 tests that failed with the recent diagnosis for out of range RVA, and a couple of other gc-sections tests that failed for other reasons. * testsuite/ld-gc/gc.exp: Pass "-image-base 0" to ld for PE, and arrange to define __main for some run_dump_test tests. * testsuite/ld-gc/pr13683.d: Accept more symbols. * testsuite/ld-gc/pr14265.d: Likewise, and ordering. * testsuite/ld-scripts/crossref.exp: Pass "-image-base 0" to ld for PE. * testsuite/ld-srec/srec.exp: Likewise. * testsuite/lib/ld-lib.exp (ld_link_defsyms): Use is_pecoff_format.
2021-03-12Automatic date update in version.inGDB Administrator1-1/+1
2021-03-11x86: re-order logic in OP_XMM()Jan Beulich2-35/+35
Instead of excluding an increasing number of modes in the initial if(), check the special modes first.
2021-03-11x86: drop a few redundant EVEX-related checksJan Beulich2-4/+10
vex.b can only be set when vex.evex is also set. Similarly vex.evex can only be set when need_vex is also set.
2021-03-11x86: remove stray uses of xmmq_modeJan Beulich2-4/+6
xmmq_mode is documented to not allow for broadcast - don't include it in respective checks in OP_E_memory().
2021-03-11RISC-V: Improve multiple relax passes problem.Nelson Chu8-10/+108
According to the commit abd20cb637008da9d32018b4b03973e119388a0a, an intersting thing is that - the more relax passes, the more chances of relaxations are reduced [1]. Originally, we set the boolean `again` to TRUE once the code is actually deleted, and then we run the relaxations repeatedly if `again` is still TRUE. But `again` only works for the relax pass itself, and won't affect others. That is - we can not use `again` to re-run the relax pass when we already enter into the following passes (can not run the relax passes backwards). Besides, we must seperate the PCREL relaxations into two relax passes for some reasons [2], it make us lose some relax opportunities. This patch try to fix the problem, and the basic idea was come from Jim Wilson - we use a new boolean, restart_relax, to determine if we need to run the whole relax passes again from 0 to 2. Once we have deleted the code between relax pass 0 to 2, the restart_relax will be set to TRUE, we should run the whole relaxations again to give them more chances to shorten the code. We will only enter into the relax pass 3 when the restart_relax is FALSE, since we can't relax anything else once we start to handle the alignments. I have passed the gcc/binutils regressions by riscv-gnu-toolchain, and looks fine for now. [1] https://sourceware.org/pipermail/binutils/2020-November/114223.html [2] https://sourceware.org/pipermail/binutils/2020-November/114235.html bfd/ * elfnn-riscv.c (riscv_elf_link_hash_table): New boolean restart_relax, used to check if we need to run the whole relaxations from relax pass 0 to 2 again. (riscv_elf_link_hash_table_create): Init restart_relax to FALSE. (_bfd_riscv_relax_align): Remove obsolete sec_flg0 set. (_bfd_riscv_relax_delete): Set again to TRUE if we do delete the code. (bfd_elfNN_riscv_restart_relax_sections): New function. Called by after_allocation to check if we need to run the whole relaxations again. (_bfd_riscv_relax_section): We will only enter into the relax pass 3 when the restart_relax is FALSE; At last set restart_relax to TRUE if again is TRUE, too. * elfxx-riscv.h (bfd_elf32_riscv_restart_relax_sections): Declaration. (bfd_elf64_riscv_restart_relax_sections): Likewise. ld/ * emultempl/riscvelf.em (after_allocation): Run ldelf_map_segments many times if riscv_restart_relax_sections returns TRUE. * testsuite/ld-riscv-elf/restart-relax.d: New testcase. Before applying this patch, the call won't be relaxed to jal; But now we have more chances to do relaxations. * testsuite/ld-riscv-elf/restart-relax.s: Likewise. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
2021-03-11Automatic date update in version.inGDB Administrator1-1/+1
2021-03-10Use bool for "parse_completion"Tom Tromey4-13/+24
Some spots in GDB already use bool for "parse_completion", but a few were still using int. This patch updates these to bool. I'm checking this in. gdb/ChangeLog 2021-03-10 Tom Tromey <tromey@adacore.com> * parser-defs.h (parser_state): Change completion to bool. <parse_completion>: Likewise. * ada-lang.h (ada_find_operator_symbol, ada_resolve_funcall) (ada_resolve_variable, ada_resolve_function): Update. * ada-lang.c (ada_find_operator_symbol): Change parse_completion to bool. (ada_resolve_funcall, ada_resolve_variable) (ada_resolve_function): Likewise.
2021-03-10x86/Intel: correct AVX512 S/G disassemblyJan Beulich13-1044/+981
Commit 6ff00b5e12e7 ("x86/Intel: correct permitted operand sizes for AVX512 scatter/gather") brought the assembler side of AVX512 S/G insn handling in line with AVX2's, but the disassembler side was forgotten. This has the benefit of - allowing to fold a number of table entries, - rendering a few #define-s and enumerators unused.
2021-03-10x86: re-arrange enumerator and table entry orderJan Beulich2-77/+100
Some of the enumerators have ended up misplaced under the general current ordering scheme. Move them (and their table entries) around accordingly. Add a couple of blank lines as separators when close to code being touched anyway. Also drop the odd 0F from 0FXOP (there's no "0f" involved there anywhere) infixes where the respective enum gets played with anyway.
2021-03-10x86: reuse further VEX entries for EVEXJan Beulich6-98/+46
When the VEX.L=1 decode matches that of both EVEX.L'L=1 and EVEX.L'L=2 (typically when all three are invalid) the (smaller) VEX table entry can be reused by EVEX, instead of duplicating data. (Note that XM and XMM as well as EXxmm_md and EXd are equivalent at least for the purposes here.)
2021-03-10x86: reuse VEX entries for EVEX vperm{q,pd}Jan Beulich5-22/+20
By matching VEX decode order (L before W), some EVEX entries can refer back to VEX ones instead of carrying duplicates.
2021-03-10x86: re-arrange order of decode for various EVEX opcodesJan Beulich7-439/+249
The order of decodes influences the overall number of table entries. Reduce table size quite a bit by first decoding few-alternatives attributes common to all valid leaves. This also adds a PREFIX_DATA 7531c61332db ("x86: simplify decode of opcodes valid with (embedded) 66 prefix only") missed to apply to vbroadcastf64x4.
2021-03-10x86: re-arrange order of decode for various mask reg opcodesJan Beulich2-600/+427
The order of decodes influences the overall number of table entries. Reduce table size quite a bit by first decoding few-alternatives attributes common to all valid leaves.
2021-03-10x86: re-arrange order of decode for various VEX opcodesJan Beulich2-154/+104
The order of decodes influences the overall number of table entries. Reduce table size quite a bit by first decoding few-alternatives attributes common to all valid leaves.
2021-03-10x86: re-arrange order of decode for various legacy opcodesJan Beulich2-70/+43
The order of decodes influences the overall number of table entries. Reduce table size quite a bit by first decoding few-alternatives attributes common to all valid leaves.
2021-03-10x86: correct decoding of nop/reserved space (0f18 ... 0x1f)Jan Beulich10-64/+2433
All encodings not used in this range are (reserved) NOPs. Hence their decoding should be fully consistent. For this to work the PREFIX_IGNORED logic needs slightly extending, such that the attribute will also - have an effect when used inside prefix_table[], yet without always falling back to using slot 0, - cause prefixes marked as ignored while decoding through prefix_table[] to no longer be considered decoded, when encountered in a subsequent decoding step. In adjacent code also drop meaningless PREFIX_OPCODE.
2021-03-10bfd: strip symbols not representable in COFF/PE symbol tableJan Beulich6-4/+27
The offset-within-section field in the symbol table entry is only 32 bits wide, so rather than emitting bogus entries omit them, and issue a diagnostic identifying the issue. This requires adjusting the PR/22267 test to no longer produce symbols with out of range values on 64-bit BFD. This also depends on adjustments to testsuite/ld-scripts/map-address.* made by an earlier patch. The purpose of the test can very well be achieved nevertheless.
2021-03-10Automatic date update in version.inGDB Administrator1-1/+1
2021-03-10ELF DWARF in PE outputAlan Modra2-2/+21
* elf.c (bfd_elf_generic_reloc): Make references between debug sections use section relative values.
2021-03-09Fix function call regression in new evaluatorTom Tromey5-1/+94
The internal AdaCore test suite revealed a bug in the new evaluator. A hunk of evaluate_funcall was not correctly transcribed. This was not caught in my original testing because the feature in question was apparently not tested in gdb. This patch fixes the oversight. The idea here is that ordinary function calls should use the function's formal parameter types as the expected types of subexpressions. Regression tested on x86-64 Fedora 32. gdb/ChangeLog 2021-03-09 Tom Tromey <tromey@adacore.com> * eval.c (operation::evaluate_funcall): Use function formal parameter types when evaluating. gdb/testsuite/ChangeLog 2021-03-09 Tom Tromey <tromey@adacore.com> * gdb.base/cast-call.exp: New file. * gdb.base/cast-call.c: New file.
2021-03-09ld: adjust PE base relocations testcaseJan Beulich3-1/+15
mcore-pe and sh-pe pointed out that the testcase added by 6fa7408d72b3 ("ld: don't generate base relocations in PE output for absolute symbols") wasn't quite generic enough yet. Copy entry point stuff from another test and increase alignment to also cover targets with a page size lower than 4k. Despite all of this the test needs to be xfail-ed for mcore, as this target isn't included in the set getting DLL_SUPPORT enabled in emultempl/pe.em, and hence no base relocations get generated there (yet).
2021-03-09gdb: fix field names of GDB's type main_type structureAndrew Burgess4-3/+155
In commit: commit 5b7d941b90d1a232dc144dc14850dd2fb63c35da Date: Fri Jan 22 12:21:09 2021 -0500 gdb: add owner-related methods to struct type two fields of struct maint_type were renamed. 'flag_objfile_owned' became 'm_flag_objfile_owned' and 'owner' became 'm_owner'. Update our python helper script to take this into account. I've added a basic test that uses the self-test framework to load the pretty printers, and print a type. The test relies on stopping in GDB's `value_print` function. gdb/ChangeLog: * gdb-gdb.py.in (StructMainTypePrettyPrinter) <owner_to_string>: Updated fields names flag_objfile_owned to m_flag_objfile_owned, and owner to m_owner. gdb/testsuite/ChangeLog: * gdb.gdb/python-helper.exp: New file.
2021-03-09gdb/fortran: Add 'LOC' intrinsic support.Felix Willgerodt7-1/+51
LOC(X) returns the address of X as an integer: https://gcc.gnu.org/onlinedocs/gfortran/LOC.html Before: (gdb) p LOC(r) No symbol "LOC" in current context. After: (gdb) p LOC(r) $1 = 0xffffdf48 gdb/ChangeLog: 2021-03-09 Felix Willgerodt <felix.willgerodt@intel.com> * f-exp.h (eval_op_f_loc): Declare. (expr::fortran_loc_operation): New typedef. * f-exp.y (exp): Handle UNOP_FORTRAN_LOC after parsing an UNOP_INTRINSIC. (f77_keywords): Add LOC keyword. * f-lang.c (eval_op_f_loc): New function. * std-operator.def (UNOP_FORTRAN_LOC): New operator. gdb/testsuite/ChangeLog: 2020-03-09 Felix Willgerodt <felix.willgerodt@intel.com> * gdb.fortran/intrinsics.exp: Add LOC tests.
2021-03-09gdb/fotran: add support for the 'shape' keywordAndrew Burgess8-0/+277
Add support for the SHAPE keyword to GDB's Fortran expression parser. gdb/ChangeLog: * f-exp.h (eval_op_f_array_shape): Declare. (fortran_array_shape_operation): New type. * f-exp.y (exp): Handle UNOP_FORTRAN_SHAPE after parsing UNOP_INTRINSIC. (f77_keywords): Add "shape" keyword. * f-lang.c (fortran_array_shape): New function. (eval_op_f_array_shape): New function. * std-operator.def (UNOP_FORTRAN_SHAPE): New operator. gdb/testsuite/ChangeLog: * gdb.fortran/shape.exp: New file. * gdb.fortran/shape.f90: New file.
2021-03-09gdb/fortran: add support for 'SIZE' keywordAndrew Burgess8-0/+359
Add support for the 'SIZE' keyword to the Fortran expression parser. This returns the number of elements either in an entire array (passing a single argument to SIZE), or in a particular dimension of an array (passing two arguments to SIZE). At this point I have not added support for the optional third argument to SIZE, which controls the exact integer type of the result. gdb/ChangeLog: * f-exp.y (eval_op_f_array_size): Declare 1 and 2 argument forms of this function. (expr::fortran_array_size_1arg): New type. (expr::fortran_array_size_2arg): Likewise. * f-exp.y (exp): Handle FORTRAN_ARRAY_SIZE after parsing UNOP_OR_BINOP_INTRINSIC. (f77_keywords): Add "size" keyword. * f-lang.c (fortran_array_size): New function. (eval_op_f_array_size): New function, has a 1 arg and 2 arg form. * std-operator.def (FORTRAN_ARRAY_SIZE): New operator. gdb/testsuite/ChangeLog: * gdb.fortran/size.exp: New file. * gdb.fortran/size.f90: New file.
2021-03-09gdb/fortran: add support for RANK keywordAndrew Burgess8-0/+189
gfortran supports the RANK keyword, see: https://gcc.gnu.org/onlinedocs/gfortran/RANK.html#RANK this commit adds support for this keyword to GDB's Fortran expression parser. gdb/ChangeLog: * f-exp.h (eval_op_f_rank): Declare. (expr::fortran_rank_operation): New typedef. * f-exp.y (exp): Handle UNOP_FORTRAN_RANK after parsing an UNOP_INTRINSIC. (f77_keywords): Add "rank" keyword. * f-lang.c (eval_op_f_rank): New function. * std-operator.def (UNOP_FORTRAN_RANK): New operator. gdb/testsuite/ChangeLog: * gdb.fortran/rank.exp: New file. * gdb.fortran/rank.f90: New file.
2021-03-09x86: fold some prefix related attributes into a single oneJan Beulich7-7512/+7536
RepPrefixOk, HLEPrefixOk, and NoTrackPrefixOk can't be specified together, so can share an enum-like field. IsLockable can be inferred from HLE setting and hence only needs specifying when neither of them is present.
2021-03-09x86-64: make SYSEXIT handling similar to SYSRET'sJan Beulich16-10/+46
Despite SYSEXIT being an Intel-only insn in long mode, its behavior there is similar to SYSRET's: Depending on REX.W execution continues in either 64-bit or compatibility mode. Hence distinguishing by suffix is as necessary here as it is there.
2021-03-09bfd: don't silently wrap or truncate PE image section RVAsJan Beulich14-19/+69
In PE images section addresses get expressed as addresses relative to the image base. Therefore the VA of a section must be no less than the image base, and after subtraction of the image base the resulting value should fit in 32 bits. (The issue is particularly obvious to notice when sections, perhaps because of ELF assumptions, get placed at VA 0 by default. Debugging info sections as well as .comment, when input files are ELF, are a good example. All such sections need proper mentioning in the linker script to avoid this warning.) There are a number of test cases which previously produced bogus images, yet still declared the test a success. Like done for other tests already, force a zero image base for these. This then also allows (and requires) dropping again xfail-s which 39a7b38fac0e ("Fix linker tests to work with 16-bit targets") had added to ld-scripts/default-script*.d (originally as skip-s). This also depends on similar adjustments to testsuite/ld-scripts/map-address.* made by an earlier patch. For ld-scripts/print-memory-usage.* I suppose xcoff could be dropped from the exclusion list by suppressing garbage collection, just like already done in e.g. (as seen in the diff here) ld-scripts/data.*, but I didn't want to make unrelated adjustments.
2021-03-09Automatic date update in version.inGDB Administrator1-1/+1
2021-03-08Enable maintainer mode for simTom Tromey5-16/+80
The sim's recently switch to using Automake caused a build failure for me, because I didn't have the correct auto* tools in my path. However, the rule in the tree is that this is not needed in general. This patch adds a call to AM_MAINTAINER_MODE, to align the sim with the way the rest of the tree works here. sim/ChangeLog 2021-03-08 Tom Tromey <tromey@adacore.com> * aclocal.m4, configure, Makefile.in: Rebuild. * configure.ac: Use AM_MAINTAINER_MODE.
2021-03-08Remove some null checksTom Tromey3-16/+20
When not parsing for completion, parse_expression ensures that the resulting expression has operations. This patch removes a couple of unnecessary checks for this situation. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * printcmd.c (set_command): Remove null check. * value.c (init_if_undefined_command): Remove null check.
2021-03-08Use bound_minimal_symbol in var_msym_value_operationTom Tromey12-61/+61
This changes var_msym_value_operation to use a bound_minimal_symbol rather than separate minsym and objfile parameters. The main benefit of this is removing the possibly-confusing check_objfile overload for a plain minimal symbol. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * parse.c (parser_state::push_symbol, parser_state::push_dollar): Update. * p-exp.y (variable): Update. * go-exp.y (variable): Update. * expprint.c (dump_for_expression): Use bound_minimal_symbol. Remove overload for objfile. * expop.h (eval_op_var_msym_value): Use bound_minimal_symbol parameter. (check_objfile): Likewise. (dump_for_expression): Likewise. Remove overload for objfile. (class var_msym_value_operation): Use bound_minimal_symbol. * eval.c (eval_op_var_msym_value): Use bound_minimal_symbol parameter. (var_msym_value_operation::evaluate_for_address) (var_msym_value_operation::evaluate_for_sizeof) (var_msym_value_operation::evaluate_for_cast): Update. * d-exp.y (PrimaryExpression): Update. * c-exp.y (variable): Update. * ax-gdb.c (var_msym_value_operation::do_generate_ax): Update. * ada-lang.c (ada_var_msym_value_operation::evaluate_for_cast): Update. * ada-exp.y (write_var_or_type): Update.
2021-03-08Change exp_uses_objfile to return boolTom Tromey3-5/+10
This change exp_uses_objfile to return bool. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * parser-defs.h (exp_uses_objfile): Return bool. * parse.c (exp_uses_objfile): Return bool.
2021-03-08Remove EVAL_SKIPTom Tromey11-164/+56
EVAL_SKIP was needed in the old expression implementation due to its linearized tree structure. This is not needed in the new implementation, because it is trivial to not evaluate a subexpression. This patch removes the last vestiges of EVAL_SKIP. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * value.h (eval_skip_value): Don't declare. * opencl-lang.c (eval_opencl_assign): Update. * m2-lang.c (eval_op_m2_high, eval_op_m2_subscript): Update. * f-lang.c (eval_op_f_abs, eval_op_f_mod, eval_op_f_ceil) (eval_op_f_floor, eval_op_f_modulo, eval_op_f_cmplx): Remove. * expression.h (enum noside) <EVAL_SKIP>: Remove. * expop.h (typeof_operation::evaluate) (decltype_operation::evaluate, unop_addr_operation::evaluate) (unop_sizeof_operation::evaluate, assign_operation::evaluate) (cxx_cast_operation::evaluate): Update. * eval.c (eval_skip_value): Remove. (eval_op_scope, eval_op_var_entry_value) (eval_op_func_static_var, eval_op_string, eval_op_objc_selector) (eval_op_concat, eval_op_ternop, eval_op_structop_struct) (eval_op_structop_ptr, eval_op_member, eval_op_add, eval_op_sub) (eval_op_binary, eval_op_subscript, eval_op_equal) (eval_op_notequal, eval_op_less, eval_op_gtr, eval_op_geq) (eval_op_leq, eval_op_repeat, eval_op_plus, eval_op_neg) (eval_op_complement, eval_op_lognot, eval_op_ind) (eval_op_memval, eval_op_preinc, eval_op_predec) (eval_op_postinc, eval_op_postdec, eval_op_type) (eval_binop_assign_modify, eval_op_objc_msgcall) (eval_multi_subscript, logical_and_operation::evaluate) (logical_or_operation::evaluate, array_operation::evaluate) (operation::evaluate_for_cast) (var_msym_value_operation::evaluate_for_cast) (var_value_operation::evaluate_for_cast): Update. * c-lang.c (c_string_operation::evaluate): Update. * c-exp.h (objc_nsstring_operation::evaluate) (objc_selector_operation::evaluate): Update. * ada-lang.c (ada_assign_operation::evaluate) (eval_ternop_in_range, ada_unop_neg, ada_unop_in_range) (ada_atr_size): Update.
2021-03-08Merge namespace scopes in eval.cTom Tromey2-10/+4
The big deletion patch left some identical namespace scopes sitting next to one another. This patch removes the redundant "namespace expr"s. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c: Merge "namespace" scopes.
2021-03-08Inline expr_builder methodsTom Tromey3-16/+15
This inlines the expr_builder constructor and release method. These are straightforward, so this seemed simpler. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * parser-defs.h (struct expr_builder) <expr_builder>: Inline. <release>: Inline. * parse.c (expr_builder::expr_builder, expr_builder::release): Remove.
2021-03-08Inline expression constructorTom Tromey3-12/+13
The struct expression constructor no longer does any real work, so this inlines it. The default destructor can also be used now as well. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * parse.c (expression::expression, expression::~expression): Remove. * expression.h (struct expression): Inline constructor. Remove destructor.
2021-03-08Remove BINOP_ENDTom Tromey7-100/+107
BINOP_END is used only as a "meaningless" value in various tables. This patch changes these to use OP_NULL instead, and removes BINOP_END. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * std-operator.def (BINOP_END): Remove. * p-exp.y (tokentab3, tokentab2): Use OP_NULL, not BINOP_END. * go-exp.y (tokentab2): Use OP_NULL, not BINOP_END. * f-exp.y (dot_ops, f77_keywords): Use OP_NULL, not BINOP_END. * d-exp.y (tokentab2, ident_tokens): Use OP_NULL, not BINOP_END. * c-exp.y (tokentab3, tokentab2, ident_tokens): Use OP_NULL, not BINOP_END.
2021-03-08Remove OP_UNUSED_LASTTom Tromey2-3/+4
OP_UNUSED_LAST is no longer needed with C++ -- the trailing comma is fine. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expression.h (enum exp_opcode) <OP_UNUSED_LAST>: Remove.
2021-03-08Remove OP_EXTENDED0Tom Tromey2-4/+4
OP_EXTENDED0 was only used for an assertion in the code to rewrite an expression into prefix form. That code is gone, so this patch removes the constant. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * std-operator.def (OP_EXTENDED0): Remove.
2021-03-08Remove unused Ada opcodesTom Tromey2-43/+6
Several Ada expression opcodes are now unused, and can be removed. Most of these are handled in a different way by the code. OP_ATR_IMAGE, however, was never implemented. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * std-operator.def (OP_NAME, OP_ATR_IMAGE, OP_ATR_MODULUS) (OP_OTHERS, OP_CHOICES, OP_POSITIONAL, OP_DISCRETE_RANGE): Remove.