aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-11-28PR22471, undefined reference to linker-defined symbolsAlan Modra12-53/+82
This patch processes linker script assignment statements before ld opens DT_NEEDED libraries, in order to define symbols like __bss_start that might also be defined by a library, falsely triggering an error about "DSO missing from command line". The initial value won't be correct when assigning a symbol from dot, and I make no attempt to handle all expressions. For example, an assignment like "_start_foo = ADDR (.foo)" isn't valid until sections are laid out, so won't define _start_foo early. What's here should be enough for most common scripts, and hopefully won't perturb fragile scripts. bfd/ PR 22471 * elflink.c (_bfd_elf_merge_symbol): Allow weak symbols to override early passes over linker script symbols. * linker.c (_bfd_generic_link_add_one_symbol): Allow symbols to override early passes over linker script symbols. Clear ldscript_def on symbol definitions. ld/ PR 22471 * ldexp.c (struct definedness_hash_entry): Delete "by_script". Make "iteration" an 8-bit field, and update mask in all uses. (definedness_newfunc): Don't init "by_script". (update_definedness): Test ldscript_def rather than by_script. (is_sym_value): Likewise. (fold_name <DEFINED>): Return a result for first phase. Test ldscript_def. (fold_name <NAME>): Return a result for first phase. * ldlang.c (open_input_bfds): Process all assignments, not just defsym. (lang_process): Increment lang_statement_iteration before open_input_bfds. * testsuite/ld-mips-elf/tlsdyn-o32-1.d: Adjust for larger .dynsym. * testsuite/ld-mips-elf/tlsdyn-o32-1.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-2.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-2.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-3.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-3.got: Likewise.
2017-11-28Copying symbol type in ld script assignmentsAlan Modra5-34/+38
There is a call to update_definedness between code that evaluates an assignment expression value and code that transfers symbol attributes. When script assignment expressions contain DEFINED, that can mean the wrong symbol type is copied. This patch tracks symbols read during expression evaluation, rather than examining the expression and re-evaluating conditionals. Not only does this simplify the code, it also means ld can now copy symbol types in more complex expressions. An unfortunate side effect of copying symbol type for more complex expressions affects mmix, which uses PROVIDE (Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : _start.)); in a default script. So now _start or _start. symbol type may be copied, losing the function type specially set up for Main. This can be avoided by making bfd_copy_link_hash_symbol_type do nothing for mmix. bfd/ * elf64-mmix.c (bfd_elf64_bfd_copy_link_hash_symbol_type): Define. ld/ * ldexp.h (struct ldexp_control): Add "assign_src". * ldexp.c (fold_trinary): Save and restore assign_src around condition evaluation. (fold_name <NAME>): Set expld.assign_src. (try_copy_symbol_type): Delete. (exp_fold_tree_1): Set symbol type using expld.assign_src.
2017-11-28ld: Set non_ir_ref_regular on symbols referenced in regular objectsH.J. Lu6-3/+109
If linker plugin is enabled, set non_ir_ref_regular on symbols referenced in regular objects so that linker plugin will get the correct symbol resolution. bfd/ PR ld/22502 * elflink.c (_bfd_elf_merge_symbol): Also skip definition from an IR object. (elf_link_add_object_symbols): If linker plugin is enabled, set non_ir_ref_regular on symbols referenced in regular objects so that linker plugin will get the correct symbol resolution. ld/ PR ld/22502 * testsuite/ld-plugin/lto.exp: Run PR ld/22502 test. * testsuite/ld-plugin/pr22502a.c: New file. * testsuite/ld-plugin/pr22502b.c: Likewise.
2017-11-27Compress loads/stores with implicit 0 offset.Jim Wilson7-6/+99
gas/ * config/tc-riscv.c (riscv_handle_implicit_zero_offset): New. (riscv_ip): Cases 'k', 'l', 'm', 'n', 'M', 'N', add call to riscv_handle_implicit_zero_offset. At label load_store, replace existing code with call to riscv_handle_implicit_zero_offset. * testsuite/gas/riscv/c-ld.d, testsuite/gas/riscv/c-ld.s: New. * testsuite/gas/riscv/c-lw.d, testsuite/gas/riscv/c-lw.s: New. * testsuite/gas/riscv/riscv.exp: Run new tests.
2017-11-27Fix symbol values and relocation addends for relocatable links.Cary Coutant8-28/+92
The fix for PR 19291 broke some other cases where -r is used with scripts, as reported in PR 22266. The original fix for PR 22266 ended up breaking many cases for REL targets, where the addends are stored in the section data, and are not being adjusted properly. The problem was basically that in a relocatable output file (ET_REL), symbol values are supposed to be relative to the start address of their section. Usually in a relocatable file, all sections start at 0, so the failure to get this right is often irrelevant, but with a linker script, we occasionally see an output section whose starting address is not 0, and gold would occasionally write a symbol with its relocated value instead of its section-relative value. This patch reverts the recent fix for PR 22266 as well as my original fix for PR 19291. The original fix moved the symbol value adjustment to write_local_symbols, but neglected to undo a few places where the adjustment was also being applied, resulting in an occasional double adjustment. The more recent fix removed those other adjustments, but then failed to re-account for the adjustment when rewriting the relocations on REL targets. With the old attempts reverted, we now apply the symbol value adjustment to the one case that had been missed (non-section symbols in merge sections). But now we also need to account for the adjustment when rewriting the addends for RELA relocations. gold/ PR gold/19291 PR gold/22266 * object.cc (Sized_relobj_file::compute_final_local_value_internal): Revert changes from 2017-11-08 patch. Adjust symbol value in relocatable links for non-section symbols. (Sized_relobj_file::compute_final_local_value): Revert changes from 2017-11-08 patch. (Sized_relobj_file::do_finalize_local_symbols): Likewise. (Sized_relobj_file::write_local_symbols): Revert changes from 2015-11-25 patch. * object.h (Sized_relobj_file::compute_final_local_value_internal): Revert changes from 2017-11-08 patch. * powerpc.cc (Target_powerpc::relocate_relocs): Adjust addend for relocatable links. * target-reloc.h (relocate_relocs): Adjust addend for relocatable links. * testsuite/pr22266_a.c (hello): New function. * testsuite/pr22266_main.c (main): Add test for merge sections. * testsuite/pr22266_script.t: Add rule for .rodata.
2017-11-28Automatic date update in version.inGDB Administrator1-1/+1
2017-11-27Remove REMOTE_OBSTom Tromey2-23/+17
This removes REMOTE_OBS from the Makefile. It is no longer needed, as remote support is always built into gdb. The relevant sources are now added to COMMON_SFILES, where they are treated like other ordinary sources. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (REMOTE_OBS): Remove. (SFILES): Remove remote sources. (COMMON_SFILES): Add remote sources. (ALLDEPFILES): Remove dcache.c.
2017-11-27Move target object files to target subdirectoryTom Tromey2-7/+16
Move the object files corresponding to target/*.c to the target subdirectory in the build tree. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (SUBDIR_TARGET_SRCS, SUBDIR_TARGET_OBS): New variables. (SFILES): Use SUBDIR_TARGET_SRCS. (COMMON_OBS): Use SUBDIR_TARGET_OBS. Remove waitstatus.o. (CONFIG_SRC_SUBDIR): Add target. (%.o): Remove target rule.
2017-11-27Add missing files to COMMON_SFILESTom Tromey2-4/+11
While working on the previous patch, I found a few .o files whose corresponding .c file was not mentioned in Makefile.in. This patch fixes the problem. I pulled this out separately to make it simpler to review. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (COMMON_OBS): Remove filename-seen-cache.o, registry.o, thread-fsm.o, debug.o. (COMMON_SFILES): Add filename-seen-cache.c, registry.c, thread-fsm.c, debug.c.
2017-11-27Simplify COMMON_OBS by using list of sourcesTom Tromey2-208/+45
This introduces a new COMMON_SFILES variable, and then defines some of COMMON_OBS in terms of this new variable. This simpifies adding a new ordinary source file. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (COMMON_SFILES): New. (SFILES): Move some entries to COMMON_SFILES. (COMMON_OBS): Use COMMON_SFILES.
2017-11-27Define YYOBJ in terms of YYFILESTom Tromey2-11/+9
Change YYOBJ to be defined in terms of YYFILES. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (YYFILES): Update comment. (YYOBJ): Redefine.
2017-11-27Move python object files to python subdirectoryTom Tromey4-51/+17
Move the object files corresponding to python/*.c to the python subdirectory in the build tree. Because special CFLAGS are passed just to Python compilations, this patch also required the addition of a pattern rule to update INTERNAL_CFLAGS for here. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (SUBDIR_PYTHON_OBS): Redefine. (CONFIG_SRC_SUBDIR): Add python. (%.o): Remove python rule. (python/%.o): New rule. * configure: Rebuild. * configure.ac (CONFIG_OBS): Refer to python/python.o
2017-11-27Move guile object files to guile subdirectoryTom Tromey4-34/+13
Move the object files corresponding to guile/*.c to the guile subdirectory in the build tree. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac (CONFIG_OBS): Refer to guile/guile.o. * Makefile.in (SUBDIR_GUILE_OBS): Redefine. (CONFIG_SRC_SUBDIR): Add guile. (%.o): Remove guile rule.
2017-11-27Move unittests object files to unittests subdirectoryTom Tromey2-19/+8
Move the object files corresponding to unittests/*.c to the unittests subdirectory in the build tree. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (SUBDIR_UNITTESTS_OBS): Redefine. (%.o): Remove unittests rule. (CONFIG_SRC_SUBDIR): Add unittests.
2017-11-27Move tui object files to tui subdirectoryTom Tromey2-24/+9
Move the object files corresponding to tui/*.c to the tui subdirectory in the build tree. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (SUBDIR_TUI_OBS): Redefine. (CONFIG_SRC_SUBDIR): Add tui. (%.o): Remove tui rule.
2017-11-27Move compile object files to compile subdirectoryTom Tromey2-14/+9
Move the object files corresponding to compile/*.c to the compile subdirectory in the build tree. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (SUBDIR_GCC_COMPILE_OBS): Redefine. (%.o): Remove compile rule. (CONFIG_SRC_SUBDIR): Add compile.
2017-11-27Move mi objects to mi subdirectoryTom Tromey2-25/+11
Move object files corresponding to mi/*.c to a subdirectory in the build tree. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (SUBDIR_MI_OBS): Redefine. (%.o): Remove mi rule. (CONFIG_SRC_SUBDIR): Add mi. (COMMON_OBS): Use mi/mi-common.o
2017-11-27Move cli object files to cli subdirectoryTom Tromey2-15/+9
Following the "arch" move, this moves the object files corresponding to the cli/*.c source files to the "cli" build directory. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * Makefile.in (SUBDIR_CLI_OBS): Redefine. (%.o): Remove cli rule. (CONFIG_SRC_SUBDIR): Add cli.
2017-11-27A simpler way to make the "arch" build directoryTom Tromey4-28/+17
This implements a simpler way to make the "arch" build directory -- namely, now it is done as an order-only dependency in the Makefile, rather than being created when config.status is run. This simpler because it means that the build directories can be changed without re-running autoconf. ChangeLog 2017-11-27 Tom Tromey <tom@tromey.com> * configure.ac (CONFIG_SRC_SUBDIR): Don't subst. * configure: Rebuild. * Makefile.in (CONFIG_SRC_SUBDIR): Redefine. (CONFIG_DEP_SUBDIR): New variable. (%.o): Add order-only dependency. ($(CONFIG_DEP_SUBDIR)): New target.
2017-11-27gas: xtensa: speed up find_trampoline_segMax Filippov2-1/+13
find_trampoline_seg takes noticeable time when assembling source with many sections. Cache the result of the most recent search and check it first. No functional changes. gas/ 2017-11-27 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (find_trampoline_seg): Add static variable that caches the result of the most recent search.
2017-11-27gas: xtensa: implement trampoline coalescingMax Filippov7-28/+341
There is a recurring pattern in assembly files generated by a compiler where a lot of jumps in a function are going to the same place. When these jumps are relaxed with trampolines the assembler generates a separate jump thread from each source. Create an index of trampoline jump targets for each segment and see if a jump being relaxed goes to a location from that index, in which case replace its target with a location of existing trampoline jump that results in the shortest path to the original target. gas/ 2017-11-27 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (trampoline_chain_entry, trampoline_chain) (trampoline_chain_index): New structures. (trampoline_index): Add chain_index field. (xg_order_trampoline_chain_entry, xg_sort_trampoline_chain) (xg_find_chain_entry, xg_get_best_chain_entry) (xg_order_trampoline_chain, xg_get_trampoline_chain) (xg_find_best_eq_target, xg_add_location_to_chain) (xg_create_trampoline_chain, xg_get_single_symbol_slot): New functions. (xg_relax_fixups): Call xg_find_best_eq_target to adjust jump target to point to an existing jump. Call xg_create_trampoline_chain to create new jump target. Call xg_add_location_to_chain to add newly created trampoline jump to the corresponding chain. (add_jump_to_trampoline): Extract loop searching for a single slot with a symbol into a separate function, replace that code with a call to that function. (relax_frag_immed): Call xg_find_best_eq_target to adjust jump target to point to an existing jump. * testsuite/gas/xtensa/all.exp: Add trampoline-2 test. * testsuite/gas/xtensa/trampoline.d: Adjust absolute addresses as many duplicate trampoline chains are now coalesced. * testsuite/gas/xtensa/trampoline.s: Add _nop so that objdump stays in sync with instruction stream. * testsuite/gas/xtensa/trampoline-2.l: New test result file. * testsuite/gas/xtensa/trampoline-2.s: New test source file.
2017-11-27gas: xtensa: reuse trampoline placement codeMax Filippov3-91/+23
There's almost exact copy of the trampoline placement code in the search_trampolines function that is used for jumps generated for relaxed branch instructions. Get rid of the duplication and reuse xg_find_best_trampoline function for that. gas/ 2017-11-27 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (search_trampolines, get_best_trampoline): Remove definitions. (xg_find_best_trampoline_for_tinsn): New function. (relax_frag_immed): Replace call to get_best_trampoline with a call to xg_find_best_trampoline_for_tinsn. * testsuite/gas/xtensa/trampoline.d: Adjust absolute addresses as the placement of trampolines for relaxed branches has been changed.
2017-11-27gas: xtensa: rewrite xg_relax_trampolineMax Filippov5-301/+284
Replace linked list of trampoline frags with an ordered array, so that instead of indexing fixups trampolines could be indexed. Keep each array in the trampoline_seg structure, so there's no need to rebuild it for every new processed segment. Don't run relaxation for each trampoline frag, instead run it for each fixup in the current segment that needs relaxation at the beginning of each relaxation pass. This way the complexity of this process drops from about O(n^2 * m) to about O(log n * m), where n is the number of trampoline frags and m is the number of fixups that need relaxation in the segment. gas/ 2017-11-27 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (trampoline_index): New structure. (trampoline_seg): Replace trampoline list with trampoline index. (xg_find_trampoline, xg_add_trampoline_to_index) (xg_remove_trampoline_from_index, xg_add_trampoline_to_seg) (xg_is_trampoline_frag_full, xg_get_fulcrum) (xg_find_best_trampoline, xg_relax_fixup, xg_relax_fixups) (xg_is_relaxable_fixup): New functions. (J_MARGIN): New macro. (xtensa_create_trampoline_frag): Use xg_add_trampoline_to_seg instead of open-coded addition to the linked list. (dump_trampolines): Iterate through the trampoline_seg::index. (cached_fixupS, cached_fixup, fixup_cacheS, fixup_cache) (fixup_order, xtensa_make_cached_fixup) (xtensa_realloc_fixup_cache, xtensa_cache_relaxable_fixups) (xtensa_find_first_cached_fixup, xtensa_delete_cached_fixup) (xtensa_add_cached_fixup, check_and_update_trampolines): Remove definitions. (xg_relax_trampoline): Extract logic into separate functions, replace body with a call to xg_relax_fixups. (search_trampolines): Replace search in linked list with search in index. Change data type of address-tracking variables from int to offsetT. Replace abs with labs. (xg_append_jump): Finish the trampoline frag if it's full. (add_jump_to_trampoline): Remove trampoline frag from the index if the frag is full. * config/tc-xtensa.h (xtensa_frag_type): Remove next_trampoline. * testsuite/gas/xtensa/trampoline.d: Adjust absolute addresses as the placement of trampolines has slightly changed. * testsuite/gas/xtensa/trampoline.s: Add _nop so that objdump stays in sync with instruction stream.
2017-11-27gas: xtensa: merge trampoline_frag into xtensa_frag_typeMax Filippov3-67/+83
The split between fragS and trampoline_frag doesn't save much space, but makes trampolines management much more awkward. Merge trampoline_frag data into the xtensa_frag_type, which is a part of fragS. No functional changes. gas/ 2017-11-27 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (init_trampoline_frag): Replace pointer to struct trampoline_frag parameter with pointer to fragS. (xg_append_jump): Remove jump_around parameter. (struct trampoline_frag): Remove. (struct trampoline_seg): Change type of trampoline_list from struct trampoline_frag to fragS. (xtensa_create_trampoline_frag): Don't allocate struct trampoline_frag. Initialize new fragS::tc_frag_data fields. (dump_trampolines, xg_relax_trampoline, search_trampolines) (get_best_trampoline, init_trampoline_frag) (add_jump_to_trampoline, relax_frag_immed): Replace pointer to struct trampoline_frag with a pointer to fragS. (xg_append_jump): Remove jump_around parameter, use fragS::tc_frag_data.jump_around_fix instead. (xg_relax_trampoline, init_trampoline_frag) (add_jump_to_trampoline): Don't pass jump_around parameter to xg_append_jump. * config/tc-xtensa.h (struct xtensa_frag_type): Add new fields: needs_jump_around, next_trampoline and jump_around_fix.
2017-11-27gas: xtensa: reuse find_trampoline_segMax Filippov2-22/+23
xtensa_create_trampoline_frag has opencoded fragment equivalent to find_trampoline_seg. Drop the fragment and use find_trampoline_seg instead. No functional changes. gas/ 2017-11-27 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (find_trampoline_seg): Move above the first use. (xtensa_create_trampoline_frag): Replace trampoline seg search code with a call to find_trampoline_seg.
2017-11-27gas: xtensa: extract jump assembling for trampolinesMax Filippov2-102/+64
init_trampoline_frag, add_jump_to_trampoline and xg_relax_trampoline add a jump to the end of a trampoline frag. Extract it into a separate funciton and use it in all these places. No functional changes. gas/ 2017-11-27 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (xg_append_jump): New function. (xg_relax_trampoline, init_trampoline_frag) (add_jump_to_trampoline): Replace trampoline jump assembling code with a call to xg_append_jump.
2017-11-27gas: extract xg_relax_trampoline from xtensa_relax_fragMax Filippov2-159/+174
To make measurement and changes easier extract trampoline relaxation function. No functional changes. gas/ 2017-11-27 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (xg_relax_trampoline): New function. (xtensa_relax_frag): Replace trampoline relaxation code with a call to xg_relax_trampoline.
2017-11-27fix two issues in gdb.ada/mi_catch_ex.exp (re: "exception-message")Joel Brobecker2-2/+9
The following patch introduced a new feature related to Ada exception catchpoints: commit e547c119d043f2ecffb70452020ab9150d083a91 Author: Joel Brobecker <brobecker@adacore.com> Date: Fri Nov 24 17:09:42 2017 -0500 Subject: (Ada) provide the exception message when hitting an exception catchpoint Unfortunately, the patch left 2 errors in gdb.ada/mi_catch_ex.exp, both inside the "continue_to_exception" function: 1. The exception message on the console can include the exception message, and thus this patch adjust the expected output in the corresponding gdb_expect call to allow it; to allow it. 2. There was a TCL syntax confusion in "$exception_name(..." that caused TCL to evaluate "exception_name as an array, rather than as a variable. This patch fixes this by escaping the '(' (and the corresponding closing parenthesis, for consistency). gdb/testsuite/ChangeLog: * gdb.ada/mi_catch_ex.exp (continue_to_exception): Adjust expected output in gdb_expect call to allow the exception message to be present as well. Fix syntax confusion to avoid TCL thinking that exception_name is an array. Tested on x86_64-linux, with: DejaGnu version 1.6 Expect version 5.45 Tcl version 8.6
2017-11-27[PR ld/22263] aarch64: Avoid dynamic TLS relocs in PIESzabolcs Nagy2-4/+12
No dynamic relocs are needed for TLS defined in an executable, the TP relative offset is known at link time. Fixes FAIL: Build pr22263-1 bfd/ PR ld/22263 * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Use bfd_link_executable instead of bfd_link_pic for TLS. (elfNN_aarch64_allocate_dynrelocs): Likewise. (aarch64_can_relax_tls): Likewise.
2017-11-27[PR ld/22269] aarch64: Handle local undefined weak symbolsSzabolcs Nagy2-2/+15
With static pie linking undefined weak symbols are forced to resolve locally to 0, so no GOT setup is needed in elfNN_aarch64_finish_dynamic_symbol, which previously failed for these symbols. The failure caused the unhelpful error message: "ld: final link failed: Nonrepresentable section on output" bfd/ PR ld/22269 * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Use UNDEFWEAK_NO_DYNAMIC_RELOC to avoid dynamic GOT relocs. (elfNN_aarch64_allocate_dynrelocs): Likewise.
2017-11-27Update the simplified Chinese translation of the messages in the opcodes ↵Nick Clifton2-437/+945
library. * po/zh_CN.po: Updated simplified Chinese translation.
2017-11-27Fix a seg-fault when displaying notes from a prorgam segment. Check for a ↵Nick Clifton2-11/+29
NULL string section before attempting compute the name of a separate debug info file. PR 22490 * readelf.c (dump_section_as_bytes): Check for a NULL string section pointer. (process_notes_at): Compute the alignment to use if displaying notes from a segment.
2017-11-27When creating a .note section to contain a version note, set the section ↵Nick Clifton2-0/+7
alignment to 4 bytes. PR 22492 * config/obj-elf.c (obj_elf_version): Set the alignment of the .note section.
2017-11-26Update find command help and search memory docsDominik Czarnota4-2/+22
This patch updates the `find` command help and docs description to show how to search for not null terminated strings when current language's strings includes it. gdb/ChangeLog: PR gdb/21945 * findcmd.c (_initialize_mem_search): Update find command help text. gdb/doc/ChangeLog: PR gdb/21945 * gdb.texinfo (Search Memory): Update description and example about how to search a string without NULL terminator.
2017-11-26python: Fix memleak in do_start_initializationSimon Marchi2-6/+12
While playing with valgrind, I noticed that with Python 3, the progname variable in do_start_initialization is not being freed (concat returns a malloc'ed string). This patch uses unique_xmalloc_ptr to manage it. With Python 2, we pass progname it directly to Py_SetProgramName, so it should not be freed. We therefore release it before passing it. gdb/ChangeLog: * python/python.c (do_start_initialization): Change progname type to gdb::unique_xmalloc_ptr. Release the pointer when using Python 2.
2017-11-27Automatic date update in version.inGDB Administrator1-1/+1
2017-11-26Add include guards to common/format.hTom Tromey2-0/+9
This adds include guards to common/format.h. ChangeLog 2017-11-26 Tom Tromey <tom@tromey.com> * common/format.h: Add include guards.
2017-11-26Rename argument name from link to xlinkH.J. Lu2-3/+8
This fixed the build with GCC 4.2: cc1: warnings being treated as errors binutils-gdb/binutils/dwarf.c: In function ‘load_separate_debug_info’: binutils-gdb/binutils/dwarf.c:9650: warning: declaration of ‘link’ shadows a global declaration /usr/include/unistd.h:757: warning: shadowed declaration is here * dwarf.c (load_separate_debug_info): Rename argument name from link to xlink.
2017-11-26Change maybe_disable_address_space_randomization to a classTom Tromey6-67/+72
This changes maybe_disable_address_space_randomization to be an RAII class, rather than having it return a cleanup. Regression tested by the buildbot. ChangeLog 2017-11-26 Tom Tromey <tom@tromey.com> * nat/linux-personality.h (class maybe_disable_address_space_randomization): New class. (maybe_disable_address_space_randomization): Don't declare function. * nat/linux-personality.c (restore_personality) (make_disable_asr_cleanup): Remove. (maybe_disable_address_space_randomization): Now a constructor. (~maybe_disable_address_space_randomization): New destructor. * linux-nat.c (linux_nat_create_inferior): Update. gdbserver/ChangeLog 2017-11-26 Tom Tromey <tom@tromey.com> * linux-low.c (linux_create_inferior): Update.
2017-11-26Removes a cleanup from gcore.cTom Tromey2-9/+10
This removes a cleanup from gcore.c, replacing it with unique_xmalloc_ptr. Regression tested by the buildbot. ChangeLog 2017-11-26 Tom Tromey <tom@tromey.com> * gcore.c (write_gcore_file_1): Use gdb::unique_xmalloc_ptr.
2017-11-26gas: Update x86 sse-noavx testsH.J. Lu6-0/+16
This fixed: FAIL: i386 SSE without AVX equivalent FAIL: x86-64 SSE without AVX equivalent FAIL: x86-64 (ILP32) SSE without AVX equivalent on x86-64. * testsuite/gas/i386/sse-noavx.s: Add tests for fisttps and fisttpl. * testsuite/gas/i386/x86-64-sse-noavx.s: Likewise. * testsuite/gas/i386/ilp32/x86-64-sse-noavx.d: Updated. * testsuite/gas/i386/sse-noavx.d: Likewise. * testsuite/gas/i386/x86-64-sse-noavx.d: Likewise.
2017-11-26Fix broken ChangeLog entry for last commit.Ulrich Weigand1-0/+17
2017-11-26[spu] Fix various test casesUlrich Weigand22-72/+68
The SPU-specific test cases were not modified to use standard_output_file and therefore all were no longer being executed. Fixing this exposed a few other bugs in spu-info noticed by using a more recent compiler, which are also fixed here. gdb/testsuite/ChangeLog: 2017-11-26 Ulrich Weigand <uweigand@de.ibm.com> * gdb.arch/spu-info.c: Include <unistd.h>. (do_signal_test): Fix broken calls to write. * gdb.arch/spu-info.exp: Use prepare_for_testing. Fix checks for empty mailboxes. Update signal tests for corrected do_signal_test routine. Allow nonzero event status.
2017-11-26[spu] Fix single-stepping regressionUlrich Weigand2-3/+12
Switching spu_software_single_step to use a regcache instead of a frame: https://sourceware.org/ml/gdb-patches/2016-11/msg00355.html cause a serious regression to SPU single-stepping. There were two separate problems: - SPU_LSLR_REGNUM is a pseudo register, so we must use the "cooked" regcache methods instead of the "raw" ones to access it. - When accessing a branch target register, we must only use the first four bytes of the 16-byte vector register. This was done automatically by the frame routines, but not by the regcache routines. gdb/ChangeLog: 2017-11-26 Ulrich Weigand <uweigand@de.ibm.com> * spu-tdep.c (spu_software_single_step): Access SPU_LSLR_REGNUM as "cooked" register. Access only first four bytes of branch target registers.
2017-11-26Automatic date update in version.inGDB Administrator1-1/+1
2017-11-25Adding ChangeLog entry for the last commit.Sergio Durigan Junior1-0/+9
2017-11-25Fix PR gdb/22491: Regression when setting SystemTap probe semaphoresSergio Durigan Junior1-4/+12
Pedro has kindly pointed out that gdb.arch/amd64-stap-optional-prefix.exp was failing after my C++-ification patches touching the probe interface. The failure is kind of cryptic: 77 break -pstap bar 78 Breakpoint 3 at 0x40048d 79 (gdb) PASS: gdb.arch/amd64-stap-optional-prefix.exp: bar: break -pstap bar 80 continue 81 Continuing. 82 83 Program received signal SIGILL, Illegal instruction. 84 main () at amd64-stap-optional-prefix.S:26 85 26 STAP_PROBE1(probe, foo, (%rsp)) It took me a while to figure out where this SIGILL is coming from. Initially I thought it was something related to writing registers to the inferior when dealing with probe arguments, but I discarded this since the arguments were not touching any registers. In the end, this was a mistake that was introduced during the review process of the patch. When setting/clearing a SystemTap probe's semaphore, the code was using 'm_address' (which refers the probe's address) instead of 'm_sem_addr' (which refers to the semaphore's address). This caused GDB to write a bogus value in the wrong memory position, which in turn caused the SIGILL. I am pushing this patch to correct the mistake. On a side note: I told Pedro that the BuildBot hadn't caught the failure during my try build, and for a moment there was a suspicion that the BuildBot might be at fault here. However, I investigate this and noticed that I only did one try build, with a patch that was correctly using 'm_sem_addr' where applicable, and therefore no failure should have happened indeed. I probably should have requested another try build after addressing the review's comments, but they were mostly basic and I didn't think it was needed. Oh, well. 2017-11-25 Sergio Durigan Junior <sergiodj@redhat.com> PR gdb/22491 * stap-probe.c (relocate_address): New function. (stap_probe::get_relocated_address): Use 'relocate_address'. (stap_probe::set_semaphore): Use 'relocate_address' and pass 'm_sem_addr'. (stap_probe::clear_semaphore): Likewise.
2017-11-25Use TOLOWER in SYMBOL_HASH_NEXTPedro Alves4-1/+9
The support for setting breakpoint in functions with ABI tags patch will add a use of SYMBOL_HASH_NEXT in cp-support.c, which fails to compile with: src/gdb/cp-support.c:38:0: src/gdb/cp-support.c: In function ‘unsigned int cp_search_name_hash(const char*)’: src/gdb/../include/safe-ctype.h:148:20: error: ‘do_not_use_tolower_with_safe_ctype’ was not declared in this scope #define tolower(c) do_not_use_tolower_with_safe_ctype ^ src/gdb/minsyms.h:174:18: note: in expansion of macro ‘tolower’ ((hash) * 67 + tolower ((unsigned char) (c)) - 113) ^ src/gdb/cp-support.c:1677:14: note: in expansion of macro ‘SYMBOL_HASH_NEXT’ hash = SYMBOL_HASH_NEXT (hash, *string); ^ This fixes the problem before it happens. I was somewhat worried about whether this might have an impact with languages that are case insensitive, but I convinced myself that it doesn't. As bonus, this improves GDB's minsym interning performance a bit (3%-10%). See <https://sourceware.org/ml/gdb/2017-11/msg00021.html>. gdb/ChangeLog: 2017-11-25 Pedro Alves <palves@redhat.com> * dictionary.c: Include "safe-ctype.h". * minsyms.c: Include "safe-ctype.h". * minsyms.c (SYMBOL_HASH_NEXT): Use TOLOWER instead of tolower.
2017-11-25Fix completing an empty stringPedro Alves5-6/+63
Earlier while working on the big completer rework series, I managed to break (gdb) [TAB] locally, and make GDB crash, but only notice a few weeks down the road, because we have no test for that... I also noticed that: (gdb) [TAB] didn't work (didn't show all commands as matches), even though entering a command with leading whitespace works: (gdb) help This commit fixes the latter and adds a testcase that covers both issues. The gdb.base/completion.exp change is necessary because the new test has a file name that also starts with "gdb.base/complet", making that particular test ambiguous. Adding another letter disambiguates. gdb/ChangeLog: 2017-11-25 Pedro Alves <palves@redhat.com> * completer.c (complete_line_internal_1): Skip spaces until the start of the command. gdb/testsuite/ChangeLog: 2017-11-25 Pedro Alves <palves@redhat.com> * gdb.base/complete-empty.exp: New file. * gdb.base/completion.exp: Adjust.
2017-11-25Add comprehensive C++ operator linespec/location/completion testsPedro Alves4-7/+843
This exercises the special handling C++ operators require in several places in the linespec parser, both the linespec and explicit location completers, symbol lookup, etc. Particularly, makes sure all that works without quoting. Note that despite the apparent smallish size, this adds thousands of tests to the testsuite, due to combination explosion (linespecs, explicit locations, tab completion, complete command, completion at different points in each function, etc.) Grows the gdb.linespec/ tests like this: -# of expected passes 3464 +# of expected passes 7823 gdb/testsuite/ChangeLog: 2017-11-25 Pedro Alves <palves@redhat.com> * gdb.linespec/cpls-ops.cc: New file. * gdb.linespec/cpls-ops.exp: New file. * lib/completion-support.exp (test_complete_prefix_range_re): New, factored out from ... (test_complete_prefix_range): ... this.