aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-05-10x86 LynxOS-178: Adjust floating-point context structureJoel Brobecker2-1/+46
The floating point context structure on x86 LynxOS-178 is not the same as on LynxOS 5.x. As a consequence, trying to print the return value of a function returning a float, for instance, yields incorrect results. This patch fixes the issue by providing an updated definition for LynxOS-178 (the reason why we cannot access the actual definition provided by the system still remains true). gdb/gdbserver/ChangeLog: * lynx-i386-low.c (LYNXOS_178): New macro. [LYNXOS_178] (usr_fcontext_t): Provide a definition that matches the layout on LynxOS-178. (lynx_i386_fill_fpregset, lynx_i386_store_fpregset): Do not handle floating point registers that are not supported by LynxOS-178.
2018-05-10Fix the clang buildTom Tromey5-3/+12
Simon pointed out that gdb would not build with clang, due to the addition of -Wimplicit-fallthrough. This patch fixes the problem by using -Wimplicit-fallthrough=3 -- this does not work with clang, bypassing the issue. Tested by rebuilding with both gcc and clang; and also by verifying that -Wimplicit-fallthrough=3 is used in the gcc build. I will file a follow-up bug to convert the fall-through comments to a form that can be used by both clang and gcc. gdb/ChangeLog 2018-05-10 Tom Tromey <tom@tromey.com> * configure: Rebuild. * warning.m4 (AM_GDB_WARNINGS): Use -Wimplicit-fallthrough=3. gdb/gdbserver/ChangeLog 2018-05-10 Tom Tromey <tom@tromey.com> * configure: Rebuild.
2018-05-10Allow integer immediates for AArch64 fmov instructions.Tamar Christina8-43/+37
This patch makes it possible to use an integer immediate with the fmov instructions allowing you to simply write fmov d0, #2 instead of needing fmov d0, #2.0. The parse double function already know to deal with this so we just need to list the restriction put in place in parser. The is considered a QoL improvement for hand assembly writers and allows more code portability between assembler. gas/ * config/tc-aarch64.c (parse_aarch64_imm_float): Remove restrictions. * testsuite/gas/aarch64/diagnostic.s: Move fmov int test to.. * testsuite/gas/aarch64/fpmov.s: Here. * testsuite/gas/aarch64/fpmov.d: Update results with fmov. * testsuite/gas/aarch64/diagnostic.l: Remove fmov values. * testsuite/gas/aarch64/sve-invalid.s: Update test files. * testsuite/gas/aarch64/sve-invalid.l: Likewise
2018-05-10Allow integer immediate for VFP vmov instructions.Tamar Christina4-0/+34
This patch fixes the case where you want to use an integer value the floating point immediate to a VFP vmov instruction such as vmovmi.f32 s27, #11. If the immediate is not a float we convert it and copy it's representation into the imm field and then carry on validating as if we originally entered a floating point immediate. The is considered a QoL improvement for hand assembly writers and allows more code portability between assembler. gas/ * gas/config/tc-arm.c (do_neon_mov): Allow integer literal for float immediate. * testsuite/gas/arm/vfp-mov-enc.s: New. * testsuite/gas/arm/vfp-mov-enc.d: New.
2018-05-10gdbserver/Windows: crash during connection establishment phaseJoel Brobecker12-28/+81
On Windows, starting a new process with GDBserver seems to work, in the sense that the program does get started, and GDBserver confirms that it is listening for GDB to connect. However, as soon as GDB establishes the connection with GDBserver, and starts discussing with it, GDBserver crashes, with a SEGV. This SEGV occurs in remote-utils.c::prepare_resume_reply... | regp = current_target_desc ()->expedite_regs; | [...] | while (*regp) ... because, in our case, REGP is NULL. This patches fixes the issues by adding a parameter to init_target_desc, in order to make sure that we always provide the list of registers when we initialize a target description. gdb/ChangeLog: PR server/23158: * regformats/regdat.sh: Adjust script, following the addition of the new expedite_regs parameter to init_target_desc. gdb/gdbserver/ChangeLog: PR server/23158: * tdesc.h (init_target_desc) <expedite_regs>: New parameter. * tdesc.c (init_target_desc) <expedite_regs>: New parameter. Use it to set the expedite_regs field in the given tdesc. * x86-tdesc.h: New file. * linux-aarch64-tdesc.c (aarch64_linux_read_description): Adjust following the addition of the new expedite_regs parameter to init_target_desc. * linux-tic6x-low.c (tic6x_read_description): Likewise. * linux-x86-tdesc.c: #include "x86-tdesc.h". (i386_linux_read_description, amd64_linux_read_description): Adjust following the addition of the new expedite_regs parameter to init_target_desc. * lynx-i386-low.c: #include "x86-tdesc.h". (lynx_i386_arch_setup): Adjust following the addition of the new expedite_regs parameter to init_target_desc. * nto-x86-low.c: #include "x86-tdesc.h". (nto_x86_arch_setup): Adjust following the addition of the new expedite_regs parameter to init_target_desc. * win32-i386-low.c: #include "x86-tdesc.h". (i386_arch_setup): Adjust following the addition of the new expedite_regs parameter to init_target_desc.
2018-05-10gdbserver/Windows: Fix "no program to debug" errorJoel Brobecker2-0/+10
Trying to start a program with GDBserver on Windows yields the following error: $ gdbserver.exe --once :4444 simple_main.exe Killing process(es): 5008 No program to debug Exiting The error itself comes from the following code shortly after create_inferior gets called (in server.c::main): /* Wait till we are at first instruction in program. */ create_inferior (program_path.get (), program_args); [...] if (last_status.kind == TARGET_WAITKIND_EXITED || last_status.kind == TARGET_WAITKIND_SIGNALLED) was_running = 0; else was_running = 1; if (!was_running && !multi_mode) error ("No program to debug"); What happens is that the "last_status" global starts initialized as zeroes, which means last_status.kind == TARGET_WAITKIND_EXITED, and we expect create_inferior to be waiting for the inferior to start until reaching the SIGTRAP, and to set the "last_status" global to match that last event we received. I suspect this is an unintended side-effect of the following change... commit 2090129c36c7e582943b7d300968d19b46160d84 Date: Thu Dec 22 21:11:11 2016 -0500 Subject: Share fork_inferior et al with gdbserver ... which removes some code in server.c that was responsible for starting the inferior in a functin that was named start_inferior, and looked like this: signal_pid = create_inferior (new_argv[0], &new_argv[0]); [...] /* Wait till we are at 1st instruction in program, return new pid (assuming success). */ last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0); The code has been transitioned to using fork_inferior, but sadly, only for the targets that support it. On Windows, the calls to wait setting "last_status" simply disappeared. This patch adds it back in the Windows-specific implementation of create_inferior. gdb/gdbserver/ChangeLog: PR server/23158: * win32-low.c (win32_create_inferior): Add call to my_wait setting last_status global.
2018-05-10[gdbserver/win32] fatal "glob could not process pattern '(null)'" errorJoel Brobecker2-2/+11
Trying to start GDBserver on Windows currently yields the following error... $ gdbserver.exe --once :4444 simple_main.exe glob could not process pattern '(null)'. Exiting ... after which GDB terminates with a nonzero status. This is because create_process in win32-low.c calls gdb_tilde_expand with the result of a call to get_inferior_cwd without verifying that the returned directory is not NULL: | static BOOL | create_process (const char *program, char *args, | DWORD flags, PROCESS_INFORMATION *pi) | { | const char *inferior_cwd = get_inferior_cwd (); | std::string expanded_infcwd = gdb_tilde_expand (inferior_cwd); This patch avoids this by only calling gdb_tilde_expand when INFERIOR_CWD is not NULL, which is similar to what is done on GNU/Linux for instance. gdb/gdbserver/ChangeLog: PR server/23158: * win32-low.c (create_process): Only call gdb_tilde_expand if inferior_cwd is not NULL.
2018-05-10Add support for detecting Freescale S12Z binaries in readelf.John Darrington4-0/+12
* include/elf/common.h (EM_S12Z): New macro * binutils/readelf.c (get_machine_name): EM_S12Z - handle new case.
2018-05-10Fix tagged pointer supportOmair Javaid4-10/+23
This patch fixes tagged pointer support for AArch64 GDB. Linux kernel debugging failure was reported after tagged pointer support was committed. After a discussion around best path forward to manage tagged pointers on GDB side we are going to disable tagged pointers support for aarch64-none-elf-gdb because for non-linux applications we cant be sure if tagged pointers will be used by MMU or not. Also for aarch64-linux-gdb we are going to sign extend user-space address after clearing tag bits. This will help debug both kernel and user-space addresses based on information from linux kernel documentation given below: According to AArch64 memory map: https://www.kernel.org/doc/Documentation/arm64/memory.txt "User addresses have bits 63:48 set to 0 while the kernel addresses have the same bits set to 1." According to AArch64 tagged pointers document: https://www.kernel.org/doc/Documentation/arm64/tagged-pointers.txt The kernel configures the translation tables so that translations made via TTBR0 (i.e. userspace mappings) have the top byte (bits 63:56) of the virtual address ignored by the translation hardware. This frees up this byte for application use. Running gdb testsuite after applying this patch introduces no regressions and tagged pointer test cases still pass. gdb/ChangeLog: 2018-05-10 Omair Javaid <omair.javaid@linaro.org> PR gdb/23127 * aarch64-linux-tdep.c (aarch64_linux_init_abi): Add call to set_gdbarch_significant_addr_bit. * aarch64-tdep.c (aarch64_gdbarch_init): Remove call to set_gdbarch_significant_addr_bit. * utils.c (address_significant): Update to sign extend addr.
2018-05-10Fix _GLOBAL_OFFSET_TABLE_ value for large GOTs (aarch64).Stephen Crane2-2/+7
Gold resolves GOT-relative relocs relative to the GOT base + 0x8000 when the GOT is larger than 0x8000. However, previously the _GLOBAL_OFFSET_TABLE_ symbol was set to GOT base + 0x8000 when the .got.plt was larger than 0x8000. This patch makes both checks use the size of the .got section so that they agree when to add 0x8000.
2018-05-10Automatic date update in version.inGDB Administrator1-1/+1
2018-05-09gas: xtensa: fix literal movementMax Filippov9-21/+116
Not all literals need to be moved in the presence of --text-section-literals or --auto-litpools, but only those created by .literal pseudo op or generated as a result of relaxation. Attempts to move other literals may result in abnormal termination of the assembler due to the following assertion failure: Internal error in xg_find_litpool at gas/config/tc-xtensa.c:11209. The same assertion may also be triggered by attempting to assign literal pools to literals in .init and .fini sections; don't try to do that. gas/ 2018-05-09 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (xtensa_is_init_fini): New function. (xtensa_move_literals): Only attempt to assign literal pool to literals with tc_frag_data.is_literal mark and not in .init or .fini sections. Join nested 'if' conditions to simplify function structure. (xtensa_switch_to_non_abs_literal_fragment): Use xtensa_is_init_fini to test for .init/.fini sections. * testsuite/gas/xtensa/all.exp (auto-litpools-3) (auto-litpools-4, text-section-literals-1): New tests. * testsuite/gas/xtensa/auto-litpools-3.d: New test results. * testsuite/gas/xtensa/auto-litpools-3.s: New test source. * testsuite/gas/xtensa/auto-litpools-4.d: New test results. * testsuite/gas/xtensa/auto-litpools-4.s: New test source. * testsuite/gas/xtensa/text-section-literals-1.d: New test results. * testsuite/gas/xtensa/text-section-literals-1.s: New test source.
2018-05-09x86: Remove Disp<N> from movidir{i,64b}H.J. Lu2-3/+7
* i386-opc.tbl: Remove Disp<N> from movidir{i,64b}.
2018-05-09gdb: xtensa: handle privileged registersMax Filippov3-8/+19
xtensa GDB may be used with both bare-metal and linux-based applications. In case of bare-metal application gdbserver is able to provide information about all CPU registers: both unprivileged and privileged. In case of linux-based application only a small subset of privileged state is available. Currently xtensa GDB only expects unprivileged registers in 'g' packets and it fails to communicate with server that sends both privileged and unprivileged registers. Allow bare-metal xtensa GDB to deal with both privileged and unprivileged registers by initializing tdep->num_regs with the total number of target CPU registers. Keep linux-based xtensa GDB functionality as is by copying tdep->num_nopriv_regs to tdep->num_regs. gdb/ 2018-05-09 Max Filippov <jcmvbkbc@gmail.com> * xtensa-linux-tdep.c (xtensa-tdep.h): New include. (xtensa_linux_init_abi): Limit tdep->num_regs by tdep->num_nopriv_regs. * xtensa-tdep.c (xtensa_derive_tdep): Calculate tdep->num_nopriv_regs and only copy it to tdep->num_regs if it's not initialized.
2018-05-09Fix typo in od-macho.cAlan Modra2-1/+5
PR 22069 * od-macho.c (dump_unwind_encoding_x86): Fix typo in last patch.
2018-05-09Fix binary compatibility between GCC and the TI compiler for the PRU target.Dimitar Dimitrov15-79/+268
My original implementation for LDI32 pseudo does not conform to the TI ABI. I wrongly documented my TI PRU ELF object files inspection, which got propagated into my binutils implementation. Issue was exposed when running the GCC ABI testsuite against TI toolchain. According to TI ABI, LDI32 must use first LDI instruction to load the MSB 16bits, and second LDI instruction for the LSB 16bits. This patch will break binary compatibility with previously released binutils versions for PRU. Still, I think it is better to fix binutils to conform to the chip vendor ABI. bfd * elf32-pru.c (pru_elf32_do_ldi32_relocate): Make LDI32 relocation conformant to TI ABI. (pru_elf32_relax_section): Likewise. (pru_elf_relax_delete_bytes): Fix offsets for new LDI32 code. * elf32-pru.c (pru_elf32_do_ldi32_relocate): Ignore addend. (pru_elf32_pmem_relocate): Trap - should not get here. (pru_elf32_relocate_section): Add support for REL relocations. (elf_info_to_howto_rel): Enable REL. (elf_backend_may_use_rel_p): Likewise. (elf_backend_may_use_rela_p): Likewise. (elf_backend_default_use_rela_p): Likewise. gas * config/tc-pru.c (md_apply_fix): Make LDI32 relocation conformant to TI ABI. (pru_assemble_arg_i): Likewise. (output_insn_ldi32): Likewise. * testsuite/gas/pru/ldi.d: Update test for the now fixed LDI32. * gas/config/tc-pru.c (pru_assemble_arg_b): Check imm8 operand range. * gas/testsuite/gas/pru/illegal2.l: New test. * gas/testsuite/gas/pru/illegal2.s: New test. * gas/testsuite/gas/pru/pru.exp: Register new illegal2 test. ld * scripttempl/pru.sc: Add LD sections to allow linking TI toolchain object files. * scripttempl/pru.sc: Switch to init_array. * testsuite/ld-pru/ldi32.d: Update LDI32 test to conform to TI ABI. * testsuite/ld-pru/norelax_ldi32-data.d: Likewise. * testsuite/ld-pru/norelax_ldi32-dis.d: Likewise. * testsuite/ld-pru/relax_ldi32-data.d: Likewise. * testsuite/ld-pru/relax_ldi32-dis.d: Likewise.
2018-05-09PR22069, Several instances of register accidentally spelled as regsiterAlan Modra12-8/+33
PR 22069 binutils/ * od-macho.c (dump_unwind_encoding_x86): Adjust for macro renaming. cpu/ChangeLog * or1kcommon.cpu (spr-reg-info): Typo fix. include/ChangeLog * mach-o/unwind.h (MACH_O_UNWIND_X86_64_RBP_FRAME_REGISTERS): Rename from MACH_O_UNWIND_X86_64_RBP_FRAME_REGSITERS. (MACH_O_UNWIND_X86_EBP_FRAME_REGISTERS): Rename from MACH_O_UNWIND_X86_EBP_FRAME_REGSITERS. opcodes/ChangeLog * cr16-opc.c (cr16_instruction): Comment typo fix. * hppa-dis.c (print_insn_hppa): Likewise. sim/ppc/ChangeLog * e500_registers.h: Comment typo fix. * ppc-instructions (ppc_insn_mfcr): Likewise.
2018-05-09Regen ld potfileAlan Modra2-0/+8
* po/BLD-POTFILES.in: Regenerate.
2018-05-09PR23148, Heap buffer overflow in pe_print_edataAlan Modra2-1/+6
PR 23148 * peXXigen.c (pe_print_edata): Correct minimum size.
2018-05-09PR23147, Heap buffer overflow in pe_print_idataAlan Modra2-1/+6
PR 23147 * peXXigen.c (pe_print_idata): Bound check hint_addr.
2018-05-09Automatic date update in version.inGDB Administrator1-1/+1
2018-05-08RISC-V: Add missing hint instructions from RV128I.Jim Wilson9-11/+92
gas/ * testsuite/gas/riscv/c-zero-imm.d: Add more tests. * testsuite/gas/riscv/c-zero-imm.s: Likewise. * testsuite/gas/riscv/c-zero-reg.d: Fix typo in test. Add disabled future test for RV128 support. * testsuite/gas/riscv/c-zero-reg.s: Likewise. include/ * opcode/riscv-opc.h (MATCH_C_SRLI64, MASK_C_SRLI64): New. (MATCH_C_SRAI64, MASK_C_SRAI64): New. (MATCH_C_SLLI64, MASK_C_SLLI64): New. opcodes/ * riscv-opc.c (match_c_slli, match_slli_as_c_slli): New. (match_c_slli64, match_srxi_as_c_srxi): New. (riscv_opcodes) <slli, sll>: Use match_slli_as_c_slli. <srli, srl, srai, sra>: Use match_srxi_as_c_srxi. <c.slli, c.srli, c.srai>: Use match_s_slli. <c.slli64, c.srli64, c.srai64>: New.
2018-05-08Define GNULIB_NAMESPACE in unittests/string_view-selftests.cSimon Marchi2-0/+6
When building with x86_64-w64-mingw32-g++ (to test cross-compiling for Windows), I get this error: unittests/string_view-selftests.o: In function `selftests::string_view::inserters_2::test05(unsigned long long)': /home/emaisin/src/binutils-gdb/gdb/unittests/basic_string_view/inserters/char/2.cc:60: undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::rpl_close()' This is caused by gnulib redefining "close" as "rpl_close", and therefore messing up the declaration of basic_ofstream in the libstdc++ header. The solution would be to use gnulib namespaces [1]. Until we use them across GDB, we can use them locally in files that are problematic, like this one. gdb/ChangeLog: * unittests/string_view-selftests.c: Define GNULIB_NAMESPACE.
2018-05-08RISC-V: New emulations to make path searches follow glibc ABI.Jim Wilson12-21/+177
ld/ PR ld/22962 * Makefile.am (ALL_EMULATION_SOURCES): Add eelf32lriscv_ilp32f.c, eelf32lriscv_ilp32.c, eelf64lriscv_lp64f.c, eelf64lriscv_lp64.c. (eelf32lriscv_ilp32f.c, eelf32lriscv_ilp32.c): New build rules. (eelf64lriscv_lp64f.c, eelf64lriscv_lp64.c): New build rules. * Makefile.in: Regenerated. * configure.tgt (riscv32*-*-linux*, riscv64*-*-linux*): New. * ld/emulparams/elf32lriscv.sh: Set LIBPATH_SUFFIX. * ld/emulparams/elf32lriscv_ilp32.sh: New. * ld/emulparams/elf32lriscv_ilp32f.sh: New. * ld/emulparams/elf64lriscv-defs.sh: Don't set LIBPATH_SUFFIX here. * ld/emulparams/elf64lriscv.sh: Set LIBPATH_SUFFIX. * ld/emulparams/elf64lriscv_lp64.sh: New. * ld/emulparams/elf64lriscv_lp64f.sh: New. * ld/genscripts.sh (append_to_lib_path): Change LIBPATH_SUFFIX test to a for. Inside loop, change LIBPATH_SUFFIX uses to libpath_suffix. (LIB_PATH): In LIB_PATH if, add loop for LIBPATH_SUFFIX, changes uses inside loop to libpath_suffix.
2018-05-08gdb/x86: Handle kernels using compact xsave formatAndrew Burgess12-400/+872
For GNU/Linux on x86-64, if the target is using the xsave format for passing the floating-point information from the inferior then there currently exists a bug relating to the x87 control registers, and the mxcsr register. The xsave format allows different floating-point features to be lazily enabled, a bit in the xsave format tells GDB which floating-point features have been enabled, and which have not. Currently in GDB, when reading the floating point state, we check the xsave bit flags, if the feature is enabled then we read the feature from the xsave buffer, and if the feature is not enabled, then we supply the default value from within GDB. Within GDB, when writing the floating point state, we first fetch the xsave state from the target and then, for any feature that is not yet enabled, we write the default values into the xsave buffer. Next we compare the regcache value with the value in the xsave buffer, and, if the value has changed we update the value in the xsave buffer, and mark the feature enabled in the xsave bit flags. The problem then, is that the x87 control registers were not following this pattern. We assumed that these registers were always written out by the kernel, and we always wrote them out to the xsave buffer (but didn't enabled the feature). The result of this is that if the kernel had not yet enabled the x87 feature then within GDB we would see random values for the x87 floating point control registers, and if the user tried to modify one of these register, that modification would be lost. Finally, the mxcsr register was also broken in the same way as the x87 control registers. The added complexity with this case is that the mxcsr register is part of both the avx and sse floating point feature set. When reading or writing this register we need to check that at least one of these features is enabled. This bug was present in native GDB, and within gdbserver. Both are fixed with this commit. gdb/ChangeLog: * common/x86-xstate.h (I387_FCTRL_INIT_VAL): New constant. (I387_MXCSR_INIT_VAL): New constant. * amd64-tdep.c (amd64_supply_xsave): Only read state from xsave buffer if it was supplied by the inferior. * i387-tdep.c (i387_supply_fsave): Use I387_MXCSR_INIT_VAL. (i387_xsave_get_clear_bv): New function. (i387_supply_xsave): Only read x87 control registers from the xsave buffer if the feature is enabled, and the state will have been written, otherwise, provide a suitable default. (i387_collect_xsave): Pre-clear all registers in xsave buffer, including x87 control registers. Update control registers if they have changed from the default value, and mark features as enabled as required. * i387-tdep.h (i387_xsave_get_clear_bv): Declare. gdb/gdbserver/ChangeLog: * i387-fp.c (i387_cache_to_xsave): Only write x87 control registers to the cache if their values have changed. (i387_xsave_to_cache): Provide default values for x87 control registers when these features are available, but disabled. * regcache.c (supply_register_by_name_zeroed): New function. * regcache.h (supply_register_by_name_zeroed): Declare new function. gdb/testsuite/ChangeLog: * gdb.arch/amd64-init-x87-values.S: New file. * gdb.arch/amd64-init-x87-values.exp: New file.
2018-05-08PR23141, SIGSEGV in bfd_elf_set_group_contentsAlan Modra2-5/+12
Another fuzzing fix. I think it's reasonable to simply strip out any group section that is too weird for objcopy to handle. PR 23141 * objcopy.c (is_strip_section): Strip groups without a valid signature symbol.
2018-05-08Correct powerpc spe opcode lookupAlan Modra2-6/+12
Defining SPE2_OPCD_SEGS as 13 discounts the possibility that we'd ever look up spe2_opcd_indices[14..16], which I think is possible. Extend that array to size 16+1, using the macros we use to index the array. Similarly use the index macros for PPC_OPCD_SEGS and VLE_OPCD_SEGS. * ppc-dis.c (PPC_OPCD_SEGS): Define using PPC_OP. (VLE_OPCD_SEGS, SPE2_OPCD_SEGS): Similarly, using macros used to partition opcode space for index lookup.
2018-05-08watchpoint-unaligned.exp: Use skip_hw_watchpoint_testsJan Kratochvil2-0/+8
gdb/testsuite/ChangeLog 2018-05-08 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.base/watchpoint-unaligned.exp: Use skip_hw_watchpoint_tests.
2018-05-08[spu] Fix "info spu event" output formattingUlrich Weigand2-3/+9
The formatting of the output of the "info spu event" command changed, causing spurious test suite failures. Use phex instead of phex_nz to get back the expected format, and fix emission of new line characters. gdb/ChangeLog: 2018-05-08 Ulrich Weigand <uweigand@de.ibm.com> * spu-tdep.c (info_spu_event_command): Fix output formatting.
2018-05-08Prevent a memory exhaustion failure when running objdump on a fuzzed input ↵Nick Clifton3-0/+18
file with corrupt string and attribute sections. PR 22809 * elf.c (bfd_elf_get_str_section): Check for an excessively large string section. * elf-attrs.c (_bfd_elf_parse_attributes): Issue an error if the attribute section is larger than the size of the file.
2018-05-07Simplify VLE handling in print_insn_powerpc().Peter Bergner2-35/+26
opcodes/ * ppc-dis.c (print_insn_powerpc) <insn_is_short>: Replace this... <insn_length>: ...with this. Update usage. Remove duplicate call to *info->memory_error_func.
2018-05-07Enable Intel MOVDIRI, MOVDIR64B instructionsH.J. Lu21-5115/+5484
gas/ * config/tc-i386.c (cpu_arch): Add .movdir, .movdir64b. (cpu_noarch): Likewise. (process_suffix): Add check for register size. * doc/c-i386.texi: Document movdiri, movdir64b. * testsuite/gas/i386/i386.exp: Run MOVDIR{I,64B} tests. * testsuite/gas/i386/movdir-intel.d: New file. * testsuite/gas/i386/movdir.d: Likewise. * testsuite/gas/i386/movdir.s: Likewise. * testsuite/gas/i386/movdir64b-reg.s: Likewise. * testsuite/gas/i386/movdir64b-reg.l: Likewise. * testsuite/gas/i386/x86-64-movdir-intel.d: Likewise. * testsuite/gas/i386/x86-64-movdir.d: Likewise. * testsuite/gas/i386/x86-64-movdir.s: Likewise. * testsuite/gas/i386/x86-64-movdir64b-reg.s: Likewise. * testsuite/gas/i386/x86-64-movdir64b-reg.l: Likewise. opcodes/ * i386-dis.c (Gva): New. (enum): Add PREFIX_0F38F8, PREFIX_0F38F9, MOD_0F38F8_PREFIX_2, MOD_0F38F9_PREFIX_0. (prefix_table): New instructions (see prefix above). (mod_table): New instructions (see prefix above). (OP_G): Handle va_mode. * i386-gen.c (cpu_flag_init): Add CPU_MOVDIRI_FLAGS, CPU_MOVDIR64B_FLAGS. (cpu_flags): Add CpuMOVDIRI and CpuMOVDIR64B. * i386-opc.h (enum): Add CpuMOVDIRI, CpuMOVDIR64B. (i386_cpu_flags): Add cpumovdiri and cpumovdir64b. * i386-opc.tbl: Add movidir{i,64b}. * i386-init.h: Regenerated. * i386-tbl.h: Likewise.
2018-05-07x86: Replace AddrPrefixOp0 with AddrPrefixOpRegH.J. Lu6-17/+35
This patch replaces AddrPrefixOp0 with AddrPrefixOpReg to indicate that the size of register operand is controlled by the address size prefix. This will be used by Intel MOVDIRI and MOVDIR64B instructions later. gas/ * config/tc-i386.c (process_suffix): Check addrprefixopreg instead of addrprefixop0. opcodes/ * i386-gen.c (opcode_modifiers): Replace AddrPrefixOp0 with AddrPrefixOpReg. * i386-opc.h (AddrPrefixOp0): Renamed to ... (AddrPrefixOpReg): This. (i386_opcode_modifier): Rename addrprefixop0 to addrprefixopreg. * i386-opc.tbl: Replace AddrPrefixOp0 with AddrPrefixOpReg.
2018-05-07Add -Wduplicated-condTom Tromey5-3/+15
This adds -Wduplicated-cond to warnings.m4. This caught one bug. I tried adding -Wduplicated-branches as well, but it results in some spurious failures from code like this in cgen.h: #define CGEN_ATTR_TYPE(n) \ struct { unsigned int bool_; \ CGEN_ATTR_VALUE_TYPE nonbool[(n) ? (n) : 1]; } This will trigger a warning if passed n==1, which seems like a perfectly valid thing to do; and there were other issues like this as well. ChangeLog 2018-05-07 Tom Tromey <tom@tromey.com> * configure: Rebuild. * warning.m4 (AM_GDB_WARNINGS): Add -Wduplicated-cond. gdbserver/ChangeLog 2018-05-07 Tom Tromey <tom@tromey.com> * configure: Rebuild.
2018-05-07Fix decoding of ARM VFP instructionsTom Tromey2-2/+9
-Wduplicated-cond pointed out that arm_record_vfp_data_proc_insn checks "opc1 == 0x0b" twice. I filed this a while ago as PR tdep/20362. Based on the ARM instruction manual at https://www.scss.tcd.ie/~waldroj/3d1/arm_arm.pdf, I think the instruction decoding in this function has two bugs. First, opc1 is computed as: opc1 = bits (arm_insn_r->arm_insn, 20, 23); [...] opc1 = opc1 & 0x04; This means that tests like: else if (opc1 == 0x01) can never be true. In the ARM manual, "opc1" corresponds to these bits: name bit r 20 q 21 D 22 p 23 ... where the D bit is not used for VFP instruction decoding. So, I believe this code should use ~0x04 instead. Second, VDIV is recognized by the bits "pqrs" being equal to "1000". This tranlates to opc1 == 0x08 -- not 0x0b. Note that pqrs==1001 is an undefined encoding, which is probably why opc2 is not checked here; this code doesn't seem to really deal with undefined encodings in general, so I've left that as is. I don't have an ARM machine or any reasonable way to test this. ChangeLog 2018-05-07 Tom Tromey <tom@tromey.com> PR tdep/20362: * arm-tdep.c (arm_record_vfp_data_proc_insn): Properly mask off D bit. Use correct value for VDIV.
2018-05-07Cleanup ppc code dealing with opcode dumps.Peter Bergner7-85/+82
include/ * opcode/ppc.h (powerpc_num_opcodes): Change type to unsigned. (vle_num_opcodes): Likewise. (spe2_num_opcodes): Likewise. opcodes/ * ppc-opc.c (powerpc_num_opcodes): Likewise. (vle_num_opcodes): Likewise. (spe2_num_opcodes): Likewise. * ppc-dis.c (disassemble_init_powerpc) <powerpc_opcd_indices>: Rewrite initialization loop. (disassemble_init_powerpc) <vle_opcd_indices>: Likewise. (disassemble_init_powerpc) <spe2_opcd_indices>: Likewise. Initialize only once. gas/ * config/tc-ppc.c (ppc_setup_opcodes) <powerpc_opcodes>: Rewrite code to dump the entire opcode table. (ppc_setup_opcodes) <spe2_opcodes>: Likewise. (ppc_setup_opcodes) <vle_opcodes>: Likewise. Fix calculation of opcode index.
2018-05-07Bug 23142, SIGSEGV in is_strip_sectionAlan Modra2-5/+10
PR 23142 * objcopy.c (group_signature): Don't accept groups that use a symbol table other than the one we've read.
2018-05-07Replace uses of strncmp with memcmpAlan Modra3-8/+18
Avoids gcc pr85623 for these calls. * cofflink.c (_bfd_coff_link_input_bfd): Use memcmp rather than strncmp when checking for ".bf" special symbol. * prXXigen.c (_bfd_XXi_swap_scnhdr_out): Make pe_required_section_flags section name a char array, remove sentinal known_sections entry, and adjust loop over known_sections to suit. Use memcmp rather than strncmp.
2018-05-06gas/i386/xmmhi32.d: Also allow dir32 relocationH.J. Lu2-42/+46
Also allow dir32 relocation to support mingw targets. * testsuite/gas/i386/xmmhi32.d: Also allow dir32 relocation.
2018-05-06i386: Append ".p2align 4,0" to gas testsH.J. Lu9-0/+23
Append ".p2align 4,0" to i386 assembler tests to support mingw targets. * testsuite/gas/i386/avx512f-plain.s: Append ".p2align 4,0". * testsuite/gas/i386/avx512vl-plain.s: Likewise. * testsuite/gas/i386/bnd.s: Likewise. * testsuite/gas/i386/stN.s: Likewise. * testsuite/gas/i386/avx512f-plain.l: Updated. * testsuite/gas/i386/avx512vl-plain.l: Likewise. * testsuite/gas/i386/bnd.l: Likewise. * testsuite/gas/i386/stN.l: Likewise.
2018-05-07Automatic date update in version.inGDB Administrator1-1/+1
2018-05-06Automatic date update in version.inGDB Administrator1-1/+1
2018-05-04Add -Wimplicit-fallthroughTom Tromey5-3/+15
This adds -Wimplicit-fallthrough to the set of default warnings. 2018-05-04 Tom Tromey <tom@tromey.com> * configure: Rebuild. * warning.m4 (AM_GDB_WARNINGS): Add -Wimplicit-fallthrough. gdbserver/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * configure: Rebuild.
2018-05-04Add a missing break in record_linux_system_callTom Tromey2-0/+6
This adds a "break" at the end of the RECORD_SYS_RECVFROM case in record_linux_system_call. This seemed correct to me. 2018-05-04 Tom Tromey <tom@tromey.com> * linux-record.c (record_linux_system_call) <case RECORD_SYS_RECVFROM>: Add "break".
2018-05-04Add missing "breaks"Tom Tromey3-0/+9
This adds a "break" to a couple of spots where it was erroneously omitted. I think these are the two (potential) real bugs caught by this series. 2018-05-04 Tom Tromey <tom@tromey.com> * mi/mi-main.c (mi_cmd_trace_frame_collected) <REGISTERS_FORMAT>: Add missing "break". * mi/mi-cmd-stack.c (mi_cmd_stack_list_locals) <NO_FRAME_FILTERS>: Add missing "break".
2018-05-04Add two fall-through comments in rs6000-tdep.cTom Tromey2-0/+7
This adds two fall-through comments in rs6000-tdep.c. I looked at the PPC instruction manual and convinced myself that this was correct. And, this isn't a semantic change. However, close review would still be good. 2018-05-04 Tom Tromey <tom@tromey.com> * rs6000-tdep.c (ppc_process_record_op4) (ppc_process_record_op63): Add fall-through comment.
2018-05-04Add fall-through comment to i386-tdep.cTom Tromey2-0/+5
This adds a fall-through comment in i386-tdep.c. I was not sure what to do here, so I elected to preserve the status quo. In review, John Baldwin pointed out that: "I believe this is correct based on the diff that added the special cases for xgetbv and xsetbv as previously ldgt and lidt were treated the same". gdb/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * i386-tdep.c (i386_process_record): Add fall-through comment.
2018-05-04Add a fall-through comment to stabsread.cTom Tromey2-0/+6
This adds a fall-through comment to stabsread.c. I skimmed the stabs manual a bit and it seems that 'p' and 'P' are similar enough that this makes sense. Also, stabs is mostly deprecated, and the code has been this way for a long time, so it seemed safest to keep the status quo. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * stabsread.c (define_symbol) <case 'p'>: Add fall-through comment.
2018-05-04Fix "obvious" fall-through warningsTom Tromey6-0/+16
This patch fixes the subset of -Wimplicit-fallthrough warnings that I considered obvious. In most cases it was obvious from context that falling through was desired; here I added the appropriate comment. In a couple of cases it seemed clear that a "break" was missing. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * riscv-tdep.c (riscv_isa_xlen): Add fall-through comment. * utils.c (can_dump_core) <LIMIT_CUR>: Add fall-through comment. * eval.c (fetch_subexp_value) <MEMORY_ERROR>: Add fall-through comment. * d-valprint.c (d_val_print) <TYPE_CODE_STRUCT>: Add fall-through comment. * coffread.c (coff_symtab_read) <C_LABEL>: Add fall-through comment.
2018-05-04Add missing ATTRIBUTE_NORETURNsTom Tromey2-1/+5
This patch adds a missing ATTRIBUTE_NORETURN. This lets -Wimplicit-fallthrough recognize that a given case does not fall through. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * dwarf2loc.c (unimplemented): Add ATTRIBUTE_NORETURN.