1. 24 Jun, 2016 18 commits
    • John Baldwin's avatar
      Add a gdbarch 'print_auxv_entry' method for FreeBSD ABIs. · 82372b2f
      John Baldwin authored
      Add a 'print_auxv_entry' method for FreeBSD ABIs that parses
      FreeBSD-specific auxiliary vector entries and outputs a suitable
      description using fprint_auxv_entry.
      
      gdb/ChangeLog:
      
      	* fbsd-tdep.c: Include "auxv.h".
      	(fbsd_print_auxv_entry): New function.
      	(fbsd_init_abi): Install gdbarch "print_auxv_entry" method.
      82372b2f
    • John Baldwin's avatar
      Add a new gdbarch method to print a single AUXV entry. · 2faa3447
      John Baldwin authored
      Different platforms have different meanings for auxiliary vector
      entries.  The 'print_auxv_entry' gdbarch method allows an architecture
      to output a suitable description for platform-specific entries.
      
      A fprint_auxv_entry function is split out of fprint_target_auxv.
      This function outputs the description of a single auxiliary vector
      entry to the specified file using caller-supplied formatting and
      strings to describe the vector type.
      
      The existing switch on auxiliary vector types is moved out of
      fprint_target_auxv into a new default_print_auxv_entry function.
      default_print_auxv_entry chooses an appropriate format and description
      and calls fprint_single_auxv to describe a single vector entry.
      This function is used as the default 'print_auxv_entry' gdbarch method.
      
      fprint_target_auxv now invokes the gdbarch 'print_auxv_entry' method
      on each vector entry.
      
      gdb/ChangeLog:
      
      	* auxv.c (fprint_auxv_entry): New function.
      	(default_print_auxv_entry): New function...
      2faa3447
    • John Baldwin's avatar
      Create a pseudo section for the ELF AUXV core dump note on FreeBSD. · 3350c5f5
      John Baldwin authored
      The procstat AUXV core dump note in FreeBSD consists of 32-bit integer
      followed by an array of auxiliary vector entries.
      
      bfd/ChangeLog:
      
      	* elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PROCSTAT_AUXV
      	notes.
      3350c5f5
    • John Baldwin's avatar
      Fetch the ELF auxiliary vector from live processes on FreeBSD. · 7697fc9e
      John Baldwin authored
      Use the kern.proc.auxv.<pid> sysctl to fetch the ELF auxiliary vector for
      a live process.
      
      gdb/ChangeLog:
      
      	* fbsd-nat.c [KERN_PROC_AUXV] New variable super_xfer_partial.
      	(fbsd_xfer_partial): New function.
      	(fbsd_nat_add_target) [KERN_PROC_AUXV] Set "to_xfer_partial" to
      	"fbsd_xfer_partial".
      7697fc9e
    • John Baldwin's avatar
      Add elfcore_grok_freebsd_note to parse FreeBSD ELF core notes. · aa1ed4a9
      John Baldwin authored
      Move parsing of FreeBSD-specific ELF core notes out of elfcore_grok_note
      into a new elfcore_grok_freebsd_note function.  Add core note grok routines
      for FreeBSD's psinfo and prstatus notes while here rather than depending
      on the native handling in elfcore_grok_note.
      
      bfd/ChangeLog:
      
      	* elf.c (elfcore_grok_note): Remove handling of NT_X86_XSTATE for
      	FreeBSD.  Remove case for NT_FREEBSD_THRMISC.
      	(elfcore_grok_freebsd_psinfo): New function.
      	(elfcore_grok_freebsd_prstatus): New function.
      	(elfcore_grok_freebsd_note): New function.
      	(elf_parse_notes): Use "elfcore_grok_freebsd_note" for "FreeBSD"
      	notes.
      aa1ed4a9
    • John Baldwin's avatar
      Add constants for FreeBSD-specific auxiliary vector entry types. · b00f86d0
      John Baldwin authored
      include/ChangeLog:
      
      	* elf/common.h (AT_FREEBSD_EXECPATH, AT_FREEBSD_CANARY)
      	(AT_FREEBSD_CANARYLEN, AT_FREEBSD_OSRELDATE, AT_FREEBSD_NCPUS)
      	(AT_FREEBSD_PAGESIZES, AT_FREEBSD_PAGESIZESLEN)
      	(AT_FREEBSD_TIMEKEEP, AT_FREEBSD_STACKPROT): Define.
      b00f86d0
    • Joel Brobecker's avatar
    • Joel Brobecker's avatar
      fix undefined reference to bfd_link_plugin_object_p during link · 08ce1d72
      Joel Brobecker authored
      When configured with the default options, GDB currently fails to link,
      due to an undefined reference to bfd_link_plugin_object_p, coming from
      elflink.c:
      
          #ifdef BFD_SUPPORTS_PLUGINS
                 || (abfd->plugin_format == bfd_plugin_unknown
                    && bfd_link_plugin_object_p (abfd))
          #endif
      
      This is because BFD_SUPPORTS_PLUGINS is always defined. It is its value
      that determines whether plugin support is enabled or not.
      
      bfd/ChangeLog:
      
              * elflink.c: Check the value of BFD_SUPPORTS_PLUGINS rather
              than its existance.
      08ce1d72
    • Alan Modra's avatar
      MIPS objcopy --rename-section fix · 9cc0123f
      Alan Modra authored
      Some MIPS targets use a named section symbol rather than a symbol with
      no name as is used with most ELF targets.  When renaming sections, the
      named section symbol needs to be renamed too.
      
      Rather than fix this bug, I'd originally intended to just correct the
      xfail added recently for update-1.o vs update4.o in update-section.exp,
      using the same set of targets for the localize-hidden-1 mips xfail.
      I'd extracted that target test into a new function, is_bad_symtab.  It
      turns out to be useful in readelf.exp too.
      
      bfd/
      	* config.bfd: Delete mips vxworks patterns matched earlier.
      	Combine mips*-*-none with mips*-*-elf*.
      binutils/
      	* objcopy.c (find_section_rename): Forward declare.  Remove
      	ibfd and sec_ptr param.  Add old_name param.  Allow for NULL
      	returned_flags.  Move read of section name and flags to..
      	(setup_section): ..here.  Update find_section_rename call.
      	(filter_symbols): Rename section symbols for renamed sections.
      	(copy_object): Call filter_symbols when renamed sections.
      	* testsuite/lib/binutils-common.exp (is_bad_symtab): New.
      	* testsuite/binutils-all/update-section.exp: Revert 96037eb0
      	mips xfail.
      	* testsuite/binutils-all/objcopy.exp (copy_executable): Use
      	is_bad_symtab.
      	(localize-hidden-1): xfail if is_bad_symtab.
      	* testsuite/binutils-all/readelf.exp: Use is_bad_symtab to select
      	between mips/tmips.
      9cc0123f
    • Alan Modra's avatar
      aarch64 ld testsuite · 78da3bc1
      Alan Modra authored
      Fixes failure on aarch64-rtems.
      
      	* testsuite/ld-aarch64/aarch64-elf.exp (aarch64_choose_ilp32_emul):
      	Don't error out, always return an emulation.
      78da3bc1
    • Alan Modra's avatar
      alpha-openbsd build failure · 5c0ff163
      Alan Modra authored
      This target doesn't build, due to a missing gas/config/te-obsd.h file.
      It's been that way since the commit switching to elf, in 2002.
      https://lists.gnu.org/archive/html/bug-gnu-utils/2002-07/msg00128.html
      
      	* configure.tgt (alpha-*-openbsd*): Use em=nbsd.
      5c0ff163
    • Alan Modra's avatar
      Limit objdump -S context lines · 43339b1d
      Alan Modra authored
      Showing context lines is confusing in many cases, an obvious example
      being loops.
      
      	* objdump.c (struct print_file_list): Add "max_printed".
      	(try_print_file_open): Init new field.
      	(show_line): Don't show 5 context lines when redisplaying source.
      43339b1d
    • H.J. Lu's avatar
      Check DEFAULT_LD_Z_RELRO for -z relro help message · da4463c7
      H.J. Lu authored
      	* lexsup.c (elf_shlib_list_options): Check DEFAULT_LD_Z_RELRO
      	for -z relro help message.
      da4463c7
    • Tom Tromey's avatar
      Move logic out of symbol_find_demangled_name · 8b302db8
      Tom Tromey authored
      This patch moves most of the demangling logic out of
      symbol_find_demangled_name into the various language_defn objects.
      
      The simplest way to do this seemed to be to add a new method to
      language_defn.  This is shame given the existing la_demangle, but
      given Ada's unusual needs, and the differing demangling options
      between languages, la_demangle didn't seem to fit.
      
      In order to make this work, I made enum language order-sensitive.
      This helps preserve the current ordering of demangling operations.
      
      2016-06-23  Tom Tromey  <tom@tromey.com>
      
      	* symtab.c (symbol_find_demangled_name): Loop over languages and
      	use language_sniff_from_mangled_name.
      	* rust-lang.c (rust_sniff_from_mangled_name): New function.
      	(rust_language_defn): Update.
      	* p-lang.c (pascal_language_defn): Update.
      	* opencl-lang.c (opencl_language_defn): Update.
      	* objc-lang.c (objc_sniff_from_mangled_name): New function.
      	(objc_language_defn): Update.
      	* m2-lang.c (m2_language_defn): Update.
      	* langua...
      8b302db8
    • Tom Tromey's avatar
      Move filename extensions into language_defn · 56618e20
      Tom Tromey authored
      This moves filename extensions from a function in symfile.c out to
      each language_defn.  I think this is an improvement because it means
      less digging around when writing a new language port.
      
      2016-06-23  Tom Tromey  <tom@tromey.com>
      
      	* ada-lang.c (ada_extensions): New array.
      	(ada_language_defn): Use it.
      	* c-lang.c (c_extensions): New array.
      	(c_language_defn): Use it.
      	(cplus_extensions): New array.
      	(cplus_language_defn): Use it.
      	(asm_extensions): New array.
      	(asm_language_defn): Use it.
      	(minimal_language_defn): Update.
      	* d-lang.c (d_extensions): New array.
      	(d_language_defn): Use it.
      	* f-lang.c (f_extensions): New array.
      	(f_language_defn): Use it.
      	* go-lang.c (go_language_defn): Update.
      	* jv-lang.c (java_extensions): New array.
      	(java_language_defn): Use it.
      	* language.c (add_language): Call add_filename_language.
      	(unknown_language_defn, auto_language_defn, local_language_defn):
      	Update.
      	* language.h (struct language_defn) <la_filename_extensions>: New
      	field.
      	* m2-lang.c (m2_language_defn): Update.
      	* objc-lang.c (objc_extensions): New array.
      	(objc_language_defn): Use it.
      	* opencl-lang.c (opencl_language_defn): Update.
      	* p-lang.c (p_extensions): New array.
      	(pascal_language_defn): Use it.
      	* rust-lang.c (rust_extensions): New array.
      	(rust_language_defn): Use it.
      	* symfile.c (add_filename_language): No longer static.  Make "ext"
      	const.
      	(init_filename_language_table): Remove.
      	(_initialize_symfile): Update.
      	* symfile.h (add_filename_language): Declare.
      56618e20
    • Tom Tromey's avatar
      Use VEC for filename_language_table · 3fcf0b0d
      Tom Tromey authored
      This patch changes filename_language_table to be a VEC.  This seemed
      like a reasonable cleanup over the old code.
      
      2016-06-23  Tom Tromey  <tom@tromey.com>
      
      	* symfile.c (filename_language_table): Now a VEC.
      	(fl_table_size, fl_table_next): Remove.
      	(add_filename_language): Use VEC_safe_push.
      	(set_ext_lang_command, info_ext_lang_command)
      	(deduce_language_from_filename): Use VEC_iterate.
      	(init_filename_language_table): Use VEC_empty.
      3fcf0b0d
    • Tom Tromey's avatar
      Make gdbpy_parameter static · 0c72ed4c
      Tom Tromey authored
      While working on the next patch in this series, I noticed that
      gdbpy_parameter did not need to be exported.  This makes it "static".
      
      2016-06-23  Tom Tromey  <tom@tromey.com>
      
      	* python/python.c (gdbpy_parameter): Now static.
      	* python/python-internal.h (gdbpy_parameter): Don't declare.
      0c72ed4c
    • GDB Administrator's avatar
      Automatic date update in version.in · 5153607f
      GDB Administrator authored
      5153607f
  2. 23 Jun, 2016 6 commits
    • Cary Coutant's avatar
      Fix bug with grouping sections. · 3ca25b56
      Cary Coutant authored
      The fix for PR 15370 did not correctly check all patterns in a group,
      but instead threw all unassigned sections into the group. This patch
      fixes that.
      
      2016-06-23  Cary Coutant  <ccoutant@gmail.com>
      	    Igor Kudrin  <ikudrin@accesssoftek.com>
      
      gold/
      	PR gold/15370
      	* script-sections.cc
      	(Output_section_element_input::set_section_addresses): Keep bin_count
      	separate from input_pattern_count.
      	* testsuite/script_test_12.t: Add another section .x4.
      	* testsuite/script_test_12i.t: Likewise.
      	* testsuite/script_test_12a.c: Likewise.
      	* testsuite/script_test_12b.c: Likewise.
      3ca25b56
    • Igor Kudrin's avatar
      Fix compilation error in MSYS2 environment. · 2ec060b7
      Igor Kudrin authored
      gold/
      	* gold-threads.cc (impl_threads::Lock_impl_threads): Fix typos.
      2ec060b7
    • Tom Tromey's avatar
      PR gdb/16483 - simplify "info frame-filters" output · 17621150
      Tom Tromey authored
      PR gdb/16483 notes that the output of "info frame-filters" is quite
      voluminous.  In particular it prints an entry for each objfile, even if
      only to say that the objfile does not have any associated frame filters.
      
      I think it's better to only print output when there is a frame filter.
      There's nothing worth doing with the no-frame-filter information, and
      limiting the output makes it much more readable.
      
      Built and regtested on x86-64 Fedora 23.
      
      2016-06-23  Tom Tromey  <tom@tromey.com>
      
      	PR gdb/16483:
      	* python/lib/gdb/command/frame_filters.py
      	(InfoFrameFilter.list_frame_filters): Rename to print_list.  Print
      	nothing if no filters found.  Return value indicating whether
      	filters were printed.
      	(InfoFrameFilter.print_list): Remove.
      	(InfoFrameFilter.invoke): Print message if no frame filters
      	found.
      
      2016-06-23  Tom Tromey  <tom@tromey.com>
      
      	PR gdb/16483:
      	* gdb.python/py-framefilter.exp: Add "info frame-filter" test
      	before any filters are loaded.
      17621150
    • Maciej W. Rozycki's avatar
      MIPS/GAS: Keep the original microMIPS symbol reference in branch relocs · 0e9c5a5c
      Maciej W. Rozycki authored
      Keep original microMIPS symbols in references from branch relocations so
      that the ISA bit is retained and can be verified for validity in static
      link.  No need to update WRT MIPS16 symbols because we keep them all
      anyway for other reasons.
      
      	gas/
      	* config/tc-mips.c (b_reloc_p): New function.
      	(mips_fix_adjustable): Also keep the original microMIPS symbol
      	referred from branch relocations.
      	* testsuite/gas/mips/branch-local-1.d: New test.
      	* testsuite/gas/mips/branch-local-n32-1.d: New test.
      	* testsuite/gas/mips/branch-local-n64-1.d: New test.
      	* testsuite/gas/mips/micromips@branch-misc-4-64.d: Update
      	relocations.
      	* testsuite/gas/mips/branch-local-1.s: New test source.
      	* testsuite/gas/mips/mips.exp: Run the new cases.
      0e9c5a5c
    • Graham Markall's avatar
      [ARC] Misc minor edits/fixes · ce440d63
      Graham Markall authored
      The code supporting -mspfp, -mdpfp, and -mfpuda options are in
      sections of code that are commented as being for backward
      compatibility only, and having no effect. However, they do have an
      effect, enabling the SPX, DPX, and DPA instruction subclasses
      respectively. This commit moves the code supporting these options
      away from the comments indicating that they are dummy options, and
      also fixes a small issue where -mnps400 had the additional effect
      of enabling SPX instructions.
      
      A couple of other minor edits (that make no functional change) are
      also included.
      
      gas/ChangeLog:
      
              * config/tc-arc.c (options, md_longopts, md_parse_option):
              Move -mspfp, -mdpfp and -mfpuda out of the sections for
              dummy options. Correct erroneous enabling of SPFP
              instructions when using -mnps400.
      
      include/ChangeLog:
      
              * opcode/arc.h: Make insn_class_t alphabetical again.
      
      opcodes/ChangeLog:
      
              * arc-opc.c: Correct description of availability of NPS400
              features.
      ce440d63
    • GDB Administrator's avatar
      Automatic date update in version.in · f215c83b
      GDB Administrator authored
      f215c83b
  3. 22 Jun, 2016 12 commits
    • Maciej W. Rozycki's avatar
      MIPS/LD/testsuite: Use wildcard address matching in `undefweak-overflow' · 4041bc9b
      Maciej W. Rozycki authored
      So that test case updates result in legible dump pattern changes.
      
      	ld/
      	* testsuite/ld-mips-elf/undefweak-overflow.d: Use wildcard
      	address matching.
      4041bc9b
    • Maciej W. Rozycki's avatar
      MIPS/LD/testsuite: Uniquely identify `undefweak-overflow' tests · 4861b804
      Maciej W. Rozycki authored
      	ld/
      	* testsuite/ld-mips-elf/mips-elf.exp: Uniquely identify
      	`undefweak-overflow' tests.
      4861b804
    • Maciej W. Rozycki's avatar
      MIPS/GAS: Handle resolved R6 PC-relative relocations (ChangeLog) · 8cec2cfe
      Maciej W. Rozycki authored
      Add missing ChangeLog entry for commit 41947d9e ("MIPS/GAS: Handle
      resolved R6 PC-relative relocations").
      8cec2cfe
    • Peter Bergner's avatar
      Add support for yet some more new ISA 3.0 instructions. · 6fd3a02d
      Peter Bergner authored
      opcodes/
      	* ppc-opc.c (RM, DRM, VXASH, VXASH_MASK, XMMF, XMMF_MASK): New defines.
      	(powerpc_opcodes) <brd, brh, brw, mffsce, mffscdrn, mffscdrni,
      	mffscrn, mffscrni, mffsl, nandxor, rldixor, setbool,
      	xor3>: New mnemonics.
      	<setb>: Change to a VX form instruction.
      	(insert_sh6): Add support for rldixor.
      	(extract_sh6): Likewise.
      
      gas/
      	* testsuite/gas/ppc/power9.d <brd, brh, brw, mffs, mffs., mffsce,
      	mffscdrn, mffscdrni, mffscrn, mffscrni, mffsl, nandxor, rldixor,
      	setbool, xor3>: New tests.
      	* testsuite/gas/ppc/power9.s: Likewise.
      6fd3a02d
    • Trevor Saunders's avatar
      addmore extern C · 6b477896
      Trevor Saunders authored
      opcodes/ChangeLog:
      
      2016-06-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
      
      	* arc-ext.h: Wrap in extern C.
      
      include/ChangeLog:
      
      2016-06-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
      
      	* elf/dlx.h: Wrap in extern C.
      	* elf/xtensa.h: Likewise.
      	* opcode/arc.h: Likewise.
      6b477896
    • Nick Clifton's avatar
      Fix various binutils testsuite failures. · 96037eb0
      Nick Clifton authored
      	* testsuite/binutils-all/ar.exp: Skip tests for Alpha target.
      	Skip bfdtest1 tests for tic30 target.
      	* testsuite/binutils-all/arm/objdump.exp: Skip for aout arm
      	target.
      	* testsuite/binutils-all/compress.exp: Expect some tests to fail
      	on the nds32.
      	* testsuite/binutils-all/copy-3.d: Skip for go32 targets.
      	* testsuite/binutils-all/copy-4.d: Skip for AIX and linuxecoff
      	targets.
      	* testsuite/binutils-all/nm.exp: Treat beos based targets as ELF
      	targets.
      	* testsuite/binutils-all/objcopy.exp: Only run reverse bytes tests
      	if the bintest.o file was created.  Use the
      	get_standard_section_names proc to get the name of the data
      	section.
      	* testsuite/binutils-all/objdump.exp: Update regexps to allow for
      	RX section names.
      	* testsuite/binutils-all/readelf.exp: Use
      	get_standard_section_names proc to get the name of the data
      	section.
      	* testsuite/binutils-all/readelf.r: Allow for non standard text
      	section names.
      	* testsuite/binutils-all/readelf.s: Update regexps for tilepro.
      	* testsuite/binutils-all/size.exp: Allow for non standard section
      	names.
      	* testsuite/binutils-all/update-section.exp: Expect comapre 1vs4
      	to fail on mips targets.
      	* testsuite/lib/utils-lib.exp (default_binutils_run): Use
      	get_standard_section_names proc.
      	(run_dump_test): Likewise.
      	(proc get_standard_section_names): New proc.
      96037eb0
    • H.J. Lu's avatar
      gold: Add a linker configure option --enable-relro · 6b1edb94
      H.J. Lu authored
      Add a configure option --enable-relro to decide whether -z relro should
      be enabled by default.  Default to yes.
      
      	PR ld/20283
      	* NEWS: Mention --enable-relro.
      	* configure.ac: Add --enable-relro.
      	(DEFAULT_LD_Z_RELRO): New.  Set by --enable-relro and default
      	to 1.
      	* config.in: Regenerated.
      	* configure: Likewise.
      	* options.h (General_options::relro): Default to
      	DEFAULT_LD_Z_RELRO.
      6b1edb94
    • H.J. Lu's avatar
      ld: Add a linker configure option --enable-relro · 647e4d46
      H.J. Lu authored
      Add a configure option --enable-relro to decide whether -z relro should
      be enabled in ELF linker by default.  Default to yes for all Linux
      targets, except FRV, HPPA, IA64 and MIPS, since many relro tests fail
      on these targets.
      
      	PR ld/20283
      	* NEWS: Mention --enable-relro.
      	* configure.ac: Add --enable-relro.
      	(DEFAULT_LD_Z_RELRO): New.  Set by --enable-relro.
      	* configure.tgt (ac_default_ld_z_relro): Default it to 1 for
      	some Linux targets.
      	* config.in: Regenerated.
      	* configure: Likewise.
      	* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
      	link_info.relro to DEFAULT_LD_Z_RELRO.
      	* testsuite/config/default.exp (ld_elf_shared_opt): New.
      	* testsuite/lib/ld-lib.exp (run_dump_test): Pass
      	$ld_elf_shared_opt to ld for ELF targets with shared object
      	support.
      	(run_ld_link_tests): Likewise.
      647e4d46
    • Trevor Saunders's avatar
      tilegx: move TILEGX_NUM_PIPELINE_ENCODINGS to tilegx_pipeline enum · 6edaf4d7
      Trevor Saunders authored
      Its closely related to what the encodings are, more than a set of random
      constants, so it seems to make sense to put it here.
      
      include/ChangeLog:
      
      2016-06-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
      
      	* opcode/tilegx.h: Move TILEGX_NUM_PIPELINE_ENCODINGS into
      	tilegx_pipeline.
      6edaf4d7
    • Trevor Saunders's avatar
      xtensa: include elf/xtensa.h in tc-xtensa.c · b0b79343
      Trevor Saunders authored
      There's no reason to define these macros twice.
      
      gas/ChangeLog:
      
      2016-06-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
      
      	* config/tc-xtensa.c: Include elf/xtensa.h.
      b0b79343
    • Nick Clifton's avatar
      Increase size of string buffer used to hold printed versions of timestamps. · d5b07ef4
      Nick Clifton authored
      binutils* readelf.c (dynamic_section_mips_val): Increase size of timebuf.
      	(process_mips_specific): Likewise.
      	(process_gnu_liblist): Likewise.
      d5b07ef4
    • GDB Administrator's avatar
      Automatic date update in version.in · cbf55359
      GDB Administrator authored
      cbf55359
  4. 21 Jun, 2016 4 commits
    • Maciej W. Rozycki's avatar
      MIPS/GAS: Handle resolved R6 PC-relative relocations · 41947d9e
      Maciej W. Rozycki authored
      Complement commit 7361da2c ("Add support for MIPS R6.") and fix
      internal errors like:
      
      foo.s: Assembler messages:
      foo.s: Internal error!
      Assertion failure in md_apply_fix at .../gas/config/tc-mips.c:15028.
      Please report this bug.
      
      triggered by resolved R6 PC-relative relocations in sources containing
      R6 code fragments wrapped into ISA override blocks embedded within code
      otherwise assembled for an older ISA.
      
      	gas/
      	* config/tc-mips.c (calculate_reloc) <BFD_RELOC_HI16_S_PCREL>
      	<BFD_RELOC_LO16_PCREL>: New switch cases.
      	(md_apply_fix) <BFD_RELOC_HI16_S_PCREL, BFD_RELOC_LO16_PCREL>:
      	Move switch cases along `BFD_RELOC_MIPS_JMP'.
      	<BFD_RELOC_MIPS_21_PCREL_S2, BFD_RELOC_MIPS_26_PCREL_S2>
      	<BFD_RELOC_MIPS_18_PCREL_S3, BFD_RELOC_MIPS_19_PCREL_S2>: Handle
      	the resolved case.
      	* testsuite/gas/mips/pcrel-reloc-4.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-4-r6.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-5.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-5-r6.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-6.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-6.l: New list test.
      	* testsuite/gas/mips/pcrel-reloc-4.s: New test source.
      	* testsuite/gas/mips/pcrel-reloc-6.s: New test source.
      	* testsuite/gas/mips/mips.exp: Run the new tests.
      41947d9e
    • Maciej W. Rozycki's avatar
      MIPS/GAS: Fix null pointer dereferences in R6 PC-relative relocation checks · 717ba204
      Maciej W. Rozycki authored
      Avoid segmentation faults in alignment checks made in `md_apply_fix' for
      BFD_RELOC_MIPS_18_PCREL_S3 and BFD_RELOC_MIPS_19_PCREL_S2 relocations
      caused by dereferencing `fixP->fx_addsy' which will be null if the
      relocation processed has been fully resolved.
      
      	gas/
      	* config/tc-mips.c (md_apply_fix) <BFD_RELOC_MIPS_18_PCREL_S3>
      	<BFD_RELOC_MIPS_19_PCREL_S2>: Avoid null pointer dereferences
      	via `fixP->fx_addsy'.
      717ba204
    • Maciej W. Rozycki's avatar
      MIPS/GAS: Correct BFD_RELOC_MIPS_18_PCREL_S3 calculation · 51f6035b
      Maciej W. Rozycki authored
      The PC-relative R_MIPS_PC18_S3 relocation and consequently its BFD
      internal BFD_RELOC_MIPS_18_PCREL_S3 representation is calculated from
      the address of the aligned doubleword containing the location being
      relocated: (sign_extend(A) + S - (P & ~0x7)) >> 3 rather than the
      address of the location itself.  Reflect this in calculations made by
      GAS so that the relocated field is set correctly if resolved by GAS,
      such as with local symbols in the same section which do not require
      relocations to be propagated to the link stage.
      
      	gas/
      	* config/tc-mips.c (md_pcrel_from) <BFD_RELOC_MIPS_18_PCREL_S3>:
      	Calculate relocation from the containing aligned doubleword.
      	(tc_gen_reloc) <BFD_RELOC_MIPS_18_PCREL_S3>: Calculate the
      	addend from the containing aligned doubleword.
      51f6035b
    • Maciej W. Rozycki's avatar
      MIPS/GAS: Use the module level ISA setting for R6 relaxation · 912815f0
      Maciej W. Rozycki authored
      Use the module level ISA setting rather than the last ISA selected with
      a `.set' directive in the source file in determination as to whether to
      keep PC-relative relocations and then with the original symbol referred,
      for the purpose of R6 linker relaxation.
      
      This is so that with e.g. code like this:
      
      	b	foo
      	.set	mips32r2
      	...
      
      it's the command line options or any `.module' directive that decides
      how to encode any relocation for `foo' rather than the presence of `.set
      mips32r2'.
      
      	gas/
      	* config/tc-mips.c (mips_force_relocation): Use `file_mips_opts'
      	rather than `mips_opts' for the R6 ISA check.
      	(mips_fix_adjustable): Likewise.
      	* testsuite/gas/mips/pcrel-reloc-1.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-1-r6.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-2.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-2-r6.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-3.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-3-r6.d: New test.
      	* testsuite/gas/mips/pcrel-reloc-1.s: New test source.
      	* testsuite/gas/mips/mips.exp: Run the new tests.
      912815f0