aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-04-18[ARM] FDPIC: Implement Thumb-only PLT for FDPIC.users/clyon/arm-fdpicChristophe Lyon8-21/+332
2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * elf32-arm.c (elf32_arm_fdpic_thumb_plt_entry): New. (elf32_arm_plt_needs_thumb_stub_p): Handle thumb-only case. (elf32_arm_populate_plt_entry): Likewise. (elf32_arm_output_plt_map_1): Likewise. (elf32_arm_output_arch_local_syms): Likewise. ld/testsuite/ * arm-elf.exp: Execute the new FDPIC Thumb-only tests. * fdpic-main-m.d: New test. * fdpic-main-m.s: New. * fdpic-main-m.sym: New. * fdpic-shared-m.d: New test. * fdpic-shared-m.s: New. * fdpic-shared-m.sym: New.
2018-04-18[ARM] FDPIC: New tests.Christophe Lyon11-0/+796
2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> ld/ * testsuite/ld-arm/arm-elf.exp: Execute the new FDPIC tests. * testsuite/ld-arm/fdpic-main.d: New test. * testsuite/ld-arm/fdpic-main.ld: New. * testsuite/ld-arm/fdpic-main.r: New. * testsuite/ld-arm/fdpic-main.s: New. * testsuite/ld-arm/fdpic-main.sym: New. * testsuite/ld-arm/fdpic-shared.d: New test. * testsuite/ld-arm/fdpic-shared.ld: New. * testsuite/ld-arm/fdpic-shared.r: New. * testsuite/ld-arm/fdpic-shared.s: New. * testsuite/ld-arm/fdpic-shared.sym: New.
2018-04-18[ARM] FDPIC: Fix ld testcase not to conflict with uclibc's includes.Christophe Lyon1-4/+4
2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> ld * testsuite/ld-elf/pr2404b.c (main): Rename time variable into time1.
2018-04-18[ARM] FDPIC: Make _GLOBAL_OFFSET_TABLE_ a relative symbolChristophe Lyon1-3/+3
2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Handle _GLOBAL_OFFSET_TABLE_ in FDPIC mode.
2018-04-18[ARM] FDPIC: Translate R_ARM_TARGET2 relocation into R_ARM_GOT32 relocation ↵Christophe Lyon1-1/+3
for FDPIC platform 2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * elf32-arm.c (bfd_elf32_arm_set_target_params): Handle FDPIC case for R_ARM_TARGET2.
2018-04-18[ARM] FDPIC: Add stack segmentChristophe Lyon1-0/+13
The size of the stack segment defaults to 32KB, and can be overridden by defining the __stacksize symbol. 2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * elf32-arm.c (DEFAULT_STACK_SIZE): New. (elf32_arm_always_size_sections): Create stack segment.
2018-04-18[ARM] Add TLS relocations for FDPIC.Christophe Lyon6-14/+109
Define and handle TLS relocations for FDPIC in BFD and gas. In gas, the new relocations are rejected if the --fdpic option was not specified. We also define the __tdata_start symbol to mark the start of the .tdata section. This allows FDPIC static binaries to find the start of .tdata section, since phdr->p_vaddr of TLS segment is not a valid value for FDPIC. 2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/: * bfd-in2.h (BFD_RELOC_ARM_TLS_GD32_FDPIC) (BFD_RELOC_ARM_TLS_LDM32_FDPIC, BFD_RELOC_ARM_TLS_IE32_FDPIC): New relocations. * elf32-arm.c (elf32_arm_howto_table_2): Add R_ARM_TLS_GD32_FDPIC, R_ARM_TLS_LDM32_FDPIC, R_ARM_TLS_IE32_FDPIC relocations. (elf32_arm_reloc_map): Add R_ARM_TLS_GD32_FDPIC, R_ARM_TLS_LDM32_FDPIC, R_ARM_TLS_IE32_FDPIC. (struct elf32_arm_link_hash_table): Update comment. (elf32_arm_final_link_relocate): Handle TLS FDPIC relocations. (IS_ARM_TLS_RELOC): Likewise. (elf32_arm_check_relocs): Likewise. (allocate_dynrelocs_for_symbol): Likewise. (elf32_arm_size_dynamic_sections): Update comment. * reloc.c: Add BFD_RELOC_ARM_TLS_GD32_FDPIC, BFD_RELOC_ARM_TLS_LDM32_FDPIC, BFD_RELOC_ARM_TLS_IE32_FDPIC. gas/ * config/tc-arm.c (reloc_names): Add TLSGD_FDPIC, TLSLDM_FDPIC, GOTTPOFF_FDIC relocations. (md_apply_fix): Handle the new TLS FDPIC relocations. (tc_gen_reloc): Likewise. (arm_fix_adjustable): Likewise. include/ * elf/arm.h: Add R_ARM_TLS_GD32_FDPIC, R_ARM_TLS_LDM32_FDPIC, R_ARM_TLS_IE32_FDPIC. ld/ * scripttempl/elf.sc: Define __tdata_start for .tdata section. * Define __tdata_start symbol to mark start of .tdata section This allow fdpic static binaries to find start of .tdata section since phdr->p_vaddr of TLS segment is not a valid value for fdpic. * Add fdpic tls specific relocations
2018-04-18[ARM] Implement PLT for FDPIC.Christophe Lyon1-9/+143
FDPIC requires special PLT entries, defined in this patch. Note that lazy binding is not supported because of a race condition for lack of an atomic 64-bits load instruction. 2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> * elf32-arm.c (elf32_arm_fdpic_plt_entry): New. (elf32_arm_create_dynamic_sections): Handle FDPIC. (elf32_arm_allocate_plt_entry): Likewise. (elf32_arm_populate_plt_entry): Likewise. (elf32_arm_output_plt_map_1): Likewise.
2018-04-18[ARM] Implement FDPIC relocations.Christophe Lyon2-31/+702
This is the main BFD patch, that enables the linker to actually handle the FDPIC relocations. 2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * elf32-arm.c (struct fdpic_local): New. (elf_arm_obj_tdata): Add local_fdpic_cnts field. (elf32_arm_local_fdpic_cnts): New. (struct fdpic_global): New. (elf32_arm_link_hash_entry): Add fdpic_cnts field. (elf32_arm_link_hash_table): Add srofixup field. (arm_elf_add_rofixup): New. (arm_elf_fill_funcdesc): New. (elf32_arm_link_hash_newfunc): Handle fdpic_cnts. (elf32_arm_allocate_local_sym_info): Likewise. (create_got_section): Create .rofixup section. (elf32_arm_copy_indirect_symbol): Handle fdpic_cnts. (bfd_elf32_arm_set_target_params): Handle FDPIC. (elf32_arm_final_link_relocate): Likewise. (elf32_arm_check_relocs): Likewise. (allocate_dynrelocs_for_symbol): Likewise. (elf32_arm_size_dynamic_sections): Likewise. (elf32_arm_finish_dynamic_sections): Likewise. (elf32_arm_output_arch_local_syms): Likewise. (elf32_arm_fdpic_omit_section_dynsym): New. ld/ * emulparams/armelf_linux_fdpiceabi.sh: Add .rofixup section.
2018-03-27[ARM] Add FDPIC relocations definitionsChristophe Lyon7-4/+136
Add FDPIC relocation definitions in BFD and gas. Gas rejects them if the --fdpic option was not specified. 2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * bfd-in2.c (BFD_RELOC_ARM_GOTFUNCDESC) (BFD_RELOC_ARM_GOTOFFFUNCDESC, BFD_RELOC_ARM_FUNCDESC) (BFD_RELOC_ARM_FUNCDESC_VALUE): New. * elf32-arm.c (elf32_arm_howto_table_2): Add R_ARM_GOTFUNCDESC, R_ARM_GOTOFFFUNCDESC, R_ARM_FUNCDESC, R_ARM_FUNCDESC_VALUE. (elf32_arm_howto_from_type): Take new members of elf32_arm_howto_table_2 into account. (elf32_arm_reloc_map): Add BFD_RELOC_ARM_GOTFUNCDESC, BFD_RELOC_ARM_GOTOFFFUNCDESC, BFD_RELOC_ARM_FUNCDESC, BFD_RELOC_ARM_FUNCDESC_VALUE. * reloc.c: Add BFD_RELOC_ARM_GOTFUNCDESC, BFD_RELOC_ARM_GOTOFFFUNCDESC, BFD_RELOC_ARM_FUNCDESC, BFD_RELOC_ARM_FUNCDESC_VALUE. gas/ * config/tc-arm.c (reloc_names): Add gotfuncdesc, gotofffuncdesc, funcdesc. (md_apply_fix): Support the new relocations. (tc_gen_reloc): Likewise. * testsuite/gas/arm/reloc-fdpic.d: New. * testsuite/gas/arm/reloc-fdpic.s: New. include/ * elf/arm.h (R_ARM_GOTFUNCDESC, R_ARM_GOTOFFFUNCDESC) (R_ARM_FUNCDESC) (R_ARM_FUNCDESC_VALUE): Define new relocations.
2018-03-20[ARM] Add FDPIC OSABI flag support.Christophe Lyon4-4/+52
ELF files targetting ARM FDPIC use the ELFOSABI_ARM_FDPIC flag. Set it appropriately in file generators (eg. gas), and handle it in readers (eg. readelf). 2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * elf32-arm.c (elf32_arm_print_private_bfd_data): Support EF_ARM_PIC and ELFOSABI_ARM_FDPIC. (elf32_arm_post_process_headers): Support ELFOSABI_ARM_FDPIC. (ELF_OSABI): Define to ELFOSABI_ARM_FDPIC. binutils/ * readelf.c (decode_ARM_machine_flags): Support EF_ARM_PIC. (get_osabi_name): Support ELFOSABI_ARM_FDPIC. gas/ * config/tc-arm.c (arm_fdpic): New. (elf32_arm_target_format): Support FDPIC. (OPTION_FDPIC): New. (md_longopts): Support FDPIC. (md_parse_option): Likewise. (md_show_usage): Likewise. include/ * elf/arm.h (EF_ARM_FDPIC): New.
2018-03-20[ARM] Add armelf_linux_fdpiceabi and armelfb_linux_fdpiceabi BFD backendsChristophe Lyon10-4/+99
Initial definition of these new backends. 2018-XX-XX Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * config.bfd (arm*b-*-linux-*): Add arm_elf32_fdpic_be_vec and arm_elf32_fdpic_le_vec to targ_selvecs. (arm*-*-linux-*): Likewise. * configure.ac: Add support for arm_elf32_fdpic_be_vec and arm_elf32_fdpic_le_vec. * configure: Regenerate. * elf32-arm.c (struct elf32_arm_link_hash_table): Add fdpic_p. (elf32_arm_link_hash_table_create): Initialize fdpic_p. (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, TARGET_BIG_SYM) (TARGET_BIG_NAME, elf_match_priority): Define for FDPIC targets. (elf32_arm_fdpic_link_hash_table_create): New. * targets.c (_bfd_target_vector): Add arm_elf32_fdpic_be_vec and arm_elf32_fdpic_le_vec. ld/ * Makefile.am (ALL_EMULATION_SOURCES): Add earmelf_linux_fdpiceabi.c and earmelfb_linux_fdpiceabi.c. (earmelf_linux_fdpiceabi.c, earmelfb_linux_fdpiceabi.c): New rules. * Makefile.in: Regenerate. * configure.tgt (arm*b-*-linux-*eabi*): Add armelf_linux_fdpiceabi and armelfb_linux_fdpiceabi. (arm*-*-linux-*eabi*): Likewise. * emulparams/armelf_linux_fdpiceabi.sh: New. * emulparams/armelfb_linux_fdpiceabi.sh: New.
2018-03-14Update my email addressYao Qi2-4/+8
gdb: 2018-03-14 Yao Qi <qiyao@sourceware.org> * MAINTAINERS: Update my email address.
2018-03-14PowerPC64 debian bug 886264, out-of-line save/restore functionsAlan Modra2-15/+25
This calculation in relocate_section if (stub_entry->stub_type == ppc_stub_save_res) relocation += (stub_sec->output_offset + stub_sec->output_section->vma + stub_sec->size - htab->sfpr->size - htab->sfpr->output_offset - htab->sfpr->output_section->vma); to adjust from the original out-of-line save/restore function address in sfpr to a copy at the end of stub_sec goes wrong when stub_sec is padded, because the copy is no longer at the end of stub_sec. The solution is to pad before copying sfpr, so the copy is always at the end of stub_sec. * elf64-ppc.c (sfpr_define): Adjust for stub_sec size having sfpr size added before defining alias symbols. (ppc64_elf_build_stubs): Add stub section padding before copying sfpr contents and defining save/restore alias symbols.
2018-03-14GC: Also check the local debug definition sectionH.J. Lu5-11/+45
Extend commit b7c871edcd83ccdc5fcd8148a7f433efd6b52255 Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed May 17 07:57:15 2017 -0700 Mark debug sections referenced by kept debug sections to handle the local debug definition section. bfd/ PR ld/20882 * elflink.c (elf_gc_mark_debug_section): Also check the local debug definition section. ld/ PR ld/20882 * testsuite/ld-gc/pr20882.d: Also dump and check .debug_abbrev section. * testsuite/ld-gc/pr20882b.s: Add .debug_abbrev section.
2018-03-14gc.exp: Fix a typo: $LFLAGS -> $LDFLAGSH.J. Lu2-1/+5
* testsuite/ld-gc/gc.exp: Fix a typo: $LFLAGS -> $LDFLAGS.
2018-03-14Automatic date update in version.inGDB Administrator1-1/+1
2018-03-13Remove two cleanups using std::stringTom Tromey3-37/+26
This patches removes cleanups from a couple of spots by using std::string rather than manual memory management. Regression tested by the buildbot, though note that I don't believe the buildbot actually exercises the machoread code. gdb/ChangeLog 2018-03-13 Tom Tromey <tom@tromey.com> * machoread.c (macho_check_dsym): Change filenamep to a std::string*. (macho_symfile_read): Update. * symfile.c (load_command): Use std::string.
2018-03-13Prevent a buffer overrun when parsing corrupt STABS debug information.Nick Clifton2-1/+10
PR 22957 * stabs.c (pop_binincl): Fail if the file index is off the end of the stack.
2018-03-13Updated Russian and Brazilian Portuguese translations.Nick Clifton6-1056/+1284
ld * po/pt_BR.po: Updated Brazilian Portuguese translation. opcodes * po/pt_BR.po: Updated Brazilian Portuguese translation. gas * po/ru.po: Updated Russian translation.
2018-03-13Add range changing to STABS parsing functions, in order to prevent buffer ↵Nick Clifton2-144/+284
overruns. PR 22955 * stabs.c (parse_number): Add p_end parameter and use it to check the validity of the pp parameter. Add checks to prevent walking off the end of the string buffer. (parse_stab_string): Likewise. (parse_stab_type): Likewise. (parse_stab_type_number): Likewise. (parse_stab_range_type): Likewise. (parse_stab_sun_builtin_type): Likewise. (parse_stab_sun_floating_type): Likewise. (parse_stab_enum_type): Likewise. (parse_stab_struct_type): Likewise. (parse_stab_baseclasses): Likewise. (parse_stab_struct_fields): Likewise. (parse_stab_cpp_abbrev): Likewise. (parse_stab_one_struct_field): Likewise. (parse_stab_members): Likewise. (parse_stab_tilde_field): Likewise. (parse_stab_array_type): Likewise. * parse_stab: Compute the end of the string and then pass it on to individual parser functions.
2018-03-13Prevent memory access violations when attempting to parse an x86_64 PE ↵Nick Clifton4-8/+66
binary containing corrupt unwind information. PR 22113 incldue * coff/pe.h (struct pex64_unwind_info): Add a rawUnwindCodesEnd field. bfd * pei-x86_64.c (pex64_get_unwind_info): Change to a boolean function. Add an end address parameter. Check access of the data pointer to make sure that they do not extend beyond the end address. Return FALSE if any check fails. Add the end address pointer to the ui structure. (pex64_xdata_print_uwd_codes): Check accesses of the raw unwind codes to make sure that they do not extend beyond the end address pointer. Print an error message and return immediately if any check fails.
2018-03-13Automatic date update in version.inGDB Administrator1-1/+1
2018-03-12gdb/riscv: Fix some ARI issuesAndrew Burgess2-9/+19
Fix some ARI issues in recently added riscv code, the ARI email is: https://sourceware.org/ml/gdb-patches/2018-03/msg00156.html gdb/ChangeLog: * riscv-tdep.c (riscv_sw_breakpoint_from_kind): Add localization to error message string. (riscv_register_name): Use xsnprintf instead of sprintf. (riscv_insn::fetch_instruction): Use gdb_assert instead of internal_error. (riscv_print_arg_location): Use gdb_assert_not_reached instead of error. (riscv_push_dummy_call): Likewise.
2018-03-12Use gdb::byte_vector when reading section dataTom Tromey3-42/+32
This changes a couple of spots that read section data to use gdb::byte_vector rather than a cleanup. Regression tested by the buildbot. I am not certain that the buildbot actually tests the code in question, so I recommend careful review. gdb/ChangeLog 2018-03-12 Tom Tromey <tom@tromey.com> * rs6000-aix-tdep.c (rs6000_aix_core_xfer_shared_libraries_aix): Use gdb::byte_vector. * arm-tdep.c (arm_exidx_new_objfile): Use gdb::byte_vector.
2018-03-12Fix ia64 GDB buildYao Qi3-2/+9
Commit 849d0ba8 breaks GDB build for ia64 with --with-libunwind-ia64=yes. This patch fixes it. gdb: 2018-03-12 Yao Qi <yao.qi@linaro.org> * ia64-libunwind-tdep.c (libunwind_get_reg_special): Change parameter type to readable_regcache. * ia64-libunwind-tdep.h (libunwind_get_reg_special): Update the declaration.
2018-03-11Use std::vector for field lists in dwarf2read.cTom Tromey2-193/+112
This changes dwarf2read.c to use std::vector rather than a linked list when managing the fields and base classes to be added to a type. This removes some bookkeeping types and also allows the removal of some cleanups. gdb/ChangeLog 2018-03-11 Tom Tromey <tom@tromey.com> * dwarf2read.c (struct nextfield): Add initializers. (struct nextfnfield): Remove. (struct fnfieldlist): Add initializers. Remove "length" and "head", use std::vector. (struct decl_field_list): Remove. (struct field_info): Add initializers. <fields, baseclasses>: Now std::vector. <nbaseclasses, nfnfields, typedef_field_list_count, nested_types_list_count>: Remove. (dwarf2_add_field, dwarf2_add_type_defn) (dwarf2_attach_fields_to_type, dwarf2_add_member_fn) (dwarf2_attach_fn_fields_to_type, handle_struct_member_die) (process_structure_scope): Update.
2018-03-11Remove cleanup from build_type_psymtabs_1Tom Tromey2-20/+15
This removes a cleanup from build_type_psymtabs_1, by using std::vector rather than manual memory management. gdb/ChangeLog 2018-03-11 Tom Tromey <tom@tromey.com> * dwarf2read.c (sort_tu_by_abbrev_offset): Change to be suitable for use by std::sort. (build_type_psymtabs_1): Use std::vector.
2018-03-12Automatic date update in version.inGDB Administrator1-1/+1
2018-03-11Automatic date update in version.inGDB Administrator1-1/+1
2018-03-10Automatic date update in version.inGDB Administrator1-1/+1
2018-03-09x86: Encode EVEX instructions with VEX128 if possibleH.J. Lu4-25/+33
If EVEX encoding isn't required, we can encode EVEX instructions with VEX128. * config/tc-i386.c (optimize_encoding): Encode EVEX instructions with VEX128 if EVEX encoding isn't required. * testsuite/gas/i386/optimize-1.d: Updated. * testsuite/gas/i386/x86-64-optimize-2.d: Likewise.
2018-03-09Fix Sparc, s390 and AArch64 targets so that they can handle relocs against ↵Nick Clifton9-7/+156
ifunc symbols found in note sections. Following on from PR 22929, I have found the same problem exists with other ifunc supporting targets too. Plus see this link for the bug being reported against the s390x binutils for Fedora rawhide: https://bugzilla.redhat.com/show_bug.cgi?id=1553705 So I am going to check in the patch below which applies the same change that H.J. made for the x86_64 target to the other affected targets. (Specifically: S390, AArch64 and Sparc). Plus it adds a new test to the linker testsuite to make sure that this problem stays fixed. bfd * elf64-s390.c (elf_s390_relocate_section): Move check for relocations against non-allocated sections to before the code that handles ifunc relocations. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Treat relocs against IFUNC symbols in non-allocated sections as relocs against FUNC symbols. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. ld * testsuite/ld-ifunc/ifuncmod5.s: New test. Checks that targets that support IFUNC symbols can handle relocations against those symbols in NOTE sections. * testsuite/ld-ifunc/ifuncmod5.d: New file: Driver for the new test. * testsuite/ld-ifunc/ifunc.exp: Run the new test.
2018-03-09Update "gdb --configuration" with recently added featuresEli Zaretskii2-9/+41
This adds display of a few recently added optional features. gdb/ChangeLog: 2018-03-09 Eli Zaretskii <eliz@gnu.org> * top.c (print_gdb_configuration): Reflect LIBIPT, LIBMEMCHECK, and LIBMPFR in the printed configuration.
2018-03-09x86: Strip whitespace in check_VecOperationsH.J. Lu4-2/+15
Since the addition of pseudo prefixes changed how the scrubber treats '{', we need to explicitly strip whitespace in check_VecOperations (). * config/tc-i386.c (check_VecOperations): Strip whitespace. * testsuite/gas/i386/optimize-1.s: Add whitespaces before {%k7} and {z}, * testsuite/gas/i386/x86-64-optimize-2.s: Likewise.
2018-03-08Use scoped_fd in more placesTom Tromey4-46/+37
This changes a few more places to use scoped_fd. This allows the removal of some cleanups. Regression tested by the buildbot, though note that I'm not sure whether the buildbot actually builds anything using all of these files. gdb/ChangeLog 2018-03-08 Tom Tromey <tom@tromey.com> * source.c (get_filename_and_charpos): Use scoped_fd. * nto-procfs.c (procfs_open_1): Use scoped_fd. (procfs_pidlist): Likewise. * procfs.c (proc_get_LDT_entry): Use scoped_fd. (iterate_over_mappings): Likewise.
2018-03-08Change enable_thread_stack_temporaries to an RAII classTom Tromey5-84/+77
This started as a patch to change enable_thread_stack_temporaries to be an RAII class, but then I noticed that this code used a VEC, so I went ahead and did a bit more C++-ification, changing stack_temporaries_enabled to a bool and changing stack_temporaries to a std::vector. Regression tested by the buildbot. gdb/ChangeLog 2018-03-08 Tom Tromey <tom@tromey.com> * infcall.c (struct call_return_meta_info) <stack_temporaries_enabled>: Remove. (get_call_return_value, call_function_by_hand_dummy): Update. * thread.c (disable_thread_stack_temporaries): Remove. (enable_thread_stack_temporaries): Remove. (thread_stack_temporaries_enabled_p): Return bool. (push_thread_stack_temporary, value_in_thread_stack_temporaries) (get_last_thread_stack_temporary): Update. * eval.c (evaluate_subexp): Update. * gdbthread.h (class enable_thread_stack_temporaries): Now a class, not a function. (value_ptr, value_vec): Remove typedefs. (class thread_info) <stack_temporaries_enabled>: Now bool. <stack_temporaries>: Now a std::vector. (thread_stack_temporaries_enabled_p) (value_in_thread_stack_temporaries): Return bool.
2018-03-08x86: Optimize with EVEX128 encoding for AVX512VLH.J. Lu13-56/+459
We can optimize AVX512 instructions with EVEX128 only if AVX512VL is enabled: 1. Instruction is an AVX512VL instruction. Or 2. AVX512VL is enabled explicitly by -march=+avx512vl/".arch .avx512vl". We should optimize EVEX instructions with EVEX128 encoding when pseudo {evex} prefix is used. * config/tc-i386.c (set_cpu_arch): Set cpu_arch_isa_flags. (md_parse_option): Likewise. (optimize_encoding): Check i.tm.cpu_flags and cpu_arch_isa_flags for cpuavx512vl instead of cpu_arch_flags. Optimize EVEX with EVEX128 when EVEX encoding is required. * testsuite/gas/i386/i386.exp: Run optimize-4, optimize-5, x86-64-optimize-5 and x86-64-optimize-6. * testsuite/gas/i386/optimize-1.d: Updated. * testsuite/gas/i386/x86-64-optimize-2.d: Likewise. * testsuite/gas/i386/optimize-4.d: New file. * testsuite/gas/i386/optimize-4.s: Likewise. * testsuite/gas/i386/optimize-5.d: Likewise. * testsuite/gas/i386/optimize-5.s: Likewise. * testsuite/gas/i386/x86-64-optimize-5.d: Likewise. * testsuite/gas/i386/x86-64-optimize-5.s: Likewise. * testsuite/gas/i386/x86-64-optimize-6.d: Likewise. * testsuite/gas/i386/x86-64-optimize-6.s: Likewise.
2018-03-08Fix misreporting of omitted bytes for large remote packetsSimon Marchi2-10/+11
In remote.c, when the output of "set debug remote" is truncated, the number of characters reported is incorrect. What is reported is the number of characters added by the quoting, not the number of characters that were truncated. gdb/ChangeLog: * remote.c (putpkt_binary): Fix omitted bytes reporting. (getpkt_or_notif_sane_1): Likewise.
2018-03-09Automatic date update in version.inGDB Administrator1-1/+1
2018-03-08Use std::string to simplify build_id_to_debug_bfdSimon Marchi2-22/+15
Using std::string here makes the string building simpler thank playing with char*. A stack allocation is replaced with heap allocation, but I don't think this is really performance-critical code. gdb/ChangeLog: * build-id.c (build_id_to_debug_bfd): Use std::string.
2018-03-08Make find_separate_debug_file* return std::stringSimon Marchi7-70/+66
This patch makes the find_separate_debug_file* functions return std::string, which allows to get rid of some manual memory management and one cleanup. gdb/ChangeLog: * build-id.c (find_separate_debug_file_by_buildid): Return std::string. * build-id.h (find_separate_debug_file_by_buildid): Return std::string. * coffread.c (coff_symfile_read): Adjust to std::string. * elfread.c (elf_symfile_read): Adjust to std::string. * symfile.c (separate_debug_file_exists): Change parameter to std::string. (find_separate_debug_file): Return std::string. (find_separate_debug_file_by_debuglink): Return std::string. * symfile.h (find_separate_debug_file_by_debuglink): Return std::string.
2018-03-08Add xml_escape_text_append and use itSimon Marchi6-17/+58
[This patch should go on top of "linux_qxfer_libraries_svr4: Use std::string", I should have sent them together as a series.] I noticed that linux_qxfer_libraries_svr4 used xml_escape_text, which returns an std::string. That string is then copied into a larger buffer. It would be more efficient if we had a version of xml_escape_text which appended to an existing string instead of returning a new one. This is what this patch does. I manually verified that the output of linux_qxfer_libraries_svr4 didn't change before/after the patch. gdb/ChangeLog: * common/xml-utils.c (xml_escape_text): Move code to... (xml_escape_text_append): ... this new function. * common/xml-utils.h (xml_escape_text_append): New declaration. * unittests/xml-utils-selftests.c (test_xml_escape_text_append): New function. (_initialize_xml_utils): register test_xml_escape_text_append as a selftest. gdb/gdbserver/ChangeLog: * linux-low.c (linux_qxfer_libraries_svr4): Use xml_escape_text_append.
2018-03-08linux_qxfer_libraries_svr4: Use std::stringSimon Marchi2-34/+16
Use std::string, removing some manual memory management. gdb/gdbserver/ChangeLog: * linux-low.c (linux_qxfer_libraries_svr4): Use std::string.
2018-03-08remote-stdio-gdbserver: Pass "target" to remote_exec to delete fileSimon Marchi2-1/+7
As described here https://sourceware.org/bugzilla/show_bug.cgi?id=22841 there seems to be situations where the remote-stdio-gdbserver board fails to delete the uploaded binary file. Passing "target" fixes the issue for Christian who reported the bug. I did not experience this problem, but passing "target" to remote_exec still works for me, so I'm fine with changing it. Any objection? gdb/testsuite/ChangeLog: PR gdb/22841 * boards/remote-stdio-gdbserver.exp (${board}_file): Pass "target" to remote_exec.
2018-03-08Don't redefine upload/download/file in gdbserver-baseSimon Marchi2-22/+6
Before patch Make native gdbserver boards no longer be "remote" (in DejaGnu terms) 739b3f1d8ff7072dcc66240c25b026c6433bda1a the local gdbserver boards (except native-extended-gdbserver...) were considered as remote by DejaGNU. To avoid DejaGNU trying to use ssh/scp to download the files to the target (which is actually local), the gdbserver-base.exp file defined some _download, _upload and _file board operations to override the default behavior, and instead just use local operations. The same patch also changed remote-stdio-gdbserver.exp to make it inherit from gdbserver-base.exp. Since then, this board (which is actually remote) uses the overrides with local file operations. As a result, files are never actually copied to the target. I think we can simply remove the overrides from gdbserver-base.exp. Because all boards should be properly considered local or remote by DejaGNU, it should by default use the right method for transferring files. gdb/testsuite/ChangeLog: PR gdb/22841 * boards/gdbserver-base.exp (${board}_file, ${board}_download, ${board}_upload): Remove.
2018-03-08x86-64: Also optimize "clr reg64"H.J. Lu7-9/+30
"clr reg" is an alias of "xor reg, reg". We can encode "clr reg64" as "xor reg32, reg32". gas/ * config/tc-i386.c (optimize_encoding): Also encode "clr reg64" as "xor reg32, reg32". * testsuite/gas/i386/x86-64-optimize-1.s: Add "clr reg64" tests. * testsuite/gas/i386/x86-64-optimize-1.d: Updated. opcodes/ * i386-opc.tbl: Add Optimize to clr. * i386-tbl.h: Regenerated.
2018-03-08x86: Treat relocation against IFUNC symbol as FUNCH.J. Lu10-0/+94
When resolving a relocation against IFUNC symbol in a SHT_NOTE section without SHF_ALLOC, we treat it as relocation against FUNC symbol since it needs the address of IFUNC symbol, not the address returned by IFUNC function. bfd/ PR ld/22929 * elf32-i386.c (elf_i386_relocate_section): Treat relocation against IFUNC symbol in SHT_NOTE section without SHF_ALLOC as relocation against FUNC symbol. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. ld/ PR ld/22929 * testsuite/ld-i386/i386.exp: Run PR ld/22929 test. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr22929.d: New file. * testsuite/ld-i386/pr22929.s: Likewise. * testsuite/ld-x86-64/pr22929.d: Likewise. * testsuite/ld-x86-64/pr22929.s: Likewise.
2018-03-08x86: Remove support for old (<= 2.8.1) versions of gccH.J. Lu17-5297/+5146
Old (<= 2.8.1) versions of gcc generate broken fsubp, fsubrp, fdivp and fdivrp instructions. Assembler translates them to correct ones with a warning: [hjl@gnu-cfl-1 gas]$ cat x.s fsubp %st(3),%st [hjl@gnu-cfl-1 gas]$ gcc -c x.s x.s: Assembler messages: x.s:1: Warning: translating to `fsubp %st,%st(3)' [hjl@gnu-cfl-1 gas]$ This patch removes support for old (<= 2.8.1) versions of gcc: [hjl@gnu-cfl-1 gas]$ ./as-new -o x.o x.s x.s: Assembler messages: x.s:1: Error: operand type mismatch for `fsubp' [hjl@gnu-cfl-1 gas]$ gas/ * NEWS: Mention -mold-gcc removal. * config/tc-i386.c (i386_error): Remove old_gcc_only. (old_gcc): Removed. (match_template): Remove old gcc support. (OPTION_MOLD_GCC): Removed. (OPTION_MRELAX_RELOCATIONS): Updated. (md_longopts): Remove OPTION_MOLD_GCC. (md_parse_option): Likewise. (md_show_usage): Remove -mold-gcc. * testsuite/gas/i386/general.s: Convert fsub/fdiv tests for old (<= 2.8.1) versions of gcc. * testsuite/gas/i386/intel.s: Likewise. * testsuite/gas/i386/general.l: Updated. * testsuite/gas/i386/intel-intel.d: Likewise. * testsuite/gas/i386/intel.d: Likewise. * testsuite/gas/i386/intel.e: Likewise. * testsuite/gas/i386/i386.exp: Don't pass -mold-gcc to general. include/ * opcode/i386 (OLDGCC_COMPAT): Removed. opcodes/ * i386-gen.c (opcode_modifiers): Remove OldGcc. * i386-opc.h (OldGcc): Removed. (i386_opcode_modifier): Remove oldgcc. * i386-opc.tbl: Remove fsubp, fsubrp, fdivp and fdivrp instructions for old (<= 2.8.1) versions of gcc. * i386-tbl.h: Regenerated.
2018-03-08Remove MAX_REGISTER_SIZE defineAlan Hayward4-8/+7
gdb/ * defs.h: Remove MAX_REGISTER_SIZE. * regcache.c (init_regcache_descr): Remove MAX_REGISTER_SIZE asserts. * python/py-unwind.c (pyuw_sniffer): Likewise.