and though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here

  1. 28 Nov, 2017 8 commits
    • Nick Clifton's avatar
      Fix a memory access violation when attempting to parse a corrupt COFF binary... · b23dc97f
      Nick Clifton authored
      Fix a memory access violation when attempting to parse a corrupt COFF binary with a relocation that points beyond the end of the section to be relocated.
      
      	PR 22506
      	* reloc.c (reloc_offset_in_range): Rename to
      	bfd_reloc_offset_in_range and export.
      	(bfd_perform_relocation): Rename function invocation.
      	(bfd_install_relocation): Likewise.
      	(bfd_final_link_relocate): Likewise.
      	* bfd-in2.h: Regenerate.
      	* coff-arm.c (coff_arm_reloc): Use bfd_reloc_offset_in_range.
      	* coff-i386.c (coff_i386_reloc): Likewise.
      	* coff-i860.c (coff_i860_reloc): Likewise.
      	* coff-m68k.c (mk68kcoff_common_addend_special_fn): Likewise.
      	* coff-m88k.c (m88k_special_reloc): Likewise.
      	* coff-mips.c (mips_reflo_reloc): Likewise.
      	* coff-x86_64.c (coff_amd64_reloc): Likewise.
      b23dc97f
    • H.J. Lu's avatar
      ELF: Don't set non_ir_ref_regular in check_relocs · 6c6bc899
      H.J. Lu authored
      Since elf_link_add_object_symbols sets non_ir_ref_regular now, there is
      no need to set non_ir_ref_regular in check_relocs.
      
      Tested on i686 and x86-64.
      
      	* elf-m10300.c (mn10300_elf_check_relocs): Don't set
      	non_ir_ref_regular.
      	* elf32-arm.c (elf32_arm_check_relocs): Likewise.
      	* elf32-bfin.c (bfin_check_relocs): Likewise.
      	* elf32-cr16.c (cr16_elf_check_relocs): Likewise.
      	* elf32-cris.c (cris_elf_check_relocs): Likewise.
      	* elf32-d10v.c (elf32_d10v_check_relocs): Likewise.
      	* elf32-dlx.c (elf32_dlx_check_relocs): Likewise.
      	* elf32-fr30.c (fr30_elf_check_relocs): Likewise.
      	* elf32-frv.c (elf32_frv_check_relocs): Likewise.
      	* elf32-hppa.c (elf32_hppa_check_relocs): Likewise.
      	* elf32-i370.c (i370_elf_check_relocs): Likewise.
      	* elf32-i386.c (elf_i386_check_relocs): Likewise.
      	* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
      	* elf32-lm32.c (lm32_elf_check_relocs): Likewise.
      	* elf32-m32c.c (m32c_elf_check_relocs): Likewise.
      	* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
      	* elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
      	* elf32-m68k.c (elf_m68k_check_relocs): Likewise.
      	* elf32-mcore.c (mcore_elf_check_relocs): Likewise.
      	* elf32-metag.c (elf_metag_check_relocs): Likewise.
      	* elf32-microblaze.c (microblaze_elf_check_relocs): Likewise.
      	* elf32-moxie.c (moxie_elf_check_relocs): Likewise.
      	* elf32-msp430.c (elf32_msp430_check_relocs): Likewise.
      	* elf32-mt.c (mt_elf_check_relocs): Likewise.
      	* elf32-nios2.c (nios2_elf32_check_relocs): Likewise.
      	* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
      	* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
      	* elf32-rl78.c (rl78_elf_check_relocs): Likewise.
      	* elf32-s390.c (elf_s390_check_relocs): Likewise.
      	* elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
      	* elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
      	* elf32-sh.c (sh_elf_check_relocs): Likewise.
      	* elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
      	* elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
      	* elf32-v850.c (v850_elf_check_relocs): Likewise.
      	* elf32-vax.c (elf_vax_check_relocs): Likewise.
      	* elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise.
      	* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
      	* elf64-aarch64.c (elf64_aarch64_check_relocs): Likewise.
      	* elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
      	* elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
      	* elf64-ia64-vms.c (elf64_ia64_check_relocs): Likewise.
      	* elf64-mmix.c (mmix_elf_check_relocs): Likewise.
      	* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
      	* elf64-s390.c (elf_s390_check_relocs): Likewise.
      	* elf64-sh64.c (sh_elf64_check_relocs): Likewise.
      	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
      	* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise.
      	* elfnn-ia64.c (elfNN_ia64_check_relocs): Likewise.
      	* elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
      	* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
      	* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
      	* elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
      6c6bc899
    • Alan Modra's avatar
      PR22471, undefined reference to linker-defined symbols · 165f707a
      Alan Modra authored
      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.
      165f707a
    • Alan Modra's avatar
      Copying symbol type in ld script assignments · cd5b2bab
      Alan Modra authored
      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.
      cd5b2bab
    • H.J. Lu's avatar
      ld: Set non_ir_ref_regular on symbols referenced in regular objects · a83ef4d1
      H.J. Lu authored
      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.
      a83ef4d1
    • Jim Wilson's avatar
      Compress loads/stores with implicit 0 offset. · f0531ed6
      Jim Wilson authored
      	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.
      f0531ed6
    • Cary Coutant's avatar
      Fix symbol values and relocation addends for relocatable links. · 033bfb73
      Cary Coutant authored
      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.
      033bfb73
    • GDB Administrator's avatar
      Automatic date update in version.in · 57c1b681
      GDB Administrator authored
      57c1b681
  2. 27 Nov, 2017 30 commits
    • Tom Tromey's avatar
      Remove REMOTE_OBS · 18ca7347
      Tom Tromey authored
      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.
      18ca7347
    • Tom Tromey's avatar
      Move target object files to target subdirectory · 66599a7d
      Tom Tromey authored
      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.
      66599a7d
    • Tom Tromey's avatar
      Add missing files to COMMON_SFILES · 4f04fba8
      Tom Tromey authored
      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.
      4f04fba8
    • Tom Tromey's avatar
      Simplify COMMON_OBS by using list of sources · b5adff3b
      Tom Tromey authored
      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.
      b5adff3b
    • Tom Tromey's avatar
      Define YYOBJ in terms of YYFILES · afa0a411
      Tom Tromey authored
      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.
      afa0a411
    • Tom Tromey's avatar
      Move python object files to python subdirectory · 8fd8d003
      Tom Tromey authored
      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
      8fd8d003
    • Tom Tromey's avatar
      Move guile object files to guile subdirectory · bd810fff
      Tom Tromey authored
      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.
      bd810fff
    • Tom Tromey's avatar
      Move unittests object files to unittests subdirectory · 75787ac1
      Tom Tromey authored
      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.
      75787ac1
    • Tom Tromey's avatar
      Move tui object files to tui subdirectory · 5c8a9431
      Tom Tromey authored
      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.
      5c8a9431
    • Tom Tromey's avatar
      Move compile object files to compile subdirectory · a26aa30c
      Tom Tromey authored
      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.
      a26aa30c
    • Tom Tromey's avatar
      Move mi objects to mi subdirectory · 6f3cdf9a
      Tom Tromey authored
      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
      6f3cdf9a
    • Tom Tromey's avatar
      Move cli object files to cli subdirectory · f06afa53
      Tom Tromey authored
      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.
      f06afa53
    • Tom Tromey's avatar
      A simpler way to make the "arch" build directory · b22c88c2
      Tom Tromey authored
      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.
      b22c88c2
    • Max Filippov's avatar
      gas: xtensa: speed up find_trampoline_seg · 407e1140
      Max Filippov authored
      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.
      407e1140
    • Max Filippov's avatar
      gas: xtensa: implement trampoline coalescing · 148d6384
      Max Filippov authored
      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.
      148d6384
    • Max Filippov's avatar
      gas: xtensa: reuse trampoline placement code · 76a493ab
      Max Filippov authored
      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.
      76a493ab
    • Max Filippov's avatar
      gas: xtensa: rewrite xg_relax_trampoline · fe6c2f1b
      Max Filippov authored
      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.
      fe6c2f1b
    • Max Filippov's avatar
      gas: xtensa: merge trampoline_frag into xtensa_frag_type · 46888d71
      Max Filippov authored
      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.
      46888d71
    • Max Filippov's avatar
      gas: xtensa: reuse find_trampoline_seg · 1c2649f5
      Max Filippov authored
      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.
      1c2649f5
    • Max Filippov's avatar
      gas: xtensa: extract jump assembling for trampolines · fec68fb1
      Max Filippov authored
      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.
      fec68fb1
    • Max Filippov's avatar
      gas: extract xg_relax_trampoline from xtensa_relax_frag · 120bc8b8
      Max Filippov authored
      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.
      120bc8b8
    • Joel Brobecker's avatar
      fix two issues in gdb.ada/mi_catch_ex.exp (re: "exception-message") · 10329bb2
      Joel Brobecker authored
      The following patch introduced a new feature related to Ada exception
      catchpoints:
      
          commit e547c119
          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
      10329bb2
    • Szabolcs Nagy's avatar
      [PR ld/22263] aarch64: Avoid dynamic TLS relocs in PIE · 6dda7875
      Szabolcs Nagy authored
      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.
      6dda7875
    • Szabolcs Nagy's avatar
      [PR ld/22269] aarch64: Handle local undefined weak symbols · a377ae2a
      Szabolcs Nagy authored
      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.
      a377ae2a
    • Nick Clifton's avatar
      Update the simplified Chinese translation of the messages in the opcodes library. · 64973b0a
      Nick Clifton authored
      	* po/zh_CN.po: Updated simplified Chinese translation.
      64973b0a
    • Nick Clifton's avatar
      Fix a seg-fault when displaying notes from a prorgam segment. Check for a... · 4dff97b2
      Nick Clifton authored
      Fix a seg-fault when displaying notes from a prorgam segment.  Check for a 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.
      4dff97b2
    • Nick Clifton's avatar
      When creating a .note section to contain a version note, set the section alignment to 4 bytes. · e3d40582
      Nick Clifton authored
      	PR 22492
      	* config/obj-elf.c (obj_elf_version): Set the alignment of the
      	.note section.
      e3d40582
    • Dominik Czarnota's avatar
      Update find command help and search memory docs · ee9a09e9
      Dominik Czarnota authored
      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.
      ee9a09e9
    • Simon Marchi's avatar
      python: Fix memleak in do_start_initialization · e8e7d10c
      Simon Marchi authored
      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.
      e8e7d10c
    • GDB Administrator's avatar
      Automatic date update in version.in · 7db85adb
      GDB Administrator authored
      7db85adb
  3. 26 Nov, 2017 2 commits
    • Tom Tromey's avatar
      Add include guards to common/format.h · 6a997029
      Tom Tromey authored
      This adds include guards to common/format.h.
      
      ChangeLog
      2017-11-26  Tom Tromey  <tom@tromey.com>
      
      	* common/format.h: Add include guards.
      6a997029
    • H.J. Lu's avatar
      Rename argument name from link to xlink · 2b63c337
      H.J. Lu authored
      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.
      2b63c337