aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-01-19Find arm-linux-gnueabi(hf)?-gcc in compileYao Qi2-1/+6
GCC for arm-linux has different names on different distros. It is arm-linux-gnu-gcc on fedora. Debian/Ubuntu has arm-linux-gnueabihf-gcc and arm-linux-gnueabi-gcc. So when I run gdb.compile/ tests on arm-linux, I get, (gdb) compile code -- ; Could not find a compiler matching "^arm(-[^-]*)?-linux(-gnu)?-gcc$" This patch extend the regexp to match both arm-linux-gnu-gcc and arm-linux-gnueabihf-gcc. gdb: 2018-01-19 Yao Qi <yao.qi@linaro.org> * osabi.c (gdb_osabi_names): Extend the regexp for arm-linux-gnueabihf and arm-linux-gnueabi.
2018-01-19Make tests expect [ \t]+ pattern instead of \t for "info reg" commandRuslan Kabatsayev9-198/+211
This will allow to format output of "info reg" command as we wish, without breaking the tests. In particular, it'll let us correctly align raw and natural values of the registers using spaces instead of current badly-working approach with tabs. This change is forwards- and backwards-compatible, so that the amended tests will work in the same way before and after reformatting patches (unless the tests check formatting, of course, but I've not come across any such tests). Some tests already used this expected pattern, so they didn't even have to be modified. Others are changed by this patch. I've checked this on a i386 system, with no noticeable differences in test results, so at least on i386 nothing seems to be broken by this. gdb/testsuite/ChangeLog: * gdb.arch/powerpc-d128-regs.exp: Replace expected "\[\t\]*" from "info reg" with "\[ \t\]*". * gdb.arch/altivec-regs.exp: Replace expected "\t" from "info reg" with "\[ \t\]+". * gdb.arch/s390-multiarch.exp: Ditto. * gdb.base/pc-fp.exp: Ditto. * gdb.reverse/i386-precsave.exp: Ditto. * gdb.reverse/i386-reverse.exp: Ditto. * gdb.reverse/i387-env-reverse.exp: Ditto. * gdb.reverse/i387-stack-reverse.exp: Ditto.
2018-01-18Also xfail ld-elf/group1.d for SolarisH.J. Lu2-1/+5
Also xfail ld-elf/group1.d for Solaris since _GLOBAL_OFFSET_TABLE_ is always generated for Solaris as a global symbol after .*: 0+1000 +0 +(NOTYPE|OBJECT) +WEAK +DEFAULT +. foo instead of appending "#..." which will weaken the test. * testsuite/ld-elf/group1.d: Also xfail Solaris.
2018-01-18x86: Update ld-elf/linkinfo1[ab].d for Solaris/x86H.J. Lu3-4/+10
Update ld-elf/linkinfo1[ab].d to accommodate slightly different PLT/GOT order/layout for Solaris/x86 targets. * testsuite/ld-elf/linkinfo1a.d: Updated for slightly different PLT/GOT order/layout for Solaris/x86 targets. * testsuite/ld-elf/linkinfo1b.d: Likewise.
2018-01-18solaris2.em: Fold after_allocation into before_allocationH.J. Lu2-41/+35
Since all ELF linkers call check_relocs after opening all inputs, we can fold after_allocation into before_allocation so that local dynamic symbols will be placed before global dynamic symbols in .dynsym section. This fixed: FAIL: Common symbol override test (auxiliary shared object build) FAIL: ld-elf/pr19617a FAIL: ld-elf/pr19698 for i386-solaris2.12 and x86_64-solaris2.12 targets. PR ld/22728 * emultempl/solaris2.em (elf_solaris2_after_allocation): Fold into ... (elf_solaris2_before_allocation): This. (LDEMUL_AFTER_ALLOCATION): Removed.
2018-01-19Automatic date update in version.inGDB Administrator1-1/+1
2018-01-18GDB testsuite: Re-enable -fdiagnostics-color=neverAndreas Arnez2-1/+6
In August 2017 the GDB test suite was changed to always add the compile option "-fdiagnostics-color=never", see: https://sourceware.org/ml/gdb-patches/2017-08/msg00150.html Since this option is not understood by rustc, a commit from 09/2017 dropped its use in that case: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=5eb5f850 ("Don't use -fdiagnostics-color=never for rustc") But that change goes overboard and stops using the option for other languages as well. Thus compiler diagnostics written into gdb.log may contain colored output again. This is fixed. gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_compile): Re-enable use of universal_compile_options for languages other than Rust.
2018-01-18S390: Use soft float in s390-tdbregs test caseAndreas Arnez2-1/+8
The GDB test case s390-tdbregs.exp verifies GDB's handling of the "transaction diagnostic block". For simplicity, the test case uses the "transaction begin" (TBEGIN) instruction with the "allow floating-point operation" flag set to zero. But some GCC versions may indeed emit floating point or vector instructions for this test case. If this happens in the transaction, it aborts, and an endless loop results. This change tells the compiler to produce a soft-float binary, so no floating-point or vector registers are touched. gdb/testsuite/ChangeLog: * gdb.arch/s390-tdbregs.exp: Add the compile option -msoft-float.
2018-01-18Make abbrev_table::abbrevs privateYao Qi2-6/+15
abbrev_table::abbrevs is only access within abbrev_table's methods, so it can be private. Add "m_" prefix. gdb: 2018-01-18 Yao Qi <yao.qi@linaro.org> * dwarf2read.c (abbrev_table) <abbrevs>: Rename it to m_abbrevs. (abbrev_table::add_abbrev): Update. (abbrev_table::lookup_abbrev): Update.
2018-01-18Call cooked_read in ppu2spu_prev_registerYao Qi2-5/+5
The code in ppu2spu_prev_register is in fact regcache_cooked_read, because spu doesn't have gdbarch method pseudo_register_read_value. gdb: 2018-01-18 Yao Qi <yao.qi@linaro.org> * ppc-linux-tdep.c (ppu2spu_prev_register): Call cooked_read.
2018-01-18PowerPC PLT stub alignment fixesAlan Modra8-19/+58
Asking for ppc32 plt call stubs to be aligned at 32 byte boundaries didn't quite work. For ld.bfd they were spaced 32 bytes apart, but only started on a 16 byte boundary. ld.gold also didn't get it right. Finding that bug made me check over the ppc64 plt stub alignment, where I found that negative values for alignment (meaning align to minimize boundary crossing) were not accepted. Since no one has complained about that, I guess I could have removed the feature from ld.bfd documentation, but I've opted instead to correct the code. I've also added an optional alignment paramenter for ppc32 --plt-align, for some consistency with gold and ppc64 ld.bfd. bfd/ * elf32-ppc.c (ppc_elf_create_glink): Correct alignment of .glink. * elf64-ppc.c (ppc64_elf_size_stubs): Handle negative plt_stub_align. (ppc64_elf_build_stubs): Likewise. gold/ * powerpc.cc (param_plt_align): New function supplying default --plt-align values. Use it.. (Stub_table::plt_call_align): ..here, and.. (Output_data_glink::global_entry_align): ..here. (Stub_table::stub_align): Correct 32-bit minimum alignment. ld/ * emultempl/ppc32elf.em: Support optional --plt-align arg. * emultempl/ppc64elf.em: Support negative --plt-align arg.
2018-01-18Update Bulgarian translation of the binutils sub-directoryNick Clifton3-1606/+2057
2018-01-18Automatic date update in version.inGDB Administrator1-1/+1
2018-01-17Fix warning on gdb/compile/compile.c (C++-ify "triplet_rx")Sergio Durigan Junior2-5/+11
This fixes a GCC warning that happens when compiling gdb/compile/compile.c on some GCC versions (e.g., "gcc (GCC) 7.2.1 20180104 (Red Hat 7.2.1-6)"): ../../gdb/compile/compile.c: In function 'void eval_compile_command(command_line*, const char*, compile_i_scope_types, void*)': ../../gdb/compile/compile.c:548:19: warning: 'triplet_rx' may be used uninitialized in this function [-Wmaybe-uninitialized] error_message = compiler->fe->ops->set_arguments_v0 (compiler->fe, triplet_rx, ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ argc, argv); ~~~~~~~~~~~ ../../gdb/compile/compile.c:466:9: note: 'triplet_rx' was declared here char *triplet_rx; ^~~~~~~~~~ It's a simple patch that converts "triplet_rx" from "char *" to "std::string", thus guaranteeing that it will be always initialized. I've regtested this patch and did not find any regressions. OK to apply on both master and 8.1 (after creating a bug for it)? gdb/ChangeLog: 2018-01-17 Sergio Durigan Junior <sergiodj@redhat.com> * compile/compile.c (compile_to_object): Convert "triplet_rx" to "std::string".
2018-01-17RISC-V: Fix bug in prior addi/c.nop patch.Jim Wilson4-1/+20
gas/ * config/tc-riscv.c (validate_riscv_insn) <'z'>: New. (riscv_ip) <'z'>: New. opcodes/ * riscv-opc.c (riscv_opcodes) <addi>: Use z instead of 0.
2018-01-17Remove symbolp typedefTom Tromey2-3/+4
This removes the symbolp typedef from dwarf2read.c. It is no longer used. 2018-01-17 Tom Tromey <tom@tromey.com> * dwarf2read.c (symbolp): Remove typedef. Don't instantiate VEC.
2018-01-17Remove objfile argument from add_dyn_propTom Tromey4-10/+16
The objfile argument to add_dyn_prop is redundant, so this patch removes it. 2018-01-17 Tom Tromey <tom@tromey.com> * gdbtypes.h (add_dyn_prop): Remove objfile parameter. * gdbtypes.c (add_dyn_prop): Remove objfile parameter. (create_array_type_with_stride): Update. * dwarf2read.c (set_die_type): Update.
2018-01-17Change dwarf2_cu::method_info to be a std::vectorTom Tromey2-57/+49
This changes the type of dwarf2_cu::method_info and fixes up the uses. In order to remove cleanups from process_full_comp_unit and process_full_type_unit, psymtab_include_file_name also had to be changed to avoid leaving dangling cleanups. 2018-01-17 Tom Tromey <tom@tromey.com> * dwarf2read.c (delayed_method_info): Remove typedef. (dwarf2_cu::method_info): Now a std::vector. (add_to_method_list): Update. (free_delayed_list): Remove. (compute_delayed_physnames): Update. (process_full_comp_unit, process_full_type_unit): Clear the method list. Remove cleanups. (psymtab_include_file_name): Add name_holder parameter. Use unique_xmalloc_ptr. (dwarf_decode_lines): Update.
2018-01-17Allocate dwarf2_cu with newSimon Marchi2-143/+79
This changes dwarf2_cu to be allocated with new, and fixes up the users. 2018-01-17 Tom Tromey <tom@tromey.com> Simon Marchi <simon.marchi@ericsson.com> * dwarf2read.c (struct dwarf2_cu): Add constructor, destructor. (dwarf2_per_objfile::free_cached_comp_units) (init_tu_and_read_dwo_dies, init_cutu_and_read_dies) (init_cutu_and_read_dies_no_follow): Update. (dwarf2_cu::dwarf2_cu): Rename from init_one_comp_unit. (dwarf2_cu::~dwarf2_cu): New. (free_heap_comp_unit, free_stack_comp_unit): Remove. (age_cached_comp_units, free_one_cached_comp_unit): Update.
2018-01-17Allocate abbrev_table with newTom Tromey2-180/+134
This changes dwarf2read.c to allocate abbrev tables using "new", and then updates the users. This version of the patch incorporates the changes that Simon implemented. These changes simplify the ownership rules for abbrev tables. 2018-01-17 Tom Tromey <tom@tromey.com> Simon Marchi <simon.marchi@ericsson.com> * dwarf2read.c (struct dwarf2_cu) <abbrev_table>: Remove. (struct die_reader_specs) <abbrev_table>: New member. (struct abbrev_table): Add constructor. <alloc_abbrev, add_abbrev, lookup_abbrev>: Declare. <abbrev_obstack>: Now an auto_obstack. (abbrev_table_up): New typedef. (init_cu_die_reader): Add abbrev_table parameter. (read_cutu_die_from_dwo): Remove abbrev_table_provided parameter. Add result_dwo_abbrev_table. (init_tu_and_read_dwo_dies, init_cutu_and_read_dies) (init_cutu_and_read_dies_no_follow, build_type_psymtabs_1): Update. (peek_die_abbrev): Take die_reader_specs, not dwarf_cu as parameter. (skip_children): Update. (abbrev_table::alloc_abbrev): Rename from abbrev_table_alloc_abbrev. (abbrev_table::add_abbrev): Rename from abbrev_table_add_abbrev. (abbrev_table::lookup_abbrev): Rename from abbrev_table_lookup_abbrev. (abbrev_table_read_table): Return abbrev_table_up. (abbrev_table_free, abbrev_table_free_cleanup) (dwarf2_read_abbrevs, dwarf2_free_abbrev_table): Remove. (load_partial_dies): Update.
2018-01-17Unify new_symbol and new_symbol_fullTom Tromey2-20/+16
This patch unifies new_symbol with new_symbol_full, replacing a wrapper function with a default parameter. 2018-01-17 Tom Tromey <tom@tromey.com> * dwarf2read.c (dwarf2_compute_name): Update comment. (read_func_scope, read_variable): Update. (new_symbol): Remove. (new_symbol_full): Rename to new_symbol.
2018-01-17Fix ChangeLog dates of previous commitSimon Marchi2-2/+2
2018-01-17Fix gdb segv when objfile can't be openedMike Gulick8-12/+261
This fixes PR 16577. This patch changes gdb_bfd_map_section to issue a warning rather than an error if it is unable to read the object file, and sets the size of the section/frame that it attempted to read to 0 on error. The description of gdb_bfd_map_section states that it will try to read or map the contents of the section SECT, and if successful, the section data is returned and *SIZE is set to the size of the section data. This function was throwing an error and leaving *SIZE as-is. Setting the section size to 0 indicates to dwarf2_build_frame_info that there is no data to read, otherwise it will try to read from an invalid frame pointer. Changing the error to a warning allows this to be handled gracefully. Additionally, the error was clobbering the breakpoint output indicating the current frame (function name, arguments, source file, and line number). E.g. Thread 3 "foo" hit Breakpoint 1, BFD: reopening /tmp/jna-1013829440/jna2973250704389291330.tmp: No such file or directory BFD: reopening /tmp/jna-1013829440/jna2973250704389291330.tmp: No such file or directory (gdb) While the "BFD: reopening ..." messages will still appear interspersed in the breakpoint output, the current frame info is now displayed: Thread 3 "foo" hit Breakpoint 1, BFD: reopening /tmp/jna-1013829440/jna1875755897659885075.tmp: No such file or directory BFD: reopening /tmp/jna-1013829440/jna1875755897659885075.tmp: No such file or directory warning: Can't read data for section '.eh_frame' in file '/tmp/jna-1013829440/jna1875755897659885075.tmp' do_something () at file.cpp:80 80 { (gdb)
2018-01-17Make linux_ptrace_attach_fail_reason return an std::stringSimon Marchi7-58/+64
This patch makes linux_ptrace_attach_fail_reason and linux_ptrace_attach_fail_reason_string return std::string. It also replaces usages of struct buffer with std::string. This allows getting rid of a cleanup in in linux_ptrace_attach_fail_reason_string and simplifies the code in general. Something that looks odd to me is that in linux_ptrace_attach_fail_reason, if the two messages are appended, there is no separating space or \n, so the result won't be very nice. I left it as-is for now though. gdb/ChangeLog: * nat/linux-ptrace.h (linux_ptrace_attach_fail_reason): Return std::string. (linux_ptrace_attach_fail_reason_string): Likewise. * nat/linux-ptrace.c (linux_ptrace_attach_fail_reason): Likewise. (linux_ptrace_attach_fail_reason_string): Likewise. * linux-nat.c (attach_proc_task_lwp_callback): Adjust. gdb/gdbserver/ChangeLog: * linux-low.c (attach_proc_task_lwp_callback): Adjust to linux_ptrace_attach_fail_reason_string now returning an std::string. (linux_attach): Likewise. * thread-db.c (attach_thread): Likewise.
2018-01-17linux-nat: Remove unnecessary xstrdupSimon Marchi2-6/+7
I think this xstrdup is not useful. We can pass ex.message directly to throw_error instead. gdb/ChangeLog: * linux-nat.c (linux_nat_attach): Remove xstrdup.
2018-01-17Replace CET bit with IBT and SHSTK bits.Igor Tsimbalist18-5563/+5671
The latest specification for Intel CET technology defined two new bits instead of previously used CET bit. These are IBT and SHSTK bits. The patch replaces CET bit with IBT and SHSTK bits. gas/ * config/tc-i386.c (cpu_arch): Delete .cet. Add .ibt, .shstk. (cpu_noarch): Add noibt, noshstk. (parse_insn): Change cpucet to cpuibt. * doc/c-i386.texi: Delete .cet. Add .ibt, .shstk. * testsuite/gas/i386/cet-ibt-inval.l: New test. * testsuite/gas/i386/cet-ibt-inval.s: Likewise. * testsuite/gas/i386/cet-shstk-inval.l: Likewise. * testsuite/gas/i386/cet-shstk-inval.s: Likewise. * testsuite/gas/i386/x86-64-cet-ibt-inval.l: Likewise. * testsuite/gas/i386/x86-64-cet-ibt-inval.s: Likewise. * testsuite/gas/i386/x86-64-cet-shstk-inval.l: Likewise. * testsuite/gas/i386/x86-64-cet-shstk-inval.s: Likewise. opcodes/ * i386-gen.c (cpu_flag_init): Delete CPU_CET_FLAGS, CpuCET. Add CPU_IBT_FLAGS, CPU_SHSTK_FLAGS, CPY_ANY_IBT_FLAGS, CPU_ANY_SHSTK_FLAGS, CpuIBT, CpuSHSTK. (cpu_flags): Add CpuIBT, CpuSHSTK. * i386-opc.h (enum): Add CpuIBT, CpuSHSTK. (i386_cpu_flags): Add cpuibt, cpushstk. * i386-opc.tbl: Change CpuCET to CpuSHSTK and CpuIBT. * i386-init.h: Regenerate. * i386-tbl.h: Likewise.
2018-01-17Update Ukranian and Russian translations in bfd libraryNick Clifton3-1983/+5147
2018-01-17configure: Fix test for fs_base/gs_base in <sys/user.h>Eldar Abusalimov6-6/+26
Make <sys/types.h> be included prior to including <sys/user.h>. glibc versions older than 2.14 use __uintNN_t types within certain structures defined in <sys/user.h> probably assuming these types are defined prior to including the header. This results in the following `configure` feature test compilation error that makes it think that `struct user_regs_struct` doesn't have `fs_base`/`gs_base` fields, althouh it does. configure:13617: checking for struct user_regs_struct.fs_base configure:13617: gcc -c -g -O2 -I/linux/include conftest.c >&5 In file included from conftest.c:158:0: /usr/include/sys/user.h:32:3: error: unknown type name '__uint16_t' __uint16_t cwd; ^ /usr/include/sys/user.h:33:3: error: unknown type name '__uint16_t' __uint16_t swd; ^ /usr/include/sys/user.h:34:3: error: unknown type name '__uint16_t' __uint16_t ftw; ^ /usr/include/sys/user.h:35:3: error: unknown type name '__uint16_t' __uint16_t fop; ^ /usr/include/sys/user.h:36:3: error: unknown type name '__uint64_t' __uint64_t rip; ^ /usr/include/sys/user.h:37:3: error: unknown type name '__uint64_t' __uint64_t rdp; ^ /usr/include/sys/user.h:38:3: error: unknown type name '__uint32_t' __uint32_t mxcsr; ^ /usr/include/sys/user.h:39:3: error: unknown type name '__uint32_t' __uint32_t mxcr_mask; ^ /usr/include/sys/user.h:40:3: error: unknown type name '__uint32_t' __uint32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ ^ /usr/include/sys/user.h:41:3: error: unknown type name '__uint32_t' __uint32_t xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ ^ /usr/include/sys/user.h:42:3: error: unknown type name '__uint32_t' __uint32_t padding[24]; ^ configure:13617: $? = 1 configure: failed program was: | /* confdefs.h */ ... | /* end confdefs.h. */ | #include <sys/user.h> | | int | main () | { | static struct user_regs_struct ac_aggr; | if (ac_aggr.fs_base) | return 0; | ; | return 0; | } Recent glibc versions don't use typedef'ed int types in <sys/user.h>, thus allowing it to be included as is (glibc commit d79a9c949c84e7f0ba33e87447c47af833e9f11a). However there're still some distros alive that use older glibc, for instance, RHEL/CentOS 6 package glibc 2.12. Also affects PR gdb/21559: ../../gdb/regcache.c:1087: internal-error: void regcache_raw_supply(regcache, int, const void): Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed. As noted by Andrew Paprocki, who submitted the PR (https://sourceware.org/bugzilla/show_bug.cgi?id=21559#c3): > It should be noted that modifying `configure` to force on > `HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE` and > `HAVE_STRUCT_USER_REGS_STRUCT_GS_BASE` fixes this issue. For some > reason the `configure` tests for `fs_base` and `gs_base` fail > even though `sys/user.h` on RHEL5 has the fields defined in > `user_regs_struct`. Note that this patch does NOT fix the root cause of PR gdb/21559, although now that `configure` properly detects the presence of the fields and sets HAVE_XXX accordingly, the execution takes another path, which doesn't lead to the assertion failure in question. gdb/ChangeLog: 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> PR gdb/21559 * configure.ac: Include <sys/types.h> prior to <sys/user.h> when checking for fs_base/gs_base fields in struct user_regs_struct. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> PR gdb/21559 * configure.ac: Include <sys/types.h> prior to <sys/user.h> when checking for fs_base/gs_base fields in struct user_regs_struct. * configure: Regenerate.
2018-01-17Don't pass -m64 to libcc1 on aarch64-linux.Yao Qi2-0/+18
Nowadays, if we use "compile" on aarch64-linux, we'll get the following error, (gdb) compile code -- ; aarch64-none-linux-gnu-gcc: error: unrecognized command line option '-m64' because the default gcc_target_options returns "-m64" and "-mcmodel=large", neither is useful to aarch64-linux. gdb: 2018-01-17 Yao Qi <yao.qi@linaro.org> * aarch64-linux-tdep.c (aarch64_linux_gcc_target_options): New function. (aarch64_linux_init_abi): Install it to gdbarch hook gcc_target_options.
2018-01-17Relax gdb.compile/compile.exp to match the address printed for frameYao Qi2-2/+10
One test in gdb.compile/compile.exp passes on one fedora builder, bt #0 0x00007ffff7ff43f6 in _gdb_expr (__regs=0x7ffff7ff2000) at gdb command line:1^M #1 <function called from gdb>^M #2 main () at /home/gdb-buildbot/fedora-x86-64-1/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.compile/compile.c:106^M (gdb) PASS: gdb.compile/compile.exp: bt but fails on my machine with gcc trunk, bt^M #0 _gdb_expr (__regs=0x7ffff7ff3000) at gdb command line:1^M #1 <function called from gdb>^M #2 main () at gdb/testsuite/gdb.compile/compile.c:106^M (gdb) FAIL: gdb.compile/compile.exp: bt The test should be tweaked to match both cases (pc in the start of line vs pc in the middle of line). Note that I am not clear that why libcc1 emits debug info this way so that the address is in the middle of line. gdb/testsuite: 2018-01-17 Yao Qi <yao.qi@linaro.org> * gdb.compile/compile.exp: Match the address printed for frame in the output of command "bt".
2018-01-17Warning fixAlan Modra2-1/+5
* elf64-ppc.c (ppc64_elf_build_stubs): Silence gcc warning.
2018-01-17PowerPC PLT speculative execution barriersAlan Modra16-48/+261
Spectre variant 2 mitigation for PowerPC and PowerPC64. bfd/ * elf32-ppc.c (GLINK_ENTRY_SIZE): Handle speculation barrier. (CRSETEQ, BEQCTRM): Define. (is_nonpic_glink_stub): Don't check bctr. (ppc_elf_link_hash_table_create): Init new ppc_elf_params field. (ppc_elf_relax_section): Size speculation barrier. (output_bctr): New function. (write_glink_stub): Use output_bctr. (ppc_elf_relocate_section): Use output_bctr for long branch stub. (ppc_elf_finish_dynamic_symbol): Likewise. (ppc_elf_finish_dynamic_sections): Use output_bctr. * elf32-ppc.h (struct ppc_elf_params): Add speculate_indirect_jumps. * elf64-ppc.c (CRSETEQ, BEQCTRM, BEQCTRLM): Define. (GLINK_PLTRESOLVE_SIZE): Size speculation barrier. (size_global_entry_stubs): Handle speculation barrier sizing. (plt_stub_size): Likewise. (output_bctr): New function. (build_plt_stub, build_tls_get_addr_stub): Output speculation barrier. (ppc_build_one_stub): Likewise for ppc_stub_plt_branch. (ppc_size_one_stub): Size speculation barrier in ppc_stub_plt_branch. (build_global_entry_stubs): Output speculation barrier. (ppc64_elf_build_stubs): Likewise in __glink_PLTresolve stub. * elf64-ppc.h (struct ppc64_elf_params): Add speculate_indirect_jumps. gold/ * options.h (speculate_indirect_jumps): New option. * powerpc.cc (beqctrm, beqctrlm, crseteq): New insn constants. (output_bctr): New function. (Stub_table::plt_call_size): Add space for speculation barrier. (Stub_table::branch_stub_size): Likewise. (Output_data_glink::pltresolve_size): Likewise. (Stub_table::do_write): Output speculation barriers. ld/ * emultempl/ppc32elf.em (params): Init new field. (OPTION_SPECULATE_INDIRECT_JUMPS): Define. (OPTION_NO_SPECULATE_INDIRECT_JUMPS): Define. (PARSE_AND_LIST_LONGOPTS): Handle new options. (PARSE_AND_LIST_ARGS_CASES): Likewise. (PARSE_AND_LIST_OPTIONS): Likewise. * emultempl/ppc64elf.em (params): Init new field. (OPTION_SPECULATE_INDIRECT_JUMPS): Define. (OPTION_NO_SPECULATE_INDIRECT_JUMPS): Define. (PARSE_AND_LIST_LONGOPTS): Handle --speculate-indirect-jumps. (PARSE_AND_LIST_OPTIONS): Likewise. (PARSE_AND_LIST_ARGS_CASES): Likewise. * ld.texinfo (--no-plt-thread-safe): Correct itemx. (--speculate-indirect-jumps): Document. * testsuite/ld-powerpc/elfv2exe.d, * testsuite/ld-powerpc/elfv2so.d, * testsuite/ld-powerpc/relbrlt.d, * testsuite/ld-powerpc/powerpc.exp: Disable plt alignment and speculation barriers on various tests.
2018-01-17PowerPC PLT stub tidyAlan Modra24-433/+555
This is in preparation for the next patch adding Spectre variant 2 mitigation for PowerPC and PowerPC64. Besides tidying code involved in stub output (to reduce the number of places where bctr is output), the patch adds some user visible features: 1) PowerPC64 ELFv2 global entry stubs now are aligned under the control of --plt-align, with a default alignment of 32 bytes. 2) PowerPC64 __glink_PLTresolve is no longer padded out with nops. 3) PowerPC32 PLT stubs are aligned under the control of --plt-align, with the default alignment being 16 bytes as before. 4) The PowerPC32 branch/nop table emitted before __glink_PLTresolve is now smaller in many cases. It was sized incorrectly when the __tls_get_addr_opt stub was used, and unnecessarily included space for local ifuncs. bfd/ * elf32-ppc.c (GLINK_ENTRY_SIZE): Add parameters, handle __tls_get_addr_opt, and alignment sizing. (TLS_GET_ADDR_GLINK_SIZE): Delete. (is_nonpic_glink_stub): Don't use GLINK_ENTRY_SIZE. (ppc_elf_get_synthetic_symtab): Recognize stubs spaced at 4, 6, or 8 insns. (ppc_elf_link_hash_table_create): Init new ppc_elf_params field. (allocate_dynrelocs): Use new GLINK_ENTRY_SIZE. (ppc_elf_size_dynamic_sections): Likewise. Size branch table by PLT reloc count. (write_glink_stub): Handle __tls_get_addr_opt stub. Pad out to size given by GLINK_ENTRY_SIZE. (ppc_elf_relocate_section): Adjust write_glink_stub call. (ppc_elf_finish_dynamic_symbol): Likewise. (ppc_elf_finish_dynamic_sections): Write PLTresolve without using insn array since so many need rewriting. * elf32-ppc.h (struct ppc_elf_params): Add plt_stub_align. * elf64-ppc.c (GLINK_PLTRESOLVE_SIZE): Rename from GLINK_CALL_STUB_SIZE. Add htab param and evaluate to size without nops. Adjust all uses. (ppc64_elf_get_synthetic_symtab): Don't use GLINK_CALL_STUB_SIZE in glink_vma calculation. (struct ppc_link_hash_table): Add global_entry section pointer. (create_linkage_sections): Create separate section for global entry stubs. (PPC_LO, PPC_HI, PPC_HA): Move earlier. (size_global_entry_stubs): Handle sizing for aligned stubs. (ppc64_elf_size_dynamic_sections): Handle global_entry alloc, and don't stash end of glink branch table in rawsize. (ppc_build_one_stub): Rewrite stub size calculations. (build_global_entry_stubs): Use new section. (ppc64_elf_build_stubs): Don't pad __glink_PLTresolve with nops. Build lazy link stubs out to end of section. Build global entry stubs in new section. gold/ * options.h (plt_align): Support for PowerPC32 too. * powerpc.cc (Stub_table::stub_align): Heed --plt-align for 32-bit. (Stub_table::plt_call_size, branch_stub_size): Tidy. (Stub_table::plt_call_align): Implement using stub_align. (Output_data_glink::global_entry_align): New function. (Output_data_glink::global_entry_off): New function. (Output_data_glink::global_entry_address): Use global_entry_off. (Output_data_glink::pltresolve_size): New function, replacing pltresolve_size_ constant. Update all uses. (Output_data_glink::add_global_entry): Align offset. (Output_data_glink::set_final_data_size): Use global_entry_align. (Stub_table::do_write): Don't pad __glink_PLTrelsolve with nops. Tidy stub output. Use global_entry_off. ld/ * emultempl/ppc32elf.em (params): Init new field. (enum ppc32_opt): New enum to define OPTION_* values. Add OPTION_PLT_ALIGN and OPTION_NO_PLT_ALIGN. (PARSE_AND_LIST_LONGOPTS): Handle new options. (PARSE_AND_LIST_ARGS_CASES): Likewise. (PARSE_AND_LIST_OPTIONS): Likewise. Break up help output. * emultempl/ppc64elf.em (ppc_add_stub_section): Init alignment correctly for negative --plt-stub-align. * testsuite/ld-powerpc/elfv2exe.d, * testsuite/ld-powerpc/elfv2so.d, * testsuite/ld-powerpc/relbrlt.d, * testsuite/ld-powerpc/relbrlt.s, * testsuite/ld-powerpc/tlsexe.d, * testsuite/ld-powerpc/tlsexe.r, * testsuite/ld-powerpc/tlsexe32.d, * testsuite/ld-powerpc/tlsexe32.g, * testsuite/ld-powerpc/tlsexe32.r, * testsuite/ld-powerpc/tlsexetoc.d, * testsuite/ld-powerpc/tlsexetoc.r, * testsuite/ld-powerpc/tlsopt5_32.d, * testsuite/ld-powerpc/tlsso.d, * testsuite/ld-powerpc/tlstocso.d: Update for changed stub order.
2018-01-17Automatic date update in version.inGDB Administrator1-1/+1
2018-01-16binutils release procedure: Add AI to update branch name in crontabJoel Brobecker2-6/+24
binutils/ChangeLog: * README-how-to-make-a-release: Add reminder to update the branch name in gdbadmin's crontab on sourceware.
2018-01-16Update translations for various binutils components.Nick Clifton9-4932/+7265
ld * po/pt_BR.po: Updated Brazilian Portugese translation. opcodes * po/pt_BR.po: Updated Brazilian Portugese translation. * po/de.po: Updated German translation. gas * po/fr.po: Updated French translation. binutils* po/fr.po: Updated French translation.
2018-01-16Remove trailing spaces in binutils/README-how-to-make-a-releaseJoel Brobecker2-15/+19
binutils/ChangeLog: * README-how-to-make-a-release: Remove trailing spaces.
2018-01-16Mark register unavailable when PTRACE_PEEKUSER failsYao Qi2-1/+11
As described in PR 18749, GDB/GDBserver may get an error on accessing memory or register because the thread may disappear. However, some path doesn't expect the error. This patch fixes this problem by marking the register unavailable when PTRACE_PEEKUSER fails instead of throwing error. gdb/gdbserver: 2018-01-16 Yao Qi <yao.qi@linaro.org> PR gdb/18749 * linux-low.c (fetch_register): Call supply_register instead of error.
2018-01-16Automatic date update in version.inGDB Administrator1-1/+1
2018-01-15RISC-V: Add support for addi that compresses to c.nop.Jim Wilson5-2/+22
gas/ * testsuite/gas/riscv/c-zero-imm.s: Test addi that compresses to c.nop. * testsuite/gas/riscv/c-zero-imm.d: Likewise. opcodes/ * riscv-opc.c (match_c_nop): New. (riscv_opcodes) <addi>: Handle an addi that compresses to c.nop.
2018-01-15gdb/common/signals-state-save-restore.c: Fix typosPedro Alves2-2/+6
gdb/ChangeLog: 2018-01-15 Pedro Alves <palves@redhat.com> * common/signals-state-save-restore.c (save_original_signals_state): Fix typos.
2018-01-15Fix scm-ports.exp regressionTom Tromey2-1/+6
In https://sourceware.org/ml/gdb-patches/2017-12/msg00215.html, Jan pointed out that the scalar printing patches caused a regression in scm-ports.exp on x86. What happens is that on x86, this: set sp_reg [get_integer_valueof "\$sp" 0] ... ends up setting sp_reg to a negative value, because get_integer_valueof uses "print/d": print /d $sp $1 = -11496 Then later the test suite does: gdb_test "guile (print (seek rw-mem-port (value->integer sp-reg) SEEK_SET))" \ "= $sp_reg" \ "seek to \$sp" ... expecting this value to be identical to the saved $sp_reg value. However it gets: guile (print (seek rw-mem-port (value->integer sp-reg) SEEK_SET)) = 4294955800 "print" is just a wrapper for guile's format: gdb_test_no_output "guile (define (print x) (format #t \"= ~A\" x) (newline))" The seek function returns a scm_t_off, the printing of which is handled by guile, not by gdb. Tested on x86-64 Fedora 26 using an ordinary build and also a -m32 build. 2018-01-15 Tom Tromey <tom@tromey.com> * gdb.guile/scm-ports.exp (test_mem_port_rw): Use get_valueof to compute sp_reg.
2018-01-15Fix -fuse-ld option to accept string argument.Cary Coutant2-1/+6
PR 22042 complained that garbage text was being printed in the help for the -fuse-ld option; this was caused by passing an empty string to the gettext() function, which sometimes returns garbage when passed an empty string. The quick fix was to replace "" with NULL as the helparg, but that changed the parsing of the option, as gold uses the helparg to determine whether an option takes an argument. This patch adds a non-empty helparg string to fix both problems. gold/ PR gold/22694 * options.h (-fuse-ld): Add correct helparg.
2018-01-15[ARM] Add new macro for Thumb-only opcodesThomas Preud'homme2-9/+27
Armv8-M Security Extensions introduced some Thumb-only opcodes (eg. sg). These are defined using the TUE and TCE macros, setting the Arm execution state related fields to 0/NULL. This patch adds 2 new macros to avoid filling this field and clearly identify Thumb-only instructions. 2018-01-15 Thomas Preud'homme <thomas.preudhomme@arm.com> gas/ * config/tc-arm.c (ToC): Define macro. (ToU): Likewise. (insns): Make use of above macros for new instructions introduced in Armv8-M.
2018-01-15[ARM] Enable conditional Armv8-M instructionsThomas Preud'homme3-11/+27
Newly introduced instructions common to ARMv8-M Baseline and Mainline are currently all marked as unconditional. However, all instructions but sg (ie. blxns, bxns, tt, ttt, tta, ttat, vlldm and vlstm) do actually support conditional execution. This patch fixes the definition of these instructions accordingly. 2018-01-15 Thomas Preud'homme <thomas.preudhomme@arm.com> gas/ * config/tc-arm.c (insns): Make blxns, bxns, tt, ttt, tta, ttat, vlldm and vlstm conditionally executable and reindent parameters. * testsuite/gas/arm/archv8m-cmse-main.s: Add conditional version of aforementionned instructions.
2018-01-15[ARM] No IT usage deprecation for ARMv8-MThomas Preud'homme7-54/+70
Deprecations related to the use of the IT instruction introduced in Armv8-A do not apply to Armv8-M Baseline and mainline. However the warning logic do not distinguish between the various profiles and warn whenever the architecture version is 8. This patch adds a check to exclude M profile architectures from this warning. This works as expected when -march is specified on the command-line or a .arch/.cpu directive exist. However, in autodetection mode the CPU/architecture targeted is only known once the instructions have been all processed but this code is run when IT instruction is processed. It is therefore not possible to distinguish between Armv8-M and Armv8-A in that mode. The approach chosen here is not to warn in autodetection mode. The udf.d testcase that relied on that behavior to test deprecation warning for Armv8-A is therefore updated to explicitely pass -march=armv8-a. 2018-01-15 Thomas Preud'homme <thomas.preudhomme@arm.com> gas/ * config/tc-arm.c (it_fsm_post_encode): Do not warn if targeting M profile architecture or if in autodetection mode. Clarify that deprecation is for performance reason and concerns Armv8-A and Armv8-R. * testsuite/gas/arm/armv8-ar-bad.l: Adapt to new IT deprecation warning message. * testsuite/gas/arm/armv8-ar-it-bad.l: Likewise. * testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l: Likewise. * testsuite/gas/arm/udf.l: Likewise. * testsuite/gas/arm/udf.d: Assemble for Armv8-A explicitely.
2018-01-15Fix gdb.texinfo moreSzabolcs Nagy2-0/+5
Add incorrectly removed @pindex back. gdb/doc/ChangeLog: * gdb.texinfo (gdb-add-index man): Add pindex.
2018-01-15Update Ukranian translations for bfd, binutils, gas, gold, ld and opcodesNick Clifton12-7548/+9404
2018-01-15Fix gdb.texinfo for old makeinfo (again)Szabolcs Nagy2-4/+8
With old makeinfo (version 4.13) the changes introduced in commit ba643918cf869fa0d064d733f69b453b6fe642ea Author: Sergio Durigan Junior <sergiodj@redhat.com> Install and generate docs for gdb-add-index fail to build with gdb/doc/gdb.texinfo:2498: warning: `.' or `,' must follow @xref, not `@'. gdb/doc/gdb.texinfo:2517: warning: `.' or `,' must follow @xref, not `@'. gdb/doc/gdb.texinfo:43443: Node `gdb-add-index man' requires a sectioning command (e.g., @unnumberedsubsec). gdb/doc/gdb.texinfo:43443: `gdb-add-index man' has no Up field (perhaps incorrect sectioning?). gdb/doc/gdb.texinfo:43350: Next field of node `gdbinit man' not pointed to (perhaps incorrect sectioning?). gdb/doc/gdb.texinfo:43443: This node (gdb-add-index man) has the bad Prev. This patch fixes the warnings too. gdb/doc/ChangeLog: * gdb.texinfo (set cwd): Add period. (gdb-add-index man): Move anchor.
2018-01-15Automatic date update in version.inGDB Administrator1-1/+1