aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-02-28MIPS/BFD: Also handle `jalr $0, $25' with R_MIPS_JALRMaciej W. Rozycki13-12/+207
Interpret the `jalr $0, $25' instruction encoding with an R_MIPS_JALR relocation attached as an alias to `jr $25' and convert the jump to an equivalent branch where possible, consequently covering the MIPSr6 architecture for the purpose of this optimization too. bfd/ * elfxx-mips.c (mips_elf_perform_relocation): Also handle the `jalr $0, $25' instruction encoding. gas/ * testsuite/gas/mips/jalr4.s: Add `jalr $0, $25' instructions. * testsuite/gas/mips/jalr4.d: Adjust accordingly. Remove MIPSr6 encoding patterns. * testsuite/gas/mips/jalr4-n64.d: Likewise. * testsuite/gas/mips/mipsr6@jalr4.d: New test. * testsuite/gas/mips/mipsr6@jalr4-n32.d: New test. * testsuite/gas/mips/mipsr6@jalr4-n64.d: New test. ld/ * testsuite/ld-mips-elf/jalr4.dd: Adjust for `jalr $0, $25' instructions. * testsuite/ld-mips-elf/jalr4-r6.dd: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2017-02-28Automatic date update in version.inGDB Administrator1-1/+1
2017-02-27Fix compilation with GCC 4.4.7.Jan Kratochvil2-3/+11
binutils/ 2017-02-27 Jan Kratochvil <jan.kratochvil@redhat.com> Fix compilation with GCC 4.4.7. * dwarf.c (display_loclists_list, display_debug_rnglists_list): Initialize begin and end.
2017-02-27Remove struct keyword from range-based for loopSimon Marchi2-1/+6
The previous patch introduced this error with recent-ish GCCs: ../../binutils-gdb/gdb/remote.c: In function ‘int remote_add_target_side_condition(gdbarch*, bp_target_info*, char*, char*)’: ../../binutils-gdb/gdb/remote.c:9668:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct agent_expr *aexpr : bp_tgt->conditions) ^~~~~~ Removing the struct keyword fixes the error. gdb/ChangeLog: * remote.c (remote_add_target_side_condition): Remove "struct" keyword from range-based for loop.
2017-02-27Use range-based for loop in remote_add_target_side_conditionSimon Marchi2-4/+7
Using a range based for loop makes this code a bit more clean and readable. The comment above is clearly erroneous, so I've updated it. gdb/ChangeLog: * remote.c (remote_add_target_side_condition): Use range-based for loop. Update comment.
2017-02-27Fix array out of bound accessYao Qi2-2/+8
ASAN reports the following error, (gdb) PASS: gdb.fortran/vla-ptr-info.exp: continue to breakpoint: pvla-associated print &pvla^M =================================================================^M ^[[1m^[[31m==14331==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000ea569f at pc 0x0000008eb546 bp 0x7ffde0c1dc70 sp 0x7ffde0c1dc60^M ^[[1m^[[0m^[[1m^[[34mREAD of size 1 at 0x000000ea569f thread T0^[[1m^[[0m^M #0 0x8eb545 in f_print_type(type*, char const*, ui_file*, int, int, type_print_options const*) ../../binutils-gdb/gdb/f-typeprint.c:89^M #1 0xb611e2 in type_print(type*, char const*, ui_file*, int) ../../binutils-gdb/gdb/typeprint.c:365^M #2 0x7b3471 in c_value_print(value*, ui_file*, value_print_options const*) ../../binutils-gdb/gdb/c-valprint.c:650^M #3 0xb99517 in value_print(value*, ui_file*, value_print_options const*) ../../binutils-gdb/gdb/valprint.c:1233^M #4 0xa42be8 in print_formatted ../../binutils-gdb/gdb/printcmd.c:321^M #5 0xa46ac9 in print_value(value*, format_data const*) ../../binutils-gdb/gdb/printcmd.c:1233^M #6 0xa46d82 in print_command_1 ../../binutils-gdb/gdb/printcmd.c:1261^M #7 0xa46e3e in print_command ../../binutils-gdb/gdb/printcmd.c:1267 on this line of code demangled_args = varstring[strlen (varstring) - 1] == ')'; because varstring is an empty string and strlen () is 0, so "strlen () - 1" is definitely out of the bound of "varstring", (gdb) bt 10 at /home/yao/SourceCode/gnu/gdb/git/gdb/f-typeprint.c:56 at /home/yao/SourceCode/gnu/gdb/git/gdb/typeprint.c:365 at /home/yao/SourceCode/gnu/gdb/git/gdb/c-valprint.c:650 at /home/yao/SourceCode/gnu/gdb/git/gdb/valprint.c:1236 This patch adds a pre-check that varstring is empty or not. gdb: 2017-02-27 Yao Qi <yao.qi@linaro.org> * f-typeprint.c (f_print_type): Check "varstring" is empty first.
2017-02-27Place read-only data in the text section on AVR Tiny targets.Georg-Johann Lay2-2/+15
PR target/20849 * scripttempl/avrtiny.sc (__RODATA_PM_OFFSET__): New define. (.rodata): New section. (.data): Remove .rodata*.
2017-02-27Add symbol called __nm_<name> to exported symbols created by dlltool.Rudy Y2-1/+26
PR 20881 * dlltool.c (secdata): Align .idata$6 on 2 byte boundary. (make_one_lib_file): Export a symbol called __nm_<symbol> for use with auto-importing.
2017-02-27Fix segfault in microblaze linker when garbage collection removes a symbol ↵Nick Clifton2-3/+17
scheduled for a slot in the PLT. PR ld/21180 * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid generating a seg-fault when encountering a symbol that has been deleted by garbage collection.
2017-02-27Remove MAX_REGISTER_SIZE from remote.cAlan Hayward4-5/+24
gdb/ * regcache.c (regcache_raw_update): New function. (regcache_raw_read): Move code to regcache_raw_update. * regcache.h (regcache_raw_update): New declaration. * remote.c (remote_prepare_to_store): Call regcache_raw_update.
2017-02-27Automatic date update in version.inGDB Administrator1-1/+1
2017-02-26DWARF-5: Initialization due to a false compiler warningJan Kratochvil2-0/+9
gcc-6.3.1-1.fc25.x86_64 dwarf2read.c: In function ‘void create_debug_type_hash_table(dwo_file*, dwarf2_section_info*, htab*&, rcuh_kind)’: dwarf2read.c:4776:32: error: ‘header.comp_unit_head::type_offset_in_tu.cu_offset::cu_off’ may be used uninitialized in this function [-Werror=maybe-uninitialized] dwarf2read.c:4816:21: error: ‘header.comp_unit_head::signature’ may be used uninitialized in this function [-Werror=maybe-uninitialized] cc1plus: all warnings being treated as errors gdb/ChangeLog 2017-02-26 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf2read.c (create_debug_type_hash_table): Initialize header.signature and header.type_offset_in_tu.
2017-02-25Add missing smov support, and clean up existing umov support.Jim Wilson4-75/+227
sim/aarch64/ * simulator.c (do_vec_SMOV_into_scalar): New. (do_vec_UMOV_into_scalar): Renamed from do_vec_MOV_into_scalar. Rewritten. (do_vec_UMOV): Merged into do_vec_UMOV_into_scalar and deleted. (do_vec_op1): Move do_vec_TRN call and do_vec_UZP call. Add do_vec_SMOV_into_scalar call. Delete do_vec_MOV_into_scalar and do_vec_UMOV calls. Add do_vec_UMOV_into_scalar call. sim/testsuite/sim/aarch64/ * sumov.s: New.
2017-02-25Add missing cnt (popcount) instruction support.Jim Wilson4-0/+94
sim/aarch64/ * simulator.c (popcount): New. (do_vec_CNT): New. (do_vec_op1): Add do_vec_CNT call. sim/testsuite/sim/aarch64/ * cnt.s: New.
2017-02-26Automatic date update in version.inGDB Administrator1-1/+1
2017-02-25Testsuite fixes for hppa64-hpuxAlan Modra18-62/+128
HPUX has a different .comm syntax, and anything in the first column is a label. gas/ * testsuite/gas/elf/strtab.s: Don't put directives on first column or continuation with labels not in first column. ld/ * testsuite/ld-elf/elf.exp: Xfail pr20995 tests on hppa64-hpux. Set up HPUX defsym. Run pr14170 tests and build symbol3 objects, defining HPUX where necessary. Define HPUX for implib tests. * testsuite/ld-elf/comm-data4.d: Run for hpux. * testsuite/ld-elf/endsym.d: Likewise. * testsuite/ld-elf/linkoncerdiff.d: Likewise. * testsuite/ld-elf/comm-data4.s: Add alternate .comm when HPUX. * testsuite/ld-elf/comm-data5.s: Likewise. * testsuite/ld-elf/endsym.s: Likewise. * testsuite/ld-elf/pr14170c.s: Likewise. * testsuite/ld-elf/symbol3.s: Likewise. * testsuite/ld-elf/implib.s: Likewise. Don't start directives in first column. * testsuite/ld-elf/linkoncerdiff2.s: Don't use numeric labels. * testsuite/ld-elf/warn3.d: Run for hpux. * testsuite/ld-scripts/rgn-at10.d: Xfail for hpux. * testsuite/ld-scripts/rgn-at11.d: Likewise. * testsuite/ld-scripts/size-2.d: Remove xfail for hpux.
2017-02-25Fixes for new dw5 testAlan Modra3-31/+47
On some targets, .string does not add a NUL string terminator. * testsuite/binutils-all/dw5.S: Replace .string with .asciz. Support hpux .comm variant. * testsuite/binutils-all/readelf.exp: Define HPUX when assembling dw5 test for hppa64-hpux.
2017-02-25ARC naughtiness causing assertion fail at elf-strtab.c:302Alan Modra2-135/+78
This patch fixes a number of issues in the ARC backend. - The ARC size_dynamic_sections was trashing dynamic section contents, in particular the .gnu.version_d contents. Those versions definitions are therefore lost so they do not drain from the strtab, resulting in assertion failures. - The code attempting to set DT_TEXTREL was completely bogus. - The ARC finish_dynamic_sections would segfault on trying to set sh_entsize for .rela.plt if that section had been discarded. - arc_create_dynamic_sections wouldn't have ever created dynamics sections, which was just as well since the places it was called were way too late to create dynamic sections. Its usefulness then devolved down to finding just one dynamic section. All the others packaged into a struct were unused. - .interp wasn't set for PIEs. * elf32-arc.c (struct dynamic_sections): Delete. (enum dyn_section_types): Delete. (dyn_section_names): Delete. (arc_create_dynamic_sections): Delete. (elf_arc_finish_dynamic_sections): Don't call the above. Don't segfault on discarded .rela.plt section. (elf_arc_size_dynamic_sections): Formatting. Don't call arc_create_dynamic_sections. Don't allocate memory for sections handled by the generic linker. Correct code finding relocs in read-only sections. Set SEC_EXCLUDE on zero size .got, .got.plt, and .dynbss sections. Do set .interp for pies.
2017-02-25Automatic date update in version.inGDB Administrator1-1/+1
2017-02-24[AArch64] Additional SVE instructionsRichard Sandiford20-2097/+7909
This patch supports some additions to the SVE architecture prior to its public release. include/ * opcode/aarch64.h (AARCH64_OPND_SVE_ADDR_RI_S4x16) (AARCH64_OPND_SVE_IMM_ROT1, AARCH64_OPND_SVE_IMM_ROT2) (AARCH64_OPND_SVE_Zm3_INDEX, AARCH64_OPND_SVE_Zm3_22_INDEX) (AARCH64_OPND_SVE_Zm4_INDEX): New aarch64_opnds. opcodes/ * aarch64-tbl.h (OP_SVE_HMH, OP_SVE_VMU_HSD, OP_SVE_VMVU_HSD) (OP_SVE_VMVV_HSD, OP_SVE_VMVVU_HSD, OP_SVE_VM_HSD, OP_SVE_VUVV_HSD) (OP_SVE_VUV_HSD, OP_SVE_VU_HSD, OP_SVE_VVVU_H, OP_SVE_VVVU_S) (OP_SVE_VVVU_HSD, OP_SVE_VVV_D, OP_SVE_VVV_D_H, OP_SVE_VVV_H) (OP_SVE_VVV_HSD, OP_SVE_VVV_S, OP_SVE_VVV_S_B, OP_SVE_VVV_SD_BH) (OP_SVE_VV_BHSDQ, OP_SVE_VV_HSD, OP_SVE_VZVV_HSD, OP_SVE_VZV_HSD) (OP_SVE_V_HSD): New macros. (OP_SVE_VMU_SD, OP_SVE_VMVU_SD, OP_SVE_VM_SD, OP_SVE_VUVV_SD) (OP_SVE_VU_SD, OP_SVE_VVVU_SD, OP_SVE_VVV_SD, OP_SVE_VZVV_SD) (OP_SVE_VZV_SD, OP_SVE_V_SD): Delete. (aarch64_opcode_table): Add new SVE instructions. (aarch64_opcode_table): Use imm_rotate{1,2} instead of imm_rotate for rotation operands. Add new SVE operands. * aarch64-asm.h (ins_sve_addr_ri_s4): New inserter. (ins_sve_quad_index): Likewise. (ins_imm_rotate): Split into... (ins_imm_rotate1, ins_imm_rotate2): ...these two inserters. * aarch64-asm.c (aarch64_ins_imm_rotate): Split into... (aarch64_ins_imm_rotate1, aarch64_ins_imm_rotate2): ...these two functions. (aarch64_ins_sve_addr_ri_s4): New function. (aarch64_ins_sve_quad_index): Likewise. (do_misc_encoding): Handle "MOV Zn.Q, Qm". * aarch64-asm-2.c: Regenerate. * aarch64-dis.h (ext_sve_addr_ri_s4): New extractor. (ext_sve_quad_index): Likewise. (ext_imm_rotate): Split into... (ext_imm_rotate1, ext_imm_rotate2): ...these two extractors. * aarch64-dis.c (aarch64_ext_imm_rotate): Split into... (aarch64_ext_imm_rotate1, aarch64_ext_imm_rotate2): ...these two functions. (aarch64_ext_sve_addr_ri_s4): New function. (aarch64_ext_sve_quad_index): Likewise. (aarch64_ext_sve_index): Allow quad indices. (do_misc_decoding): Likewise. * aarch64-dis-2.c: Regenerate. * aarch64-opc.h (FLD_SVE_i3h, FLD_SVE_rot1, FLD_SVE_rot2): New aarch64_field_kinds. (OPD_F_OD_MASK): Widen by one bit. (OPD_F_NO_ZR): Bump accordingly. (get_operand_field_width): New function. * aarch64-opc.c (fields): Add new SVE fields. (operand_general_constraint_met_p): Handle new SVE operands. (aarch64_print_operand): Likewise. * aarch64-opc-2.c: Regenerate. gas/ * doc/c-aarch64.texi: Document that sve implies fp16, simd and compnum. * config/tc-aarch64.c (parse_vector_type_for_operand): Allow .q to be used with SVE registers. (parse_operands): Handle new SVE operands. (aarch64_features): Make "sve" require F16 rather than FP. Also require COMPNUM. * testsuite/gas/aarch64/sve.s: Add tests for new instructions. Include compnum tests. * testsuite/gas/aarch64/sve.d: Update accordingly. * testsuite/gas/aarch64/sve-invalid.s: Add tests for new instructions. * testsuite/gas/aarch64/sve-invalid.l: Update accordingly. Also update expected output for new FMOV and MOV alternatives.
2017-02-24[AArch64] Add a "compnum" featureRichard Sandiford9-7/+87
This patch adds a named "compnum" feature for the ARMv8.3-A FCADD and FCMLA extensions. include/ * opcode/aarch64.h (AARCH64_FEATURE_COMPNUM): New macro. (AARCH64_ARCH_V8_3): Include AARCH64_FEATURE_COMPNUM. opcodes/ * aarch64-tbl.h (aarch64_feature_simd_v8_3): Replace with... (aarch64_feature_compnum): ...this. (SIMD_V8_3): Replace with... (COMPNUM): ...this. (CNUM_INSN): New macro. (aarch64_opcode_table): Use it for the complex number instructions. gas/ * doc/c-aarch64.texi: Add a "compnum" entry. * config/tc-aarch64.c (aarch64_features): Likewise, * testsuite/gas/aarch64/advsimd-compnum.s: New test. * testsuite/gas/aarch64/advsimd-compnum.d: Likewise.
2017-02-24Fix snafu with booleans in readelf patch - lack of a program header is not a ↵Nick Clifton2-3/+7
reason for a function to return false. (process_program_headers): Fix snafu - if the program headers are not available then this is not a cause to fail. (process_corefile_note_segments): Likewise.
2017-02-24symtab.c: Small refactorPedro Alves2-15/+8
add_symtab_completions does the exact same as the code that it is replacing. gdb/ChangeLog: 2017-02-24 Pedro Alves <palves@redhat.com> * symtab.c (make_file_symbol_completion_list_1): Use add_symtab_completions.
2017-02-24bfd: RISC-V: relax to gp in more cases.Andrew Waterman2-1/+22
bfd/ChangeLog: 2017-02-24 Andrew Waterman <andrew@sifive.com> * elfnn-riscv.c (GP_NAME): New macro. (riscv_global_pointer_value): Use it. (_bfd_riscv_relax_lui): If symbol and global pointer are in same output section, consider only that section's alignment.
2017-02-24Add new counter-enable CSRsAndrew Waterman2-0/+11
include/ChangeLog: 2017-02-22 Andrew Waterman <andrew@sifive.com> * opcode/riscv-opc.h (CSR_SCOUNTEREN): New define. (CSR_MCOUNTEREN): Likewise. (scounteren): Declare register. (mcounteren): Likewise.
2017-02-24Remove use of MAX_REGISTER_SIZEAlan Hayward2-41/+46
gdb/ * stack.c (frame_info): Use frame_unwind_register_value to avoid buf.
2017-02-24Use I386_MAX_REGISTER_SIZE and M68K_MAX_REGISTER_SIZEAlan Hayward4-6/+16
gdb/ * i386-tdep.c (i386_pseudo_register_read_into_value): Use I386_MAX_REGISTER_SIZE. (i386_pseudo_register_write): Likewise. (i386_process_record): Likewise. * i387-tdep.c (i387_supply_xsave): Likewise. * m68k-linux-nat.c (fetch_register): Use M68K_MAX_REGISTER_SIZE. (store_register): Likewise.
2017-02-24Tidy up readelf's use of boolean values.Nick Clifton2-716/+929
* readelf.c (show_name, do_dynamic, do_syms, do_dyn_syms, (do_reloc, do_sections, do_section_groups, do_section_details, (do_segments, do_unwind, do_using_dynamic, do_header, do_dump, (do_version, do_histogram, do_debugging, do_arch, do_notes, (do_archive_index, is_32bit_elf, decompress_dumps): Use bfd_boolean type. (parse_args): Treat the do_* variables as booleans. (print_vma): Return an unsigned int. (print_symbol): Change width parameter to signed int. (is_ia64_vms): Change return type to bfd_boolean. (guess_is_rela): Likewise. (slurp_rela_relocs): Likewise. (slurp_rel_relocs): Likewise. (dump_relocations): Likewise. (process_file_header): Likewise. (get_program_headers): Likewise. (process_program_headers): Likewise. (process_section_headers): Likewise. (process_section_groups): Likewise. (dump_ia64_vms_dynamic_fixups): Likewise. (dump_ia64_vms_dynamic_relocs): Likewise. (process_ia64_vms_dynamic_relocs): Likewise. (process_relocs): Likewise. (dump_ia64_unwind): Likewise. (ia64_process_unwind): Likewise. (dump_hppa_unwind): Likewise. (slurp_hppa_unwind_table): Likewise. (hppa_process_unwind): Likewise. (decode_arm_unwind_bytecode): Likewise. (decode_tic6x_unwind_bytecode): Likewise. (decode_arm_unwind): Likewise. (dump_arm_unwind): Likewise. (arm_process_unwind): Likewise. (process_unwind): Likewise. (get_32bit_dynamic_section): Likewise. (get_64bit_dynamic_section): Likewise. (process_dynamic_section): Likewise. (process_version_sections): Likewise. (process_symbol_table): Likewise. (process_syminfo): Likewise. (apply_relocations): Likewise. (disassemble_section): Likewise. (dump_section_as_strings): Likewise. (dump_section_as_bytes): Likewise. (load_specific_debug_section): Likewise. (load_debug_section): Likewise. (display_debug_section): Likewise. (process_section_contents): Likewise. (process_attributes): Likewise. (process_nds32_specific): Likewise. (process_gnu_liblist): Likewise. (print_core_note): Likewise. (print_gnu_note): Likewise. (print_v850_note): Likewise. (process_netbsd_elf_note): Likewise. (print_stapsdt_note): Likewise. (print_ia64_vms_note): Likewise. (process_note): Likewise. (process_notes_at): Likewise. (process_corefile_note_segments): Likewise. (process_v850_notes): Likewise. (process_note_sections): Likewise. (process_notes): Likewise. (process_arch_specific): Likewise. (get_file_header): Likewise. (process_object): Likewise. (process_archive): Likewise. (process_file): Likewise. (section_subset): Make static. (get_mips_reg_size): Return a signed integer. (process_object): Reverse the logic of the return value. (process_archive): Likewise. (process_file): Likewise.
2017-02-24readelf: Correct version flag formattingMaciej W. Rozycki2-6/+16
Remove a trailing space or a leading pipe character from version flags printed with `readelf --version-info'. For example with the `mips-linux' target we get: $ cat ver_def.s .data .globl new_foo .type new_foo, %object new_foo: .symver new_foo, foo@@ver_foo $ cat ver_def.ver { global: *foo*; local: *; }; $ as -o ver_def.o ver_def.s $ ld -e 0 --export-dynamic --version-script=ver_def.ver -o ver_def ver_def.o $ readelf -V ver_def Version symbols section '.gnu.version' contains 4 entries: Addr: 000000000000007e Offset: 0x01007e Link: 2 (.dynsym) 000: 0 (*local*) 2 (ver_foo) 1 (*global*) 2 (ver_foo) Version definition section '.gnu.version_d' contains 2 entries: Addr: 0x0000000000000088 Offset: 0x010088 Link: 3 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: ver_def 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: ver_foo $ which includes an unnecessary space after `BASE'; both call sites already provide suitable separation from output that follows. Also if only unknown flags were present, then lone `| <unknown>' would be printed. binutils/ * readelf.c (get_ver_flags): Tidy the formatting of the string returned
2017-02-24readelf: Make version section index sum unsignedMaciej W. Rozycki2-2/+8
Make `isum' unsigned like data it is calculated from. binutils/ * readelf.c (process_version_sections) <SHT_GNU_verdef>: Make `isum' unsigned. <SHT_GNU_verneed>: Likewise.
2017-02-24readelf: Fix incorrect "Version definition past end of section" messageMaciej W. Rozycki9-3/+132
Fix a commit 74e1a04b9787 ("More fixes for reading corrupt ELF files.") `readelf --version-info' regression that caused "Version definition past end of section" to be always printed at the end, even with good section data. For example with the `mips-linux' target we get: $ cat ver_def.s .data .globl new_foo .type new_foo, %object new_foo: .symver new_foo, foo@@ver_foo $ cat ver_def.ver { global: *foo*; local: *; }; $ as -o ver_def.o ver_def.s $ ld -e 0 --export-dynamic --version-script=ver_def.ver -o ver_def ver_def.o $ readelf -V ver_def Version symbols section '.gnu.version' contains 4 entries: Addr: 000000000000007e Offset: 0x01007e Link: 2 (.dynsym) 000: 0 (*local*) 2 (ver_foo) 1 (*global*) 2 (ver_foo) Version definition section '.gnu.version_d' contains 2 entries: Addr: 0x0000000000000088 Offset: 0x010088 Link: 3 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: ver_def 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: ver_foo Version definition past end of section $ The cause is the `if (idx + ent.vd_next <= idx)' condition introduced to ensure forward progress, which however always triggers for good version definition section data as the last entry will have its `vd_next' value set to 0. Adjust the condition then, to say `if (idx + ent.vd_next < idx)' instead and to ensure forward progress limit the number of entries processed to the size of the version definition section, removing the problematic message from output quoted above, while ensuring the original PR 17531 test case is still handled gracefully. Add a suitable test case so that we have `readelf --version-info' coverage; due to the lack of infrastructure needed to run the linker in the `binutils' test suite and limited justification to implement it add a new `readelf.exp' script to the `ld' test suite instead, intended to gather any `readelf' test cases that require the linker to be run. If ever we decide to have linker infrastructure added to the `binutils' test suite, then the script can be moved between the test suites. binutils/ * readelf.c (process_version_sections) <SHT_GNU_verdef>: Limit the number of entries processed by the section size. Don't break out of the loop if `ent.vd_next' is 0. ld/ * testsuite/ld-elf/ver_def.d: New test. * testsuite/ld-elf/ver_def.ld: New test linker script. * testsuite/ld-elf/ver_def.ver: New test version script. * testsuite/ld-elf/ver_def.s: New test source. * testsuite/ld-elf/readelf.exp: New test script.
2017-02-24x86: also correctly support TEST opcode aliasesJan Beulich9-2/+38
Opcodes F6/1 and F7/1 are aliases of F6/0 and F7/0 in all modes. This complements commit 8b89fe14b5 ("X86: Decode opcode 0x82 as opcode 0x80 in 32-bit mode"), just that here 64-bit mode is also covered.
2017-02-24gas: test cases for the architecture level aware SPARC ASI work.Sheldon Lobo6-0/+22
gas/ChangeLog: Test cases for the architecture level aware SPARC ASI work. * gas/testsuite/gas/sparc/sparc.exp: 2 new tests * gas/testsuite/gas/sparc/asi-bump-warn.s: New test * gas/testsuite/gas/sparc/asi-bump-warn.l: Likewise * gas/testsuite/gas/sparc/asi-arch-error.s: Likewise * gas/testsuite/gas/sparc/asi-arch-error.l: Likewise
2017-02-24Automatic date update in version.inGDB Administrator1-1/+1
2017-02-23MIPS/BFD: Remove duplicate NewABI JALR relocation handlingMaciej W. Rozycki10-169/+19
Remove separate original NewABI JALR relocation handling, introduced with commit d06471104a83 ("relax jalr $t9 [R_MIPS_JALR symbol] to bal symbol"), <https://sourceware.org/ml/binutils/2003-03/msg00394.html>, and only used by LD with the `--relax' option specified, and rely solely on `mips_elf_perform_relocation' code, which has been introduced with commit 1367d393bb74 ("On the RM9000 convert jal to bal if in range"), <https://www.sourceware.org/ml/binutils/2004-12/msg00088.html> and since made more complete, across all the three ABIs. Also remove the `--relax' option, now irrelevant, from the tests added with the former commit. bfd/ * elfxx-mips.h (_bfd_mips_relax_section): Remove prototype. * elfxx-mips.c (_bfd_mips_relax_section): Remove function. * elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro. * elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise. ld/ * testsuite/ld-mips-elf/relax-jalr-n32.d: Remove `--relax' option. * testsuite/ld-mips-elf/relax-jalr-n32-shared.d: Likewise. * testsuite/ld-mips-elf/relax-jalr-n64.d: Likewise. * testsuite/ld-mips-elf/relax-jalr-n64-shared.d: Likewise.
2017-02-23MIPS/BFD: Discard ineligible JALR relocations right awayMaciej W. Rozycki11-1/+200
Discard R_MIPS_JALR and R_MICROMIPS_JALR relocations associated with jumps that cannot be converted to an equivalent branch right away in `mips_elf_calculate_relocation' rather than letting them through to `mips_elf_perform_relocation'. This includes cross-mode jumps which need to flip the ISA bit or jumps to a misaligned location that cannot be encoded with a branch, in addition to preemptible symbol references already handled. Cross-mode jumps are actually already rejected as the conversion is made in `mips_elf_perform_relocation', so in this case this change only saves some processing. Jumps to a misaligned location are however converted, with bits causing misalignment lost, making resulting code functionally different even if the lone effect is avoiding an address error exception with an instruction fetch at the jump destination requested. Add test cases suitable, also including GAS verification to confirm that the JALR relocations explicitly requested have indeed been output in the intermediate objects used. bfd/ * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR> <R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p' or misaligned. gas/ * testsuite/gas/mips/jalr4.d: New test. * testsuite/gas/mips/jalr4-n32.d: New test. * testsuite/gas/mips/jalr4-n64.d: New test. * testsuite/gas/mips/jalr4.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * testsuite/ld-mips-elf/jalr4.dd: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2017-02-23DWARF-5: testcaseJan Kratochvil4-0/+1065
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * testsuite/binutils-all/dw5.S: New file. * testsuite/binutils-all/dw5.W: New file. * testsuite/binutils-all/readelf.exp (readelf -wiaoRlL): New test.
2017-02-23DWARF-5: DW_FORM_data16Jan Kratochvil2-0/+30
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (read_and_display_attr_value): Support DW_FORM_data16.
2017-02-23DWARF-5: MacrosJan Kratochvil2-28/+33
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (display_debug_macro): Support DWARF-5. Rename DW_MACRO_GNU_*.
2017-02-23DWARF-5: call sitesJan Kratochvil2-7/+45
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (decode_location_expression): Support DW_OP_implicit_pointer, DW_OP_const_type, DW_OP_regval_type, DW_OP_deref_type, DW_OP_convert and DW_OP_reinterpret. (read_and_display_attr_value): Support DW_AT_call_value, DW_AT_call_data_value, DW_AT_call_target and DW_AT_call_target_clobbered.
2017-02-23DWARF-5 basic functionalityJan Kratochvil4-204/+994
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (fetch_indirect_line_string): New function. (abbrev_attr): New field implicit_const. (add_abbrev_attr): New parameter implicit_const. (process_abbrev_section): Support DW_FORM_implicit_const. (decode_location_expression): Support DW_OP_entry_value. (read_and_display_attr_value): Add parameter implicit_const. Support DW_FORM_line_strp and DW_FORM_implicit_const. (read_and_display_attr): Add parameter implicit_const. (process_debug_info): Support line_str and DWARF-5. (read_debug_line_header): Support DWARF-5. (display_formatted_table): New function. (display_debug_lines_raw): New parameter file. Support DWARF-5. (display_debug_lines_decoded): New parameter fileptr. Support DWARF-5. (display_debug_lines): Pass file parameter. (display_debug_macro): Update read_and_display_attr_value caller. (display_debug_abbrev): Support DW_FORM_implicit_const. (display_loclists_list): New function. (display_loc_list): Support .debug_loclists. (display_debug_ranges_list): New function from display_debug_ranges. (display_debug_rnglists_list): New function. (display_debug_ranges): Support .debug_rnglists. (debug_displays): Add .debug_line_str, .debug_loclists and .debug_rnglists. * dwarf.h: Include dwarf2.h (DWARF2_Internal_LineInfo): Add li_offset_size. (DWARF2_Internal_CompUnit): Add cu_unit_type. (enum dwarf_section_display_enum): Add line_str. * readelf.c (process_section_headers): Add rnglists and loclists.
2017-02-23DWARF attrs: add delimiterJan Kratochvil2-25/+33
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (display_block): Add parameter delimiter. (decode_location_expression): Update display_block callers. (read_and_display_attr_value): Add parameter delimiter. (read_and_display_attr, display_debug_macro): Update read_and_display_attr_value caller.
2017-02-23PR21166: Validate rdrand/rdseed support separately in ↵Luis Machado2-9/+35
gdb.reverse/insn-reverse-x86.c As reported in PR21166, there are Intel processors out there that support rdrand but not rdseed. The fix is to verify both features separately and only run rdrand/rdseed tests if supported. gdb/testsuite/ChangeLog: 2017-02-23 Luis Machado <lgustavo@codesourcery.com> * gdb.reverse/insn-reverse.x86.c (check_rdrand_support): Renamed to ... (check_supported_features): ... this. Changed return type to void. (supports_rdseed): New static global. (rdseed): Check supports_rdseed. (initialize): Call check_supported_features.
2017-02-23dwarf.c: Use more dwarf_vmaJan Kratochvil2-23/+34
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (display_loc_list): Use dwarf_vma for offset, base_address and off. (display_loc_list_dwo): Use dwarf_vma for offset. (display_debug_loc): Use dwarf_vma for offset, base_address. (struct range_entry, range_entry_compar): Use dwarf_vma for ranges_offset. (display_debug_ranges): Use dwarf_vma for ranges_offset, offset and base_address.
2017-02-23S/390: Add support for new cpu architecture - arch12.Andreas Krebbel11-92/+726
This adds support of new instructions to the S/390 specific parts. The important feature of the new instruction set is the support of single and extended precision floating point vector operations. Note: arch12 is NOT the official name of the new CPU. It just continues the series of archXX options supported as alternate names. The archXX terminology refers to the edition number of the Principle of Operations manual. The official CPU name will be added later while keeping support of the arch12 for backwards compatibility. No testsuite regressions. Committed to mainline. Bye, -Andreas- opcodes/ChangeLog: 2017-02-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * s390-mkopc.c (main): Accept arch12 as cpu string and vx2 as facility. * s390-opc.c: Add new operand description macros, new instruction types, instruction masks, and new .insn instruction types. * s390-opc.txt: Add new arch12 instructions. include/ChangeLog: 2017-02-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * opcode/s390.h (enum s390_opcode_cpu_val): New value S390_OPCODE_ARCH12. (S390_INSTR_FLAG_VX2): New macro definition. gas/ChangeLog: 2017-02-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * config/tc-s390.c (s390_parse_cpu): New entry for arch12. * doc/as.texinfo: Document arch12 as cpu type. * doc/c-s390.texi: Likewise. * testsuite/gas/s390/s390.exp: Run arch12 specific tests. * testsuite/gas/s390/zarch-arch12.d: New test. * testsuite/gas/s390/zarch-arch12.s: New test. * testsuite/gas/s390/zarch-z13.d: Rename some mnemonics in the output patterns.
2017-02-23Use gdb::function_view in iterate_over_symtabs & coPedro Alves16-690/+581
I wanted to pass a lambda to iterate_over_symtabs (see following patch), so I converted it to function_view, and then the rest is cascaded from that. This gets rid of a bunch of single-use callback functions and corresponding manually managed callback capture types (add_partial_datum, search_symbols_data, etc.) in favor of letting the compiler generate them for us by using lambdas with a capture. In a couple cases, it was more natural to convert the existing function callbacks to function objects (i.e., operator(), e.g., decode_compound_collector). gdb/ChangeLog: 2017-02-23 Pedro Alves <palves@redhat.com> * ada-lang.c: Include "common/function-view.h". (ada_iterate_over_symbols): Adjust to use function_view as callback type. (struct add_partial_datum, ada_complete_symbol_matcher): Delete. (ada_make_symbol_completion_list): Use a lambda. (ada_exc_search_name_matches): Delete. (name_matches_regex): New. (ada_add_global_exceptions): Use a lambda and name_matches_regex. * compile/compile-c-support.c: Include "common/function-view.h". (print_one_macro): Change prototype to accept a ui_file pointer. (write_macro_definitions): Use a lambda. * dwarf2read.c: Include "common/function-view.h". (dw2_map_expand_apply, dw2_map_symtabs_matching_filename) (dw2_expand_symtabs_matching): Adjust to use function_view as callback type. * language.h: Include "common/function-view.h". (struct language_defn) <la_iterate_over_symbols>: Adjust to use function_view as callback type. (LA_ITERATE_OVER_SYMBOLS): Remove DATA parameter. * linespec.c: Include "common/function-view.h". (collect_info::add_symbol): New method. (struct symbol_and_data_callback, iterate_inline_only, struct symbol_matcher_data, iterate_name_matcher): Delete. (iterate_over_all_matching_symtabs): Adjust to use function_view as callback type and lambdas. (iterate_over_file_blocks): Adjust to use function_view as callback type. (decode_compound_collector): Now a class with private fields. (decode_compound_collector::release_symbols): New method. (collect_one_symbol): Rename to... (decode_compound_collector::operator()): ... this and adjust. (lookup_prefix_sym): decode_compound_collector construction bits move to decode_compound_collector ctor. Pass the decode_compound_collector object directly as callback. Remove cleanups and use decode_compound_collector::release_symbols instead. (symtab_collector): Now a class with private fields. (symtab_collector::release_symtabs): New method. (add_symtabs_to_list): Rename to... (symtab_collector::operator()): ... this and adjust. (collect_symtabs_from_filename): symtab_collector construction bits move to symtab_collector ctor. Pass the symtab_collector object directly as callback. Remove cleanups and use symtab_collector::release_symtabs instead. (collect_symbols): Delete. (add_matching_symbols_to_info): Use lambdas. * macrocmd.c (print_macro_callback): Delete. (info_macro_command): Use a lambda. (info_macros_command): Pass print_macro_definition as callable directly. (print_one_macro): Remove 'ignore' parameter. (macro_list_command): Adjust. * macrotab.c (macro_for_each_data::fn): Now a function_view. (macro_for_each_data::user_data): Delete field. (foreach_macro): Adjust to call the function_view. (macro_for_each): Adjust to use function_view as callback type. (foreach_macro_in_scope): Adjust to call the function_view. (macro_for_each_in_scope): Adjust to use function_view as callback type. * macrotab.h: Include "common/function-view.h". (macro_callback_fn): Declare a prototype instead of a pointer. Remove "user_data" parameter. (macro_for_each, macro_for_each_in_scope): Adjust to use function_view as callback type. * psymtab.c (partial_map_expand_apply) (psym_map_symtabs_matching_filename, recursively_search_psymtabs): Adjust to use function_view as callback type and to return bool. (psym_expand_symtabs_matching): Adjust to use function_view as callback types. * symfile-debug.c (debug_qf_map_symtabs_matching_filename): Adjust to use function_view as callback type and to return bool. (debug_qf_expand_symtabs_matching): Adjust to use function_view as callback types. * symfile.c (expand_symtabs_matching): Adjust to use function_view as callback types. * symfile.h: Include "common/function-view.h". (expand_symtabs_file_matcher_ftype) (expand_symtabs_symbol_matcher_ftype) (expand_symtabs_exp_notify_ftype): Remove "data" parameter and return bool. (quick_symbol_functions::map_symtabs_matching_filename) (quick_symbol_functions::expand_symtabs_matching): Adjust to use function_view as callback type and return bool. (expand_symtabs_matching): Adjust to use function_view as callback type. (maintenance_expand_name_matcher) (maintenance_expand_file_matcher): Delete. (maintenance_expand_symtabs): Use lambdas. * symtab.c (iterate_over_some_symtabs): Adjust to use function_view as callback types and return bool. (iterate_over_symtabs): Likewise. Use unique_xmalloc_ptr instead of a cleanup. (lookup_symtab_callback): Delete. (lookup_symtab): Use a lambda. (iterate_over_symbols): Adjust to use function_view as callback type. (struct search_symbols_data, search_symbols_file_matches) (search_symbols_name_matches): Delete. (search_symbols): Use a pair of lambdas. (struct add_name_data, add_macro_name, symbol_completion_matcher) (symtab_expansion_callback): Delete. (default_make_symbol_completion_list_break_on_1): Use lambdas. * symtab.h: Include "common/function-view.h". (iterate_over_some_symtabs): Adjust to use function_view as callback type and return bool. (iterate_over_symtabs): Adjust to use function_view as callback type. (symbol_found_callback_ftype): Remove 'data' parameter and return bool. (iterate_over_symbols): Adjust to use function_view as callback type.
2017-02-23Introduce gdb::function_viewPedro Alves6-0/+557
This commit adds a new function_view type. This type holds a non-owning reference to a callable. It is meant to be used as callback type of functions, instead of using the C-style pair of function pointer and 'void *data' arguments. function_view allows passing references to stateful function objects / lambdas with captures as callbacks efficiently, while function pointer + 'void *' does not. See the intro in the new function-view.h header for more. Unit tests included, put into a new gdb/unittests/ subdir. gdb/ChangeLog: 2017-02-23 Pedro Alves <palves@redhat.com> * Makefile.in (SUBDIR_UNITTESTS_SRCS, SUBDIR_UNITTESTS_OBS): New. (%.o) <unittests/%.c>: New pattern. * configure.ac ($development): Add $(SUBDIR_UNITTESTS_OBS) to CONFIG_OBS, and $(SUBDIR_UNITTESTS_SRCS) to CONFIG_SRCS. * common/function-view.h: New file. * unittests/function-view-selftests.c: New file. * configure: Regenerate.
2017-02-23opcodes,gas: associate SPARC ASIs with an architecture level.Sheldon Lobo5-203/+256
With this change an architecture level bump due to assembly ASIs will show up as a warning/error depending on options passed to gas. Tested with sparc64-linux-gnu, and it does not introduce any regressions. gas/ChangeLog: Add support for associating SPARC ASIs with an architecture level. * config/tc-sparc.c (parse_sparc_asi): New encode SPARC ASIs. opcodes/ChangeLog: Add support for associating SPARC ASIs with an architecture level. * include/opcode/sparc.h (sparc_asi): New sparc_asi struct. * opcodes/sparc-opc.c (asi_table): Updated asi_table and encoding/ decoding of SPARC ASIs.
2017-02-23Fix usage of inferior_ptid in two thread_alive implementationsSimon Marchi3-2/+8
While inspecting some target code, I noticed that in these two implementations of thread_alive, inferior_ptid is referenced directly instead of using the ptid passed as parameters. I guess that it is wrong, although I can't really test it in both cases. gdb/ChangeLog: * bsd-uthread.c (bsd_uthread_thread_alive): Use ptid instead of inferior_ptid. * go32-nat.c (go32_thread_alive): Likewise.
2017-02-23Add support to readelf for displaying gnu attributes in architectures not ↵Nick Clifton2-76/+99
known to support them. * readelf.c (display_tag_value): Use an explicit signed type for the tag parameter. (display_gnu_attributes): Use an unsigned integer type for attribute tags. (display_power_gnu_attribute): Likewise. (display_s390_gnu_attribute): Likewise. (display_sparc_hwcaps): Likewise. (display_sparc_hwcaps2): Likewise. (display_sparc_gnu_attribute): Likewise. (display_mips_gnu_attribute): Likewise. (display_tic6x_attribute): Likewise. (display_raw_attribute): Likewise. (process_attributes): Likewise. (process_arm_specific): Delete redundant function. (process_power_specific): Likewise. (process_s390_specific): Likewise. (process_sparc_specific): Likewise. (process_tic6x_specific): Likewise. (process_msp430x_specific): Likewise. (display_public_gnu_attributes): New function. Displays known information about an unknown gnu attribute. (display_generic_attribute): New function. Calls display_tag_value for non-nul tags. (process_arch_specific): Call process_attributes even for architectures not known to specifically support gnu attributes.