Commit Graph

90915 Commits

Author SHA1 Message Date
Nick Clifton ce49701009 Fix seg-fault reading a corrupt ELF binary.
PR binutils/21640
	* elf.c (setup_group): Zero the group section pointer list after
	allocation so that loops can be caught.  Check for NULL pointers
	when processing a group list.
2017-06-21 10:36:58 +01:00
James Greenhalgh 1e29262747 Add support for the Cortex-A55 and Cortex-A75 versions of the AArch64 architecture.
* config/tc-aarch64.c (aarch64_cpus): Add cortex-a55 and cortex-a75.
	* doc/c-aarch64.texi (-mcpu): Document cortex-a55 and cortex-a75.
2017-06-21 09:13:25 +01:00
Sergio Durigan Junior eb83230b4d Fix PR gdb/21606: SYMBOL_FUNCTIONS_DOMAIN misspelled in documentation
Both Python and Guile documentations misspelled
SYMBOL_FUNCTIONS_DOMAIN, writing SYMBOL_FUNCTION_DOMAIN instead.  This
obvious commit fixes it.

gdb/doc/ChangeLog:
2017-06-20  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR gdb/21606
	* python.texi (Python representation of Symbols.): Replace
	SYMBOL_FUNCTION_DOMAIN by SYMBOL_FUNCTIONS_DOMAIN, fixing typo.
	* guile.texi (Guile representation of Symbols.): Likewise.
2017-06-20 21:31:59 -04:00
GDB Administrator eceb74ca64 Automatic date update in version.in 2017-06-21 00:00:36 +00:00
Eric Christopher 69431babfb 2017-06-20 Eric Christopher <echristo@gmail.com>
* aarch64.cc (scan_reloc_for_stub): Use plt_address_for_global to
        calculate the symbol value.
        (scan_reloc_section_for_stubs): Allow stubs to be created for
        section symbols.
        (maybe_apply_stub): Handle creating stubs for weak symbols to
        match the code in scan_reloc_for_stub.
2017-06-20 16:18:58 -07:00
Simon Marchi a206891ad1 gdbserver/Makefile.in: Sort IPA_OBJS
gdb/gdbserver/ChangeLog:

	* Makefile.in (IPA_OBJS): Sort and format one item per line.
2017-06-20 16:59:03 +02:00
Sergio Durigan Junior 96160d6051 Use '::iterator' instead of '::const_iterator' on environ.c (and fix breakage on early versions of libstdc++)
Even though C++11 supports modifying containers using a const_iterator
(e.g., calling the 'erase' method of a std::vector), early versions of
libstdc++ did not implement that.  Some of our buildslaves are using
these versions (e.g., the AArch64 buildslave uses gcc 4.8.8), and my
previous commit causes a breakage on them.  The solution is simple:
just use a normal iterator, without const.

gdb/ChangeLog:
2017-06-20  Sergio Durigan Junior  <sergiodj@redhat.com>

	* common/environ.c (gdb_environ::unset): Use '::iterator' instead
	of '::const_iterator'.
2017-06-20 09:33:53 -04:00
Sergio Durigan Junior 9a6c7d9c02 C++ify gdb/common/environ.c
As part of the preparation necessary for my upcoming task, I'd like to
propose that we turn gdb_environ into a class.  The approach taken
here is simple: the class gdb_environ contains everything that is
needed to manipulate the environment variables.  These variables are
stored in an std::vector<char *>, which can be converted to a 'char
**' and passed as argument to functions that need it.

The usage has not changed much.  As per Pedro's suggestion, this class
uses a static factory method initialization.  This means that when an
instance is created, it is initially empty.  When needed, it has to be
initialized using the static method 'from_host_environ'.

As mentioned before, this is a preparation for an upcoming work that I
will be posting in the next few weeks or so.  For that work, I'll
probably create another data structure that will contain all the
environment variables that were set by the user using the 'set
environment' command, because I'll need access to them.  This will be
much easier with the class-ification of gdb_environ.

As noted, this has been regression-tested with the new version of
environ.exp and no regressions were found.

gdb/ChangeLog:
2017-06-20  Sergio Durigan Junior  <sergiodj@redhat.com>

	* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
	'unittests/environ-selftests.c'.
	(SUBDIR_UNITTESTS_OBS): Add 'environ-selftests.o'.
	* charset.c (find_charset_names): Declare object 'iconv_env'.
	Update code to use 'iconv_env' object.  Remove call to
	'free_environ'.
	* common/environ.c: Include <utility>.
	(make_environ): Delete function.
	(free_environ): Delete function.
	(gdb_environ::clear): New function.
	(gdb_environ::operator=): New function.
	(gdb_environ::get): Likewise.
	(environ_vector): Delete function.
	(set_in_environ): Delete function.
	(gdb_environ::set): New function.
	(unset_in_environ): Delete function.
	(gdb_environ::unset): New function.
	(gdb_environ::envp): Likewise.
	* common/environ.h: Include <vector>.
	(struct gdb_environ): Delete; transform into...
	(class gdb_environ): ... this class.
	(free_environ): Delete prototype.
	(init_environ, get_in_environ, set_in_environ, unset_in_environ,
	environ_vector): Likewise.
	* infcmd.c (run_command_1): Update code to call
	'envp' from 'gdb_environ' class.
	(environment_info): Update code to call methods from 'gdb_environ'
	class.
	(unset_environment_command): Likewise.
	(path_info): Likewise.
	(path_command): Likewise.
	* inferior.c (inferior::~inferior): Delete call to 'free_environ'.
	(inferior::inferior): Initialize 'environment' using the host's
	information.
	* inferior.h: Remove forward declaration of 'struct gdb_environ'.
	Include "environ.h".
	(class inferior) <environment>: Change type from 'struct
	gdb_environ' to 'gdb_environ'.
	* mi/mi-cmd-env.c (mi_cmd_env_path): Update code to call
	methods from 'gdb_environ' class.
	* solib.c (solib_find_1): Likewise
	* unittests/environ-selftests.c: New file.

gdb/gdbserver/ChangeLog:
2017-06-20  Sergio Durigan Junior  <sergiodj@redhat.com>

	* linux-low.c (linux_create_inferior): Adjust code to access the
	environment information via 'gdb_environ' class.
	* lynx-low.c (lynx_create_inferior): Likewise.
	* server.c (our_environ): Make it an instance of 'gdb_environ'.
	(get_environ): Return a pointer to 'our_environ'.
	(captured_main): Initialize 'our_environ'.
	* server.h (get_environ): Adjust prototype.
	* spu-low.c (spu_create_inferior): Adjust code to access the
	environment information via 'gdb_environ' class.
2017-06-20 08:59:27 -04:00
Yao Qi 75c554cf9c Adjust the order of 32bit-linux.xml and 32bit-sse.xml in i386/i386-linux.xml
Exchange the order of 32bit-linux.xml and 32bit-sse.xml in
i386/i386-linux.xml, to align with other i386 linux .xml files.

gdb:

2017-06-20  Yao Qi  <yao.qi@linaro.org>

	* features/i386/i386-linux.xml: Exchange the order of including
	32bit-linux.xml and 32bit-sse.xml.
	* features/i386/i386-linux.c: Regenerated.
2017-06-20 12:08:33 +01:00
Yao Qi 72ddacb77e Class-fy tdesc_reg tdesc_type and tdesc_feature
This patch class-fies them, adding ctor, dtor, and deleting
copy ctor and assignment operator.

gdb:

2017-06-20  Yao Qi  <yao.qi@linaro.org>

	* target-descriptions.c (tdesc_reg): Add ctor, dtor.
	Delete copy ctor and assignment operator.
	(tdesc_type): Likewise.
	(tdesc_feature): Likewise.
	(tdesc_free_reg): Remove.
	(tdesc_create_reg): Use new.
	(tdesc_free_type): Remove.
	(tdesc_create_vector): Use new.
	(tdesc_create_union): Likewise.
	(tdesc_create_flags): Likewise.
	(tdesc_create_enum): Likewise.
	(tdesc_free_feature): Delete.
	(free_target_description): Use delete.
2017-06-20 11:29:17 +01:00
James Clarke 94de2a2c57 [GOLD] Avoid duplicate PLT stub symbols on ppc32
If two objects are compiled with -fPIC or -fPIE and call the same
function, two different PLT entries are created, one for each object,
but the same stub symbol name is used for both.

	* powerpc.cc (Stub_table::define_stub_syms): Always include object's
	uniq_ value.
2017-06-20 18:01:52 +09:30
H.J. Lu abfa390dac Check the DYNAMIC bit for input shared objects
Since the BFD section count may not be cleared for shared objects during
linking, we should check the DYNAMIC bit for input shared objects.

bfd/

	PR ld/21626
	* elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check
	the DYNAMIC bit instead of bfd_count_sections.

ld/

	PR ld/21626
	* testsuite/ld-i386/i386.exp: Run ld/21626 tests.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
2017-06-19 20:30:20 -07:00
GDB Administrator a6cab9afd2 Automatic date update in version.in 2017-06-20 00:00:38 +00:00
John Baldwin 325c9fd4aa Don't throw an error in 'info registers' for unavailable MIPS registers.
'info registers' for MIPS throws an error and when it first encounters
an unavailable register.  This does not match other architectures
which annotate unavailable registers and continue to print out the
values of subsequent registers.  Replace the error by displaying an
aligned "<unavailable>".  This string is truncated to "<unavl>" when
displaying a 32-bit register.

gdb/ChangeLog:

	* mips-tdep.c (print_gp_register_row): Don't error for unavailable
	registers.
2017-06-19 14:40:22 -07:00
Peter Bergner 66953522c9 Update GDB test case for new lnia extended mnemonic.
When I added the new lnia extended mnemonic for addpcis, I updated the
assembler/disassembler test cases, but overlooked the GDB test cases.
This patch fixes that oversight and associated test case failure.

	* gdb.arch/powerpc-power9.exp: Update test case for new lnia
	extended mnemonic.
	* gdb.arch/powerpc-power9.s: Likewise.
2017-06-19 13:04:13 -05:00
Nick Clifton d16fdddb4e Fix address violation when attempting to display disassembled data.
PR binutils/21619
	* objdump.c (disassemble_bytes): Check that there is sufficient
	data available before attempting to display it.
2017-06-19 15:57:19 +01:00
Nick Clifton bc21b167eb Fix address violations when reading corrupt VMS records.
PR binutils/21618
	* vms-alpha.c (evax_bfd_print_emh): Check for insufficient record
	length.
	(evax_bfd_print_eeom): Likewise.
	(evax_bfd_print_egsd): Check for an overlarge record length.
	(evax_bfd_print_etir): Likewise.
2017-06-19 14:52:36 +01:00
Nick Clifton 0f6d864de2 Prevent address violation when attempting to disassemble a corrupt score binary.
PR binutils/21614
	* score-dis.c (score_opcodes): Add sentinel.
2017-06-19 14:15:57 +01:00
Nick Clifton acb56a8301 Fix access violation when parsing a corrupt IEEE binary.
PR binutils/21612
	* libieee.h (struct common_header_type): Add end_p field.
	* ieee.c (this_byte_and_next): Do not advance input_p beyond
	end_p.
	(read_id): Check for a length that exceeds the remaining bytes in
	the input buffer.
	(ieee_seek): Initialise end_p.
	(ieee_archive_p): Likewise.
	(ieee_object_p): Likewise.
2017-06-19 14:06:53 +01:00
Nick Clifton 80053e466b Fix access violation disassembling a corrupt VMS binary.
PR binutils/21611
	* vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset
	before reading the EIHS structure entries.
2017-06-19 13:01:57 +01:00
Pedro Alves 16b7a71998 .gdb_index writer: close the file before unlinking it
We should close the file before unlinking because on MS-Windows one
cannot delete a file that is still open.

I considered making 'gdb::unlinker::unlinker(const char *)'
'noexcept(true)' and then adding
  static_assert (noexcept (gdb::unlinker (filename.c_str ())), "");

but that doesn't really work because gdb::unlinker has a gdb_assert,
which can throw a QUIT if/when the assertion fails.  'noexcept(true)'
would cause GDB to abruptly terminate if/when the assertion fails.

gdb/ChangeLog:
2017-06-19  Pedro Alves  <palves@redhat.com>

	* dwarf2read.c (write_psymtabs_to_index): Construct file_closer
	after gdb::unlinker.
2017-06-19 12:46:47 +01:00
Nick Clifton 72e84f9694 Fix access violation when disassembling a corrupt VMS binary.
PR 21615
	* vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for
	gsd_size.  Check that there are enough bytes remaining to read the
	type and size of the next egsd.  Check that the size of the egsd
	does not exceed the size of the record.
2017-06-19 12:31:07 +01:00
Alan Modra 875ffa3edc Correct target_underscore for cris
* config.bfd: Correct targ_underscore for cris.
2017-06-19 16:05:09 +09:30
Sergio Durigan Junior 1c8e01c960 Use getenv instead of gdb_environ on mi-cmd-env.c
This is a spinoff of
<https://sourceware.org/ml/gdb-patches/2017-06/msg00437.html>.
mi-cmd-env.c is using the whole gdb_environ machinery in order to
access just one variable, which can be easily replaced by a simple
call to getenv.  This patch does that, and doesn't cause regressions.

gdb/ChangeLog:
2017-06-18  Sergio Durigan Junior  <sergiodj@redhat.com>

	* mi/mi-cm-env.c (_initialize_mi_cmd_env): Use getenv instead of
	gdb_environ to access an environment variable.
2017-06-19 00:14:00 -04:00
GDB Administrator 65ce7763df Automatic date update in version.in 2017-06-19 00:00:23 +00:00
Thomas Petazzoni ffce45d224 nat/linux-ptrace.c: add missing gdb_byte* cast
On noMMU platforms, the following code gets compiled:

  child_stack = xmalloc (STACK_SIZE * 4);

Where child_stack is a gdb_byte*, and xmalloc() returns a void*. While
the lack of cast is valid in C, it is not in C++, causing the
following build failure:

../nat/linux-ptrace.c: In function 'int linux_fork_to_function(gdb_byte*, int (*)(void*))':
../nat/linux-ptrace.c:273:29: error: invalid conversion from 'void*' to 'gdb_byte* {aka unsigned char*}' [-fpermissive]
       child_stack = xmalloc (STACK_SIZE * 4);

Therefore, this commit adds the appropriate cast.

gdb/ChangeLog:

	* nat/linux-ptrace.c (linux_fork_to_function): Add cast to
	gdb_byte*.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-06-18 23:29:03 +02:00
Alan Modra bdd32e03c5 is_underscore_target for ld-elf tests
and correct targ_underscore in config.bfd

bfd/
	* config.bfd: Correct targ_underscore for epiphany, ip2k,
	m32c, mn10200, pru, rl78, rx, crisv32 and v850.
ld/
	* testsuite/lib/ld-lib.exp (is_underscore_target): New.
	* testsuite/ld-elf/elf.exp (ASFLAGS): Define UNDERSCORE.
	* testsuite/ld-elf/pr21562a.s: If UNDERSCORE defined,
	reference sym with prefix.
	* testsuite/ld-elf/pr21562b.s: Likewise.
	* testsuite/ld-elf/sizeof.s: Likewise.
	* testsuite/ld-elf/startof.s: Likewise.
	* testsuite/ld-elf/pr14156a.d: Adjust for extra symbols.
	* testsuite/ld-elf/pr21562a.d: Remove underscore target from
	xfails, and match prefixed symbol.
	* testsuite/ld-elf/pr21562b.d: Likewise.
	* testsuite/ld-elf/pr21562c.d: Likewise.
	* testsuite/ld-elf/pr21562d.d: Likewise.
	* testsuite/ld-elf/pr21562e.d: Likewise.
	* testsuite/ld-elf/pr21562f.d: Likewise.
	* testsuite/ld-elf/pr21562g.d: Likewise.
	* testsuite/ld-elf/pr21562h.d: Likewise.
	* testsuite/ld-elf/pr21562i.d: Likewise.
	* testsuite/ld-elf/pr21562j.d: Likewise.
	* testsuite/ld-elf/pr21562k.d: Likewise.
	* testsuite/ld-elf/pr21562l.d: Likewise.
	* testsuite/ld-elf/pr21562m.d: Likewise.
	* testsuite/ld-elf/pr21562n.d: Likewise.
	* testsuite/ld-elf/sizeofa.d: Likewise.
	* testsuite/ld-elf/sizeofb.d: Likewise.
	* testsuite/ld-elf/sizeofc.d: Likewise.
	* testsuite/ld-elf/startofa.d: Likewise.
	* testsuite/ld-elf/startofb.d: Likewise.
	* testsuite/ld-elf/startofc.d: Likewise.
2017-06-18 11:56:19 +09:30
GDB Administrator 99149362b1 Automatic date update in version.in 2017-06-18 00:00:37 +00:00
Simon Marchi 1d4fbac99e Add ATTRIBUTE_PRINTF to trace_start_error
clang complains that the fmt passed to vwarning in trace_start_error is
not a literal.  This looks like a fair warning, which can be removed by
adding ATTRIBUTE_PRINTF to the declaration of trace_start_error.

gdb/ChangeLog:

	* nat/fork-inferior.h (trace_start_error): Add ATTRIBUTE_PRINTF.
2017-06-17 23:19:25 +02:00
Simon Marchi ae3e2ccfe7 linux-low: Remove usage of "register" keyword
AFAIK, the register keyword is not relevant today, and clang complains
about it:

/home/emaisin/src/binutils-gdb/gdb/gdbserver/linux-low.c:5873:3: error: 'register' storage class specifier is deprecated and incompatible with C++1z
      [-Werror,-Wdeprecated-register]
  register PTRACE_XFER_TYPE *buffer;
  ^~~~~~~~~

I think we can safely remove it.

gdb/gdbserver/ChangeLog:

	* linux-low.c (linux_read_memory, linux_write_memory): Remove
	usage of "register" keyword.
2017-06-17 23:19:09 +02:00
Simon Marchi 8465943af6 gdb: Add -Wno-mismatched-tags
clang complains that for some types, we use both the class and struct
keywords in different places.  It's not really a problem, so I think we
can safely turn this warning off.

gdb/ChangeLog:

	* configure: Re-generate.
	* warning.m4 (build_warnings): Add -Wno-mismatched-tags.

gdb/gdbserver/ChangeLog:

	* configure: Re-generate.
2017-06-17 23:18:49 +02:00
Simon Marchi 3e019bdc20 gdb: Use -Werror when checking for (un)supported warning flags
In warning.m4, we pass all the warning flags one by one to the compiler
to test if they are supported by this particular compiler.  If the
compiler exits with an error, we conclude that this warning flag is not
supported and exclude it.  This allows us to use warning flags without
having to worry about which versions of which compilers support each
flag.

clang, by default, only emits a warning if an unknown flag is passed:

  warning: unknown warning option '-Wfoo' [-Wunknown-warning-option]

The result is that we think that all the warning flags we use are
supported by clang (they are not), and the compilation fails later when
building with -Werror, since the aforementioned warning becomes an
error.  The fix is to also pass -Werror when probing for supported
flags, then we'll correctly get an error when using an unknown warning,
and we'll exclude it:

  error: unknown warning option '-Wfoo' [-Werror,-Wunknown-warning-option]

I am not sure why there is a change in a random comment in
gdbserver/configure, but I suppose it's a leftfover from a previous
patch, so I included it.

gdb/ChangeLog:

	* configure: Re-generate.
	* warning.m4: Pass -Werror to compiler when checking for
	supported warning flags.

gdb/gdbserver/ChangeLog:

	* configure: Re-generate.
2017-06-17 23:18:20 +02:00
Simon Marchi cf0dd6f02c gdb: Pass -x c++ to the compiler
Because we are compiling .c files containing C++ code, clang++ complains
with:

  clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated

If renaming all the source files to .cpp is out of the question, an
alternative is to pass "-x c++" to convince the compiler that we are
really compiling C++.  It works fine with GCC too.

gdb/ChangeLog:

	* Makefile.in (COMPILE.pre): Add "-x c++".

gdb/gdbserver/ChangeLog:

	* Makefile.in (COMPILE.pre): Add "-x c++".
2017-06-17 23:17:00 +02:00
GDB Administrator 291e629539 Automatic date update in version.in 2017-06-17 00:00:41 +00:00
Yao Qi 6f98355cda extract/store integer function template
This patch converts functions extract_{unsigned,signed}_integer
to a function template extract_integer, which has two instantiations.  It
also does the similar changes to store__{unsigned,signed}_integer,
regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed},
regcache::cooked_read_{unsigned,signed},
regcache::cooked_write_{unsigned,signed}.

This patch was posted here
https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the
problem was fixed in a different way.  However, I think the patch is still
useful to shorten the code.

gdb:

2017-06-16  Alan Hayward  <alan.hayward@arm.com>
	    Pedro Alves  <palves@redhat.com>
	    Yao Qi  <yao.qi@linaro.org>

	* defs.h (RequireLongest): New.
	(extract_integer): Declare function template.
	(extract_signed_integer): Remove the declaration, but define it
	static inline.
	(extract_unsigned_integer): Likewise.
	(store_integer): Declare function template.
	(store_signed_integer): Remove the declaration, but define it
	static inline.
	(store_unsigned_integer): Likewise.
	* findvar.c (extract_integer): New function template.
	(extract_signed_integer): Remove.
	(extract_unsigned_integer): Remove.
	(extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit
	instantiations.
	(store_integer): New function template.
	(store_signed_integer): Remove.
	(store_unsigned_integer): Remove.
	(store_integer): Explicit instantiations.
	* regcache.c (regcache_raw_read_signed): Update.
	(regcache::raw_read): New function.
	(regcache::raw_read_signed): Remove.
	(regcache::raw_read_unsigned): Remove.
	(regcache_raw_read_unsigned): Update.
	(regcache_raw_write_unsigned): Update.
	(regcache::raw_write_signed): Remove.
	(regcache::raw_write): New function.
	(regcache_cooked_read_signed): Update.
	(regcache::raw_write_unsigned): Remove.
	(regcache::cooked_read_signed): Remove.
	(regcache_cooked_read_unsigned): Update.
	(regcache::cooked_read_unsigned): Remove.
	(regcache_cooked_write_signed): Update.
	(regcache_cooked_write_unsigned): Update.
	* regcache.h (regcache) <raw_read_signed>: Remove.
	<raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove.
	<raw_read, raw_write>: New.
	<cooked_read_signed, cooked_write_signed>: Remove.
	<cooked_write_unsigned, cooked_read_unsigned>: Remove.
	<cooked_read, cooked_write>: New.
	* sh64-tdep.c (sh64_pseudo_register_read): Update.
	(sh64_pseudo_register_write): Update.
2017-06-16 15:38:42 +01:00
Alan Modra e197589b72 Regen rx-decode.c
opcodes/
	* rx-decode.c: Regenerate.
2017-06-17 00:03:02 +09:30
Nick Clifton 4b48e2f6a5 Fixing linking configure generated tests of ifunc support.
* elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the
	bucketlist is empty because there are no symbols to add to the
	list.
2017-06-16 15:16:19 +01:00
Alan Modra 7dba9362c1 Rewrite __start and __stop symbol handling
This arranges for __start and __stop symbols to be defined before
garbage collection, for all target formats.  That should allow the
COFF and PE --gc-sections to keep a singleton orphan input section,
a feature lost by 2017-06-13 commit cbd0eecf26.  The fancier ELF
treatment of keeping all input sections associated with a __start or
__stop symbol, from 2015-10-23 commit 1cce69b9dc, is retained.

.startof. and .sizeof. symbols are deliberately not defined before
garbage collection, so these won't affect garbage collection of
sections.

The patch also ensures __start, __stop, .startof. and .sizeof. symbols
are defined before target size_dynamic_sections is called, albeit
with a preliminary value, so that target code doesn't need to cope
with a symbol changing from undefined at size_dynamic_sections to
defined at relocate_section.

Also, a number of problems with the testcases have been fixed.

	PR ld/20022
	PR ld/21557
	PR ld/21562
	PR ld/21571
include/
	* bfdlink.h (struct bfd_link_hash_entry): Delete undef.section.
bfd/
	* targets.c (struct bfd_target): Add _bfd_define_start_stop.
	(BFD_JUMP_TABLE_LINK): Likewise.
	* elf-bfd.h (bfd_elf_define_start_stop): Declare.
	* elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
	(bfd_elf_define_start_stop): New function.
	* linker.c (bfd_generic_define_start_stop): New function.
	* coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
	new field.
	* aout-adobe.c (aout_32_bfd_define_start_stop): Define.
	* aout-target.h (MY_bfd_define_start_stop): Define.
	* aout-tic30.c (MY_bfd_define_start_stop): Define.
	* binary.c (binary_bfd_define_start_stop): Define.
	* bout.c (b_out_bfd_define_start_stop): Define.
	* coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
	* coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
	* coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
	* coffcode.h (coff_bfd_define_start_stop): Define.
	* elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
	* i386msdos.c (msdos_bfd_define_start_stop): Define.
	* i386os9k.c (os9k_bfd_define_start_stop): Define.
	* ieee.c (ieee_bfd_define_start_stop): Define.
	* ihex.c (ihex_bfd_define_start_stop): Define.
	* libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
	* mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
	* mmo.c (mmo_bfd_define_start_stop): Define.
	* nlm-target.h (nlm_bfd_define_start_stop): Define.
	* oasys.c (oasys_bfd_define_start_stop): Define.
	* pef.c (bfd_pef_bfd_define_start_stop): Define.
	* plugin.c (bfd_plugin_bfd_define_start_stop): Define.
	* ppcboot.c (ppcboot_bfd_define_start_stop): Define.
	* som.c (som_bfd_define_start_stop): Define.
	* srec.c (srec_bfd_define_start_stop): Define.
	* tekhex.c (tekhex_bfd_define_start_stop): Define.
	* versados.c (versados_bfd_define_start_stop): Define.
	* vms-alpha.c (vms_bfd_define_start_stop): Define.
	(alpha_vms_bfd_define_start_stop): Define.
	* xsym.c (bfd_sym_bfd_define_start_stop): Define.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
ld/
	* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Don't set
	__start/__stop syms here.
	* ldlang.c (lang_set_startof): Delete.
	(start_stop_syms, start_stop_count, start_stop_alloc): New vars.
	(lang_define_start_stop, lang_init_start_stop, foreach_start_stop,
	undef_start_stop, lang_undef_start_stop, lang_init_startof_sizeof,
	set_start_stop, lang_finalize_start_stop): New functions.
	(lang_process): Call _start_stop functions.
	* testsuite/ld-elf/pr21562a.d: Use xfail rather than notarget.
	Correct typos and list of xfail targets.
	* testsuite/ld-elf/pr21562b.d: Likewise.
	* testsuite/ld-elf/pr21562c.d: Likewise.
	* testsuite/ld-elf/pr21562d.d: Likewise.
	* testsuite/ld-elf/pr21562e.d: Likewise.
	* testsuite/ld-elf/pr21562f.d: Likewise.
	* testsuite/ld-elf/pr21562g.d: Likewise.
	* testsuite/ld-elf/pr21562h.d: Likewise.
	* testsuite/ld-elf/pr21562i.d: Likewise.
	* testsuite/ld-elf/pr21562j.d: Likewise.
	* testsuite/ld-elf/pr21562k.d: Likewise.
	* testsuite/ld-elf/pr21562l.d: Likewise.
	* testsuite/ld-elf/pr21562m.d: Likewise.
	* testsuite/ld-elf/pr21562n.d: Likewise.
	* testsuite/ld-elf/sizeofa.d: Likewise.  Adjust to pass for generic ELF.
	* testsuite/ld-elf/sizeofb.d: Likewise.
	* testsuite/ld-elf/startofa.d: Likewise.
	* testsuite/ld-elf/startofb.d: Likewise.
2017-06-16 23:38:28 +09:30
Jiong Wang d68f19767d [AArch64] Use SYMBOL_REFERENCES_LOCAL in one symbol check
For some pc-relative relocations we want to allow them under PIC mode while
a normal global symbol defined in the same dynamic object can still bind
externally through copy relocation.  So, we should not allow pc-relative
relocation against such symbol.

SYMBOL_REFERENCES_LOCAL should be used and is more accurate than the original
individual checks.

bfd/
	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
	SYMBOL_REFERENCES_LOCAL.
ld/
	* testsuite/ld-aarch64/aarch64-elf.exp: Update test name
	* testsuite/ld-aarch64/pcrel.s: Add new testcases.
	* testsuite/ld-aarch64/pcrel_pic_undefined.d: Update the expected
	warnings.
	* testsuite/ld-aarch64/pcrel_pic_defined_local.d: Rename ...
	* testsuite/ld-aarch64/pcrel_pic_defined.d: ... to this.
	Update expected warnings.
2017-06-16 14:20:38 +01:00
Anton Kolesov a87dc45adc arc: Select CPU model properly before disassembling
Enforce CPU model for disassembler via its options, if it was specified in XML
target description, otherwise use default method of determining CPU implemented
in disassembler - scanning ELF private header.  The latter requires
disassemble_info->section to be properly initialized.  To make sure that
info->section is set in all cases this patch partially reverts [1] for ARC: it
reinstates arc_delayed_print_insn as a "print_insn" function for ARC, but
now this function only sets disassemble_info->section and then calls
default_print_insn to do the rest of the job.

Support for CPU in disassembler options for ARC has been added in [2].

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=39503f82427e22ed8e04d986ccdc8562091ec62e
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=10045478d984f9924cb945423388ba25b7dd3ffe

gdb/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

	* arc-tdep.c (arc_disassembler_options): New variable.
	(arc_gdbarch_init): Set and use it. Use arc_delayed_print_insn instead
	of default_print_insn.
	(arc_delayed_print_insn): Set info->section when needed,
	use default_print_insn to retrieve a disassembler.
2017-06-16 14:54:17 +03:00
Eric Christopher c092b67bf0 2017-06-15 Eric Christopher <echristo@gmail.com>
* aarch64.cc: Fix a few	typos and grammar-os.
2017-06-15 18:49:41 -07:00
GDB Administrator 00fd923b24 Automatic date update in version.in 2017-06-16 00:00:27 +00:00
H.J. Lu 75e06f9753 Correct "ld --help" to display "-z stack-size=SIZE"
ELF Linker command line option to set stack size is "-z stack-size=SIZE",
not "-z stacksize=SIZE".

	* exsup.c (elf_shlib_list_options): Display "-z stack-size=SIZE"
	instead of "-z stacksize=SIZE".
2017-06-15 12:30:53 -07:00
Jiong Wang 6353d82b8f [AArch64] Allow COPY relocation elimination
As discussed at the PR, this patch tries to avoid COPY relocation generation
and propagate the original relocation into runtime if it was relocating on
writable section.  The ELIMINATE_COPY_RELOCS has been set to true and it's
underlying infrastructure has been improved so that the COPY reloc elimination
at least working on absoluate relocations (ABS64) on AArch64.

  BFD linker copy relocation elimination framwork requires the backend to always
allocate dynrelocs for all those relocation types that are possible to introduce
copy relocations.  This is for adjust_dynamic_symbol hook to be able to get all
symbol reference information.  Should one symbol is referenced by more than one
relocations, if there is any of them needs copy relocation then linker should
generate it.

bfd/
	PR ld/21532
	* elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
	(elfNN_aarch64_final_link_relocate): Also propagate relocations to
	runtime for if there needs copy relocation elimination.
	(need_copy_relocation_p): New function.  Return true for symbol with
	pc-relative references and if it's against read-only sections.
	(elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p.
	(elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types
	that are related with accessing external objects.
	(elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change
	in elfNN_aarch64_check_relocs.

ld/
	* testsuite/ld-aarch64/copy-reloc-exe-2.s: New test source file.
	* testsuite/ld-aarch64/copy-reloc-2.d: New test.
	* testsuite/ld-aarch64/copy-reloc-exe-eliminate.s: New test source file.
	* testsuite/ld-aarch64/copy-reloc-eliminate.d: New test.
	* testsuite/ld-aarch64/copy-reloc-so.s: Define new global objects.
	* testsuite/ld-aarch64/aarch64-elf.exp: Run new tests.
2017-06-15 17:04:04 +01:00
H.J. Lu 8cac017d35 i386-dis: Add 2 tests with invalid bnd register
PR binutils/21594
	* testsuite/gas/i386/mpx.s: Add 2 tests with invalid bnd
	register.
	* testsuite/gas/i386/x86-64-mpx.s: Likewise.
	* testsuite/gas/i386/mpx.d: Updated.
	* testsuite/gas/i386/x86-64-mpx.d: Likewise.
2017-06-15 08:21:48 -07:00
H.J. Lu 0d96e4df48 i386-dis: Check valid bnd register
Since there are only 4 bnd registers, return "(bad)" for register
number > 3.

	PR binutils/21594
	* i386-dis.c (OP_E_register): Check valid bnd register.
	(OP_G): Likewise.
2017-06-15 06:40:17 -07:00
Nick Clifton cd3ea7c69a Prevent address violation problem when disassembling corrupt aarch64 binary.
PR binutils/21595
	* aarch64-dis.c (aarch64_ext_ldst_reglist): Check for an out of
	range value.
2017-06-15 13:26:54 +01:00
Nick Clifton 62b76e4b6e Fix address violation parsing a corrupt ieee binary.
PR binutils/21581
	(ieee_archive_p): Use a static buffer to avoid compiler bugs.
2017-06-15 13:08:47 +01:00
Nick Clifton 63634bb4a1 Avoid a possible compiler bug by using a static buffer instead of a stack local buffer.
PR binutils/21582
	* ieee.c (ieee_object_p): Use a static buffer to avoid compiler
	bugs.
2017-06-15 12:44:23 +01:00
Nick Clifton 63323b5b23 Fix address violation when disassembling a corrupt RL78 binary.
PR binutils/21588
	* rl78-decode.opc (OP_BUF_LEN): Define.
	(GETBYTE): Check for the index exceeding OP_BUF_LEN.
	(rl78_decode_opcode): Use OP_BUF_LEN as the length of the op_buf
	array.
	* rl78-decode.c: Regenerate.
2017-06-15 12:37:01 +01:00