Commit Graph

89051 Commits

Author SHA1 Message Date
Thomas Schwinge 53488a6e19 Avoid PATH_MAX usage
On GNU/Hurd, there is no "#define PATH_MAX", so this failed to build.

	gdb/
	* inferior.c (print_selected_inferior): Avoid PATH_MAX usage.
2016-12-09 07:19:28 +01:00
GDB Administrator cfccf141f0 Automatic date update in version.in 2016-12-09 00:00:25 +00:00
Maciej W. Rozycki 39f66f3ae2 MIPS16/opcodes: Fix off-by-one indentation in `print_mips16_insn_arg'
opcodes/
	* mips-dis.c (print_mips16_insn_arg): Remove extraneous
	indentation space across.
2016-12-08 23:32:29 +00:00
Maciej W. Rozycki 860b03a8f3 MIPS16/opcodes: Fix PC-relative operation delay-slot adjustment
Complement commit dd8b7c222e ("MIPS: mips16e jalrc/jrc opcodes"),
<https://sourceware.org/ml/binutils/2005-07/msg00349.html>, and stop the
disassembler making a delay-slot adjustment for PC-relative operations
following either MIPS16e compact jumps, or undefined RR/J(AL)R(C)
encodings that have the `l' (link) and `ra' (source register is `ra')
bits set both at a time.  Adjust code description for accuracy.  Add a
suitable test case.

	opcodes/
	* mips-dis.c (print_mips16_insn_arg): Avoid delay-slot
	adjustment for PC-relative operations following MIPS16e compact
	jumps or undefined RR/J(AL)R(C) encodings.

	binutils/
	* testsuite/binutils-all/mips/mips16-pcrel.d: New test.
	* testsuite/binutils-all/mips/mips16-pcrel.s: New test source.
	* testsuite/binutils-all/mips/mips.exp: Run the new test.
2016-12-08 23:30:57 +00:00
Maciej W. Rozycki 731f7c4ea3 ARC/GAS: Correct a `spaces' global shadowing error
Fix a commit a9752fdf83 ("[ARC] Sync cpu names with the ones accepted
by GCC.") build regression:

cc1: warnings being treated as errors
.../gas/config/tc-arc.c: In function 'arc_show_cpu_list':
.../gas/config/tc-arc.c:3452: error: declaration of 'spaces' shadows a global declaration
.../gas/../include/libiberty.h:248: error: shadowed declaration is here
make[4]: *** [tc-arc.o] Error 1

in a way following commit 91d6fa6a03 ("Add -Wshadow to the gcc command
line options used when compiling the binutils.").

	gas/
	* config/tc-arc.c (arc_show_cpu_list): Rename `spaces' local
	variable to `space_buf'.
2016-12-08 23:24:05 +00:00
Maciej W. Rozycki bf355b690f ARM/GAS: Correct an `index' global shadowing error
Fix a commit 008a97eff0 ("[GAS][ARM]Generate unpredictable warning for
pc used in data processing instructions with register-shifted register
operand.") build regression:

cc1: warnings being treated as errors
.../gas/config/tc-arm.c: In function 'encode_arm_shift':
.../gas/config/tc-arm.c:7439: error: declaration of 'index' shadows a global declaration
/usr/include/string.h:303: error: shadowed declaration is here
make[4]: *** [tc-arm.o] Error 1

in a way following commit 91d6fa6a03 ("Add -Wshadow to the gcc command
line options used when compiling the binutils.").

	gas/
	* config/tc-arm.c (encode_arm_shift): Rename `index' local
	variable to `op_index'.
2016-12-08 23:22:54 +00:00
Maciej W. Rozycki 329d01f70e AArch64/opcodes: Correct another `index' global shadowing error
Fix a commit c2c4ff8d52 ("[AArch64] Add ARMv8.3 FCMLA and FCADD
instructions") build regression:

cc1: warnings being treated as errors
.../opcodes/aarch64-dis.c: In function 'aarch64_ext_sve_addr_rr_lsl':
.../opcodes/aarch64-dis.c:1324: error: declaration of 'index' shadows a global declaration
/usr/include/string.h:303: error: shadowed declaration is here
make[4]: *** [aarch64-asm.lo] Error 1

in a way following commit 91d6fa6a03 ("Add -Wshadow to the gcc command
line options used when compiling the binutils.").

	opcodes/
	* aarch64-asm.c (aarch64_ins_reglane): Rename `index' local
	variable to `reglane_index'.
2016-12-08 23:21:23 +00:00
Luis Machado 3a2488dd21 Fix crash when disassembling invalid range on powerpc vle
I got a report of a gdb crash for vle and further investigation showed an
attempt to disassemble an invalid memory range.  I tracked the crash down
to the code in get_powerpc_dialect, where we fail to make sure we have a
valid section pointer before dereferencing it.

There is no such problem for rs6000-based disassembling.

opcodes/ChangeLog:

2016-12-08  Luis Machado  <lgustavo@codesourcery.com>

	* ppc-dis.c (get_powerpc_dialect): Check NULL info->section.
2016-12-08 07:25:09 -06:00
Etienne Buira 1d262527cf Always use a hex prefix when displaying the alignment of program headers.
* readelf.c (process_program_headers): Always use hex prefix when
	displaying the segment alignment.
2016-12-08 12:52:21 +00:00
Alan Modra 980d0cdd2f [GOLD] Don't assert in powerpc stub_table
A branch in a non-exec section that needs a stub can lead to this
assertion.

	* powerpc.cc (Powerpc_relobj::stub_table): Return NULL rather
	then asserting.
2016-12-08 22:18:47 +10:30
Alan Modra 69a2af1016 [GOLD] fix typo in --stub-group-multi help
* options.h (--stub-group-multi): Fix typo.
2016-12-08 21:35:11 +10:30
Alan Modra da17fe9de9 sync binutils config/ with gcc
config/
	* acx.m4: Import from gcc.
	* bootstrap-asan.mk: Likewise.
	* multi.m4: Likewise.
/
	* configure: Regnerate.
gas/
	* configure: Regnerate.
ld/
	* configure: Regnerate.
libiberty/
	* configure: Regnerate.
zlib/
	* configure: Regnerate.
2016-12-08 21:35:11 +10:30
Alan Modra 8e2a4f11d4 PR20932, Internal error during record link assignment
PR ld/20932
	* elflink.c (bfd_elf_record_link_assignment): Handle warning symbols.
2016-12-08 21:35:11 +10:30
Simon Marchi c3187fa5cc Hurd: In the CLI, use parse_thread_id instead of global_thread_id_to_ptid
Follow-up to commit 14f6890677.
global_thread_id_to_ptid expects global thread numbers, which are nowadays only
used in MI, never presented to the user in the CLI.  Since this is a CLI
command, it should accept the inferior-qualified format instead.

	gdb/
	* gnu-nat.c (set_sig_thread_cmd): Use parse_thread_id instead of
	global_thread_id_to_ptid.
2016-12-08 09:45:59 +01:00
Thomas Schwinge 21389b7f34 Hurd, C++: Mach/Hurd headers and MIG stubs are not yet fit for C++
..., so handle these in "C" mode still:

	gdb/
	* config/i386/i386gnu.mh (%_S.o %_U.o): Add "-x c" to
	"COMPILE.post".
	* gnu-nat.c: #include Mach/Hurd headers before all others.  Wrap
	Mach/Hurd headers and MIG stubs' prototypes in 'extern "C"'.
	* i386-gnu-nat.c: Likewise.
2016-12-08 08:29:39 +01:00
Thomas Schwinge 0947023d1d Hurd, C++: kern_return_t vs. error_t
GNU/Hurd uses its own "typedef enum __error_t_codes error_t;"
([glibc]/sysdeps/mach/hurd/bits/errno.h), contrary to the default
"typedef int error_t;" ([glibc]/stdlib/errno.h).

The Mach/Hurd RPCs return kern_return_t values, for which, upon assigning them
to an error_t variable, GCC in C++ mode tells us "error: invalid conversion
from 'kern_return_t {aka int}' to 'error_t {aka __error_t_codes}'".  Instead of
casting all these RPC return values to "error_t", just use "kern_return_t"
variables:

	gdb/
	* gnu-nat.c (proc_get_exception_port, proc_set_exception_port)
	(INF_RESUME_MSGPORT_RPC, proc_get_state, _proc_get_exc_port)
	(proc_steal_exc_port, proc_restore_exc_port, make_proc)
	(inf_startup, inf_set_pid, inf_validate_procinfo)
	(inf_validate_task_sc, inf_set_traced, inf_validate_procs)
	(inf_signal, inf_continue, gnu_wait, S_exception_raise_request)
	(do_mach_notify_dead_name, S_proc_wait_reply)
	(S_msg_sig_post_untraced_reply, S_msg_sig_post_reply)
	(port_msgs_queued, gnu_read_inferior, gnu_write_inferior)
	(gnu_find_memory_regions, steal_exc_port, thread_takeover_sc_cmd)
	(flush_inferior_icache): Instead of "error_t" use "kern_return_t".
	* i386-gnu-nat.c (fetch_fpregs, store_fpregs, i386_gnu_dr_get)
	(i386_gnu_dr_set): Likewise.
2016-12-08 08:27:07 +01:00
Thomas Schwinge 785102a7d3 Hurd, C++: Avoid "const char *" to "char *" casts
... by a bit of code refactoring:

	gdb/
	* gnu-nat.c (set_task_pause_cmd, set_signals_cmd)
	(set_exceptions_cmd): Add variants taking an "int arg" instead of
	a "char *".  Make the "char *" variants use the former.
	(set_noninvasive_cmd): Also use the "int arg" variants.
2016-12-08 08:24:53 +01:00
Thomas Schwinge a9617a426d Hurd, C++: Avoid GNU C nested functions
..., which C++ doesn't allow, so...

	gdb/
	* gnu-nat.c (gnu_create_inferior): Move nested "trace_me"
	function...
	(gnu_ptrace_me): ... here.
2016-12-08 08:24:22 +01:00
Thomas Schwinge e9e431d194 Hurd, C++: Explicitly cast "void *"
C++ doesn't do implicit type conversions from "void *", so we have to...

	gdb/
	* i386-gnu-nat.c (i386_gnu_dr_set_control_one)
	(i386_gnu_dr_set_addr_one): Explicitly cast "void *".
2016-12-08 08:23:41 +01:00
GDB Administrator e2f9914792 Automatic date update in version.in 2016-12-08 00:00:27 +00:00
Thomas Schwinge 14f6890677 Hurd: Adjust to "Per-inferior/Inferior-qualified thread IDs" changes
[...]/gdb/gnu-nat.c: In function 'set_sig_thread_cmd':
    [...]/gdb/gnu-nat.c:2973:7: warning: implicit declaration of function 'thread_id_to_pid' [-Wimplicit-function-declaration]
           ptid_t ptid = thread_id_to_pid (atoi (args));
           ^
    [...]/gdb/gnu-nat.c:2973:7: error: invalid initializer

That's commit 5d5658a1d3, which renamed
`thread_id_to_pid` to `global_thread_id_to_ptid`.

	gdb/
	* gnu-nat.c (set_sig_thread_cmd): Call global_thread_id_to_ptid
	instead of thread_id_to_pid.
2016-12-07 21:51:27 +01:00
Maciej W. Rozycki 4b0781150f MIPS/include: opcode/mips.h: Correct INSN_CHIP_MASK
Complement commit e407c74b5b ("Support for MIPS R5900 (Sony Playstation
2)"), <https://sourceware.org/ml/binutils/2012-12/msg00240.html>, and
commit 2c62985659 ("MIPS: Add Octeon 3 support") and update the chip
mask accordingly.

	include/
	* opcode/mips.h (INSN_CHIP_MASK): Update according to bit use.
2016-12-07 12:31:38 +00:00
Maciej W. Rozycki 5f5c6e032e MIPS/opcodes: Correct an `interaction' comment typo
opcodes/
	* mips-dis.c (print_mips16_insn_arg): Fix comment typo.
2016-12-07 12:30:38 +00:00
Maciej W. Rozycki 343fa69063 MIPS16/opcodes: Update opcode table comment
opcodes/
	* mips16-opc.c (mips16_opcodes): Update comment naming structure
	members.
2016-12-07 12:29:50 +00:00
Maciej W. Rozycki 6725647ca2 MIPS/opcodes: Reformat `-M' disassembler option's help text
Align output produced consistently and fix other formatting issues.

	opcodes/
	* mips-dis.c (print_mips_disassembler_options): Reformat output.
2016-12-07 12:28:22 +00:00
Maciej W. Rozycki b8760d2cb5 MIPS/include: opcode/mips.h: Add a comment for ASE_DSPR3
Complement commit 8f4f9071ad ("Add MIPS32 DSPr3 support.").

	include/
	* opcode/mips.h (ASE_DSPR3): Add a comment.
2016-12-07 12:26:11 +00:00
Maciej W. Rozycki be0fcbee1d MIPS/GAS: Use local `isa' consistently in `is_opcode_valid'
Replace a global `mips_opts.isa' reference in `is_opcode_valid' and use
a local copy just made in `isa'.  No functional change.

	gas/
	* config/tc-mips.c (is_opcode_valid): Use local `isa'
	consistently.
2016-12-07 12:24:39 +00:00
Nick Clifton c2596ca5d7 Fix internal error in the linker by replacing a call to abort with an error message.
PR ld/20932
	* elflink.c (bfd_elf_record_link_assignment): Replace call to
	abort with an error message and error return value.
2016-12-07 10:19:42 +00:00
Alan Modra 1c3a5fbe15 [GOLD] PowerPC --stub-group-multi
Adds a new option, defaulting to off, that allows a group of stubs to
serve multiple output sections.  Prior to this patch powerpc gold
allowed this unconditionally, which is a little unsafe with clever
code that discards/reuses sections at runtime.

	* options.h (--stub-group-multi): New PowerPC option.
	* powerpc.cc (Stub_control): Add multi_os_ var and param
	to constructor.  Sort start_ var later.  Comment State.
	(Stub_control::can_add_to_stub_group): Heed multi_os_.
	(Target_powerpc::group_sections): Update.
2016-12-07 14:15:59 +10:30
Alan Modra a5018ae555 [GOLD] powerpc64le-linux fails to link large Linux kernel
Gold attaches stubs to an existing section in contrast to ld.bfd which
inserts a new section for stubs.  If we want stubs before branches,
then the stubs must be added to the previous section.  Adding to the
previous section is a disaster if there is a large gap between the
previous section and the group.

	PR gold/20878
	* powerpc.cc (Stub_control): Replace stubs_always_before_branch_
	with stubs_always_after_branch_, group_end_addr_ with
	group_start_addr_.
	(Stub_control::can_add_to_stub_group): Rewrite to suit scanning
	sections by increasing address.
	(Target_powerpc::group_sections): Scan that way.  Delete corner
	case.
	* options.h (--stub-group-size): Update help string.
2016-12-07 14:15:44 +10:30
Alan Modra dc60b26d98 [GOLD] PowerPC stub debug
Some more debug output, and a little hardening.

	* powerpc.cc (Stub_table_owner): Provide constructor.
	(Powerpc_relobj::set_stub_table): Resize fill with -1.
	(Target_powerpc::Branch_info::make_stub): Provide target debug
	output on returning false.
2016-12-07 14:11:57 +10:30
GDB Administrator 86a6934561 Automatic date update in version.in 2016-12-07 00:00:19 +00:00
Simon Marchi 5590c2bae0 Remove unnecessary inferior lookup in inferior_command
In the case where we switch to a non-running inferior, we do a
"find_inferior_id (num)", although we did the same call right before.

gdb/ChangeLog:

	* inferior.c (inferior_command): Remove duplicate
	find_inferior_id call.
2016-12-06 16:19:33 -05:00
Nick Clifton 4f3ca05b48 Fix seg-fault in strip when copying a corrupt binary.
PR binutils/20931
	* elf.c (copy_special_section_fields): Check for an invalid
	sh_link field before attempting to follow it.
2016-12-06 16:53:57 +00:00
Nick Clifton 8b929e420a Fix seg-fault running strip on a corrupt binary.
PR binutils/20930
	* objcopy.c (mark_symbols_used_in_relocations): Check for a null
	symbol pointer pointer before attempting to mark the symbol as
	kept.
2016-12-06 16:26:42 +00:00
Nick Clifton 92744f0580 Fix seg-fault running strip on a corrupt binary.
PR binutils/20929
	* aoutx.h (squirt_out_relocs): Check for relocs without an
	associated symbol.
2016-12-06 15:58:15 +00:00
Nick Clifton 5eecd8621b fix typo 2016-12-06 15:34:33 +00:00
Nick Clifton 005304aae3 Stop the assembler from running out of memory when asked to generate a huge number of spaces.
PR gas/20901
	* read.c (s_space): Place an upper limit on the number of spaces
	generated.
2016-12-06 15:31:14 +00:00
Yao Qi 7c2ba67e6a Assert on lval_register
This patch adds asserts where the value's lval must be lval_register.
This triggers an error in frame_register_unwind because VALUE_REGNUM
is used but value's lval is not lval_register.

This also reveals a design issue in frame_register_unwind, that is
arguments addrp and realnump are mutually exclusive, we either use
addrp (for lval_memory), or use realnump (for lval_register).  This
can be done in a separate patch.

gdb:

2016-12-06  Yao Qi  <yao.qi@linaro.org>

	* frame.c (frame_register_unwind): Set *realnump if *lvalp is
	lval_register.
	* value.c (deprecated_value_next_frame_id_hack): Assert
	value->lval is lval_register.
	(deprecated_value_regnum_hack): Likewise.
2016-12-06 14:25:51 +00:00
Nick Clifton 5e359a63b7 Fix mmix assembler test to account for changes in the error messages produced by the assembler.
PR gas/20896
	* testsuite/gas/mmix/err-byte1.s: Adjust expected warning messages
	to account for patch to next_char_of_string.
2016-12-06 14:13:57 +00:00
Alan Modra 39eeab2534 PowerPC64 toc optimisation for power9
Recognize power9 and a few other insns from older machines.  Fixes
linker complaints like "toc optimization is not supported for
0xf4090002 instruction".  0xf4090002 is stxsd v0,0(r9)

bfd/
	* elf64-ppc.c (ok_lo_toc_insn): Add r_type param.  Recognize
	lq,lfq,lxv,lxsd,lxssp,lfdp,stq,stfq,stxv,stxsd,stxssp,stfdp.
	Don't match lmd and stmd.
ld/
	* testsuite/ld-powerpc/tocopt7.s,
	* testsuite/ld-powerpc/tocopt7.out,
	* testsuite/ld-powerpc/tocopt7.d: New test.
	* testsuite/ld-powerpc/tocopt8.s,
	* testsuite/ld-powerpc/tocopt8.d: New test.
	* testsuite/ld-powerpc/powerpc.exp: Run them.
2016-12-06 18:25:14 +10:30
DJ Delorie fc72affa68 argv.c (expandargv): Check for directories passed as @-files.
gcc pr 78584
2016-12-06 01:40:44 -05:00
GDB Administrator e99f7af2bf Automatic date update in version.in 2016-12-06 00:00:23 +00:00
Alan Modra efe4db3f06 Fix gold/testsuite/file_in_many_sections_test.sh file mode
chmod a+x
2016-12-06 07:56:12 +10:30
Cary Coutant 82d93790a8 Fix problem where absolute local symbols are omitted when output has many sections.
2016-12-05  Cary Coutant  <ccoutant@gmail.com>
            Tristan Gingold  <gingold@adacore.com>

gold/
	* object.cc (Sized_relobj_file::do_count_local_symbols): Check
	is_ordinary before using shndx.
	* testsuite/Makefile.am (file_in_many_sections_test.sh): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/file_in_many_sections.c: New source file.
	* testsuite/file_in_many_sections_test.sh: New script.
2016-12-05 10:41:09 -08:00
Nick Clifton f49547a604 Fix fault in assembler when passed a bogus input file.
PR gas/20902
	* read.c (next_char_of_string): Do end advance past the end of the
	buffer.
2016-12-05 17:36:45 +00:00
Nick Clifton 14c1428b29 Fix ICE in assembler when passed a bogus input file.
PR gas/20904
	* as.h (SKIP_ALL_WHITESPACE): New macro.
	* expr.c (operand): Use it.
2016-12-05 16:54:59 +00:00
Nick Clifton fa6631b4ee Fix seg-fault in the binutils utilities when reading a corrupt input file.
PR binutils/20905
	* peicode.h (pe_ILF_object_p): Use strnlen to avoid running over
	the end of the string buffer.
2016-12-05 16:34:45 +00:00
Nick Clifton 406bd128db Fix seg-fault in linker when passed a bogus input script.
PR ld/20906
	* ldlex.l: Check for bogus strings in linker scripts.
2016-12-05 16:00:43 +00:00
Jose E. Marchesi 9b5481c63a binutils: add myself to MAINTAINERS
2016-12-05  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* MAINTAINERS: Add myself as maintainer for the SPARC targets.
2016-12-05 16:57:53 +01:00