Commit Graph

83785 Commits

Author SHA1 Message Date
Nick Clifton de13ef81f0 Fix compile time warning messages about variables being used before they are initialised.
PR 18313
bin	* ieee.c (ieee_read_cxx_class): Initialise the varargs variable.
	* readelf.c (uncompress_section_contents): Zero initialise the
	zstream structure.

bfd	* compress.c (decompress_contents): Zero initialse the z_stream
	structure.
2015-04-24 17:13:22 +01:00
Richard Earnshaw 7a5c933c7c [ARM]: Don't tail-pad over-aligned functions to the alignment boundary.
2015-04/24  Richard Earnshaw  <rearnsha@arm.com>

	gas/
	* config/tc-arm.h (arm_min): New function.
	(SUB_SEGMENT_ALIGN): Define.

	gas/testsuite/
	* gas/arm/align64.d: Delete trailing padding NOPs.

	ld/testsuite/
	* ld-arm/armthumb-lib.d: Regenerate expected output.
	* ld-arm/armthumb-lib.d: Likewise.
	* ld-arm/armthumb-lib.sym: Likewise.
	* ld-arm/cortex-a8-fix-b-rel-arm.d: Likewise.
	* ld-arm/cortex-a8-fix-b-rel-thumb.d: Likewise.
	* ld-arm/cortex-a8-fix-b.d: Likewise.
	* ld-arm/cortex-a8-fix-bcc-rel-thumb.d: Likewise.
	* ld-arm/cortex-a8-fix-bcc.d: Likewise.
	* ld-arm/cortex-a8-fix-bl-rel-arm.d: Likewise.
	* ld-arm/cortex-a8-fix-bl-rel-plt.d: Likewise.
	* ld-arm/cortex-a8-fix-bl-rel-thumb.d: Likewise.
	* ld-arm/cortex-a8-fix-bl.d: Likewise.
	* ld-arm/cortex-a8-fix-blx-bcond.d: Likewise.
	* ld-arm/cortex-a8-fix-blx-rel-arm.d: Likewise.
	* ld-arm/cortex-a8-fix-blx-rel-thumb.d: Likewise.
	* ld-arm/cortex-a8-fix-blx.d: Likewise.
	* ld-arm/cortex-a8-fix-hdr.d: Likewise.
	* ld-arm/farcall-mixed-app-v5.d: Likewise.
	* ld-arm/farcall-mixed-app.d: Likewise.
	* ld-arm/farcall-mixed-lib-v4t.d: Likewise.
	* ld-arm/farcall-mixed-lib.d: Likewise.
	* ld-arm/mixed-app-v5.d: Likewise.
	* ld-arm/mixed-app.d: Likewise.
	* ld-arm/mixed-lib.d: Likewise.
2015-04-24 15:54:39 +01:00
Nick Clifton de7669bfa5 Fix typos in sim sources exposed by static analysis.
bfin	PR 18273
	* bfin-sim.c (decode_dsp32alu_0): Remove spurious check for
	s == 1.

erc32	PR 18273
	* exec.c (add32): Fix typo in check for overflow.

igen	PR 18273
	* misc.c (a2i): Fix typos checking for uppercase letters.
2015-04-24 15:43:21 +01:00
Nick Clifton 63c72d1ae4 Fix typo in check for valid register number in RX sim.
PR sim/18273
	* reg.c (put_reg): Fix check for valid register number.
2015-04-24 15:31:36 +01:00
Nick Clifton b1fa9dd630 Extend test for local labels to include fake symbols and local labels with a numeric suffix.
* elf.c (_bfd_elf_is_local_label_name): Extend test for assembler
	local labels to include local labels with a numeric suffix and
	fake symbols.
2015-04-24 15:17:13 +01:00
Pierre-Marie de Rodat 8cd00c5973 Fix printing for GNAT stuff for types that do not have descr. types
gdb/ChangeLog:
2015-04-24  Pierre-Marie de Rodat  <derodat@adacore.com>

	* gdbtypes.c (print_gnat_stuff): Do not recurse on the
	descriptive type when there is none.
2015-04-24 16:14:17 +02:00
H.J. Lu 9361e6307b Define SEC_MEP_VLIW in bfd/section.c
Bits in section flags should only be defined in bfd/section.c.  This
patch moves SEC_MEP_VLIW to bfd/section.c.

bfd/

	PR binutils/18316
	* section.c (SEC_MEP_VLIW): New.
	* bfd-in2.h: Regenerated.

include/elf/

	PR binutils/18316
	* mep.h (SEC_MEP_VLIW): Removed.
2015-04-24 05:40:23 -07:00
Yao Qi 8dbe7ca5a5 A new board file remote-gdbserver-on-localhost.exp
This patch is to add a new board file that does real remote gdbserver
testing on localhost.  This board file can be used to reproduce PR 18208.

gdb/testsuite

2015-04-24  Yao Qi  <yao.qi@linaro.org>

	* boards/remote-gdbserver-on-localhost.exp: New file.
2015-04-24 11:00:14 +01:00
Nick Clifton 30d72bc335 Skip the compressed1d test for targets which do not use the elf32.em linker emulation file.
* ld-elf/compressed1d.d: Add notarget for ELF based targets that
	do not use elf.em.
2015-04-24 10:15:41 +01:00
Hans-Peter Nilsson 04651c084e Correct ld-elf/compressed1e.d to use notarget and for cris-elf, not cris-*.
Don't XPASS cris-linux which *does* support -shared.
And xfail is for bugs, notarget is for not-applicable.
2015-04-24 06:10:19 +02:00
H.J. Lu 005db9f99b Xfail cris and frv for ld-elf/compressed1e.d
cris and frv don't support -shared.

	* ld-elf/compressed1e.d: Only run for Linux/gnu.  Xfail cris and
	frv.
2015-04-23 18:58:46 -07:00
GDB Administrator ef1f8ff8cd Automatic date update in version.in 2015-04-24 00:00:07 +00:00
H.J. Lu 3e19fb8f99 Delay setting up compressed debug section names
When we set up st_name for output section name in elf_fake_sections, we
don't know if the compressed DWARF debug section will be smaller. We may
end up with compressed DWARF debug sections which are bigger than the
uncompressed ones.  This patch delays setting up st_name for output DWARF
debug section to _bfd_elf_assign_file_positions_for_non_load which will
compress the output debug section.  We also postpone placement of shstrtab
section after DWARF debug sections have been compressed.  The net effect
is .shstrtab section is now placed after .symtab and .strtab sections.

bfd/

	PR ld/18277
	* compress.c (bfd_compress_section_contents): Remove the
	write_compress argument.
	(bfd_init_section_compress_status): Updated.
	(bfd_compress_section): Likewise.
	* elf.c (_bfd_elf_set_reloc_sh_name): New.
	(_bfd_elf_init_reloc_shdr): Add delay_st_name_p.  Set sh_name
	to (unsigned int) -1 if delay_st_name_p is TRUE.  Use
	_bfd_elf_set_reloc_sh_name.
	(elf_fake_sections): Don't rename DWARF debug section for
	linker output if it will be compressed.  Instead, set
	delay_st_name_p to TRUE and pass it to _bfd_elf_init_reloc_shdr.
	(assign_section_numbers): Call _bfd_elf_strtab_addref only if
	sh_name != (unsigned int) -1.  Don't finalize nor assign
	shstrtab section here.  Delay setting output section names to
	_bfd_elf_write_object_contents.
	(_bfd_elf_compute_section_file_positions): Update comments on
	sh_offset for shstrtab section.
	(assign_file_positions_for_non_load_sections): Set sh_offset to
	-1 for shstrtab section.
	(assign_file_positions_except_relocs): Likewise.
	(_bfd_elf_assign_file_positions_for_non_load): Set up sh_name
	when compressing DWARF debug sections.  Place shstrtab section
	after DWARF debug sections have been compressed.
	(_bfd_elf_write_object_contents): Setting sh_name for output
	sections.

ld/testsuite/

	PR ld/18277
	* ld-elf/compressed1d.d: New.
	* ld-elf/compressed1e.d: Likewise.
2015-04-23 16:37:56 -07:00
Matthew Fortune ece794d9c4 Improve warning messages for la/dla
gas/

	* config/tc-mips.c (macro): State the recommended way of creating
	32-bit or 64-bit addresses.

gas/testsuite/

	* gas/mips/dla-warn.l: New file.
	* gas/mips/dla-warn.s: New file.
	* gas/mips/la-warn.l: New file.
	* gas/mips/la-warn.s: New file.
	* gas/mips/mips.exp: Run new tests.
2015-04-23 22:23:17 +01:00
Sriraman Tallam a100d66fb4 Add option --weak-unresolved-symbols to treat unresolved symbols as weak ref.
This patch adds option --weak-unresolved-symbols to treat unresolved symbols as
weak references.  This is helpful when we want the link to succeed with unresolved
symbols and the dynamic loader to not complain at run-time.  Option
--warn-unresolved-symbols lets the link succeed but could fail at run-time with
unresolved symbol warnings especially when the unresolved symbols have GOT entries
and dynamic relocations against them, like when -fPIE is used.
2015-04-23 13:56:40 -07:00
Sriraman Tallam 65eb8c79be Add option --weak-unresolved-symbols to treat unresolved as weak references.
This patch adds option --weak-unresolved-symbols to treat unresolved symbols as
weak references.  This is helpful when we want the link to succeed with unresolved
symbols and the dynamic loader to not complain at run-time.  Option
--warn-unresolved-symbols lets the link succeed but could fail at run-time with
unresolved symbol warnings especially when the unresolved symbols have GOT entries
and dynamic relocations against them, like when -fPIE is used.

2015-04-23  Sriraman Tallam  <tmsriram@google.com>
	* options.h (--weak-unresolved-symbols): New option.
	* symtab.cc (Symbol_table::sized_write_globals): Change symbol
	binding to weak with new option.
	* symtab.h (is_weak_undefined): Check for new option.
	(is_strong_undefined): Check for new option.
	* testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/weak_unresolved_symbols_test.cc: New file.
2015-04-23 13:50:48 -07:00
Matthew Fortune 2ca4ff6d5b Fix r6-branch-constraints test when run with n64 as default ABI
gas/testsuite/

	* gas/mips/mips.exp: Require o32 for r6-branch-constraints.
2015-04-23 21:03:32 +01:00
H.J. Lu f6fe1ccd62 Don't change compressed input debug section names
Change compressed input debug section name for objdump is very confusing.
But we need to change it for linker so that linker will consider the
input section as a debug section.  This patch delays section rename to
elf_fake_sections for objcopy and avoids it for objdump.

bfd/

	PR binutils/18209
	* bfd.c (bfd): Add is_linker_input.
	* elf.c (convert_debug_to_zdebug): New.
	(convert_zdebug_to_debug): Likewise.
	(_bfd_elf_make_section_from_shdr): Don't convert .debug_* to
	.zdebug_* here.  Use convert_zdebug_to_debug.  Set SEC_ELF_RENAME.
	(_bfd_elf_init_reloc_shdr): Pass a pointer to section name
	instead of a pointer to section.
	(elf_fake_sections): Rename the section name if SEC_ELF_RENAME
	is set.
	* section.c (SEC_ELF_RENAME): New.
	* bfd-in2.h: Regenerated.

binutils/

	PR binutils/18209
	* objcopy.c (setup_section): Copy compress status.

binutils/testsuite/

	PR binutils/18209
	* binutils-all/compress.exp: Replace dw2-3.W with dw2-3gabi.W
	on zlib-gabi output.
	* binutils-all/dw2-1.W: Convert section names to .zdebug_*.
	* binutils-all/dw2-3.W: Likewise.
	* binutils-all/objdump.W: Likewise.
	* binutils-all/dw2-3gabi.W: New file.

ld/

	PR binutils/18209
	* ldfile.c (ldfile_try_open_bfd): Set is_linker_input to 1.
2015-04-23 07:59:59 -07:00
Pedro Alves 4ef9fb2f07 Fix gdb.base/interrupt.exp racy fail against gdbserver
Currently, against gdbserver, interrupt.exp occasionaly fails like
this:

 ERROR: Process no longer exists
 UNRESOLVED: gdb.base/interrupt.exp: send end of file

The problem is that we see gdbserver exiting before we match gdb's
output:

 expect: does "\r\n\r\nChild exited with status 0\r\nGDBserver exiting\r\n" (spawn_id exp8) match regular expression "end of file"? Gate "end of file"? gate=no
 expect: read eof
 expect: set expect_out(spawn_id) "exp8"
 expect: set expect_out(buffer) "\r\n\r\nChild exited with status 0\r\nGDBserver exiting\r\n"

Fix this by removing $inferior_spawn_id from the set of spawn ids
expect is watching as soon as we see the "end of file" string out of
the inferior spawn id, using an indirect spawn id list.

Tested on x86-64 Fedora 20, native and gdbserver (both target remote
and extended-remote).

gdb/testsuite/ChangeLog:
2015-04-23  Pedro Alves  <palves@redhat.com>

	* gdb.base/interrupt.exp: Use an indirect spawn id list holding
	$inferior_spawn_id instead of $inferior_spawn_id directly.  On
	"end of file", remove $inferior_spawn_id from the indirect list.
2015-04-23 15:48:27 +01:00
Pedro Alves 0a8031692e gdb.base/interrupt.exp: Rename saw_eof to saw_end_of_file
To avoid confusion between "end of file" string matching and eof
matching, as in process exit.

gdb/testsuite/ChangeLog:
2015-04-23  Pedro Alves  <palves@redhat.com>

	* gdb.base/interrupt.exp: Rename saw_eof to saw_end_of_file.
2015-04-23 15:48:27 +01:00
Pedro Alves 749ef8f891 gdb_test_multiple match eof of any spawn_id
Since silent handling of eof is usually the wrong thing to do, this
patch makes gdb_test_multiple handle it for all $any_spawn_id.

Currently, against gdbserver, interrupt.exp occasionaly fails like
this:

 FAIL: gdb.base/interrupt.exp: send end of file

gdb.log with expect debug output enabled shows:

 expect: does "\r\n\r\nChild exited with status 0\r\nGDBserver exiting\r\n" (spawn_id exp8) match regular expression "end of file"? Gate "end of file"? gate=no
 expect: read eof
 expect: set expect_out(spawn_id) "exp8"
 expect: set expect_out(buffer) "\r\n\r\nChild exited with status 0\r\nGDBserver exiting\r\n"
 FAIL: gdb.base/interrupt.exp: send end of file

Note "expect: read eof" for spawn_id=exp8.  exp8 is
inferior_spawn_id/gdbserver_spawn_id.  That means
expect/gdb_test_multiple saw gdbserver exit before we got the expected
gdb output.  Since there's no explicit pattern for "eof", expect (and
thus gdb_test_multiple) just returns.

After this commit, we get instead:

 ERROR: Process no longer exists
 UNRESOLVED: gdb.base/interrupt.exp: send end of file

Note that before we still got an FAIL because $saw_inferior_exit is 0
when we get to:

	gdb_assert { $saw_eof && $saw_inferior_exit } $msg

Fixing the fail (now unresolved) will be the subject of a separate
patch.

gdb/testsuite/ChangeLog:
2015-04-23  Pedro Alves  <palves@redhat.com>

	* lib/gdb.exp (gdb_test_multiple): Match eof/full_buffer/timeout
	on $any_spawn_id instead of only on $gdb_spawn_id.
2015-04-23 15:48:26 +01:00
Jan Beulich 04d824a468 x86: disambiguate disassembly of certain AVX512 insns
Certain conversion operations as well as vfpclassp{d,s} are ambiguous
when the input operand is in memory and no broadcast is being used.
While in Intel mode this gets resolved by printing suitable operand
size modifiers, AT&T mode need mnemonic suffixes to be added.

gas/testsuite/
2015-04-23  Jan Beulich  <jbeulich@suse.com>

	* gas/i386/avx512dq.d: Add 'z' suffix to vfpclassp{d,s} non-
	register, non-broadcast cases.
	* gas/i386/x86-64-avx512dq.d: Likewise.
	* gas/i386/avx512dq_vl.d: Add 'x' and 'y' suffixes to
	vcvt{,u}qq2ps and vfpclassp{d,s} non-register, non-broadcast
	cases.
	* gas/i386/x86-64-avx512dq_vl.d: Likewise.
	* gas/i386/avx512f_vl.d: Add 'x' and 'y' suffixes to
	vcvt{,t}pd2{,u}dq and vcvtpd2ps non-register, non-broadcast
	cases.
	* gas/i386/x86-64-avx512f_vl.d: Likewise.

opcodes/
2015-04-23  Jan Beulich  <jbeulich@suse.com>

	* i386-dis.c (putop): Extend "XY" handling to AVX512. Handle "XZ".
	* i386-dis-evex.h.c (vcvtpd2ps, vcvtqq2ps, vcvttpd2udq,
	vcvtpd2udq, vcvtuqq2ps, vcvttpd2dq, vcvtpd2dq): Add %XY.
	(vfpclasspd, vfpclassps): Add %XZ.
2015-04-23 16:42:40 +02:00
Jan Beulich af508cb92f x86: don't require operand size specification for AVX512 broadcasts
Certain conversion operations as well as vfpclassp{d,s} are ambiguous
when the input operand is in memory. That ambiguity, however, doesn't
apply when using broadcasts (the destination operand size can be
induced from the broadcast specifier).

gas/
2015-04-23  Jan Beulich  <jbeulich@suse.com>

	* config/tc-i386.c (match_mem_size): Also allow no size
	specification when broadcasting.

gas/testsuite/
2015-04-23  Jan Beulich  <jbeulich@suse.com>

	* gas/i386/avx512dq.s: Drop 'z' suffix from vfpclassp{d,s} in
	some AT&T and all Intel cases.
	* gas/i386/x86-64-avx512dq.s: Likewise.
	* gas/i386/avx512dq_vl.s: Drop 'x' and 'y' suffixes from
	vcvt{,u}qq2ps and vfpclassp{d,s} in some AT&T and all Intel
	cases.
	* gas/i386/x86-64-avx512dq_vl.s: Likewise.
	* gas/i386/avx512f_vl.s: Drop 'x' and 'y' suffixes from
	vcvt{,t}pd2{,u}dq and vcvtpd2ps in some AT&T and all Intel
	cases.
	* gas/i386/x86-64-avx512f_vl.s: Likewise.
2015-04-23 16:41:21 +02:00
Patrick Palka 8900d71e38 Explicitly call rl_resize_terminal() in TUI's SIGWINCH handler
In readline 6.3, the semantics of SIGWINCH handling has changed.
When a SIGWINCH signal is raised, readline's rl_sigwinch_handler() now
does not immediately call rl_resize_terminal().  Instead it sets a flag
that is checked by RL_CHECK_SIGNALS() at a point where readline has
control, and calls rl_resize_terminal() if said flag is set.

This change is item (c) in https://cnswww.cns.cwru.edu/php/chet/readline/CHANGES

  c.  Fixed a bug that caused readline to try and run code to modify its idea
      of the screen size in a signal handler context upon receiving a SIGWINCH.

This change in behavior is important to us because TUI's
tui_sigwinch_handler() relies on the assumption that by the time it's
called, readline will have updated its knowledge of the terminal
dimensions via rl_resize_terminal().  Since this assumption no longer
holds true, TUI's SIGWINCH handling does not work correctly with
readline 6.3.

To fix this issue this patch makes TUI explicitly call
rl_resize_terminal() in tui_async_resize_screen() at the point where
current terminal dimensions are needed.  (We could call it in
tui_sigwinch_handler too, but since readline avoids doing it, we are
probably safer off avoiding to call it in signal handler context as
well.)  After this change, SIGWINCH handling continues to work properly
with both readline 6.2 and 6.3.

Since we no longer need it, we could now explicitly disable readline's
SIGWINCH handler by setting rl_catch_sigwinch to zero early on in the
program startup but I can't seem to find a good spot to place this
assignment (the first call to rl_initialize() occurs in
tui_initialize_readline() so the assignment should occur before then),
and the handler is harmless anyway.

gdb/ChangeLog:

	* tui/tui-win.c (tui_async_resize_screen): Call
	rl_resize_terminal().
2015-04-23 08:00:55 -04:00
Alan Modra 2ab52ca58f Accept odd result in ld-powerpc/tocnovar testcase
I didn't commit this with the relro and powerpc .TOC. changes,
thinking that something should be done about the odd result of
.shstrtab appearing in PT_GNU_RELRO.  On looking at it further,
I think that changing readelf would be wrong, so let's just
accept the results.  Real binaries will always have other sections
past .got, so PT_GNU_RELRO won't finish past the end of loaded
sections.

	* ld-powerpc/tocnovar.d: Adjust.
2015-04-23 13:28:53 +09:30
Alan Modra a27e685fa0 Align .TOC. for PowerPC64
This change, with prerequisite 0e5fabeb, provides a toc base aligned
to 256 bytes rather than 8 bytes.  This is necessary for a minor gcc
optimisation, allowing use of d-form instructions to correctly access
toc-relative items larger than 8 bytes.

bfd/
	* elf64-ppc.c (TOC_BASE_ALIGN): Define.
	(ppc64_elf_next_toc_section): Align multi-got toc base.
	(ppc64_elf_set_toc): Likewise initial toc base and .TOC. symbol.
ld/
	* emulparams/elf64ppc.sh (GOT): Align.
ld/testsuite/
	* ld-powerpc/ambiguousv1b.d: Update for aligned .got.
	* ld-powerpc/defsym.d: Likewise.
	* ld-powerpc/elfv2-2exe.d: Likewise.
	* ld-powerpc/elfv2exe.d: Likewise.
	* ld-powerpc/elfv2so.d: Likewise.
	* ld-powerpc/relbrlt.d: Likewise.
	* ld-powerpc/tls.g: Likewise.
	* ld-powerpc/tlsexe.d: Likewise.
	* ld-powerpc/tlsexe.g: Likewise.
	* ld-powerpc/tlsexe.r: Likewise.
	* ld-powerpc/tlsexetoc.d: Likewise.
	* ld-powerpc/tlsexetoc.g: Likewise.
	* ld-powerpc/tlsexetoc.r: Likewise.
	* ld-powerpc/tlsso.d: Likewise.
	* ld-powerpc/tlsso.g: Likewise.
	* ld-powerpc/tlsso.r: Likewise.
	* ld-powerpc/tlstoc.g: Likewise.
	* ld-powerpc/tlstocso.d: Likewise.
	* ld-powerpc/tlstocso.g: Likewise.
	* ld-powerpc/tlstocso.r: Likewise.
	* ld-powerpc/tocopt.d: Likewise.
	* ld-powerpc/tocopt2.d: Likewise.
	* ld-powerpc/tocopt3.d: Likewise.
	* ld-powerpc/tocopt4.d: Likewise.
	* ld-powerpc/tocopt5.d: Likewise.
2015-04-23 09:49:19 +09:30
GDB Administrator 19947f5fbb Automatic date update in version.in 2015-04-23 00:00:07 +00:00
Joel Brobecker dfc0f57b74 libiberty/setenv.c: Do not declare environ if defined as a macro.
Otherwise, it causes a build warning on some platforms such as MinGW.

libiberty/ChangeLog (Eli Zaretskii  <eliz@gnu.org>):

        * setenv.c <environ>: Declare only if not a macro.
2015-04-22 12:37:52 -07:00
Jon Turney f16eab5ffb windows-nat: Don't change current_event.dwThreadId in handle_output_debug_string()
Using the 'catch-signal' test from the testsuite, on x86_64 Cygwin:

    $ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
    [...]
    (gdb) catch signal
    Catchpoint 1 (standard signals)
    (gdb) r
    [...]
    Catchpoint 1 (signal SIGHUP), main () at
    ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    (gdb) c
    Continuing.
    main () at ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    Failed to resume program execution (ContinueDebugEvent failed, error 87)
    (gdb)

This error occurs because when handle_output_debug_string processes a Cygwin
signal message, it re-writes current_event.dwThreadId to reflect the thread that
the signal will be delivered to, which can be different to the thread reporting
the signal.

Altering current_event.dwThreadId() will cause ContinueDebugEvent() to be
applied to the wrong thread and fail.

So, rather than re-writing the thread id in current_event, use the thread
id by returning it.

With this patch applied this test now yields the expected result:

    $ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
    [...]
    (gdb) catch signal
    Catchpoint 1 (standard signals)
    (gdb) r
    [...]
    Catchpoint 1 (signal SIGHUP), main () at
    ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    (gdb) c
    Continuing.
    Catchpoint 1 (signal SIGHUP), main () at
    ../../../gdb/testsuite/gdb.base/catch-signal.c:42
    42        raise (SIGHUP);               /* third HUP */
    (gdb)

gdb/ChangeLog:

2015-04-22  Jon Turney  <jon.turney@dronecode.org.uk>

	* windows-nat.c (handle_output_debug_string): Don't change
	current_event.dwThreadId.
	(get_windows_debug_event): Use thread_id, rather than relying on
	current_event.dwThreadId being changed.
2015-04-22 19:54:22 +01:00
Jon Turney 68ffc90245 windows-nat: Report an error if ContinueDebugEvent() fails
Using the 'catch-signal' test from the testsuite, on x86_64 Cygwin:

    $ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
    [...]
    (gdb) catch signal
    Catchpoint 1 (standard signals)
    (gdb) r
    [...]
    Catchpoint 1 (signal SIGHUP), main () at
    ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    (gdb) c
    Continuing.
    [hangs]

This is due to a defect in the way Cygwin signals are handled: When
handle_output_debug_string processes a Cygwin signal message, it re-writes
current_event.dwThreadId to reflect the thread that the signal will be delivered
to.

Subsequently, the call to ContinueDebugEvent will fail, because we're trying to
resume the wrong thread.  GDB is then stuck waiting forever for another event
that will never come.

This patch doesn't fix the problem, it just adds appropriate error handling.

Using error() seems appropriate here, if ContinueDebugEvent() fails, the
inferior is in an unknown state and we will probably not be debugging it
anymore.

With this patch applied, resuming the execution of the program now yields:

    $ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
    [...]
    (gdb) catch signal
    Catchpoint 1 (standard signals)
    (gdb) r
    [...]
    Catchpoint 1 (signal SIGHUP), main () at
    ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    (gdb) c
    Continuing.
    main () at ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    Failed to resume program execution (ContinueDebugEvent failed, error 87)
    (gdb)

gdb/ChangeLog:

2015-04-22  Jon Turney  <jon.turney@dronecode.org.uk>

	* windows-nat.c (windows_continue): Report an error if
	ContinueDebugEvent() fails.
2015-04-22 19:40:11 +01:00
Jon Turney 23942819fc windows-nat: Fix misspelling in debug output
gdb/ChangeLog:

2015-04-16  Jon Turney  <jon.turney@dronecode.org.uk>

	* windows-nat.c (windows_resume): Fix misspelling in debug output.
2015-04-22 18:30:56 +01:00
Jon Turney e6ad66bd09 windows-nat: Cleanups in get_windows_debug_event
gdb/ChangeLog:

2015-04-16  Jon Turney  <jon.turney@dronecode.org.uk>

	* windows-nat.c (get_windows_debug_event): Replace retval with
	thread_id throughout.  Update stale comment.
2015-04-22 18:30:54 +01:00
Jon Turney 776704b917 windows-nat: Don't use ternary conditional operator in get_windows_debug_event
gdb/ChangeLog:

2015-04-16  Jon Turney  <jon.turney@dronecode.org.uk>

	* windows-nat.c (get_windows_debug_event): Don't use ternary
	conditional operator.
2015-04-22 18:30:52 +01:00
Alan Modra 0e5fabeb2c Rewrite relro adjusting code
The linker tries to put the end of the last section in the relro
segment exactly on a page boundary, because the relro segment itself
must end on a page boundary.  If for any reason this can't be done,
padding is inserted.  Since the end of the relro segment is typically
between .got and .got.plt, padding effectively increases the size of
the GOT.  This isn't nice for targets and code models with limited GOT
addressing.

The problem with the current code is that it doesn't cope very well
with aligned sections in the relro segment.  When making .got aligned
to a 256 byte boundary for PowerPC64, I found that often the initial
alignment attempt failed and the fallback attempt to be less than
adequate.  This is a particular problem for PowerPC64 since the
distance between .got and .plt affects the size of plt call stubs,
leading to "stubs don't match calculated size" errors.

So this rewrite takes a direct approach to calculating a new relro
base.  Starting from the last section in the segment, we calculate
where it must start to position its end on the boundary, or as near as
possible considering alignment requirements.  The new start then
becomes the goal for the previous section to end, and so on for all
sections.  This of course ignores the possibility that user scripts
will place . = ALIGN(xxx); in the relro segment, or provide section
address expressions.  In those cases we might fail, but the old code
probably did too, and a fallback is provided.

ld/
	* ldexp.h (struct ldexp_control): Delete dataseg.min_base.  Add
	data_seg.relro_offset.
	* ldexp.c (fold_binary <DATA_SEGMENT_ALIGN>): Don't set min_base.
	(fold_binary <DATA_SEGMENT_RELRO_END>): Do set relro_offset.
	* ldlang.c (lang_size_sections): Rewrite code adjusting relro
	segment base to line up last section on page boundary.
ld/testsuite/
	* ld-x86-64/pr18176.d: Update.
2015-04-22 23:19:59 +09:30
H.J. Lu d5597ebccc i386: Allow copy relocs for building PIE
This patch allows copy relocs for R_386_GOTOFF relocations in PIE.  For

extern int glob_a;
int foo ()
{
  return glob_a;
}

compiler now can optimize it from

	call	__x86.get_pc_thunk.ax
	addl	$_GLOBAL_OFFSET_TABLE_, %eax
	movl	glob_a@GOT(%eax), %eax
	movl	(%eax), %eax
	ret

to

	call	__x86.get_pc_thunk.ax
	addl	$_GLOBAL_OFFSET_TABLE_, %eax
	movl	glob_a@GOTOFF(%eax), %eax
	ret

bfd/

	PR ld/18289
	* elf32-i386.c (elf_i386_link_hash_entry): Add gotoff_ref.
	(elf_i386_link_hash_newfunc): Initialize gotoff_ref to 0.
	(elf_i386_create_dynamic_sections): Always allow copy relocs for
	building executables.
	(elf_i386_copy_indirect_symbol): Also copy gotoff_ref.
	(elf_i386_check_relocs): Set gotoff_ref for R_386_GOTOFF.
	(elf_i386_adjust_dynamic_symbol): Also allocate copy relocs for
	PIE and R_386_GOTOFF.
	(elf_i386_relocate_section): Allow R_386_GOTOFF in executable.

ld/testsuite/

	PR ld/18289
	* ld-i386/copyreloc-lib.c: New file.
	* ld-i386/copyreloc-main.S: Likewise.
	* ld-i386/copyreloc-main.out: Likewise.
	* ld-i386/copyreloc-main1.rd: Likewise.
	* ld-i386/copyreloc-main2.rd: Likewise.
	* ld-i386/dummy.c: Likewise.
	* ld-i386/pr17689.out: Likewise.
	* ld-i386/pr17689.rd: Likewise.
	* ld-i386/pr17689a.c: Likewise.
	* ld-i386/pr17689b.S: Likewise.
	* ld-i386/pr17827.rd: Likewise.
	* ld-i386/pr17827ver.rd: Likewise.
	* ld-i386/i386.exp: Run copyreloc tests.
2015-04-22 05:30:01 -07:00
GDB Administrator 712e55b924 Automatic date update in version.in 2015-04-22 00:00:13 +00:00
Pierre Muller 8aae434443 Fix pascal behavior for class fields with testcase
Problem reported as PR pascal/17815

Part 1/3: Remember the case pattern that allowed finding a field of this.
File gdb/p-exp.y modified

  This is the fix in the pascal parser (p-exp.y),
to avoid the error that GDB does find normal variables
case insensitively, but not fields of this,
inside a class or object method.

Part 2/3: Add "class" option for pascal compiler
File gdb/testsuite/lib/pascal.exp

This part of the patch series is unchanged.
It adds class option to pascal compiler
which adds the required command line option to
accept pascal class types.

Part 3/3:
New file: gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
New file: gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas

  Here is an updated version of this test, using Pedro's suggestions.
Test to check that PR 17815 is fixed.
2015-04-21 22:10:08 +02:00
Gary Benson 819843c702 Introduce new shared function fileio_to_host_openflags
This commit introduces a new shared function to replace identical
functions in GDB and gdbserver.
2015-04-21 12:09:24 +01:00
Mike Frysinger 43236bb255 sim: mcore: clean up printf warnings
These printf statements are showing "word" objects which are typedefed
from long, so make sure to use l with %x when printing them to avoid
warnings from gcc.
2015-04-21 03:10:16 -04:00
Mike Frysinger f63036b811 sim: mcore: convert to common memory/verbose functions
Re-use the existing memory core that handles reads/writes.

The verbose command is converted to the common --verbose flag
since only a few call sites use it now.
2015-04-21 03:10:16 -04:00
Mike Frysinger e53e5aab53 sim: mcore: drop watchpoint/dumpmem/clearstats support
In preparation for converting to the common memory framework, the custom
commands get in our way.  But when we realize that gdb support has been
dropped for mcore, it makes things a bit easier: the main runner does not
let you run arbitrary commands once simulation starts.

So lets disable watchpoint support until it can be converted to the common
watchpoint logic.  There's already an ifdef to let us do that.

We straight up drop support for the dumpmem command (no other sim supports
this, and if it's a feature people want, we can add a common func) and the
clearstats command (not a big deal -- just restart your simulation).

We leave in place the verbose check points as a follow up commit will cut
that over to common logic.
2015-04-21 03:10:16 -04:00
Mike Frysinger 767e68f1b9 sim: mcore: switch to common syscall handling
Now that libgloss has a header tracking the syscalls for this arch, we
can update the database to include it for the symbolic constants/maps.
Then we can switch the mcore syscall callbacks over to the common ones.
2015-04-21 03:10:16 -04:00
Mike Frysinger 248d23e82b sim: gennltvals.sh: handle split out newlib source tree
Since newlib no longer shares the same repo as binutils/gdb, we have to go
searching further afield to locate the sources.  We still look at the top
level for newlib, but if that is not found, we also try up one dir outside
of this source tree.  It sucks, but better than the status quo (no workie).
2015-04-21 03:10:16 -04:00
Kevin Buettner 0bca7f99d8 Extend rl78 prologue analyzer to recognize more complicated prologues
This patch extends the rl78 prologue analyzer so that it can recognize
this kind of prologue:

   0x119f <main>:       movw    ax, sp
   0x11a1 <main+2>:     subw    ax, #0x1fa6
   0x11a4 <main+5>:     movw    sp, ax

The test case for gdb.base/miscexprs.exp is now compiled to generate
that sequence instead of a much longer and more inefficient sequence.

gdb/ChangeLog:

	* rl78-tdep.c (RL78_SP_ADDR): Define.
	(opc_reg_to_gdb_regnum): New static function.
	(rl78_analyze_prologue): Recognize instructions forming slightly
	more interesting prologues.
2015-04-20 23:44:19 -07:00
Ian Coolidge 4b889c3013 Ensure that dynamically loaded libraries won't use separate copies of GNU_UNIQUE symbols.
gold/
	* symtab.cc (Symbol::should_add_dynsym_entry): Return true for
	GNU_UNIQUE.
2015-04-20 18:07:49 -07:00
GDB Administrator efdacec57c Automatic date update in version.in 2015-04-21 00:00:08 +00:00
H.J. Lu e97029632c Always set up sh_name in assign_section_numbers
commit 9ad5cbcfb2 added the initial support
for more than 64k ELF sections with holes for reserved section indices in
section header table and set entries of reserved section indices in
section header table to index 0:

   for (secn = 1; secn < section_number; ++secn)
-    i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
-                                                    i_shdrp[secn]->sh_name);
-
+    if (i_shdrp[secn] == NULL)
+      i_shdrp[secn] = i_shdrp[0];
+    else
+      i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
+							i_shdrp[secn]->sh_name);

commit 4fbb74a605 removed holes in section
header table.  Check for i_shdrp[secn] == NULL is no longer needed now.
This patch removes it.

	* elf.c (assign_section_numbers): Always set up sh_name.
2015-04-20 12:37:14 -07:00
H.J. Lu be59ad3d96 Don't hardcode offset of .shstrtab section
There is no requirement on placement of section name section, .shstrtab.
This patch removes hardcoded offsets of .shstrtab sections.

binutils/testsuite/

	* binutils-all/i386/compressed-1b.d: Don't hardcode offset of
	.shstrtab section.
	* binutils-all/i386/compressed-1c.d: Likewise.
	* binutils-all/readelf.s-64: Likewise.
	* binutils-all/x86-64/compressed-1b.d: Likewise.
	* binutils-all/x86-64/compressed-1c.d: Likewise.

gas/testsuite/

	* gas/i386/ilp32/x86-64-unwind.d: Don't hardcode offset of
	.shstrtab section.
	* gas/i386/x86-64-unwind.d: Likewise.
	* gas/ia64/alias-ilp32.d: Likewise.
	* gas/ia64/alias.d: Likewise.
	* gas/ia64/group-1.d: Likewise.
	* gas/ia64/group-2.d: Likewise.
	* gas/ia64/secname-ilp32.d: Likewise.
	* gas/ia64/secname.d: Likewise.
	* gas/ia64/unwind-ilp32.d: Likewise.
	* gas/ia64/unwind.d: Likewise.
	* gas/mmix/bspec-1.d: Likewise.
	* gas/mmix/byte-1.d: Likewise.
	* gas/mmix/loc-1.d: Likewise.
	* gas/mmix/loc-2.d: Likewise.
	* gas/mmix/loc-3.d: Likewise.
	* gas/mmix/loc-4.d: Likewise.
	* gas/mmix/loc-5.d: Likewise.
	* gas/tic6x/scomm-directive-4.d: Likewise.

ld/testsuite/

	* ld-mmix/bspec1.d: Don't hardcode offset of .shstrtab section.
	* ld-mmix/bspec2.d: Likewise.
	* ld-mmix/local1.d: Likewise.
	* ld-mmix/local3.d: Likewise.
	* ld-mmix/local5.d: Likewise.
	* ld-mmix/local7.d: Likewise.
	* ld-mmix/undef-3.d: Likewise.
	* ld-sh/sh64/crangerel1.rd: Likewise.
	* ld-sh/sh64/crangerel2.rd: Likewise.
	* ld-tic6x/common.d: Likewise.
	* ld-tic6x/shlib-1.rd: Likewise.
	* ld-tic6x/shlib-1b.rd: Likewise.
	* ld-tic6x/shlib-1r.rd: Likewise.
	* ld-tic6x/shlib-1rb.rd: Likewise.
	* ld-tic6x/shlib-app-1.rd: Likewise.
	* ld-tic6x/shlib-app-1b.rd: Likewise.
	* ld-tic6x/shlib-app-1r.rd: Likewise.
	* ld-tic6x/shlib-app-1rb.rd: Likewise.
	* ld-tic6x/shlib-noindex.rd: Likewise.
	* ld-tic6x/static-app-1.rd: Likewise.
	* ld-tic6x/static-app-1b.rd: Likewise.
	* ld-tic6x/static-app-1r.rd: Likewise.
	* ld-tic6x/static-app-1rb.rd: Likewise.
	* ld-x86-64/ilp32-4.d: Likewise.
	* ld-x86-64/split-by-file-nacl.rd: Likewise.
	* ld-x86-64/split-by-file.rd: Likewise.
2015-04-20 09:55:47 -07:00
H.J. Lu e06efbf1c8 Iterate ELF sections by pointer
Iterate ELF sections by pointer without section counter.  It removes
"i++".

	* elf.c (assign_file_positions_for_non_load_sections): Iterate
	sections by pointer.
	(_bfd_elf_assign_file_positions_for_non_load): Likewise.
2015-04-20 08:50:01 -07:00
H.J. Lu d3b47e2bd4 Silence texinfo 5.1 warnings
This patch silences texinfo 5.1 warnings by using @subsection and
sorting entries in Machine Dependencies menu.

	* doc/as.texinfo (Bundle directives): Shorten menu entry and
	use @subsection.
	(CFI directives): Use @subsection.
	(SH-Dependent, SH64-Dependent): Moved after SCORE-Dependent.
	* doc/c-i386.texi (i386-Mnemonics): Use @subsection.
2015-04-20 08:08:42 -07:00