Commit Graph

14631 Commits

Author SHA1 Message Date
GDB Administrator 8ea3acd626 Automatic date update in version.in 2018-06-22 00:00:53 +00:00
Maciej W. Rozycki 1ced1a5f10 MIPS/BFD: Correct formatting of compact EH backend methods
Correct the formatting of `_bfd_mips_elf_compact_eh_encoding' and
`_bfd_mips_elf_cant_unwind_opcode' definitions which extend beyond 79
columns.

	bfd/
	* elfxx-mips.c (_bfd_mips_elf_compact_eh_encoding)
	(_bfd_mips_elf_cant_unwind_opcode): Correct formatting.
2018-06-21 21:40:57 +01:00
Maciej W. Rozycki 334cd8a780 MIPS/BFD: Keep EI_ABIVERSION setting together
Shuffle code in `_bfd_mips_post_process_headers' so that the setting of
the EI_ABIVERSION ELF file header field is complete before calling
`_bfd_elf_post_process_headers'.  This used to be the case, but was
changed with commit 351cdf24d2 ("[MIPS] Implement O32 FPXX, FP64 and
FP64A ABI extensions") for no reason.

	bfd/
	* elfxx-mips.c (_bfd_mips_post_process_headers): Keep
	EI_ABIVERSION setting together.
2018-06-21 21:40:56 +01:00
Maciej W. Rozycki bb29b84d8c MIPS/BFD: Use enumeration constants for EI_ABIVERSION
Define enumeration constants based on generated `libc-abis.h' from GNU
libc, adding a MIPS_ prefix as these are port-specific.  Use them to
replace magic numbers stored in the EI_ABIVERSION field of the ELF file
header.

	bfd/
	* elfxx-mips.c (MIPS_LIBC_ABI_DEFAULT, MIPS_LIBC_ABI_MIPS_PLT)
	(MIPS_LIBC_ABI_UNIQUE, MIPS_LIBC_ABI_MIPS_O32_FP64)
	(MIPS_LIBC_ABI_MAX): New enumeration constants.
	(_bfd_mips_post_process_headers): Use them in place of magic
	numbers.
2018-06-21 21:40:56 +01:00
Jim Wilson 25eb8346ac RISC-V: Fix 3 PIE related ld testsuite failures.
bfd/
	* elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Update comment.
	Use SYMBOL_REFERENCES_LOCAL.  Add asserts for h->got.offset.
2018-06-21 11:45:43 -07:00
Alan Modra d388f64333 Regen doc/Makefile.in
Also make the automake strictness "foreign".  My regeneration of the
three doc/Makefile.in files already had --foreign in the automake
invocation, so this just makes it explicit.

bfd/
	* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
	* doc/Makefile.in: Regenerate.
binutils/
	* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
	* doc/Makefile.in: Regenerate.
gas/
	* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
	* doc/Makefile.in: Regenerate.
zlib/
	* Makefile.in: Regenerate.
2018-06-21 23:00:05 +09:30
GDB Administrator 6ff79ccd1c Automatic date update in version.in 2018-06-21 00:00:39 +00:00
Nick Clifton 6077de0645 Fix potential illegal memroy access when using a build-id note with a negative size.
PR 23316
	* opncls.c (get_build_id): Check for a negative or excessive data
	size in the build-id note.
2018-06-20 16:30:05 +01:00
Renlin Li b939d8a0de [BFD][AARCH64]Properly truncate no overflow checking relocation value for load/store immediate.
bfd/ChangeLog:

2018-06-20  Renlin Li  <renlin.li@arm.com>

	* elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use PG_OFFSET
	to resolve BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
	BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
	BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC,
	BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC,
	BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
	BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
	BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
	BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.

ld/ChangeLog:

2018-06-20 Renlin Li  <renlin.li@arm.com>

	* testsuite/ld-aarch64/emit-relocs-115.d: Update test with new value.
	* testsuite/ld-aarch64/emit-relocs-534.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-555.d: Likewise.
2018-06-20 14:47:37 +01:00
Nick Clifton c6643fcc05 Stop objcopy from corrupting mach-o files.
PR 23299
	* mach-o.c (cputype): New function.
	(cpusubtype): New function.
	(bfd_mach_o_bfd_print_private_data): New function.  Dispalys the
	values in the MACH-O file header.
	(bfd_mach_o_bfd_copy_private_header_data): Copy the cputype and
	cpusubtype fields from the input bfd's mach-o header to the output
	bfd.
	* mach-o-target.c (bfd_mach_o_bfd_print_private_bfd_data):
	Redefine to bfd_mach_o_bfd_print_private_data.
	* mach-o.h (bfd_mach_o_bfd_print_private_bfd_data): Prototype.
2018-06-20 10:43:00 +01:00
GDB Administrator 7c69913eaa Automatic date update in version.in 2018-06-20 00:00:56 +00:00
Maciej W. Rozycki 789ff5b6c2 PR ld/22966: Fix n64 MIPS `.got.plt' range checks
The addressable signed 32-bit range for n64 MIPS `.got.plt' references
is from 0xffffffff7fff8000 to 0x7fff7fff, due to how the composition of
an LUI and an LD instruction works for address calculation in the 64-bit
addressing mode, such as when CP0.Status.UX=1.

We currently have a range check in `mips_finish_exec_plt', however it is
not correct as it verifies that the `.got.plt' start address referred is
between 0xffffffff80000000 and 0x7fffffff.  It is also implemented as an
assertion rather than a proper error message despite that the situation
can be triggered by user input.  Additionally there is no check made for
individual `.got.plt' entries referred even though they can be out of
range while the `.got.plt' start address is not.

Fix all these problems and use the correct range for the check, limiting
it to n64 output files, and then issue a proper error message both in
`mips_finish_exec_plt' and in `_bfd_mips_elf_finish_dynamic_symbol',
suggesting the use of the `-Ttext-segment=...' option that will often
work and with the default linker scripts in particular.  Add suitable
tests covering boundary cases.

	bfd/
	PR ld/22966
	* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Verify the
	`.got.plt' entry referred is in range.
	(mips_finish_exec_plt): Correct the range check for `.got.plt'
	start.  Replace the assertion used for that with a proper error
	message.

	ld/
	PR ld/22966
	* testsuite/ld-mips-elf/n64-plt-1.dd: New test.
	* testsuite/ld-mips-elf/n64-plt-1.gd: New test.
	* testsuite/ld-mips-elf/n64-plt-2.ed: New test.
	* testsuite/ld-mips-elf/n64-plt-3.ed: New test.
	* testsuite/ld-mips-elf/n64-plt-4.dd: New test.
	* testsuite/ld-mips-elf/n64-plt-4.gd: New test.
	* testsuite/ld-mips-elf/n64-plt-1.ld: New test linker script.
	* testsuite/ld-mips-elf/n64-plt-2.ld: New test linker script.
	* testsuite/ld-mips-elf/n64-plt-3.ld: New test linker script.
	* testsuite/ld-mips-elf/n64-plt-4.ld: New test linker script.
	* testsuite/ld-mips-elf/n64-plt.s: New test source.
	* testsuite/ld-mips-elf/n64-plt-lib.s: New test source.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2018-06-20 00:37:51 +01:00
Maciej W. Rozycki 6a382bcead MIPS/BFD: Fix `loc' formatting in `_bfd_mips_elf_finish_dynamic_symbol'
Fix a formatting fallout in `_bfd_mips_elf_finish_dynamic_symbol' from
commit ce558b89b1 ("Delete duplicate target short-cuts to dynamic
sections").

	bfd/
	* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Fix
	formatting.
2018-06-20 00:37:51 +01:00
Simon Marchi d0ac1c4488 Bump to autoconf 2.69 and automake 1.15.1
When trying to run the update-gnulib.sh script in gdb, I get this:

Error: Wrong automake version (Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^      =:+{}]+)}/ at /opt/automake/1.11.1/bin/automake line 4113.), we need 1.11.1.
Aborting.

Apparently, it's an issue with a regex in automake that triggers a
warning starting with Perl 5.22.  It has been fixed in automake 1.15.1.
So I think it's a good excuse to bump the versions of autoconf and
automake used in the gnulib import.  And to avoid requiring multiple
builds of autoconf/automake, it was suggested that we bump the required
version of those tools for all binutils-gdb.

For autoconf, the 2.69 version is universally available, so it's an easy
choice.  For automake, different distros and distro versions have
different automake versions.  But 1.15.1 seems to be the most readily
available as a package.  In any case, it's easy to build it from source.

I removed the version checks from AUTOMAKE_OPTIONS and AC_PREREQ,
because I don't think they are useful in our case.  They only specify a
lower bound for the acceptable version of automake/autoconf.  That's
useful if you let the user choose the version of the tool they want to
use, but want to set a minimum version (because you use a feature that
was introduced in that version).  In our case, we force people to use a
specific version anyway.  For the autoconf version, we have the check in
config/override.m4 that enforces the version we want.  It will be one
less thing to update next time we change autotools version.

I hit a few categories of problems that required some changes.  They are
described below along with the chosen solutions.

Problem 1:

  configure.ac:17: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
  configure.ac:17: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation

Solution 1:

  Adjust the code based on the example at that URL.

Problem 2 (in zlib/):

  Makefile.am: error: required file './INSTALL' not found
  Makefile.am:   'automake --add-missing' can install 'INSTALL'
  Makefile.am: error: required file './NEWS' not found
  Makefile.am: error: required file './AUTHORS' not found
  Makefile.am: error: required file './COPYING' not found
  Makefile.am:   'automake --add-missing' can install 'COPYING'

Solution 2:

  Add the foreign option to AUTOMAKE_OPTIONS.

Problem 3:

  doc/Makefile.am:20: error: support for Cygnus-style trees has been removed

Solution 3:

  Remove the cygnus options.

Problem 4:

  Makefile.am:656: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')

Solution 4:

  Rename "INCLUDES = " to "AM_CPPFLAGS += " (because AM_CPPFLAGS is
  already defined earlier).

Problem 5:

  doc/Makefile.am:71: warning: suffix '.texinfo' for Texinfo files is discouraged; use '.texi' instead
  doc/Makefile.am: warning: Oops!
  doc/Makefile.am:     It appears this file (or files included by it) are triggering
  doc/Makefile.am:     an undocumented, soon-to-be-removed automake hack.
  doc/Makefile.am:     Future automake versions will no longer place in the builddir
  doc/Makefile.am:     (rather than in the srcdir) the generated '.info' files that
  doc/Makefile.am:     appear to be cleaned, by e.g. being listed in CLEANFILES or
  doc/Makefile.am:     DISTCLEANFILES.
  doc/Makefile.am:     If you want your '.info' files to be placed in the builddir
  doc/Makefile.am:     rather than in the srcdir, you have to use the shiny new
  doc/Makefile.am:     'info-in-builddir' automake option.

Solution 5:

  Rename .texinfo files to .texi.

Problem 6:

  doc/Makefile.am: warning: Oops!
  doc/Makefile.am:     It appears this file (or files included by it) are triggering
  doc/Makefile.am:     an undocumented, soon-to-be-removed automake hack.
  doc/Makefile.am:     Future automake versions will no longer place in the builddir
  doc/Makefile.am:     (rather than in the srcdir) the generated '.info' files that
  doc/Makefile.am:     appear to be cleaned, by e.g. being listed in CLEANFILES or
  doc/Makefile.am:     DISTCLEANFILES.
  doc/Makefile.am:     If you want your '.info' files to be placed in the builddir
  doc/Makefile.am:     rather than in the srcdir, you have to use the shiny new
  doc/Makefile.am:     'info-in-builddir' automake option.

Solution 6:

  Remove the hack at the bottom of doc/Makefile.am and use
  the info-in-builddir automake option.

Problem 7:

  doc/Makefile.am:35: error: required file '../texinfo.tex' not found
  doc/Makefile.am:35:   'automake --add-missing' can install 'texinfo.tex'

Solution 7:

  Use the no-texinfo.tex automake option.  We also have one in
  texinfo/texinfo.tex, not sure if we should point to that, or move it
  (or a newer version of it added with automake --add-missing) to
  top-level.

Problem 8:

  Makefile.am:131: warning: source file 'config/tc-aarch64.c' is in a subdirectory,
  Makefile.am:131: but option 'subdir-objects' is disabled
  automake: warning: possible forward-incompatibility.
  automake: At least a source file is in a subdirectory, but the 'subdir-objects'
  automake: automake option hasn't been enabled.  For now, the corresponding output
  automake: object file(s) will be placed in the top-level directory.  However,
  automake: this behaviour will change in future Automake versions: they will
  automake: unconditionally cause object files to be placed in the same subdirectory
  automake: of the corresponding sources.
  automake: You are advised to start using 'subdir-objects' option throughout your
  automake: project, to avoid future incompatibilities.

Solution 8:

  Use subdir-objects, that means adjusting references to some .o that will now
  be in config/.

Problem 9:

  configure.ac:375: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
  ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
  ../../lib/autoconf/general.m4:2601: _AC_COMPILE_IFELSE is expanded from...
  ../../lib/autoconf/general.m4:2617: AC_COMPILE_IFELSE is expanded from...
  ../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from...
  ../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
  ../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
  configure.ac:375: the top level

Solution 9:

  Use AC_LANG_SOURCE, or use proper quoting.

Problem 10 (in intl/):

  configure.ac:7: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
  /usr/share/aclocal/threadlib.m4:36: gl_THREADLIB_EARLY_BODY is expanded from...
  /usr/share/aclocal/threadlib.m4:29: gl_THREADLIB_EARLY is expanded from...
  /usr/share/aclocal/threadlib.m4:318: gl_THREADLIB is expanded from...
  /usr/share/aclocal/lock.m4:9: gl_LOCK is expanded from...
  /usr/share/aclocal/intl.m4:211: gt_INTL_SUBDIR_CORE is expanded from...
  /usr/share/aclocal/intl.m4:25: AM_INTL_SUBDIR is expanded from...
  /usr/share/aclocal/gettext.m4:57: AM_GNU_GETTEXT is expanded from...
  configure.ac:7: the top level

Solution 10:

  Add AC_USE_SYSTEM_EXTENSIONS in configure.ac.

ChangeLog:

	* libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE.
	* README-maintainer-mode: Update version requirements.
	* ar-lib: New file.
	* test-driver: New file.
	* configure: Re-generate.

bfd/ChangeLog:

	* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11.
	(INCLUDES): Rename to ...
	(AM_CPPFLAGS): ... this.
	* configure.ac: Remove AC_PREREQ.
	* doc/Makefile.am (AUTOMAKE_OPTIONS): Remove 1.9, cygnus, add
	info-in-builddir no-texinfo.tex.
	(info_TEXINFOS): Rename bfd.texinfo to bfd.texi.
	* doc/bfd.texinfo: Rename to ...
	* doc/bfd.texi: ... this.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* config.in: Re-generate.
	* configure: Re-generate.
	* doc/Makefile.in: Re-generate.

binutils/ChangeLog:

	* configure.ac: Remove AC_PREREQ.
	* doc/Makefile.am (AUTOMAKE_OPTIONS): Remove cygnus, add
	info-in-builddir no-texinfo.tex.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* config.in: Re-generate.
	* configure: Re-generate.
	* doc/Makefile.in: Re-generate.

config/ChangeLog:

	* override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.

etc/ChangeLog:

	* configure.in: Remove AC_PREREQ.
	* configure: Re-generate.

gas/ChangeLog:

	* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11, add subdir-objects.
	(TARG_CPU_O, OBJ_FORMAT_O, ATOF_TARG_O): Add config/ prefix.
	* configure.ac (TARG_CPU_O, OBJ_FORMAT_O, ATOF_TARG_O, emfiles,
	extra_objects): Add config/ prefix.
	* doc/as.texinfo: Rename to...
	* doc/as.texi: ... this.
	* doc/Makefile.am: Rename as.texinfo to as.texi throughout.
	Remove DISTCLEANFILES hack.
	(AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add no-texinfo.tex and
	info-in-builddir.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* config.in: Re-generate.
	* configure: Re-generate.
	* doc/Makefile.in: Re-generate.

gdb/ChangeLog:

	* common/common-defs.h (PACKAGE_NAME, PACKAGE_VERSION,
	PACKAGE_STRING, PACKAGE_TARNAME): Undefine.
	* configure.ac: Remove AC_PREREQ, add missing quoting.
	* gnulib/configure.ac: Modernize usage of
	AC_INIT/AM_INIT_AUTOMAKE.  Remove AC_PREREQ.
	* gnulib/update-gnulib.sh (AUTOCONF_VERSION): Bump to 2.69.
	(AUTOMAKE_VERSION): Bump to 1.15.1.
	* configure: Re-generate.
	* config.in: Re-generate.
	* aclocal.m4: Re-generate.
	* gnulib/aclocal.m4: Re-generate.
	* gnulib/config.in: Re-generate.
	* gnulib/configure: Re-generate.
	* gnulib/import/Makefile.in: Re-generate.

gdb/gdbserver/ChangeLog:

	* configure.ac: Remove AC_PREREQ, add missing quoting.
	* configure: Re-generate.
	* config.in: Re-generate.
	* aclocal.m4: Re-generate.

gdb/testsuite/ChangeLog:

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.

gold/ChangeLog:

	* configure.ac: Remove AC_PREREQ, add missing quoting and usage
	of AC_LANG_SOURCE.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* configure: Re-generate.
	* testsuite/Makefile.in: Re-generate.

gprof/ChangeLog:

	* configure.ac: Remove AC_PREREQ.
	* Makefile.am: Remove DISTCLEANFILES hack.
	(AUTOMAKE_OPTIONS): Remove 1.11, add info-in-builddir.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* configure: Re-generate.
	* gconfig.in: Re-generate.

intl/ChangeLog:

	* configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ.
	* configure: Re-generate.
	* config.h.in: Re-generate.
	* aclocal.m4: Re-generate.

ld/ChangeLog:

	* configure.ac: Remove AC_PREREQ.
	* Makefile.am: Remove DISTCLEANFILES hack, rename ld.texinfo to
	ld.texi, ldint.texinfo to ldint.texi throughout.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	* README: Rename ld.texinfo to ld.texi, ldint.texinfo to
	ldint.texi throughout.
	* gen-doc.texi: Likewise.
	* h8-doc.texi: Likewise.
	* ld.texinfo: Rename to ...
	* ld.texi: ... this.
	* ldint.texinfo: Rename to ...
	* ldint.texi: ... this.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* config.in: Re-generate.
	* configure: Re-generate.

libdecnumber/ChangeLog:

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* aclocal.m4.

libiberty/ChangeLog:

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* config.in: Re-generate.

opcodes/ChangeLog:

	* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* configure: Re-generate.

readline/ChangeLog.gdb:

	* configure: Re-generate.
	* examples/rlfe/configure: Re-generate.

sim/ChangeLog:

	* All configure.ac: Remove AC_PREREQ.
	* All configure: Re-generate.

zlib/ChangeLog.bin-gdb:

	* configure.ac: Modernize AC_INIT call, remove AC_PREREQ.
	* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add
	foreign.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* configure: Re-generate.
2018-06-19 16:55:06 -04:00
GDB Administrator e31716b076 Automatic date update in version.in 2018-06-19 00:01:05 +00:00
Mephi ed1299fe46 Add support for the TLV relocation generated by LLVM for x86_64 MACH-O targets.
PR 23297
	* mach-o-x86-64.c (x86_64_howto_table): Add entry for
	BFD_RELOC_MACH_O_X86_64_RELOC_TLV.
	(bfd_mach_o_x86_64_canonicalize_one_reloc): Handle the new reloc.
	(bfd_mach_o_x86_64_swap_reloc_out): Likewise.
	* reloc.c (BFD_RELOC_MACH_O_X86_64_TV): New entry.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
2018-06-18 12:56:44 +01:00
GDB Administrator fd8079f900 Automatic date update in version.in 2018-06-18 00:01:09 +00:00
GDB Administrator 8887b88af8 Automatic date update in version.in 2018-06-17 00:00:41 +00:00
GDB Administrator c8e1763890 Automatic date update in version.in 2018-06-16 00:00:56 +00:00
GDB Administrator 5785bb826b Automatic date update in version.in 2018-06-15 00:00:48 +00:00
Faraz Shahbazker 6f20c942c3 MIPS: Add Global INValidate ASE support
Add support for the Global INValidate Application Specific Extension
for Release 6 of the MIPS Architecture.

[1] "MIPS Architecture for Programmers Volume II-A: The MIPS32
    Instruction Set Manual", Imagination Technologies Ltd., Document
    Number: MD00086, Revision 6.06, December 15, 2016, Section 3.2
    "Alphabetical List of Instructions", pp. 187-191

bfd/
	* elfxx-mips.c (print_mips_ases): Add GINV extension.

binutils/
	* readelf.c (print_mips_ases): Add GINV extension.

gas/
	* NEWS: Mention MIPS Global INValidate ASE support.
	* config/tc-mips.c (options): Add OPTION_GINV and OPTION_NO_GINV.
	(md_longopts): Likewise.
	(mips_ases): Define availability for GINV.
	(mips_convert_ase_flags): Map ASE_GINV to AFL_ASE_GINV.
	(md_show_usage): Add help for -mginv and -mno-ginv.
	* doc/as.texinfo: Document -mginv, -mno-ginv.
	* doc/c-mips.texi: Document -mginv, -mno-ginv, .set ginv and
	.set noginv.
	* testsuite/gas/mips/ase-errors-1.s: Add error checks for GINV
	ASE.
	* testsuite/gas/mips/ase-errors-2.s: Likewise.
	* testsuite/gas/mips/ase-errors-1.l: Likewise.
	* testsuite/gas/mips/ase-errors-2.l: Likewise.
	* testsuite/gas/mips/ginv.d: New test.
	* testsuite/gas/mips/ginv-err.d: New test.
	* testsuite/gas/mips/ginv-err.l: New test stderr output.
	* testsuite/gas/mips/ginv.s: New test source.
	* testsuite/gas/mips/ginv-err.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

include/
	* elf/mips.h (AFL_ASE_GINV, AFL_ASE_RESERVED1): New macros.
	(AFL_ASE_MASK): Update to include AFL_ASE_GINV.
	* opcode/mips.h: Document "+\" operand format.
	(ASE_GINV): New macro.

opcodes/
	* mips-dis.c (mips_arch_choices): Add GINV to mips32r6 and
	mips64r6 descriptors.
	(parse_mips_ase_option): Handle -Mginv option.
	(print_mips_disassembler_options): Document -Mginv.
	* mips-opc.c (decode_mips_operand) <+\>: New operand format.
	(GINV): New macro.
	(mips_opcodes): Define ginvi and ginvt.
2018-06-14 21:34:49 +01:00
H.J. Lu 1f6f5dba57 elf: Check if the first symbol version is base version
Check VER_FLG_BASE instead of assuming that the first symbol version is
base version.

bfd/

	PR binutils/23267
	* elf.c (_bfd_elf_get_symbol_version_string): Check if the first
	symbol version is base version.

binutils/

	PR binutils/23267
	* readelf.c (get_symbol_version_string): Check if the first
	symbol version is base version.
2018-06-14 05:37:33 -07:00
Alan Modra 7f923b7fd2 ELF dynsyms
Many ELF targets arrange to emit a number of section symbols in
.dynsym for use by dynamic relocations.  This happens before the
dynamic relocations are output, and the need for those symbols
determined.  In most cases they are not needed.  A proper analysis of
the need for dynamic section symbols is target specific and tedious,
so this patch just excludes them in the obvious case when no
dynamic relocations are present.

The patch also runs the new pr23161 and pr23162 tests on more targets.

bfd/
	* elf-bfd.h (struct elf_link_hash_table): Add "dynamic_relocs".
	* elflink.c (_bfd_elf_init_2_index_sections): Comment fix.
	(_bfd_elf_add_dynamic_entry): Set "dynamic_relocs".
	(_bfd_elf_link_renumber_dynsyms): Exclude all section symbols when
	"dynamic_relocs" is not set.
	* elfxx-mips.c (count_section_dynsyms): Likewise.
ld/
	* testsuite/ld-elf/readelf.exp: Delete DUMP and selection of
	variant ver_def.vd.
	* testsuite/ld-elf/ver_def-tic6x.vd: Delete.
	* testsuite/ld-elf/shared.exp: Run most pr23161 and pr23162 tests for
	linux, nacl and gnu targets.
	* testsuite/ld-mips-elf/mips-elf.exp: Set base_syms to 1.
	* testsuite/ld-elf/pr23161a.rd: Don't check reloc type.  Allow any
	order of __bss_start, _edata and _end.
	* testsuite/ld-elf/pr23161b.rd: Don't check plt and dyn relocs.
	Allow and order of __bss_start, _edata and _end.
	* testsuite/ld-elf/pr23162.rd: Fail if __bss_start, _edata or _end
	relocs are present rather than testing for no relocations.
	* testsuite/ld-aarch64/gc-plt-relocs.d,
	* testsuite/ld-aarch64/ifunc-1-local.d,
	* testsuite/ld-aarch64/ifunc-1.d,
	* testsuite/ld-aarch64/ifunc-2-local.d,
	* testsuite/ld-aarch64/ifunc-2.d,
	* testsuite/ld-aarch64/ifunc-21.d,
	* testsuite/ld-aarch64/ifunc-3a.d,
	* testsuite/ld-arm/farcall-mixed-lib-v4t.d,
	* testsuite/ld-arm/farcall-mixed-lib.d,
	* testsuite/ld-arm/gc-hidden-1.d,
	* testsuite/ld-arm/tls-gdesc-got.d,
	* testsuite/ld-arm/tls-lib-loc.d,
	* testsuite/ld-arm/tls-longplt-lib.d,
	* testsuite/ld-arm/tls-thumb1.d,
	* testsuite/ld-cris/libdso-10.d,
	* testsuite/ld-cris/libdso-11.d,
	* testsuite/ld-cris/libdso-13b.d,
	* testsuite/ld-cris/libdso-14.d,
	* testsuite/ld-cris/libdso-15.d,
	* testsuite/ld-cris/pic-gc-72.d,
	* testsuite/ld-cris/pic-gc-73.d,
	* testsuite/ld-cris/tls-gc-71.d,
	* testsuite/ld-mips-elf/mips16-pic-4a.nd,
	* testsuite/ld-mips-elf/pic-and-nonpic-3a.dd,
	* testsuite/ld-mips-elf/pie-n32.d,
	* testsuite/ld-mips-elf/pie-n64.d,
	* testsuite/ld-mips-elf/pie-o32.d: Update for removed dynamic
	section symbols.
2018-06-14 11:32:01 +09:30
Alan Modra ff91d2f0e2 PR23282, Reinstate seek optimization
PR 23282
	* bfdio.c (bfd_seek): Optimize away seeks to current position.
2018-06-14 11:32:01 +09:30
GDB Administrator 7be6cc9284 Automatic date update in version.in 2018-06-14 00:00:36 +00:00
Scott Egerton 730c31740a MIPS: Add CRC ASE support
Add support for the CRC Application Specific Extension for Release 6 of
the MIPS Architecture.

[1] "MIPS Architecture for Programmers Volume II-A: The MIPS32
    Instruction Set Manual", Imagination Technologies Ltd., Document
    Number: MD00086, Revision 6.06, December 15, 2016, Section 3.2
    "Alphabetical List of Instructions", pp. 143-148

[2] "MIPS Architecture for Programmers Volume II-A: The MIPS64
    Instruction Set Manual", Imagination Technologies Ltd., Document
    Number: MD00087, Revision 6.06, December 15, 2016, Section 3.2
    "Alphabetical List of Instructions", pp. 165-170

ChangeLog:

bfd/
2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
            Faraz Shahbazker  <Faraz.Shahbazker@mips.com>

	* elfxx-mips.c (print_mips_ases): Add CRC.

binutils/
2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
            Faraz Shahbazker  <Faraz.Shahbazker@mips.com>

	* readelf.c (print_mips_ases): Add CRC.

gas/
2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
            Faraz Shahbazker  <Faraz.Shahbazker@mips.com>
            Maciej W. Rozycki  <macro@mips.com>

	* config/tc-mips.c (options): Add OPTION_CRC and OPTION_NO_CRC.
	(md_longopts): Likewise.
	(md_show_usage): Add help for -mcrc and -mno-crc.
	(mips_ases): Define availability for CRC and CRC64.
	(mips_convert_ase_flags): Map ASE_CRC to AFL_ASE_CRC.
	* doc/as.texinfo: Document -mcrc, -mno-crc.
	* doc/c-mips.texi: Document -mcrc, -mno-crc, .set crc and
	.set no-crc.
	* testsuite/gas/mips/ase-errors-1.l: Add error checks for CRC
	ASE.
	* testsuite/gas/mips/ase-errors-2.l: Likewise.
	* testsuite/gas/mips/ase-errors-1.s: Likewise.
	* testsuite/gas/mips/ase-errors-2.s: Likewise.
	* testsuite/gas/mips/crc.d: New test.
	* testsuite/gas/mips/crc64.d: New test.
	* testsuite/gas/mips/crc-err.d: New test.
	* testsuite/gas/mips/crc64-err.d: New test.
	* testsuite/gas/mips/crc-err.l: New test stderr output.
	* testsuite/gas/mips/crc64-err.l: New test stderr output.
	* testsuite/gas/mips/crc.s: New test source.
	* testsuite/gas/mips/crc64.s: New test source.
	* testsuite/gas/mips/crc-err.s: New test source.
	* testsuite/gas/mips/crc64-err.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

include/
2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
            Faraz Shahbazker  <Faraz.Shahbazker@mips.com>

	* elf/mips.h (AFL_ASE_CRC): New macro.
	(AFL_ASE_MASK): Update to include AFL_ASE_CRC.
	* opcode/mips.h (ASE_CRC): New macro.
	* opcode/mips.h (ASE_CRC64): Likewise.

opcodes/
2018-06-13  Scott Egerton  <scott.egerton@imgtec.com>
            Faraz Shahbazker  <Faraz.Shahbazker@mips.com>

	* mips-dis.c (mips_arch_choices): Add CRC and CRC64 ASEs.
	* mips-opc.c (CRC, CRC64): New macros.
	(mips_builtin_opcodes): Define crc32b, crc32h, crc32w,
	crc32cb, crc32ch and crc32cw for CRC.  Define crc32d and
	crc32cd for CRC64.
2018-06-13 15:39:05 +01:00
GDB Administrator c75c496d6d Automatic date update in version.in 2018-06-13 00:00:44 +00:00
GDB Administrator 90b345f613 Automatic date update in version.in 2018-06-12 00:00:49 +00:00
GDB Administrator 65a68903e2 Automatic date update in version.in 2018-06-11 00:01:03 +00:00
GDB Administrator 09897e3330 Automatic date update in version.in 2018-06-10 00:01:24 +00:00
GDB Administrator 30d42fef63 Automatic date update in version.in 2018-06-09 00:00:45 +00:00
H.J. Lu ecf99cc092 ld/x86: Remove hidden _edata, __bss_start, and _end
There is no need to put hidden _edata, __bss_start, and _end in dynamic
symbol table in shared libraries.

bfd/

	PR ld/23161
	* elfxx-x86.c (elf_x86_hide_linker_defined): New function.
	(_bfd_x86_elf_link_check_relocs): Use it to hide hidden
	__bss_start, _end and _edata in shared libraries.

ld/

	PR ld/23161
	* testsuite/ld-elf/pr23161d.rd: Remove local _edata, __bss_start,
	and _end from dynamic symbol table.
2018-06-08 12:41:54 -07:00
GDB Administrator 4f652d7b9a Automatic date update in version.in 2018-06-08 00:00:43 +00:00
GDB Administrator 066b621238 Automatic date update in version.in 2018-06-07 00:00:50 +00:00
Alan Modra 527278f336 TIC6X __c6xabi_DSBT_BASE
Adding an undefined __c6xabi_DSBT_BASE via an EXTERN in the linker
script isn't ideal, as the symbol is not always needed.  This patch
adds the undefined symbol on encountering relocations where it is
implicitly referenced.

bfd/
	* elf32-tic6x.c (elf32_tic6x_check_relocs): Reference
	__c6xabi_DSBT_BASE explicitly for R_C6000_SBR_* relocs.
ld/
	* emulparams/elf32_tic6x_le.sh (EXECUTABLE_SYMBOLS): Don't define.
2018-06-07 09:07:32 +09:30
GDB Administrator 773ff7907c Automatic date update in version.in 2018-06-06 00:00:53 +00:00
Alan Modra 5c4ce239a3 Tidy bfdio to consistenly use containing archive
Archive element IO is performed on the file of the containing archive,
which leads to the BFD "where" field of archives and their elements
being out of sync with the real file position.  (We're talking
traditional archives here, not thin archives.)  The old bfd_seek code
recognized this by not attempting to optimize away seeks for
archives.  However, there was other code that could return bogus
results.  For example, cache.c limits the number of open files by
closing a file and remembering its state once the limit is reached.
If bfd_tell is called on an archive element when the containing
archive is closed, it will return an invalid file pointer.

It's possible to have a valid "where" field for archives by always
using and updating the containing archive BFD.  That's what this patch
does.  Note that cache.c used to find the containing archive BFD
anyway for the iostream, so we're not really doing extra work, just
transferring it up to the correct abstraction level.

The patch also gets rid of some hacks.  bfd_tell was called when
bfd_seek failed, in an attempt to correct "where".  That's got to be
papering over another problem, so that code has been removed.
bfd_read also had an "optimiziation" to return early when the number
of bytes was zero, and bfd_seek optimized calls that didn't move the
file pointer.  This was covering for a coff_slurp_line_table bug where
IO was attempted on a pe-dll BFD without an iovec.

	* bfd.c (struct bfd): Update comment on "where" usage.
	* bfdio.c (bfd_bwrite, bfd_stat): Use and update "iovec",
	"iostream", and "where" from containing archive file.  Return
	error on NULL iovec.
	(bfd_bread): Similarly, and return error attempted out of
	bounds archive element access.
	(bfd_tell, bfd_flush): Use and update "iovec", "iostream", and
	"where" from containing archive file.
	(bfd_seek): Likewise.  Return error on NULL iovec.  Don't
	attempt to optimize away seeks.  Don't paper over errors by
	calling bfd_tell.
	(bfd_get_mtime): Call bfd_stat rather than iovec->bstat.
	(bfd_get_size): Likewise.
	(bfd_mmap): Operate on and use iovec of containing archive
	file.  Return error on NULL iovec.
	* cache.c (bfd_cache_lookup_worker): Abort if working on
	archive element bfd.
	(cache_bread_1): Delete bfd parameter, add FILE* parameter.
	Don't ignore zero byte reads.
	(cache_bread): Look up FILE* in cache here.  Error on NULL
	lookup.
	(cache_bwrite): Rename "where" to "from".
	(cache_bmmap): Don't handle archive elements.
	* coffcode.h (coff_slurp_line_table): Exit early on zero
	lineno count.
	* bfd-in2.h: Regenerate.
2018-06-05 22:39:12 +09:30
Alan Modra 27b0767593 PR23254, ld.bfd mishandles file pointers while scanning archive
Best practice is to not mix lseek/read with fseek/fread on the same
underlying file descriptor, as not all stdio implementations will cope.
Since the plugin uses lseek/read while bfd uses fseek/fread this patch
reopens the file for exclusive use by the plugin rather than trying to
restore the file descriptor.  That allows the plugin to read the file
after plugin_call_claim_file too.

bfd/
	PR 23254
	* plugin.c (bfd_plugin_open_input): Allow for possibility of
	nested archives.  Open file again for plugin.
	(try_claim): Don't save and restore file position.  Close file
	if not claimed.
	* sysdep.h (O_BINARY): Define.
ld/
	PR 23254
	* plugin.c (plugin_call_claim_file): Revert 2016-07-19 patch.
	(plugin_object_p): Don't dup file descriptor.
2018-06-05 22:39:11 +09:30
GDB Administrator e6d079c2fb Automatic date update in version.in 2018-06-05 00:00:36 +00:00
Max Filippov 4b8e28c793 xtensa: use property tables for correct disassembly
xtensa disassembler does not use information from the .xt.prop sections
to switch between code/data disassembly in text sections. This may
result in incorrect disassembly when data is interpreted as code and
disassembler loses synchronization with instruction stream. Use .xt.prop
section information to correctly interpret code and data and synchronize
with instruction stream.

2018-06-04  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* elf32-xtensa.c (xtensa_read_table_entries): Make global.
	(compute_fill_extra_space): Drop declaration. Rename function to
	xtensa_compute_fill_extra_space.
	(compute_ebb_actions, remove_dead_literal): Update references to
	compute_fill_extra_space.

include/
	* elf/xtensa.h (xtensa_read_table_entries)
	(xtensa_compute_fill_extra_space): New declarations.

opcodes/
	* xtensa-dis.c (bfd.h, elf/xtensa.h): New includes.
	(dis_private): Add new fields for property section tracking.
	(xtensa_coalesce_insn_tables, xtensa_find_table_entry)
	(xtensa_instruction_fits): New functions.
	(fetch_data): Bump minimal fetch size to 4.
	(print_insn_xtensa): Make struct dis_private static.
	Load and prepare property table on section change.
	Don't disassemble literals. Don't disassemble instructions that
	cross property table boundaries.
2018-06-04 10:38:55 -07:00
Max Filippov 8255c61b8a xtensa: add separate property sections option
It is currently not possible to correctly match .xt.prop information
for sections with identical VMA. Allow creation of separate property
sections in the BFD. Add assembler option --separate-prop-tables to
allow creation of separate property sections.

2018-06-04  Volodymyr Arbatov  <arbatov@cadence.com>
bfd/

	* elf32-xtensa.c (elf32xtensa_separate_props): New global
	variable.
	(xtensa_add_names): New function.
	(xtensa_property_section_name): Add new parameter
	separate_sections, use it to choose property section name.
	(xtensa_get_separate_property_section): New function.
	(xtensa_get_property_section): Invoke
	xtensa_get_separate_property_section to get individual property
	section if it exists, common property section otherwise.
	(xtensa_make_property_section): Pass elf32xtensa_separate_props
	to xtensa_property_section_name.

gas/
	* config/tc-xtensa.c (elf32xtensa_separate_props): New
	declaration.
	(option_separate_props, option_no_separate_props): New
	enumeration constants.
	(md_longopts): Add separate-prop-tables option.
	(md_parse_option): Add cases for option_separate_props and
	option_no_separate_props.
	(md_show_usage): Add help for [no-]separate-prop-tables options.
2018-06-04 10:36:39 -07:00
H.J. Lu 95da985446 Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence GCC 8.1
GCC 8.1 warns about destination size with -Wstringop-truncation:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643

Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence it.

bfd/

	PR binutils/23146
	* bfd-in.h: Include "diagnostics.h".
	* bfd-in2.h: Regenerated.
	* elf32-arm.c (elf32_arm_nabi_write_core_note): Use
	DIAGNOSTIC_PUSH, DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION and
	DIAGNOSTIC_POP to silence GCC 8.1 warnings with
	-Wstringop-truncation.
	* elf32-ppc.c (ppc_elf_write_core_note): Likewse.
	* elf32-s390.c (elf_s390_write_core_note): Likewse.
	* elf64-ppc.c (ppc64_elf_write_core_note): Likewse.
	* elf64-s390.c (elf_s390_write_core_note): Likewse.
	* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewse.

include/

	* diagnostics.h (DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION): Always
	define for GCC.
2018-06-04 10:01:46 -07:00
GDB Administrator ff183b0d82 Automatic date update in version.in 2018-06-04 00:00:48 +00:00
Jim Wilson cf7a5066b9 RISC-V: Handle out-of-range calls to undefined weak.
bfd/
	PR ld/23244
	* elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Check
	for and handle an undefined weak with no PLT.

	ld/
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run new weak ref tests.
	* testsuite/ld-riscv-elf/weakref.ld: New.
	* testsuite/ld-riscv-elf/weakref32.d: New.
	* testsuite/ld-riscv-elf/weakref32.s: New.
	* testsuite/ld-riscv-elf/weakref64.d: New.
	* testsuite/ld-riscv-elf/weakref64.s: New.
2018-06-03 15:42:29 -07:00
Jim Wilson 137b5cbd20 RISC-V: Fix symbol address problem with versioned symbols.
bfd/
	PR ld/22756
	* elfnn-riscv.c (riscv_relax_delete_bytes): Add versioned_hidden check
	to code that ignores duplicate symbols.
2018-06-03 14:44:44 -07:00
GDB Administrator b15fe636af Automatic date update in version.in 2018-06-03 00:00:49 +00:00
GDB Administrator a131318670 Automatic date update in version.in 2018-06-02 00:00:35 +00:00
H.J. Lu 55e99962b2 Bump version number to 2.30.52
Bump version number to 2.30.52 since _bfd_link_hide_symbol has been added
to bfd_target.

bfd/

	* version.m4: Bump version to 2.30.52
	* configure: Regenerated.

binutils/

	* configure: Regenerated.

gas/

	* configure: Regenerated.

gprof/

	* configure: Regenerated.

ld/

	* configure: Regenerated.

opcodes/

	* configure: Regenerated.
2018-06-01 09:34:16 -07:00
Alan Modra 030157d8a6 Make _bfd_error_handler available outside libbfd
Needed when building libopcodes.so.

bfd/
	* bfd.c (_bfd_error_handler): Arrange for this function to be
	declared in bfd-in2.h.
	* libbfd-in.h (_bfd_error_handler): Don't declare.
	* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.
opcodes/
	* sysdep.h (_bfd_error_handler): Don't declare.
	* msp430-decode.opc: Include bfd.h.  Don't include ansidecl.h here.
	* rl78-decode.opc: Likewise.
	* msp430-decode.c: Regenerate.
	* rl78-decode.c: Regenerate.
2018-06-01 13:10:33 +09:30
GDB Administrator 61a9a607b5 Automatic date update in version.in 2018-06-01 00:01:00 +00:00
GDB Administrator 4a4459db18 Automatic date update in version.in 2018-05-31 00:00:35 +00:00
Amaan Cheval 421acf1873 2018-05-30 Amaan Cheval <amaan.cheval@gmail.com>
* config.bfd (x86_64-*-*): Add pei-x86-64 target to x86_64-*-rtems*
	This is needed to generate UEFI application image files from ELFs.
2018-05-30 10:04:28 -05:00
GDB Administrator 51af6fa066 Automatic date update in version.in 2018-05-30 00:01:00 +00:00
GDB Administrator fe1658217f Automatic date update in version.in 2018-05-29 00:00:36 +00:00
H.J. Lu 92e68c1d65 x86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout
ENDBR64 is added to the special TLSDESC entry, which is similar to the
PLT0 entry, in the x86-64 lazy procedure linkage table to support Intel
CET.  The NaCl PLT is different from the normal PLT.  This patch adds
plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end to elf_x86_lazy_plt_layout to support both
normal and NaCl TLSDESC entries.  This fixed

FAIL: TLS descriptor -fpic -shared transitions

for x86_64-nacl.

	* elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry,
	plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
	plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
	plt_tlsdesc_got2_insn_end for TLSDESC entry.
	(elf_i386_lazy_ibt_plt): Likewise.
	(elf_i386_nacl_plt): Likewise.
	* elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ...
	(elf_x86_64_tlsdesc_plt_entry): This.
	(elf_x86_64_lazy_plt): Add plt_tlsdesc_entry,
	plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
	plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
	plt_tlsdesc_got2_insn_end for TLSDESC entry.
	(elf_x86_64_lazy_bnd_plt): Likewise.
	(elf_x86_64_lazy_ibt_plt): Likewise.
	(elf_x32_lazy_ibt_plt): Likewise.
	(elf_x86_64_nacl_plt): Likewise.
	(elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry,
	plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
	plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
	plt_tlsdesc_got2_insn_end to update TLSDESC entry.
	* elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments.
	Add plt_tlsdesc_entry, plt_tlsdesc_entry_size,
	plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset,
	plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end.
	(elf_x86_non_lazy_plt_layout): Update comments.
	(elf_x86_plt_layout): Likewise.
2018-05-28 10:46:16 -07:00
H.J. Lu ac98f9e227 ld: Unify STT_GNU_IFUNC handling
Take STT_GNU_IFUNC handling scattered across targets and gather it in
the generic ELF linker.

bfd/

	PR ld/23238
	* elf-s390-common.c (elf_s390_add_symbol_hook): Removed.
	* elf32-arc.c (elf_arc_add_symbol_hook): Likewise.
	(elf_backend_add_symbol_hook): Likewise.
	* elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise.
	(elf_backend_add_symbol_hook): Likewise.
	* elf32-s390.c (elf_backend_add_symbol_hook): Likewise.
	* elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
	(elf_backend_add_symbol_hook): Likewise.
	* elf64-s390.c (elf_backend_add_symbol_hook): Likewise.
	* elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise.
	* elfxx-aarch64.h (_bfd_aarch64_elf_add_symbol_hook): Likewise.
	(elf_backend_add_symbol_hook): Likewise.
	* elf32-arm.c (elf32_arm_add_symbol_hook): Remove STT_GNU_IFUNC
	handling.
	* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
	* elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
	* elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
	* elflink.c (elf_link_add_object_symbols): Set
	elf_gnu_symbol_ifunc for STT_GNU_IFUNC symbols.

ld/

	PR ld/23238
	* testsuite/ld-ifunc/ifunc-26.d: New file.
	* testsuite/ld-ifunc/ifunc-26.s: Likewise.
	* testsuite/ld-ifunc/ifunc.exp: Run *.d tests without a
	working compiler.
2018-05-28 08:15:21 -07:00
GDB Administrator 46207bf3b5 Automatic date update in version.in 2018-05-28 00:00:23 +00:00
GDB Administrator 121dac5822 Automatic date update in version.in 2018-05-27 00:01:17 +00:00
H.J. Lu 099bb8fb97 ld: Add _bfd_elf_link_hide_sym_by_version
bfd_hide_sym_by_version can't be used to check if a versioned symbol is
hidden.  This patch adds _bfd_elf_link_hide_sym_by_version to support
both versioned and unversioned symbols by extracting versioned symbol
check from _bfd_elf_link_assign_sym_version.

bfd/

	PR ld/23194
	* elf-bfd.h (_bfd_elf_link_hide_sym_by_version): New.
	* elflink.c (_bfd_elf_link_hide_versioned_symbol): New function.
	Extracted from _bfd_elf_link_assign_sym_version.
	(_bfd_elf_link_hide_sym_by_version): New function.
	(_bfd_elf_link_assign_sym_version): Use
	_bfd_elf_link_hide_versioned_symbol.
	* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Call
	_bfd_elf_link_hide_sym_by_version instead of
	bfd_hide_sym_by_version.  Don't check unversioned symbol.

ld/

	PR ld/23194
	* testsuite/ld-i386/pr23194.d: Expect only R_386_GLOB_DAT
	against foobar.
	* testsuite/ld-i386/pr23194.map: Add foobar.
	* testsuite/ld-x86-64/pr23194.map: Likewise.
	* testsuite/ld-i386/pr23194.s: Add a common foobar symbol.
	* testsuite/ld-x86-64/pr23194.s: Likewise.
	* testsuite/ld-x86-64/pr23194.d: Expect only R_X86_64_GLOB_DAT
	against foobar.
2018-05-26 04:27:24 -07:00
GDB Administrator d7460de3ea Automatic date update in version.in 2018-05-26 00:00:34 +00:00
Alan Modra 277eb7f64a s12z regen
This patch regenerates a number of files that either were edited by
hand or not regenerated when s12z support was added to binutils.

bfd/
	* Makefile.in: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
gas/
	* po/POTFILES.in: Regenerate.
ld/
	* po/BLD-POTFILES.in: Regenerate.
opcodes/
	* Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.
2018-05-25 16:05:30 +09:30
Alan Modra 629dabe3b7 Fix hidden visibility compiler test
Warnings from configure tests aren't usually checked.  gcc's
"visibility attribute not supported in this configuration" warning is
enabled by default so we don't need to add any warning flag except
-Werror.

	* configure.ac (bfd_cv_hidden): Run test with -Werror in CFLAGS.
	* configure: Regenerate.
2018-05-25 15:26:47 +09:30
GDB Administrator f9885f5602 Automatic date update in version.in 2018-05-25 00:00:18 +00:00
GDB Administrator 08163f025e Automatic date update in version.in 2018-05-24 00:00:28 +00:00
H.J. Lu 9ef6d1e31f Add ATTRIBUTE_NONSTRING to ppc64_elf_write_core_note
This patch silences gcc8 -Wstringop-truncation warnings.

	* elf64-ppc.c (ppc64_elf_write_core_note): Add ATTRIBUTE_NONSTRING
	to data.
2018-05-23 10:15:11 -07:00
GDB Administrator f2a3bd7da2 Automatic date update in version.in 2018-05-23 00:00:29 +00:00
Alan Modra 215f527155 PR23207, hppa ld SIGSEGVs on invalid object files
The last patch was enough to cure the testcase, but not the original
object file.  This patch does the same for hppa as is done for ppc64,
simply test for the section belonging to a group.  I've also
restricted stubs to load, alloc, code sections.

	PR 23207
	* elf32-hppa.c (hppa_get_stub_entry): Return NULL when link_sec
	is NULL.
	(elf32_hppa_size_stubs): Only create stubs for load, alloc, code
	sections.
	(final_link_relocate): Revert last change.
2018-05-22 19:37:06 +09:30
Alan Modra 7455c018e4 PR23207, hppa ld SIGSEGVs on invalid object files
We don't create PLT call stubs for anything in non-alloc sections,
so it doesn't pay to go looking for them.  The problem is that
non-alloc sections aren't processed by group_sections and thus don't
get a link_sec set up for them.

	PR 23207
	* elf32-hppa.c (final_link_relocate): Don't look for plt call
	stubs in non-alloc sections.
2018-05-22 14:45:15 +09:30
H.J. Lu 34a87bb07a ld: Hide symbols defined by HIDDEN/PROVIDE_HIDDEN
There should be no difference in output for symbols defined by HIDDEN
or PROVIDE_HIDDEN assignments whether they are explicitly marked as
hidden or not.  This patch adds a new BFD function, bfd_link_hide_symbol,
to hide symbols defined by HIDDEN and PROVIDE_HIDDEN assignments.

bfd

	PR ld/23201
	* aout-target.h (MY_bfd_link_hide_symbol): New.
	* aout-tic30.c (MY_bfd_link_hide_symbol): Likewise.
	* binary.c (binary_bfd_link_hide_symbol): Likewise.
	* coff-alpha.c (_bfd_ecoff_bfd_link_hide_symbol): Likewise.
	* coff-mips.c (_bfd_ecoff_bfd_link_hide_symbol): Likewise.
	* coff-rs6000.c (_bfd_xcoff_bfd_link_hide_symbol): Likewise.
	* coffcode.h (coff_bfd_link_hide_symbol): Likewise.
	* elf-bfd.h (_bfd_elf_link_hide_symbol): Likewise.
	* elfxx-target.h (bfd_elfNN_bfd_link_hide_symbol): Likewise.
	* i386msdos.c (msdos_bfd_link_hide_symbol): Likewise.
	* ihex.c (ihex_bfd_link_hide_symbol): Likewise.
	* libbfd-in.h (_bfd_nolink_bfd_link_hide_symbol): Likewise.
	* linker.c (_bfd_generic_link_hide_symbol): Likewise.
	(bfd_link_hide_symbol): Likewise.
	* mach-o-target.c (bfd_mach_o_bfd_link_hide_symbol): Likewise.
	* mmo.c (mmo_bfd_link_hide_symbol): Likewise.
	* pef.c (bfd_pef_bfd_link_hide_symbol): Likewise.
	* plugin.c (bfd_plugin_bfd_link_hide_symbol): Likewise.
	* ppcboot.c (ppcboot_bfd_link_hide_symbol): Likewise.
	* som.c (som_bfd_link_hide_symbol): Likewise.
	* srec.c (srec_bfd_link_hide_symbol): Likewise.
	* tekhex.c (tekhex_bfd_link_hide_symbol): Likewise.
	* vms-alpha.c (vms_bfd_link_hide_symbol): Likewise.
	(alpha_vms_bfd_link_hide_symbol): Likewise.
	* xsym.c (bfd_sym_bfd_link_hide_symbol): Likewise.
	* coff64-rs6000.c (rs6000_xcoff64_vec): Add
	_bfd_generic_link_hide_symbol.
	(rs6000_xcoff64_aix_vec): Likewise.
	* elflink.c (bfd_elf_record_link_assignment): Don't make forced
	local symbol dynamic.
	(_bfd_elf_link_hide_symbol): New function.
	* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
	check root.ldscript_def.
	* targets.c (bfd_target): Add _bfd_link_hide_symbol.
	(BFD_JUMP_TABLE_LINK): Add NAME##_bfd_link_hide_symbol.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Likewise.

ld/

	PR ld/23201
	* ldexp.c (exp_fold_tree_1): Call bfd_link_hide_symbol to hide
	a symbol.
	* testsuite/ld-elf/provide-hidden-dynabs.nd: Removed.
	* testsuite/ld-elf/provide-hidden-dynsec.nd: Likewise.
	* testsuite/ld-elf/provide-hidden.exp: Replace
	provide-hidden-dynsec.nd with provide-hidden-sec.nd and
	provide-hidden-dyn.nd.  Replace provide-hidden-dynabs.nd with
	provide-hidden-abs.nd and provide-hidden-dyn.nd.
	* testsuite/ld-i386/pr23189.d: Expect no dynamic relocation.
	* testsuite/ld-x86-64/pr23189.d: Likewise.
2018-05-21 20:39:30 -07:00
H.J. Lu bae363f114 Mark section in a section group with SHF_GROUP
All sections in a section group should be marked with SHF_GROUP.  But
some tools generate broken objects without SHF_GROUP.  This patch fixes
them up for objcopy and strip.

	PR binutils/23199
	* elf.c (setup_group): Mark section in a section group with
	SHF_GROUP.
2018-05-21 19:25:33 -07:00
GDB Administrator e54bb2a017 Automatic date update in version.in 2018-05-22 00:00:37 +00:00
GDB Administrator b1aed5de0c Automatic date update in version.in 2018-05-21 00:00:50 +00:00
GDB Administrator 205f121826 Automatic date update in version.in 2018-05-20 00:01:18 +00:00
GDB Administrator 2dd50e74b7 Automatic date update in version.in 2018-05-19 00:00:39 +00:00
H.J. Lu 97373b2eba x86: Don't set eh->local_ref to 1 for versioned symbol
bfd_hide_sym_by_version can't be used to check if a versioned symbol is
hidden.  It has to be synced with _bfd_elf_link_assign_sym_version to
get the correct answer.

bfd/

	PR ld/23194
	* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
	set eh->local_ref to 1 if a symbol is versioned and there is a
	version script.

ld/

	PR ld/23194
	* testsuite/ld-i386/i386.exp: Run pr23194.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr23194.d: New file.
	* testsuite/ld-i386/pr23194.map: Likewise.
	* testsuite/ld-i386/pr23194.s: Likewise.
	* testsuite/ld-x86-64/pr23194.d: Likewise.
	* testsuite/ld-x86-64/pr23194.map: Likewise.
	* testsuite/ld-x86-64/pr23194.s: Likewise.
2018-05-18 14:34:49 -07:00
Jim Wilson 7f99954970 RISC-V: Add RV32E support.
Kito Cheng  <kito.cheng@gmail.com>
	Monk Chiang  <sh.chiang04@gmail.com>

	bfd/
	* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Handle
	EF_RISCV_RVE.

	binutils/
	* readelf.c (get_machine_flags): Handle EF_RISCV_RVE.

	gas/
	* config/tc-riscv.c (rve_abi): New.
	(riscv_set_options): Add rve field.  Initialize it.
	(riscv_set_rve) New function.
	(riscv_set_arch): Support 'e' ISA subset.
	(reg_lookup_internal): If rve, check register is available.
	(riscv_set_abi): New parameter rve.
	(md_parse_option): Pass new argument to riscv_set_abi.
	(riscv_after_parse_args): Call riscv_set_rve.  If rve_abi, set
	EF_RISCV_RVE.
	* doc/c-riscv.texi (-mabi): Document new ilp32e argument.

	include/
	* elf/riscv.h (EF_RISCV_RVE): New define.
2018-05-18 14:03:18 -07:00
Jim Wilson 6487709f3f RISC-V: Fix ld-elf/pr22269* testcases.
bfd/
	* elfnn-riscv.c (allocate_dynrelocs): Discard dynamic relocations if
	UNDEFWEAK_NO_DYNAMIC_RELOC is true.
	(riscv_elf_relocate_section): Don't generate dynamic relocation if
	UNDEFWEAK_NO_DYNAMIC_RELOC is true.
	(riscv_elf_finish_dynamic_symbol): Likewise.
2018-05-18 13:06:19 -07:00
John Darrington 7b4ae82428 Add support for the Freescale s12z processor.
bfd	* Makefile.am: Add s12z files.
	* Makefile.in: Regenerate.
	* archures.c: Add bfd_s12z_arch.
	* bfd-in.h: Add exports of bfd_putb24 and bfd_putl24.
	* bfd-in2.h: Regenerate.
	* config.bfd: Add s12z target.
	* configure.ac: Add s12z target.
	* configure: Regenerate.
	* cpu-s12z.c: New file.
	* elf32-s12z.c: New file.
	* libbfd.c (bfd_putb24): New function.
	(bfd_putl24): New function.
	* libbfd.h: Regenerate.
	* reloc.c: Add s12z relocations.
	(bfd_get_reloc_size): Handle size 5 relocs.
	* targets.c: Add s12z_elf32_vec.

opcodes	* Makefile.am: Add support for s12z architecture.
	* configure.ac: Likewise.
	* disassemble.c: Likewise.
	* disassemble.h: Likewise.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* s12z-dis.c: New file.
	* s12z.h: New file.

include	* elf/s12z.h: New header.

ld	* Makefile.am: Add support for s12z architecture.
	* configure.tgt: Likewise.
	* Makefile.in: Regenerate.
	* emulparams/m9s12zelf.sh: New file.
	* scripttempl/elfm9s12z.sc: New file.
	* testsuite/ld-discard/static.d: Expect to fail for the s12z
	target.
	* testsuite/ld-elf/endsym.d: Likewise.
	* testsuite/ld-elf/merge.d: Likewise.
	* testsuite/ld-elf/pr14926.d: Skip for the s12z target.
	* testsuite/ld-elf/sec64k.exp: Likewise.
	* testsuite/ld-s12z: New directory.
	* testsuite/ld-s12z/opr-linking.d: New file.
	* testsuite/ld-s12z/opr-linking.s: New file.
	* testsuite/ld-s12z/relative-linking.d: New file.
	* testsuite/ld-s12z/relative-linking.s: New file.
	* testsuite/ld-s12z/z12s.exp: New file.

gas	* Makefile.am: Add support for s12z target.
	* Makefile.in: Regenerate.
	* NEWS: Mention the new support.
	* config/tc-s12z.c: New file.
	* config/tc-s12z.h: New file.
	* configure.tgt: Add  s12z support.
	* doc/Makefile.am: Likewise.
	* doc/Makefile.in: Regenerate.
	* doc/all.texi: Add s12z documentation.
	* doc/as.textinfo: Likewise.
	* doc/c-s12z.texi: New file.
	* testsuite/gas/s12z: New directory.
	* testsuite/gas/s12z/abs.d: New file.
	* testsuite/gas/s12z/abs.s: New file.
	* testsuite/gas/s12z/adc-imm.d: New file.
	* testsuite/gas/s12z/adc-imm.s: New file.
	* testsuite/gas/s12z/adc-opr.d: New file.
	* testsuite/gas/s12z/adc-opr.s: New file.
	* testsuite/gas/s12z/add-imm.d: New file.
	* testsuite/gas/s12z/add-imm.s: New file.
	* testsuite/gas/s12z/add-opr.d: New file.
	* testsuite/gas/s12z/add-opr.s: New file.
	* testsuite/gas/s12z/and-imm.d: New file.
	* testsuite/gas/s12z/and-imm.s: New file.
	* testsuite/gas/s12z/and-opr.d: New file.
	* testsuite/gas/s12z/and-opr.s: New file.
	* testsuite/gas/s12z/and-or-cc.d: New file.
	* testsuite/gas/s12z/and-or-cc.s: New file.
	* testsuite/gas/s12z/bfext-special.d: New file.
	* testsuite/gas/s12z/bfext-special.s: New file.
	* testsuite/gas/s12z/bfext.d: New file.
	* testsuite/gas/s12z/bfext.s: New file.
	* testsuite/gas/s12z/bit-manip.d: New file.
	* testsuite/gas/s12z/bit-manip.s: New file.
	* testsuite/gas/s12z/bit.d: New file.
	* testsuite/gas/s12z/bit.s: New file.
	* testsuite/gas/s12z/bra-expression-defined.d: New file.
	* testsuite/gas/s12z/bra-expression-defined.s: New file.
	* testsuite/gas/s12z/bra-expression-undef.d: New file.
	* testsuite/gas/s12z/bra-expression-undef.s: New file.
	* testsuite/gas/s12z/bra.d: New file.
	* testsuite/gas/s12z/bra.s: New file.
	* testsuite/gas/s12z/brclr-symbols.d: New file.
	* testsuite/gas/s12z/brclr-symbols.s: New file.
	* testsuite/gas/s12z/brset-clr-opr-imm-rel.d: New file.
	* testsuite/gas/s12z/brset-clr-opr-imm-rel.s: New file.
	* testsuite/gas/s12z/brset-clr-opr-reg-rel.d: New file.
	* testsuite/gas/s12z/brset-clr-opr-reg-rel.s: New file.
	* testsuite/gas/s12z/brset-clr-reg-imm-rel.d: New file.
	* testsuite/gas/s12z/brset-clr-reg-imm-rel.s: New file.
	* testsuite/gas/s12z/brset-clr-reg-reg-rel.d: New file.
	* testsuite/gas/s12z/brset-clr-reg-reg-rel.s: New file.
	* testsuite/gas/s12z/clb.d: New file.
	* testsuite/gas/s12z/clb.s: New file.
	* testsuite/gas/s12z/clr-opr.d: New file.
	* testsuite/gas/s12z/clr-opr.s: New file.
	* testsuite/gas/s12z/clr.d: New file.
	* testsuite/gas/s12z/clr.s: New file.
	* testsuite/gas/s12z/cmp-imm.d: New file.
	* testsuite/gas/s12z/cmp-imm.s: New file.
	* testsuite/gas/s12z/cmp-opr-inc.d: New file.
	* testsuite/gas/s12z/cmp-opr-inc.s: New file.
	* testsuite/gas/s12z/cmp-opr-rdirect.d: New file.
	* testsuite/gas/s12z/cmp-opr-rdirect.s: New file.
	* testsuite/gas/s12z/cmp-opr-reg.d: New file.
	* testsuite/gas/s12z/cmp-opr-reg.s: New file.
	* testsuite/gas/s12z/cmp-opr-rindirect.d: New file.
	* testsuite/gas/s12z/cmp-opr-rindirect.s: New file.
	* testsuite/gas/s12z/cmp-opr-sxe4.d: New file.
	* testsuite/gas/s12z/cmp-opr-sxe4.s: New file.
	* testsuite/gas/s12z/cmp-opr-xys.d: New file.
	* testsuite/gas/s12z/cmp-opr-xys.s: New file.
	* testsuite/gas/s12z/cmp-s-imm.d: New file.
	* testsuite/gas/s12z/cmp-s-imm.s: New file.
	* testsuite/gas/s12z/cmp-s-opr.d: New file.
	* testsuite/gas/s12z/cmp-s-opr.s: New file.
	* testsuite/gas/s12z/cmp-xy.d: New file.
	* testsuite/gas/s12z/cmp-xy.s: New file.
	* testsuite/gas/s12z/com-opr.d: New file.
	* testsuite/gas/s12z/com-opr.s: New file.
	* testsuite/gas/s12z/complex-shifts.d: New file.
	* testsuite/gas/s12z/complex-shifts.s: New file.
	* testsuite/gas/s12z/db-tb-cc-opr.d: New file.
	* testsuite/gas/s12z/db-tb-cc-opr.s: New file.
	* testsuite/gas/s12z/db-tb-cc-reg.d: New file.
	* testsuite/gas/s12z/db-tb-cc-reg.s: New file.
	* testsuite/gas/s12z/dbCC.d: New file.
	* testsuite/gas/s12z/dbCC.s: New file.
	* testsuite/gas/s12z/dec-opr.d: New file.
	* testsuite/gas/s12z/dec-opr.s: New file.
	* testsuite/gas/s12z/dec.d: New file.
	* testsuite/gas/s12z/dec.s: New file.
	* testsuite/gas/s12z/div.d: New file.
	* testsuite/gas/s12z/div.s: New file.
	* testsuite/gas/s12z/eor.d: New file.
	* testsuite/gas/s12z/eor.s: New file.
	* testsuite/gas/s12z/exg.d: New file.
	* testsuite/gas/s12z/exg.s: New file.
	* testsuite/gas/s12z/ext24-ld-xy.d: New file.
	* testsuite/gas/s12z/ext24-ld-xy.s: New file.
	* testsuite/gas/s12z/inc-opr.d: New file.
	* testsuite/gas/s12z/inc-opr.s: New file.
	* testsuite/gas/s12z/inc.d: New file.
	* testsuite/gas/s12z/inc.s: New file.
	* testsuite/gas/s12z/inh.d: New file.
	* testsuite/gas/s12z/inh.s: New file.
	* testsuite/gas/s12z/jmp.d: New file.
	* testsuite/gas/s12z/jmp.s: New file.
	* testsuite/gas/s12z/jsr.d: New file.
	* testsuite/gas/s12z/jsr.s: New file.
	* testsuite/gas/s12z/ld-imm-page2.d: New file.
	* testsuite/gas/s12z/ld-imm-page2.s: New file.
	* testsuite/gas/s12z/ld-imm.d: New file.
	* testsuite/gas/s12z/ld-imm.s: New file.
	* testsuite/gas/s12z/ld-immu18.d: New file.
	* testsuite/gas/s12z/ld-immu18.s: New file.
	* testsuite/gas/s12z/ld-large-direct.d: New file.
	* testsuite/gas/s12z/ld-large-direct.s: New file.
	* testsuite/gas/s12z/ld-opr.d: New file.
	* testsuite/gas/s12z/ld-opr.s: New file.
	* testsuite/gas/s12z/ld-s-opr.d: New file.
	* testsuite/gas/s12z/ld-s-opr.s: New file.
	* testsuite/gas/s12z/ld-small-direct.d: New file.
	* testsuite/gas/s12z/ld-small-direct.s: New file.
	* testsuite/gas/s12z/lea-immu18.d: New file.
	* testsuite/gas/s12z/lea-immu18.s: New file.
	* testsuite/gas/s12z/lea.d: New file.
	* testsuite/gas/s12z/lea.s: New file.
	* testsuite/gas/s12z/mac.d: New file.
	* testsuite/gas/s12z/mac.s: New file.
	* testsuite/gas/s12z/min-max.d: New file.
	* testsuite/gas/s12z/min-max.s: New file.
	* testsuite/gas/s12z/mod.d: New file.
	* testsuite/gas/s12z/mod.s: New file.
	* testsuite/gas/s12z/mov.d: New file.
	* testsuite/gas/s12z/mov.s: New file.
	* testsuite/gas/s12z/mul-imm.d: New file.
	* testsuite/gas/s12z/mul-imm.s: New file.
	* testsuite/gas/s12z/mul-opr-opr.d: New file.
	* testsuite/gas/s12z/mul-opr-opr.s: New file.
	* testsuite/gas/s12z/mul-opr.d: New file.
	* testsuite/gas/s12z/mul-opr.s: New file.
	* testsuite/gas/s12z/mul-reg.d: New file.
	* testsuite/gas/s12z/mul-reg.s: New file.
	* testsuite/gas/s12z/mul.d: New file.
	* testsuite/gas/s12z/mul.s: New file.
	* testsuite/gas/s12z/neg-opr.d: New file.
	* testsuite/gas/s12z/neg-opr.s: New file.
	* testsuite/gas/s12z/not-so-simple-shifts.d: New file.
	* testsuite/gas/s12z/not-so-simple-shifts.s: New file.
	* testsuite/gas/s12z/opr-18u.d: New file.
	* testsuite/gas/s12z/opr-18u.s: New file.
	* testsuite/gas/s12z/opr-expr.d: New file.
	* testsuite/gas/s12z/opr-expr.s: New file.
	* testsuite/gas/s12z/opr-ext-18.d: New file.
	* testsuite/gas/s12z/opr-ext-18.s: New file.
	* testsuite/gas/s12z/opr-idx-24-reg.d: New file.
	* testsuite/gas/s12z/opr-idx-24-reg.s: New file.
	* testsuite/gas/s12z/opr-idx3-reg.d: New file.
	* testsuite/gas/s12z/opr-idx3-reg.s: New file.
	* testsuite/gas/s12z/opr-idx3-xysp-24.d: New file.
	* testsuite/gas/s12z/opr-idx3-xysp-24.s: New file.
	* testsuite/gas/s12z/opr-indirect-expr.d: New file.
	* testsuite/gas/s12z/opr-indirect-expr.s: New file.
	* testsuite/gas/s12z/opr-symbol.d: New file.
	* testsuite/gas/s12z/opr-symbol.s: New file.
	* testsuite/gas/s12z/or-imm.d: New file.
	* testsuite/gas/s12z/or-imm.s: New file.
	* testsuite/gas/s12z/or-opr.d: New file.
	* testsuite/gas/s12z/or-opr.s: New file.
	* testsuite/gas/s12z/p2-mul.d: New file.
	* testsuite/gas/s12z/p2-mul.s: New file.
	* testsuite/gas/s12z/page2-inh.d: New file.
	* testsuite/gas/s12z/page2-inh.s: New file.
	* testsuite/gas/s12z/psh-pul.d: New file.
	* testsuite/gas/s12z/psh-pul.s: New file.
	* testsuite/gas/s12z/qmul.d: New file.
	* testsuite/gas/s12z/qmul.s: New file.
	* testsuite/gas/s12z/rotate.d: New file.
	* testsuite/gas/s12z/rotate.s: New file.
	* testsuite/gas/s12z/s12z.exp: New file.
	* testsuite/gas/s12z/sat.d: New file.
	* testsuite/gas/s12z/sat.s: New file.
	* testsuite/gas/s12z/sbc-imm.d: New file.
	* testsuite/gas/s12z/sbc-imm.s: New file.
	* testsuite/gas/s12z/sbc-opr.d: New file.
	* testsuite/gas/s12z/sbc-opr.s: New file.
	* testsuite/gas/s12z/shift.d: New file.
	* testsuite/gas/s12z/shift.s: New file.
	* testsuite/gas/s12z/simple-shift.d: New file.
	* testsuite/gas/s12z/simple-shift.s: New file.
	* testsuite/gas/s12z/single-ops.d: New file.
	* testsuite/gas/s12z/single-ops.s: New file.
	* testsuite/gas/s12z/specd6.d: New file.
	* testsuite/gas/s12z/specd6.s: New file.
	* testsuite/gas/s12z/st-large-direct.d: New file.
	* testsuite/gas/s12z/st-large-direct.s: New file.
	* testsuite/gas/s12z/st-opr.d: New file.
	* testsuite/gas/s12z/st-opr.s: New file.
	* testsuite/gas/s12z/st-s-opr.d: New file.
	* testsuite/gas/s12z/st-s-opr.s: New file.
	* testsuite/gas/s12z/st-small-direct.d: New file.
	* testsuite/gas/s12z/st-small-direct.s: New file.
	* testsuite/gas/s12z/st-xy.d: New file.
	* testsuite/gas/s12z/st-xy.s: New file.
	* testsuite/gas/s12z/sub-imm.d: New file.
	* testsuite/gas/s12z/sub-imm.s: New file.
	* testsuite/gas/s12z/sub-opr.d: New file.
	* testsuite/gas/s12z/sub-opr.s: New file.
	* testsuite/gas/s12z/tfr.d: New file.
	* testsuite/gas/s12z/tfr.s: New file.
	* testsuite/gas/s12z/trap.d: New file.
	* testsuite/gas/s12z/trap.s: New file.

binutils* readelf.c: Add support for s12z architecture.
	* testsuite/lib/binutils-common.exp (is_elf_format): Excluse s12z
	targets.
2018-05-18 15:26:18 +01:00
H.J. Lu 011b32fd42 x86: Don't set eh->local_ref to 1 for linker defined symbols
Since symbols created by HIDDEN and PROVIDE_HIDDEN assignments in
linker script may be marked as defined, but not hidden, we can't
set eh->local_ref to 1 in _bfd_x86_elf_link_symbol_references_local.

Also R_386_GOT32X should be handled as just like R_386_GOT32 when
relocating a section.  The input R_386_GOT32X relocations, which
can be relaxed, should have been converted to R_386_PC32, R_386_32
or R_386_GOTOFF.

bfd/

	PR ld/23189
	* elf32-i386.c (elf_i386_relocate_section): Handle R_386_GOT32X
	like R_386_GOT32.
	* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
	set eh->local_ref to 1 for linker defined symbols.

ld/

	PR ld/23189
	* testsuite/ld-i386/i386.exp: Run pr23189.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr23189.d: New file.
	* testsuite/ld-i386/pr23189.s: Likewise.
	* testsuite/ld-i386/pr23189.t: Likewise.
	* testsuite/ld-x86-64/pr23189.d: Likewise.
	* testsuite/ld-x86-64/pr23189.s: Likewise.
	* testsuite/ld-x86-64/pr23189.t: Likewise.
2018-05-18 06:43:34 -07:00
Alan Modra 4bba0fb1c6 PR23199, Invalid SHT_GROUP entry leads to group confusion
This patch prevents elf_next_in_group list pointer confusion when
SHT_GROUP sections specify other SHT_GROUP sections in their list of
group sections.

	PR 23199
	* elf.c (setup_group): Formatting.  Check that SHT_GROUP entries
	don't point at other SHT_GROUP sections.  Set shdr corresponding
	to invalid entry, to NULL rather than section 0.  Identify
	SHT_GROUP section index when reporting an error.  Cope with NULL
	shdr pointer.
2018-05-18 18:32:35 +09:30
Alan Modra 8722de9c41 ATTRIBUTE_HIDDEN for libbfd.h
* libbfd-in.h (ATTRIBUTE_HIDDEN): Define and use throughout.
	* configure.ac (HAVE_HIDDEN): Check compiler support for hidden
	visibility.
	* libbfd.h: Regenerate.
	* configure: Regenerate.
	* config.in: Regenerate.
2018-05-18 13:07:41 +09:30
Alan Modra 0b43954349 libbfd.h and libcoff.h include guards
* libbfd-in.h: Add include guard.
	* libcoff-in.h: Likewise.
	* doc/Makefile.am (libbfd.h, libcoff.h): Append another #endif.
	* doc/Makefile.in: Regenerate.
	* libbfd.h: Regenerate.
	* libcoff.h: Regenerate.
2018-05-18 13:07:21 +09:30
GDB Administrator 838c49a4f3 Automatic date update in version.in 2018-05-18 00:00:41 +00:00
GDB Administrator 1a87f0eedc Automatic date update in version.in 2018-05-17 00:00:42 +00:00
Maciej W. Rozycki 1624c9ca3f NDS32/BFD: Fix build error in `nds32_convert_32_to_16'
Fix:

cc1: warnings being treated as errors
.../bfd/elf32-nds32.c: In function 'nds32_convert_32_to_16':
.../bfd/elf32-nds32.c:6816: error: 'insn_type' may be used uninitialized in this function
make[4]: *** [elf32-nds32.lo] Error 1

seen with GCC 4.1.2 and 4.4.7.

	bfd/
	* elf32-nds32.c (nds32_convert_32_to_16): Preset `insn_type'.
2018-05-16 20:43:29 +01:00
Alan Modra 7cf7fcc83c PR22458, failure to choose a matching ELF target
https://sourceware.org/ml/binutils/2013-05/msg00271.html was supposed
to banish "file format is ambiguous" errors for ELF.  It didn't,
because the code supposedly detecting formats that implement
match_priority didn't work.  That was due to not placing all matching
targets into the vector of matching targets.  ELF objects should all
match the generic ELF target (priority 2), plus one or more machine
specific targets (priority 1), and perhaps a single machine specific
target with OS/ABI set (priority 0, best match).  So the armel object
in the testcase actually matches elf32-littlearm,
elf32-littlearm-symbian, and elf32-littlearm-vxworks (all priority 1),
and elf32-little (priority 2).  As the PR reported, elf32-little
wasn't seen as matching.  Fixing that part of the problem wasn't too
difficult but matching the generic ELF target as well as the ARM ELF
targets resulted in ARM testsuite failures.

These proved to be the annoying reordering of stubs that occurs from
time to time due to the stub names containing the section id.
Matching another target causes more sections to be created in
elf_object_p.  If section ids change, stub names change, which results
in different hashing and can therefore result in different hash table
traversal and stub creation order.  That particular problem is fixed
by resetting section_id to the initial state before attempting each
target match, and taking a snapshot of its value after a successful
match.

	PR 22458
	* format.c (struct bfd_preserve): Add section_id.
	(bfd_preserve_save, bfd_preserve_restore): Save and restore
	_bfd_section_id.
	(bfd_reinit): Set _bfd_section_id.
	(bfd_check_format_matches): Put all matches of any priority into
	matching_vector.  Save initial section id and start each attempted
	match at that section id.
	* libbfd-in.h (_bfd_section_id): Declare.
	* section.c (_bfd_section_id): Rename from section_id and make
	global.  Adjust uses.
	(bfd_get_next_section_id): Delete.
	* elf64-ppc.c (ppc64_elf_setup_section_lists): Replace use of
	bfd_get_section_id with _bfd_section_id.
	* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.
2018-05-16 21:42:58 +09:30
GDB Administrator 0255c1a349 Automatic date update in version.in 2018-05-16 00:00:40 +00:00
Christophe Guillon 810ed4db98 Fix uninitialised memory acccess in COFF bfd backend
2018-05-15  Christophe Guillon  <christophe.guillon@st.com>

	* coffcode.h (coff_bigobj_swap_aux_in): Make sure that all fields
	of the aux structure are initialised.

Change-Id: I81be255ac6611afbe00995fac550e98e6a07e5df
2018-05-15 12:33:42 +00:00
Francois H. Theron 1678bd35a3 Fix error messages in the NFP sources when building for 32-bit targets.
bfd	* targets.c: Wrap nfp_elf64_vec in BFD64 ifdef.

include	* opcode/nfp.h: Use uint64_t instead of bfd_vma.

opcodes	* nfp-dis.c: Use uint64_t for instruction variables, not bfd_vma.
2018-05-15 13:28:06 +01:00
Nick Clifton 293b4d4fe9 Add a new Portuguese translation for the bfd sub-directory.
* po/pt.po: New Portuguese translation.
	* configure.ac (ALL_LINGUAS): Add pt.
	* configure: Regenerate.
2018-05-15 13:16:16 +01:00
GDB Administrator ee7545fe36 Automatic date update in version.in 2018-05-15 00:00:27 +00:00
H.J. Lu 4ec0995016 x86; Allow IFUNC pointer defined in PDE
If IFUNC symbol is defined in position-dependent executable, we should
change it to the normal function and set its address to its PLT entry
which should be resolved by R_*_IRELATIVE at run-time.  All external
references should be resolved to its PLT in executable.

bfd/

	PR ld/23169
	* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Don't issue
	an error on IFUNC pointer defined in PDE.
	* elf32-i386.c (elf_i386_finish_dynamic_symbol): Call
	_bfd_x86_elf_link_fixup_ifunc_symbol.
	* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
	* elfxx-x86.c (_bfd_x86_elf_link_fixup_ifunc_symbol): New
	function.
	* elfxx-x86.h (_bfd_x86_elf_link_fixup_ifunc_symbol): New.

ld/

	PR ld/23169
	* testsuite/ld-ifunc/ifunc-9-i386.d: New file.
	* testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise.
	* testsuite/ld-ifunc/pr23169a.c: Likewise.
	* testsuite/ld-ifunc/pr23169a.rd: Likewise.
	* testsuite/ld-ifunc/pr23169b.c: Likewise.
	* testsuite/ld-ifunc/pr23169b.c: Likewise.
	* testsuite/ld-ifunc/pr23169c.rd: Likewise.
	* testsuite/ld-ifunc/pr23169c.rd: Likewise.
	* testsuite/ld-ifunc/ifunc-9-x86.d: Removed.
	* testsuite/ld-ifunc/ifunc.exp: Run PR ld/23169 tests.
2018-05-14 03:55:50 -07:00
H.J. Lu 9bc935ef33 x86: Mark __bss_start, _end and _edata locally defined
__bss_start, _end and _edata are defined by linker to mark regions
within executables and shared libraries.  All references within
executables should be locally resolved.

This patch doesn't change how their references within shared libraries
are resolved.

bfd/

	PR ld/23162
	* elfxx-x86.c (elf_x86_linker_defined): New function.
	(_bfd_x86_elf_link_check_relocs): Use it to mark __bss_start,
	_end and _edata locally defined within executables.

ld/

	PR ld/23162
	* testsuite/ld-elf/pr23162.map: New file.
	* testsuite/ld-elf/pr23162.rd: Likewise.
	* testsuite/ld-elf/pr23162a.c: Likewise.
	* testsuite/ld-elf/pr23162b.c: Likewise.
	* testsuite/ld-elf/shared.exp: Run PR ld/23162 tests.
2018-05-14 03:48:02 -07:00
GDB Administrator 85bd2d83f8 Automatic date update in version.in 2018-05-14 00:00:25 +00:00
GDB Administrator de7bbc27f9 Automatic date update in version.in 2018-05-13 00:01:08 +00:00
Alan Modra 9933dc5273 PR20659, Objcopy and change section lma failing
Sections may well belong in multiple segments.  The testcase in the PR
saw an allocated section being assigned to an ABIFLAGS segment, then
not being assigned to a LOAD segment because it had already been
handled.  To fix that particular problem this patch sets and tests
segment_mark only for LOAD segments.  I kept the segment_mark test for
LOAD segments because I think there may otherwise be a problem with
zero size sections.

A few other problems showed up with the testcase.  Some targets align
.dynamic, resulting in the test failing with "section .dynamic lma
0x800000c0 adjusted to 0x800000cc" and similar messages.  I've tried
to handle that with some more hacks to the segment lma, which do the
right thing for the testcase, but may well fail in other situations.

I've also removed the tests of segment lma (p_paddr) and code involved
in deciding that an adjusted segment no longer covers the file or
program headers.  Those test can't be correct in the face of objcopy
--change-section-lma.  It may be necessary to reinstate the tests but
do them modulo page size, but we'll see how this goes.

	PR 20659
bfd/
	* elf.c (rewrite_elf_program_header): Use segment_mark only for
	PT_LOAD headers.  Delete first_matching_lma and first_suggested_lma.
	Instead make matching_lma and suggested_lma pointers to the
	sections.  Align section vma and lma calculated from segment.
	Don't clear includes_phdrs or includes_filehdr based on p_paddr
	test.  Try to handle alignment padding before first section by
	adjusting new segment lma down.  Adjust PT_PHDR map p_paddr.
ld/
	* testsuite/ld-elf/changelma.d,
	* testsuite/ld-elf/changelma.lnk,
	* testsuite/ld-elf/changelma.s: New test.
2018-05-12 16:03:44 +09:30
GDB Administrator c64c5aae28 Automatic date update in version.in 2018-05-12 00:00:35 +00:00
GDB Administrator 702dff05e5 Automatic date update in version.in 2018-05-11 00:00:38 +00:00
GDB Administrator 6fe88226c2 Automatic date update in version.in 2018-05-10 00:00:38 +00:00
Dimitar Dimitrov 493ffac5aa Fix binary compatibility between GCC and the TI compiler for the PRU target.
My original implementation for LDI32 pseudo does not conform to
the TI ABI.  I wrongly documented my TI PRU ELF object files inspection,
which got propagated into my binutils implementation.

Issue was exposed when running the GCC ABI testsuite against TI toolchain.
According to TI ABI, LDI32 must use first LDI instruction to load
the MSB 16bits, and second LDI instruction for the LSB 16bits.

This patch will break binary compatibility with previously released
binutils versions for PRU. Still, I think it is better to fix
binutils to conform to the chip vendor ABI.

bfd	* elf32-pru.c (pru_elf32_do_ldi32_relocate): Make LDI32 relocation
	conformant to TI ABI.
	(pru_elf32_relax_section): Likewise.
	(pru_elf_relax_delete_bytes): Fix offsets for new LDI32 code.
	* elf32-pru.c (pru_elf32_do_ldi32_relocate): Ignore addend.
	(pru_elf32_pmem_relocate): Trap - should not get here.
	(pru_elf32_relocate_section): Add support for REL relocations.
	(elf_info_to_howto_rel): Enable REL.
	(elf_backend_may_use_rel_p): Likewise.
	(elf_backend_may_use_rela_p): Likewise.
	(elf_backend_default_use_rela_p): Likewise.

gas	* config/tc-pru.c (md_apply_fix): Make LDI32 relocation conformant
	to TI ABI.
	(pru_assemble_arg_i): Likewise.
	(output_insn_ldi32): Likewise.
	* testsuite/gas/pru/ldi.d: Update test for the now fixed LDI32.
	* gas/config/tc-pru.c (pru_assemble_arg_b): Check imm8 operand range.
	* gas/testsuite/gas/pru/illegal2.l: New test.
	* gas/testsuite/gas/pru/illegal2.s: New test.
	* gas/testsuite/gas/pru/pru.exp: Register new illegal2 test.

ld	* scripttempl/pru.sc: Add LD sections to allow linking TI
	toolchain object files.
	* scripttempl/pru.sc: Switch to init_array.
	* testsuite/ld-pru/ldi32.d: Update LDI32 test to conform to TI ABI.
	* testsuite/ld-pru/norelax_ldi32-data.d: Likewise.
	* testsuite/ld-pru/norelax_ldi32-dis.d: Likewise.
	* testsuite/ld-pru/relax_ldi32-data.d: Likewise.
	* testsuite/ld-pru/relax_ldi32-dis.d: Likewise.
2018-05-09 11:39:32 +01:00