aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-06-02Add support for 48 and 64 bit ARC instructions.Andrew Burgess10-163/+1030
gas * config/tc-arc.c (parse_opcode_flags): New function. (find_opcode_match): Move flag parsing code out to new function. Ignore operands marked IGNORE. (build_fake_opcode_hash_entry): New function. (find_special_case_long_opcode): New function. (find_special_case): Lookup long opcodes. * testsuite/gas/arc/nps400-7.d: New file. * testsuite/gas/arc/nps400-7.s: New file. include * opcode/arc.h (MAX_INSN_ARGS): Increase to 16. (struct arc_long_opcode): New structure. (arc_long_opcodes): Declare. (arc_num_long_opcodes): Declare. opcodes * arc-dis.c (struct arc_operand_iterator): New structure. (find_format_from_table): All the old content from find_format, with some minor adjustments, and parameter renaming. (find_format_long_instructions): New function. (find_format): Rewritten. (arc_insn_length): Add LSB parameter. (extract_operand_value): New function. (operand_iterator_next): New function. (print_insn_arc): Use new functions to find opcode, and iterator over operands. * arc-opc.c (insert_nps_3bit_dst_short): New function. (extract_nps_3bit_dst_short): New function. (insert_nps_3bit_src2_short): New function. (extract_nps_3bit_src2_short): New function. (insert_nps_bitop1_size): New function. (extract_nps_bitop1_size): New function. (insert_nps_bitop2_size): New function. (extract_nps_bitop2_size): New function. (insert_nps_bitop_mod4_msb): New function. (extract_nps_bitop_mod4_msb): New function. (insert_nps_bitop_mod4_lsb): New function. (extract_nps_bitop_mod4_lsb): New function. (insert_nps_bitop_dst_pos3_pos4): New function. (extract_nps_bitop_dst_pos3_pos4): New function. (insert_nps_bitop_ins_ext): New function. (extract_nps_bitop_ins_ext): New function. (arc_operands): Add new operands. (arc_long_opcodes): New global array. (arc_num_long_opcodes): New global. * arc-nps400-tbl.h: Add comments referencing arc_long_opcodes.
2016-06-02Fix a bug displaying the interpretation of a CFA block that just contains ↵Nick Clifton2-1/+14
DW_CFA_NOP instructions. * dwarf.c (display_debug_frames): Do not display any interpretation if the block consists solely of DW__CFA_NOPs.
2016-06-02Revert PR16467 changeAlan Modra4-28/+100
This reverts the pr16467 change, which was incorrect due to faulty analysis of the pr16467 testcase. The failure was not due to a mismatch in symbol type (ifunc/non-ifunc) but due to a symbol loop being set up. See https://sourceware.org/ml/binutils/2016-06/msg00013.html for some rambling on versioned symbols and ELF shared library symbol overriding that explain this patch. bfd/ PR ld/20159 PR ld/16467 * elflink.c (_bfd_elf_merge_symbol): Revert PR16467 change. (_bfd_elf_add_default_symbol): Don't indirect to/from defined symbol given a version by a script different to the version of the symbol being added. (elf_link_add_object_symbols): Use _bfd_elf_strtab_save and _bfd_elf_strtab_restore. Don't fudge dynstr references. * elf-strtab.c (_bfd_elf_strtab_restore_size): Delete. (struct strtab_save): New. (_bfd_elf_strtab_save, _bfd_elf_strtab_restore): New functions. * elf-bfd.h (_bfd_elf_strtab_restore_size): Delete. (_bfd_elf_strtab_save, _bfd_elf_strtab_restore): Declare.
2016-06-01ns32k: remove dupplicate definition of input_line_pointerTrevor Saunders2-1/+4
gas/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-ns32k.c: Remove definition of input_line_pointer.
2016-06-01add more extern CTrevor Saunders18-0/+143
opcodes/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * nds32-asm.h: Add extern "C". * sh-opc.h: Likewise. bfd/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * elf32-hppa.h: Add extern "C". * elf32-nds32.h: Likewise. * elf32-tic6x.h: Likewise. include/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * elf/mips.h: Likewise. * elf/sh.h: Likewise. * opcode/d10v.h: Likewise. * opcode/d30v.h: Likewise. * opcode/ia64.h: Likewise. * opcode/mips.h: Likewise. * opcode/ppc.h: Likewise. * opcode/sparc.h: Likewise. * opcode/tic6x.h: Likewise. * opcode/v850.h: Likewise.
2016-06-01avr: replace sentinal with iteration from 0 to ARRAY_SIZETrevor Saunders2-4/+8
This seems a little easier to understand than using a sentinal, and will hopefully let the compiler optimize the loop better. It also has the effect that we stop initializing a field of the sentinal that is an enum with zero. gas/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-avr.c (avr_parse_cons_expression): Replace iteration to sentinal with iteration to array size.
2016-06-01xtensa: typedef enums when defining themTrevor Saunders2-10/+11
I think this is the more typical way to do this. Its also slightly shorter and less repeditive. gas/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/xtensa-relax.h: Move typedefs of enums to the enums definition.
2016-06-01ns32k: use XOBNEW in another spotTrevor Saunders2-1/+6
gas/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-ns32k.c (bit_fix_new): Replace obstack-alloc with XOBNEW macro.
2016-06-02Automatic date update in version.inGDB Administrator1-1/+1
2016-06-01Add new Serbian translation for the bfd library.Nick Clifton4-2/+6819
* po/sr.po: New Serbian translation. * configure.ac (ALL_LINGUAS): Add sr. * configure: Regenerate.
2016-06-01gdb/remote-fileio.c: Eliminate custom SIGINT signal handlerPedro Alves2-60/+35
... and fix Ctrl-C races. The current remote-fileio.c SIGINT/EINTR code can lose Ctrl-C -- there's a period where SIG_IGN is installed as signal handler, for example. Since: - remote.c no longer installs a custom SIGINT handler; - The current remote-fileio.c SIGINT handler is basically the same as the default SIGINT handler (event-top.c:handle_sigint), in principle, except that instead of setting the quit flag, it sets a separate flag. I think we should be able to completely remove the remote-fileio.c SIGINT handler, and centralize on the quit flag, thus fixing the Ctrl-C race. gdb/ChangeLog: yyyy-mm-dd Pedro Alves <palves@redhat.com> * remote-fileio.c (remote_fio_ctrl_c_flag, remote_fio_sa) (remote_fio_osa) (remote_fio_ofunc, remote_fileio_sig_init, remote_fileio_sig_set) (remote_fileio_sig_exit, remote_fileio_ctrl_c_signal_handler): Delete. (remote_fileio_o_quit_handler): New global. (remote_fileio_quit_handler): New function. (remote_fileio_reply): Check the quit flag instead of the custom 'remote_fio_ctrl_c_flag' flag. Restore the quit handler instead of changing the SIGINT handler. (do_remote_fileio_request): Override the quit handler instead of changing the SIGINT handler.
2016-06-01Add support for some variants of the ARC nps400 rflt instruction.Graham Markall5-55/+81
gas * testsuite/gas/arc/nps-400-1.s: Add rflt variants with operands of types a,b,u6, 0,b,u6, and 0,b,limm. * testsuite/gas/arc/nps-400-1.d: Likewise. opcodes * arc-nps400-tbl.h: Add operands a,b,u6, 0,b,u6, and 0,b,limm to the rflt instruction.
2016-06-01Add xmalloc_failed() function to common-utils.c in to avoid the need to link ↵Nick Clifton2-0/+11
in libiberty's xmalloc code.
2016-06-01infcmd, btrace: fix crash in 'finish' for tailcall-only framesMarkus Metzger2-5/+30
Patch 7eb895307f53 Skip unwritable frames in command "finish" skips non-writable frames in addition to tailcall frames. If skip_tailcall_frames already returns NULL, skip_unwritable_frames will be called with a NULL frame and crash in get_frame_arch. This is caught by gdb.btrace/tailcall-only.exp. Further, if we ever end up with a mixture of tailcall and non-writable frames, we may not skip all of them, as intended. Loop over skip_tailcall_frames and skip_unwritable_frames as long as at least one of them makes progress. gdb/ * infcmd.c (skip_finish_frames): New. (finish_command): Call skip_finish_frames.
2016-06-01Wake up interruptible_select in remote_fileio ctrl-c handlerYao Qi2-0/+8
As reported in PR 19998, after type ctrl-c, GDB hang there and does not send interrupt. It causes a fail in gdb.base/interrupt.exp. All targets support remote fileio should be affected. When we type ctrc-c, SIGINT is handled by remote_fileio_sig_set, as shown below, #0 remote_fileio_sig_set (sigint_func=0x4495d0 <remote_fileio_ctrl_c_signal_handler(int)>) at /home/yao/SourceCode/gnu/gdb/git/gdb/remote-fileio.c:325 #1 0x00000000004495de in remote_fileio_ctrl_c_signal_handler (signo=<optimised out>) at /home/yao/SourceCode/gnu/gdb/git/gdb/remote-fileio.c:349 #2 <signal handler called> #3 0x00007ffff647ed83 in __select_nocancel () at ../sysdeps/unix/syscall-template.S:81 #4 0x00000000005530ce in interruptible_select (n=10, readfds=readfds@entry=0x7fffffffd730, writefds=writefds@entry=0x0, exceptfds=exceptfds@entry=0x0, timeout=timeout@entry=0x0) at /home/yao/SourceCode/gnu/gdb/git/gdb/event-top.c:1017 #5 0x000000000061ab20 in stdio_file_read (file=<optimised out>, buf=0x12d02e0 "\n\022-\001", length_buf=16383) at /home/yao/SourceCode/gnu/gdb/git/gdb/ui-file.c:577 #6 0x000000000044a4dc in remote_fileio_func_read (buf=0x12c0360 "") at /home/yao/SourceCode/gnu/gdb/git/gdb/remote-fileio.c:583 #7 0x0000000000449598 in do_remote_fileio_request (uiout=<optimised out>, buf_arg=buf_arg@entry=0x12c0340) at /home/yao/SourceCode/gnu/gdb/git/gdb/remote-fileio.c:1179 we don't set quit_serial_event, do { res = gdb_select (n, readfds, writefds, exceptfds, timeout); } while (res == -1 && errno == EINTR); if (res == 1 && FD_ISSET (fd, readfds)) { errno = EINTR; return -1; } return res; we can't go out of the loop above, and that is why GDB can't send interrupt. Recently, we stop throwing exception from SIGINT handler (remote_fileio_ctrl_c_signal_handler) https://sourceware.org/ml/gdb-patches/2016-03/msg00372.html, which is correct, because gdb_select is interruptible. However, in the same patch series, we add interruptible_select later as a wrapper to gdb_select, https://sourceware.org/ml/gdb-patches/2016-03/msg00375.html and it is not interruptible (because of the loop in it) unless select/poll-able file descriptors are marked. This fix in this patch is to call quit_serial_event_set, so that we can go out of the loop above, return -1 and set errno to EINTR. 2016-06-01 Yao Qi <yao.qi@linaro.org> PR remote/19998 * remote-fileio.c (remote_fileio_ctrl_c_signal_handler): Call quit_serial_event_set.
2016-05-31sh: make constant unsigned to avoid narrowingTrevor Saunders2-1/+6
Shifting into the sign bit of a 32 bit int and then converting to a unsigned type is less straight forward than just shifting an unsigned value. opcodes/ChangeLog: 2016-05-31 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * sh-opc.h (ARCH_SH_HAS_DSP): Make the shifted value an unsigned constant.
2016-05-31Document the GDB 7.11.1 release in gdb/ChangeLogJoel Brobecker1-0/+4
gdb/ChangeLog: GDB 7.11.1 released.
2016-06-01Automatic date update in version.inGDB Administrator1-1/+1
2016-05-31[PR gdb/19893] Fix handling of synthetic C++ referencesMartin Galvan12-93/+851
https://sourceware.org/bugzilla/show_bug.cgi?id=19893 I've traced the main source of the problem to pieced_value_funcs.coerce_ref not being implemented. Since gdb always assumes references are implemented as pointers, this causes it to think that it's dealing with a NULL pointer, thus breaking any operations involving synthetic references. What I did here was implementing pieced_value_funcs.coerce_ref using some of the synthetic pointer handling code from indirect_pieced_value, as Pedro suggested. I also made a few adjustments to the reference printing code so that it correctly shows either the address of the referenced value or (if it's non-addressable) the "<synthetic pointer>" string. I also wrote some unit tests based on Dwarf::assemble; these took a while to make because in most cases I needed a synthetic reference to a physical variable. Additionally, I started working on a unit test for classes that have a vtable, but ran into a few issues so that'll probably go in a future patch. One thing that should definitely be fixed is that proc function_range (called for MACRO_AT_func) will always try to compile/link using gcc with the default options instead of g++, thus breaking C++ compilations that require e.g. libstdc++. gdb/ChangeLog: * dwarf2loc.c (coerce_pieced_ref, indirect_synthetic_pointer, fetch_const_value_from_synthetic_pointer): New functions. (indirect_pieced_value): Move lower half to indirect_synthetic_pointer. (pieced_value_funcs): Implement coerce_ref. * valops.c (value_addr): Call coerce_ref for synthetic references. * valprint.c (valprint_check_validity): Return true for synthetic references. Also, don't show "<synthetic pointer>" if they reference addressable values. (generic_val_print_ref): Handle synthetic references. Also move some code to print_ref_address. (print_ref_address, get_value_addr_contents): New functions. gdb/testsuite/ChangeLog: * gdb.dwarf2/implref.exp: Rename to... * gdb.dwarf2/implref-const.exp: ...this. Also add more test statements. * gdb.dwarf2/implref-array.c: New file. * gdb.dwarf2/implref-array.exp: Likewise. * gdb.dwarf2/implref-global.c: Likewise. * gdb.dwarf2/implref-global.exp: Likewise. * gdb.dwarf2/implref-struct.c: Likewise. * gdb.dwarf2/implref-struct.exp: Likewise.
2016-05-31objcopy add-symbol uninitialised structAlan Modra2-110/+119
* objcopy.c: Formatting, whitespace throughout. (copy_main): Init newsym->othersym. (parse_symflags): Make len a size_t. Adjust uses.
2016-05-31Don't needlessly clear xmemdup allocated memory.Alan Modra2-2/+8
* xmemdup.c (xmemdup): Use xmalloc rather than xcalloc.
2016-05-31Automatic date update in version.inGDB Administrator1-1/+1
2016-05-30gold/s390: Fix compilation on gcc 4.4Marcin Kościelnicki2-66/+162
gold/ChangeLog: PR/19960 * s390.cc (Target_s390::ss_code_st_r14): Removed. (Target_s390::ss_code_l_r14): Removed. (Target_s390::ss_code_ear): Removed. (Target_s390::ss_code_c): Removed. (Target_s390::ss_match_st_r14): New function. (Target_s390::ss_match_l_r14): New function. (Target_s390::ss_match_mcount): Call ss_match_{l,st}_r14 instead of matching code directly. (Target_s390::ss_match_ear): New function. (Target_s390::ss_match_c): New function. (Target_s390::do_calls_non_split): Call ss_match_{ear,c} instead of matching code directly.
2016-05-30Add tests for 64bit values in trace-condition.expAntoine Tremblay2-0/+99
This patch adds tests for emit operations with 64 bit values. It takes special care to avoid mistakes that one could make on a 32bit architecture using 64bit values. gdb/testsuite/ChangeLog: * gdb.trace/trace-condition.exp: Add 64bit tests.
2016-05-30Add variable length tests for emit_ref in trace-condition.expAntoine Tremblay3-5/+17
This patch add variable length tests for emit_ref by reading the variable passed as argument of 8 to 64 bit. gdb/testsuite/ChangeLog: * gdb.trace/trace-condition.c (marker): Adapt signature to 8 to 64 bits types. (main): Adapt to 8 to 64 bits types. * gdb.trace/trace-condition.exp: Add new tests.
2016-05-30Add emit_less_unsigned test in trace-condition.expAntoine Tremblay2-0/+7
This patch adds coverage for emit_less_unsigned. gdb/testsuite/ChangeLog: * gdb.trace/trace-condition.exp: Add emit_less_unsigned test.
2016-05-30Move trace conditions tests from ftrace.exp to trace-condition.expAntoine Tremblay3-74/+12
This patch moves conditional tests that were done in ftrace.exp to trace-condition.exp. Note that emit_ref is now tested by the anarg local variable there is no need to test the register directly. All emit calls have been tested using asserts before / after the move, to ensure that the tests cover the same functions. Note that these function were not covered before and are still not: emit_gt_goto, emit_lt_goto, emit_pop, emit_unsigned_less. gdb/testsuite/ChangeLog: * gdb.trace/ftrace.exp (test_ftrace_condition): Remove. Move condition tests... * gdb.trace/trace-condition.exp: Here.
2016-05-30Add counter-cases for trace-condition.exp testsAntoine Tremblay2-0/+42
In trace-condition.exp, tests are done by doing a conditional tracepoint and validating that the trace contains all the frames that could be collected if that condition is true. E.g. test_tracepoints $trace_command "21 + 21 == 42" 10 This will always return true and collect the 10 frames possible to collect with the test program. However, if the condition evaluation is broken such that the condition is unconditional we will not notice this problem. This patch adds counter-cases to such conditions like so: $trace_command "21 + 11 == 42" 0 This way such a problem would be noticed. gdb/testsuite/ChangeLog: * gdb.trace/trace-condition.exp: Add counter-case tests.
2016-05-30PR 15231: import bare DW_TAG_lexical_blockJan Kratochvil5-25/+120
Local variables in lambdas are not accessible https://sourceware.org/bugzilla/show_bug.cgi?id=15231 GDB: read_lexical_block_scope /* Ignore blocks with missing or invalid low and high pc attributes. */ [...] if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)) return; But sometimes there is: FAIL: gcc-5.3.1-6.fc23.x86_64 <2><92>: Abbrev Number: 11 (DW_TAG_lexical_block) <3><9c>: Abbrev Number: 13 (DW_TAG_structure_type) <9d> DW_AT_name : (indirect string, offset: 0x3c): <lambda()> [...] Where DW_TAG_lexical_block has no attributes. Such whole subtree is currently dropped by GDB while I think it should just import all its children DIEs. It even XFAIL->XPASSes gdb.ada/out_of_line_in_inlined.exp: commit 0fa7fe506c242b459c4c05d331e7c7d66fb52390 Author: Joel Brobecker <brobecker@adacore.com> out of line functions nested inside inline functions. So I have removed that xfail. gdb/ChangeLog 2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com> PR c++/15231 * dwarf2read.c (enum pc_bounds_kind): Add PC_BOUNDS_INVALID. (process_psymtab_comp_unit_reader, read_func_scope): Adjust callers. (read_lexical_block_scope): Import DIEs from bare DW_TAG_lexical_block. (read_call_site_scope): Adjust callers. (dwarf2_get_pc_bounds): Implement pc_bounds_invalid. (dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers. gdb/testsuite/ChangeLog 2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com> PR c++/15231 * gdb.ada/out_of_line_in_inlined.exp: Remove xfails. * gdb.dwarf2/dw2-lexical-block-bare.exp: New file.
2016-05-30Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enumJan Kratochvil2-25/+58
Make the code (maybe) more readable + primarily prepare it for [patch 2/2] enum extension. This change should have no code change impact. gdb/ChangeLog 2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com> Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum * dwarf2read.c (enum pc_bounds_kind) New. (dwarf2_get_pc_bounds): Use it in the declaration. (process_psymtab_comp_unit_reader): Adjust caller. Rename has_pc_info to cu_bounds_kind. (read_func_scope, read_lexical_block_scope, read_call_site_scope): Adjust callers. (dwarf2_get_pc_bounds): Use enum pc_bounds_kind in the definition. (dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
2016-05-30Automatic date update in version.inGDB Administrator1-1/+1
2016-05-29NEWS: QCatchSyscalls: simplifyJan Kratochvil2-8/+9
Standardize the QCatchSyscalls NEWS entry. gdb/ChangeLog 2016-05-29 Jan Kratochvil <jan.kratochvil@redhat.com> * NEWS (QCatchSyscalls): Remove the parameter. Include ... (QCatchSyscalls:1 in qSupported) ... this separate entry which got deleted.
2016-05-29NEWS: Remove empty line.Jan Kratochvil2-1/+4
gdb/ChangeLog 2016-05-29 Jan Kratochvil <jan.kratochvil@redhat.com> * NEWS (N stop reply): Remove empty line.
2016-05-29Add missing ChangeLog entriesH.J. Lu2-0/+25
2016-05-29Add .noavx512XX directives to x86 assemblerH.J. Lu9-0/+882
Add .noavx512f, .noavx512cd, .noavx512er, .noavx512pf, .noavx512dq, .noavx512bw, .noavx512vl, .noavx512ifma, .noavx512vbmi directives to x86 assembler. gas/ PR gas/20145 * config/tc-i386.c (cpu_noarch): Add noavx512f, noavx512cd, noavx512er, noavx512pf, noavx512dq, noavx512bw, noavx512vl, noavx512ifma and noavx512vbmi. * doc/c-i386.texi: Mention noavx512f, noavx512cd, noavx512er, noavx512pf, noavx512dq, noavx512bw, noavx512vl, noavx512ifma and noavx512vbmi. * testsuite/gas/i386/i386.exp: Run noavx512-1 and noavx512-2. * testsuite/gas/i386/noavx512-1.l: New file. * testsuite/gas/i386/noavx512-1.s: Likewise. * testsuite/gas/i386/noavx512-2.l: Likewise. * testsuite/gas/i386/noavx512-2.s: Likewise. opcodes/ PR gas/20145 * i386-gen.c (cpu_flag_init): Add CPU_ANY_AVX512F_FLAGS, CPU_ANY_AVX512CD_FLAGS, CPU_ANY_AVX512ER_FLAGS, CPU_ANY_AVX512PF_FLAGS, CPU_ANY_AVX512DQ_FLAGS, CPU_ANY_AVX512BW_FLAGS, CPU_ANY_AVX512VL_FLAGS, CPU_ANY_AVX512IFMA_FLAGS and CPU_ANY_AVX512VBMI_FLAGS. * i386-init.h: Regenerated.
2016-05-29Automatic date update in version.inGDB Administrator1-1/+1
2016-05-28Add dependencies to configure ruleAlan Modra3-2/+13
* Makefile.tpl (configure): Depend on m4 files included. * Makefile.in: Regenerate.
2016-05-28MIPS/BFD: Correctly handle `bfd_reloc_outofrange' with branchesMaciej W. Rozycki7-0/+85
Fix internal errors like: ld: BFD (GNU Binutils) 2.26.51.20160526 internal error, aborting at .../bfd/elfxx-mips.c:10278 in _bfd_mips_elf_relocate_section ld: Please report this bug. triggered by the `bfd_reloc_outofrange' condition on branch relocations. bfd/ * elfxx-mips.c (b_reloc_p): New function. (_bfd_mips_elf_relocate_section) <bfd_reloc_outofrange>: Handle branch relocations. ld/ * testsuite/ld-mips-elf/unaligned-branch.d: New test. * testsuite/ld-mips-elf/unaligned-branch.s: New test source. * testsuite/ld-mips-elf/unaligned-text.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2016-05-28MIPS/LD/testsuite: Rename `unaligned-syms' to `unaligned-data'Maciej W. Rozycki6-4/+13
ld/ * testsuite/ld-mips-elf/unaligned-syms.s: Rename to... * testsuite/ld-mips-elf/unaligned-data.s: ... this. * testsuite/ld-mips-elf/unaligned-ldpc-0.d: Adjust accordingly. * testsuite/ld-mips-elf/unaligned-ldpc-1.d: Likewise. * testsuite/ld-mips-elf/unaligned-lwpc-0.d: Likewise. * testsuite/ld-mips-elf/unaligned-lwpc-1.d: Likewise.
2016-05-28MIPS/BFD: Enable local R_MIPS_26 overflow detectionMaciej W. Rozycki10-8/+146
The original MIPS SVR4 psABI defines the calculation for the R_MIPS_26 relocation in a complex way, as follows[1]: Name Value Field Symbol Calculation R_MIPS_26 4 T-targ26 local (((A << 2) | \ (P & 0xf0000000)) + S) >> 2 4 T-targ26 external (sign-extend(A << 2) + S) >> 2 This is further clarified, by correcting typos (already applied in the excerpt above) in the 64-bit psABI extension[2]. A note is included in both documents to specify that for the purpose of relocation processing a local symbol is one with binding STB_LOCAL and type STT_SECTION, and otherwise, a symbol is external. We have both calculations implemented for the R_MIPS_26 relocation, and by extension also for the R_MIPS16_26 and R_MICROMIPS_26_S1 relocations, from now on collectively called jump relocations. However our code uses a different condition to tell local and external symbols apart, that is it only checks for the STB_LOCAL binding and ignores the symbol type, however for REL relocations only. The external calculation is used for all RELA jump relocations. In reality the difference matters for jump relocations referring local MIPS16 and, as from recent commit 44d3da233815 ("MIPS/GAS: Treat local jump relocs the same no matter if REL or RELA"), also local microMIPS symbols. Such relocations are not converted to refer to corresponding section symbols instead and retain the original local symbol reference. It can be inferred from the relocation calculation definitions that the addend is effectively unsigned for the local case and explicitly signed for the external case. With the REL relocation format it makes sense given the limited range provided for by the field being relocated: the use of an unsigned addend expands the range by one bit for the local case, because a negative offset from a section symbol makes no sense, and any usable negative offset from the original local symbol will have worked out positive if converted to a section-relative reference. In the external case a signed addend gives more flexibility as offsets both negative and positive can be used with a symbol. Any such offsets will typically have a small value. The inclusion of the (P & 0xf0000000) component, ORed in the calculation in the local case, seems questionable as bits 31:28 are not included in the relocatable field and are masked out as the relocation is applied. Their value is therefore irrelevant for output processing, the relocated field ends up the same regardless of their value. They could be used for overflow detection, however this is precluded by adding them to bits 31:28 of the symbol referred, as the sum will not correspond to the value calculated by the processor at run time whenever bits 31:28 of the symbol referred are not all zeros, even though it is valid as long they are the same as bits 31:28 of P. We deal with this problem by ignoring any overflow resulting from the local calculation. This however makes us miss genuine overflow cases, where 31:28 of the symbol referred are different from bits 31:28 of P, and non-functional code is produced. Given the situation, for the purpose of overflow detection we can change our code to follow the original psABI and only treat the in-place addend as unsigned in the section symbol case, permitting jumps to offsets 128MiB and above into section. Sections so large may be uncommon, but still a reasonable use case. On the other hand such large offsets from regular local symbols are not expected and it makes sense to support (possibly small) negative offsets instead, also in consistency with what we do for global symbols. Drop the (P & 0xf0000000) component then, treat the addend as signed with local non-section symbols and also detect an overflow in the result of such calculation with local symbols. NB it does not affect the value computed for the relocatable field, it only affects overflow detection. References: [1] "SYSTEM V APPLICATION BINARY INTERFACE, MIPS RISC Processor Supplement, 3rd Edition", Figure 4-11: "Relocation Types", p. 4-19 <http://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf> [2] "64-bit ELF Object File Specification, Draft Version 2.5", Table 32 "Relocation Types", p. 45 <http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf> bfd/ * elfxx-mips.c (mips_elf_calculate_relocation): <R_MIPS16_26> <R_MIPS_26, R_MICROMIPS_26_S1>: Drop the region bits of the reloc location from calculation, treat the addend as signed with local non-section symbols and enable overflow detection. ld/ * testsuite/ld-mips-elf/jal-global-overflow-0.d: New test. * testsuite/ld-mips-elf/jal-global-overflow-1.d: New test. * testsuite/ld-mips-elf/jal-local-overflow-0.d: New test. * testsuite/ld-mips-elf/jal-local-overflow-1.d: New test. * testsuite/ld-mips-elf/jal-global-overflow.s: New test source. * testsuite/ld-mips-elf/jal-local-overflow.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2016-05-28Return void from linker callbacksAlan Modra102-1467/+1026
The ldmain.c implementation of these linker callback functions always return true, so any code handling a false return is dead. What's more, some of the bfd backends abort if ever a false return is seen, and there seems to be some confusion in gdb's compile-object-load.c. The return value was never meant to be "oh yes, a multiple_definition error occurred", but rather "out of memory or other catastrophic failure". This patch removes the status return on the callbacks that always return true. I kept the return status for "notice" because that one does happen to need to return "out of memory". include/ * bfdlink.h (struct bfd_link_callbacks): Update comments. Return void from multiple_definition, multiple_common, add_to_set, constructor, warning, undefined_symbol, reloc_overflow, reloc_dangerous and unattached_reloc. bfd/ * aoutx.h: Adjust linker callback calls throughout file, removing dead code. * bout.c: Likewise. * coff-alpha.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-h8500.c: Likewise. * coff-i960.c: Likewise. * coff-mcore.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-tic80.c: Likewise. * coff-w65.c: Likewise. * coff-z80.c: Likewise. * coff-z8k.c: Likewise. * coff64-rs6000.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-bfd.h: Likewise. * elf-m10200.c: Likewise. * elf-m10300.c: Likewise. * elf32-arc.c: Likewise. * elf32-arm.c: Likewise. * elf32-avr.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cr16.c: Likewise. * elf32-cr16c.c: Likewise. * elf32-cris.c: Likewise. * elf32-crx.c: Likewise. * elf32-d10v.c: Likewise. * elf32-epiphany.c: Likewise. * elf32-fr30.c: Likewise. * elf32-frv.c: Likewise. * elf32-ft32.c: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i370.c: Likewise. * elf32-i386.c: Likewise. * elf32-i860.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-iq2000.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mep.c: Likewise. * elf32-metag.c: Likewise. * elf32-microblaze.c: Likewise. * elf32-moxie.c: Likewise. * elf32-msp430.c: Likewise. * elf32-mt.c: Likewise. * elf32-nds32.c: Likewise. * elf32-nios2.c: Likewise. * elf32-or1k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-sh.c: Likewise. * elf32-sh64.c: Likewise. * elf32-spu.c: Likewise. * elf32-tic6x.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-v850.c: Likewise. * elf32-vax.c: Likewise. * elf32-visium.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfnn-aarch64.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c: Likewise. * linker.c: Likewise. * pdp11.c: Likewise. * pe-mips.c: Likewise. * reloc.c: Likewise. * reloc16.c: Likewise. * simple.c: Likewise. * vms-alpha.c: Likewise. * xcofflink.c: Likewise. * elf32-rl78.c (get_symbol_value, get_romstart, get_ramstart): Delete status param. Adjust calls to these and linker callbacks throughout. * elf32-rx.c: (get_symbol_value, get_gp, get_romstart, get_ramstart): Delete status param. Adjust calls to these and linker callbacks throughout. ld/ * ldmain.c (multiple_definition, multiple_common, add_to_set, constructor_callback, warning_callback, undefined_symbol, reloc_overflow, reloc_dangerous, unattached_reloc): Return void. * emultempl/elf32.em: Adjust callback calls. gdb/ * compile/compile-object-load.c (link_callbacks_multiple_definition, link_callbacks_warning, link_callbacks_undefined_symbol, link_callbacks_undefined_symbol, link_callbacks_reloc_overflow, link_callbacks_reloc_dangerous, link_callbacks_unattached_reloc): Return void.
2016-05-28Automatic date update in version.inGDB Administrator1-1/+1
2016-05-27MIPS/BFD: Include the addend in JALX's target alignment verificationMaciej W. Rozycki12-6/+253
On RELA targets the addend can affect JALX target's alignment, so only verify it once the whole relocation calculation has completed. bfd/ * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS16_26> <R_MIPS_26, R_MICROMIPS_26_S1>: Include the addend in JALX's target alignment verification. ld/ * testsuite/ld-mips-elf/unaligned-jalx-addend-0.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-addend-1.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-0.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-1.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-0.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-1.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-addend-0.s: New test source. * testsuite/ld-mips-elf/unaligned-jalx-addend-1.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2016-05-27MIPS/BFD: Fix section symbol name fetching in relocationMaciej W. Rozycki6-1/+31
Symbol table entries for section symbols are different between IRIX and traditional MIPS ELF targets in that IRIX entries have their `st_name' member pointing at the section's name in the string table section, while traditional entries have 0 there and the section header string table has to be referred via the relevant section header's `shn_name' member instead. This is chosen with the `elf_backend_name_local_section_symbols' backend and can be observed with `readelf -s' output for an IRIX object: Symbol table '.symtab' contains 12 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 SECTION LOCAL DEFAULT 1 .text 2: 00000000 0 SECTION LOCAL DEFAULT 3 .data 3: 00000000 0 SECTION LOCAL DEFAULT 4 .bss 4: 00000000 0 SECTION LOCAL DEFAULT 5 .reginfo 5: 00000000 0 SECTION LOCAL DEFAULT 6 .MIPS.abiflags 6: 00000000 0 SECTION LOCAL DEFAULT 7 .pdr 7: 00000000 0 SECTION LOCAL DEFAULT 9 .gnu.attributes 8: 00002000 16 FUNC GLOBAL DEFAULT 1 foo 9: 00004008 0 FUNC LOCAL DEFAULT 1 abar 10: 00002008 0 FUNC LOCAL DEFAULT 1 afoo 11: 00004000 16 FUNC GLOBAL DEFAULT 1 bar and a corresponding traditional object: Symbol table '.symtab' contains 12 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 SECTION LOCAL DEFAULT 1 2: 00000000 0 SECTION LOCAL DEFAULT 3 3: 00000000 0 SECTION LOCAL DEFAULT 4 4: 00004008 0 FUNC LOCAL DEFAULT 1 abar 5: 00002008 0 FUNC LOCAL DEFAULT 1 afoo 6: 00000000 0 SECTION LOCAL DEFAULT 5 7: 00000000 0 SECTION LOCAL DEFAULT 6 8: 00000000 0 SECTION LOCAL DEFAULT 7 9: 00000000 0 SECTION LOCAL DEFAULT 9 10: 00002000 16 FUNC GLOBAL DEFAULT 1 foo 11: 00004000 16 FUNC GLOBAL DEFAULT 1 bar respectively. Consequently the right way to retrieve a section symbol's name has to be chosen in `mips_elf_calculate_relocation' for the purpose of error reporting. Originally we produced symbol tables in the traditional object format only and we handled it correctly until it was lost in a rewrite with: commit 7403cb6305f5660fccc8869d3333a731102ae978 Author: Mark Mitchell <mark@codesourcery.com> Date: Wed Jun 30 20:13:43 1999 +0000 probably because of the extra pointer indirection added which made the same expression have a different meaning. With the addition of IRIX symbol table format with: commit 174fd7f9556183397625dbfa99ef68ecd325c74b Author: Richard Sandiford <rdsandiford@googlemail.com> Date: Mon Feb 9 08:04:00 2004 +0000 the bug has been partially covered and now when a relocation error is triggered with an IRIX object the offending section symbol is correctly reported: tmpdir/dump0.o: In function `foo': (.text+0x2000): relocation truncated to fit: R_MIPS_26 against `.text' tmpdir/dump0.o: In function `bar': (.text+0x4000): relocation truncated to fit: R_MIPS_26 against `.text' because `bfd_elf_string_from_elf_section' retrieves the name from the string table section. With a traditional object however the function returns an empty string and consequently `no symbol' is printed instead: tmpdir/dump0.o: In function `foo': (.text+0x2000): relocation truncated to fit: R_MIPS_26 against `no symbol' tmpdir/dump0.o: In function `bar': (.text+0x4000): relocation truncated to fit: R_MIPS_26 against `no symbol' Restore the original semantics so that the section name is always correctly retrieved. bfd/ * elfxx-mips.c (mips_elf_calculate_relocation): Also use the section name if `bfd_elf_string_from_elf_section' returns an empty string. ld/ * testsuite/ld-mips-elf/reloc-local-overflow.d: New test. * testsuite/ld-mips-elf/reloc-local-overflow.s: Source for the new test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2016-05-27Update x86 CPU_XXX_FLAGS handlingH.J. Lu22-5462/+6113
Support defining CPU_XXX_FLAGS with other CPU_XXX_FLAGS. Update CPU_XXX_FLAGS to enable more bits like x87 and SYSCALL. Don't enable MMX when enabling SSE, AVX or AVX512. Don't disable AVX nor AVX512 when disabling SSE. Don't disable AVX512 when disabling AVX. Disable F16C, FMA, FMA4 and XOP when disabling AVX. Add 87, no287, no387, no687, nosse2, nosse3, nossse3, nosse4.1, nosse4.2, nosse4 and noavx2 directives to x86 assembler. TODO: Add more .noXXX, like .noavx512f, directives to x86 assembler. gas/ PR gas/20145 * config/tc-i386.c (cpu_arch): Add 687. (cpu_noarch): Add no287, no387, no687, nosse2, nosse3, nossse3, nosse4.1, nosse4.2, nosse4 and noavx2. (parse_real_register): Check cpuregmmx instead of cpummx for MMX register. Check cpuregxmm instead of cpusse for XMM register. Check cpuregymm instead of cpuavx for YMM register. Check cpuregzmm/cpuregmask instead of cpuavx512f for ZMMM/mask register. * doc/c-i386.texi: Mention 687, no287, no387, no687, nosse2, nosse3, nossse3, nosse4.1, nosse4.2, nosse4 and noavx2. * testsuite/gas/i386/arch-10-prefetchw.d (as): Add mmx. * testsuite/gas/i386/arch-10.d (as): Likewise. * testsuite/gas/i386/arch-11.s: Add ".arch .mmx". * testsuite/gas/i386/i386.exp: Pass mmx to assembler for arch-10-3 and arch-10-4. Run no87-3, nosse-4, nosse-5, noavx-3 and noavx-4. * testsuite/gas/i386/no87-3.l: New file. * testsuite/gas/i386/no87-3.s: Likewise. * testsuite/gas/i386/noavx-3.l: Likewise. * testsuite/gas/i386/noavx-3.s: Likewise. * testsuite/gas/i386/noavx-4.d: Likewise. * testsuite/gas/i386/noavx-4.s: Likewise. * testsuite/gas/i386/nosse-4.l: Likewise. * testsuite/gas/i386/nosse-4.s: Likewise. * testsuite/gas/i386/nosse-5.d: Likewise. * testsuite/gas/i386/nosse-5.s: Likewise. opcodes/ PR gas/20145 * i386-gen.c (cpu_flag_init): Update CPU_XXX_FLAGS. Remove CpuMMX from CPU_SSE_FLAGS. Remove AVX and AVX512 bits from CPU_ANY_SSE_FLAGS. Remove AVX512 bits from CPU_ANY_AVX_FLAGS. Add CPU_XSAVE_FLAGS to CPU_XSAVEOPT_FLAGS, CPU_XSAVE_FLAGS and CpuXSAVEC. Add CPU_AVX_FLAGS to CpuF16C. Remove CpuMMX from CPU_AVX512F_FLAGS, CPU_AVX512CD_FLAGS, CPU_AVX512ER_FLAGS, CPU_AVX512PF_FLAGS, CPU_AVX512DQ_FLAGS and CPU_AVX512BW_FLAGS. Add CPU_SSE2_FLAGS to CPU_SHA_FLAGS. Add CPU_ANY_287_FLAGS, CPU_ANY_387_FLAGS, CPU_ANY_687_FLAGS, CPU_ANY_SSE2_FLAGS, CPU_ANY_SSE3_FLAGS, CPU_ANY_SSSE3_FLAGS, CPU_ANY_SSE4_1_FLAGS, CPU_ANY_SSE4_2_FLAGS and CPU_ANY_AVX2_FLAGS. Enable CpuRegMMX for MMX. Enable CpuRegXMM for SSE, AVX and AVX512. Enable CpuRegYMM for AVX and AVX512VL, Enable CpuRegZMM and CpuRegMask for AVX512. (cpu_flags): Add CpuRegMMX, CpuRegXMM, CpuRegYMM, CpuRegZMM and CpuRegMask. (set_bitfield_from_cpu_flag_init): New function. (set_bitfield): Remove const on f. Call set_bitfield_from_cpu_flag_init to handle CPU_XXX_FLAGS. * i386-opc.h (CpuRegMMX): New. (CpuRegXMM): Likewise. (CpuRegYMM): Likewise. (CpuRegZMM): Likewise. (CpuRegMask): Likewise. (i386_cpu_flags): Add cpuregmmx, cpuregxmm, cpuregymm, cpuregzmm and cpuregmask. * i386-init.h: Regenerated. * i386-tbl.h: Likewise.
2016-05-27Skip attach-many-short-lived-threads.exp on known-broken DejaGnu versionsPedro Alves2-0/+40
If the testsuite is run with a DejaGnu version that predates the fix from last year: [PATCH] DejaGnu kills the wrong process due to PID-reuse races http://lists.gnu.org/archive/html/dejagnu/2015-07/msg00005.html ... gdb.threads/attach-many-short-lived-threads.exp fails randomly, often. Other tests randomly fail due to that issue too, but this one is _much_ more exposed. DejaGnu 1.6 was released meanwhile, which includes that DejaGnu fix, and also some distros backported the fix too. So skip the test when run with older/broken DejaGnus. gdb/testsuite/ChangeLog: 2016-05-27 Pedro Alves <palves@redhat.com> * gdb.threads/attach-many-short-lived-threads.exp (bad_dejagnu): New procedure. (top level): Call it, and bail out of DejaGnu is known to be bad.
2016-05-27Replace CpuAMD64/CpuIntel64 with AMD64/Intel64H.J. Lu8-10539/+10565
AMD64 vs CpuIntel64 ISA should be handled similar as AT&T vs Intel syntax. Since cpu_flags isn't sorted by position, we need to check the whole cpu_flags array for the maximum position when verifying CpuMax. gas/ PR gas/20154 * config/tc-i386.c (cpu_flags_match): Don't set cpuamd64 nor cpuintel64. (match_template): Check Intel64/AMD64 ISA. opcodes/ PR gas/20154 * i386-gen.c (cpu_flags): Remove CpuAMD64 and CpuIntel64. (opcode_modifiers): Add AMD64 and Intel64. (main): Properly verify CpuMax. * i386-opc.h (CpuAMD64): Removed. (CpuIntel64): Likewise. (CpuMax): Set to CpuNo64. (i386_cpu_flags): Remove cpuamd64 and cpuintel64. (AMD64): New. (Intel64): Likewise. (i386_opcode_modifier): Add amd64 and intel64. (i386-opc.tbl): Replace CpuAMD64/CpuIntel64 with AMD64/Intel64 on call and jmp. * i386-init.h: Regenerated. * i386-tbl.h: Likewise.
2016-05-27Improve documentation of general query packetsEli Zaretskii2-51/+57
gdb/doc/ChangeLog: * gdb.texinfo (General Query Packets): Move the description of the response before the long list of the specific 'read' and 'write' requests.
2016-05-27Correct CpuMax in i386-opc.hH.J. Lu6-12/+39
CpuMax should be CpuIntel64, not CpuNo64. i386-gen.c is updated to verify that CpuMax is correct. X86 assembler is updated to properly set cpuamd64 and cpuintel64. gas/ PR gas/20154 * config/tc-i386.c (intel64): New. (cpu_flags_match): Set cpuamd64 and cpuintel64. (md_parse_option): Set intel64 instead of cpuamd64 and cpuintel64. opcodes/ PR gas/20154 * i386-gen.c (main): Fail if CpuMax is incorrect. * i386-opc.h (CpuMax): Set to CpuIntel64. * i386-tbl.h: Regenerated.
2016-05-27Fix typo introduced during the most recent synchronization update.Nick Clifton2-2/+7