Commit Graph

84059 Commits

Author SHA1 Message Date
Gary Benson 15a201c844 Implement multiple-filesystem support for remote targets
This commit allows GDB to access executables and shared libraries
on remote targets where the remote stub does not share a common
filesystem with the inferior(s).  A new packet "vFile:setfs" is
added to the remote protocol and the three remote hostio functions
with filename arguments are modified to send "vFile:setfs" packets
as necessary.

gdb/ChangeLog:

	* remote.c (struct remote_state) <fs_pid>: New field.
	(new_remote_state): Initialize the above.
	(PACKET_vFile_setfs): New enum value.
	(remote_hostio_set_filesystem): New function.
	(remote_hostio_open): Call the above.
	(remote_hostio_unlink): Likewise.
	(remote_hostio_readlink): Likewise.
	(_initialize_remote): Register new "set/show remote
	hostio-setfs-packet" command.
	* NEWS: Announce new vFile:setfs packet.

gdb/doc/ChangeLog:

	* gdb.texinfo (Remote Configuration): Document the
	"set/show remote hostio-setfs-packet" command.
	(Host I/O Packets): Document the vFile:setfs packet.
2015-06-10 14:28:44 +01:00
Gary Benson 7a6a173129 Implement mount namespace support for native Linux targets
This commit allows GDB to access executables and shared libraries
on native Linux targets where GDB and the inferior have different
mount namespaces.

gdb/ChangeLog:

	* linux-nat.c (nat/linux-namespaces.h): New include.
	(fileio.h): Likewise.
	(linux_nat_filesystem_is_local): New function.
	(linux_nat_fileio_pid_of): Likewise.
	(linux_nat_fileio_open): Likewise.
	(linux_nat_fileio_readlink): Likewise.
	(linux_nat_fileio_unlink): Likewise.
	(linux_nat_add_target): Initialize to_filesystem_is_local,
	to_fileio_open, to_fileio_readlink and to_fileio_unlink.
	(_initialize_linux_nat): New "set/show debug linux-namespaces"
	commands.
	* NEWS: Mention new "set/show debug linux-namespaces" commands.

gdb/doc/ChangeLog:

	* gdb.texinfo (Debugging Output): Document the "set/show debug
	linux-namespaces" command.
2015-06-10 14:28:43 +01:00
Gary Benson 07c138c8ae Add "inferior" argument to some target_fileio functions
This commit adds a new argument to all target_fileio functions with
filename arguments to allow the desired inferior to be specified.
This allows GDB to support systems where processes do not necessarily
share a common filesystem.

gdb/ChangeLog:

	* target.h (struct inferior): New forward declaration.
	(struct target_ops) <to_filesystem_is_local>: Update comment.
	(struct target_ops) <to_fileio_open>: New argument inf.
	Update comment.  All implementations updated.
	(struct target_ops) <to_fileio_unlink>: Likewise.
	(struct target_ops) <to_fileio_readlink>: Likewise.
	(target_filesystem_is_local): Update comment.
	(target_fileio_open): New argument inf.  Update comment.
	(target_fileio_unlink): Likewise.
	(target_fileio_readlink): Likewise.
	(target_fileio_read_alloc): Likewise.
	(target_fileio_read_stralloc): Likewise.
	* target.c (target_fileio_open): New argument inf.
	Pass inf to implementation.  Update debug printing.
	(target_fileio_unlink): Likewise.
	(target_fileio_readlink): Likewise.
	(target_fileio_read_alloc_1): New argument inf. Pass inf
	to target_fileio_open.
	(target_fileio_read_alloc): New argument inf. Pass inf to
	target_fileio_read_alloc_1.
	(target_fileio_read_stralloc): Likewise.
	* gdb_bfd.c (inferior.h): New include.
	(gdb_bfd_iovec_fileio_open): Replace unused "open_closure"
	argument with new argument "inferior".  Pass inferior to
	target_fileio_open.
	(gdb_bfd_open): Supply inferior argument to
	gdb_bfd_iovec_fileio_open.
	* linux-tdep.c (linux_info_proc): Supply inf argument to
	relevant target_fileio calls.
	(linux_find_memory_regions_full): Likewise.
	(linux_fill_prpsinfo): Likewise.
	* remote.c (remote_filesystem_is_local): Supply inf
	argument to remote_hostio_open.
	(remote_file_put): Likewise.
	(remote_file_get): Likewise.
	(remote_file_delete): Supply inf argument to
	remote_hostio_unlink.
2015-06-10 14:28:43 +01:00
Gary Benson 12e2a5fdcc Comment and whitespace changes
Comments on the various implementations of target fileio functions
duplicate information documented in target.h.  This commit replaces
the duplicated documentation with breadcrumbs, and inserts blank
lines to separate comments from the functions they describe where
necessary.

gdb/ChangeLog:

	* inf-child.c (inf_child_fileio_open): Replace comment.
	(inf_child_fileio_pwrite): Likewise.
	(inf_child_fileio_pread): Likewise.
	(inf_child_fileio_fstat): Insert blank line before comment.
	(inf_child_fileio_close): Replace comment.
	(inf_child_fileio_unlink): Likewise.
	(inf_child_fileio_readlink): Likewise.
	* remote.c (remote_hostio_open): Likewise.
	(remote_hostio_pread): Likewise.
	(remote_hostio_pwrite): Likewise.
	(remote_hostio_close): Likewise.
	(remote_hostio_unlink): Likewise.
	(remote_hostio_readlink): Likewise.
	(remote_hostio_fstat): Likewise.
	(remote_filesystem_is_local): Likewise.
	* target.c (target_fileio_open): Likewise.
	(target_fileio_pwrite): Likewise.
	(target_fileio_pread): Likewise.
	(target_fileio_fstat): Insert blank line before comment.
	(target_fileio_close): Replace comment.
	(target_fileio_unlink): Likewise.
	(target_fileio_readlink): Likewise.
	(target_fileio_read_alloc): Likewise.
	(target_fileio_read_stralloc): Likewise.
2015-06-10 14:28:43 +01:00
Gary Benson 9bc3a9760b Remove linux_proc_pid_get_ns
This commit removes linux_proc_pid_get_ns, and updates its only
caller to use linux_ns_same instead.

gdb/ChangeLog:

	* linux-thread-db.c (nat/linux-namespaces.h): New include.
	(check_pid_namespace_match): Use linux_ns_same rather than
	linux_proc_pid_get_ns to spot PID namespace mismatches.
	* nat/linux-procfs.h (linux_proc_pid_get_ns): Remove.
	* nat/linux-procfs.c (linux_proc_pid_get_ns): Likewise.
2015-06-10 14:28:43 +01:00
Gary Benson 4b8b5e7245 Introduce nat/linux-namespaces.[ch]
This commit introduces new shared files nat/linux-namespaces.[ch]
containing code to support Linux namespaces that will be used by
both GDB and gdbserver.

gdb/ChangeLog:

	* configure.ac (AC_CHECK_FUNCS): Add setns.
	* config.in: Regenerate.
	* configure: Likewise.
	* nat/linux-namespaces.h: New file.
	* nat/linux-namespaces.c: Likewise.
	* Makefile.in (HFILES_NO_SRCDIR): Add nat/linux-namespaces.h.
	(linux-namespaces.o): New rule.
	* config/aarch64/linux.mh (NATDEPFILES): Add linux-namespaces.o.
	* config/alpha/alpha-linux.mh (NATDEPFILES): Likewise.
	* config/arm/linux.mh (NATDEPFILES): Likewise.
	* config/i386/linux.mh (NATDEPFILES): Likewise.
	* config/i386/linux64.mh (NATDEPFILES): Likewise.
	* config/ia64/linux.mh (NATDEPFILES): Likewise.
	* config/m32r/linux.mh (NATDEPFILES): Likewise.
	* config/m68k/linux.mh (NATDEPFILES): Likewise.
	* config/mips/linux.mh (NATDEPFILES): Likewise.
	* config/pa/linux.mh (NATDEPFILES): Likewise.
	* config/powerpc/linux.mh (NATDEPFILES): Likewise.
	* config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise.
	* config/powerpc/spu-linux.mh (NATDEPFILES): Likewise.
	* config/s390/linux.mh (NATDEPFILES): Likewise.
	* config/sparc/linux.mh (NATDEPFILES): Likewise.
	* config/sparc/linux64.mh (NATDEPFILES): Likewise.
	* config/tilegx/linux.mh (NATDEPFILES): Likewise.
	* config/xtensa/linux.mh (NATDEPFILES): Likewise.

gdb/gdbserver/ChangeLog:

	* configure.ac (AC_CHECK_FUNCS): Add setns.
	* config.in: Regenerate.
	* configure: Likewise.
	* Makefile.in (SFILES): Add nat/linux-namespaces.c.
	(linux-namespaces.o): New rule.
	* configure.srv (srv_linux_obj): Add linux-namespaces.o.
2015-06-10 14:28:43 +01:00
Gary Benson ca09583623 Move make_cleanup_close to common code
This commit moves the function make_cleanup_close from gdb/utils.[ch]
to gdb/common/filestuff.[ch] to make it usable from common code.

gdb/ChangeLog:

	* utils.h (make_cleanup_close): Moved to common/filestuff.h.
	* utils.c (do_close_cleanup): Moved to common/filestuff.c.
	(make_cleanup_close): Likewise.
	* common/filestuff.h (make_cleanup_close): Moved from utils.h.
	* common/filestuff.c (do_close_cleanup): Moved from utils.c.
	(make_cleanup_close): Likewise.
2015-06-10 14:28:43 +01:00
Jon Turney 5d9c55d355 windows-nat: Also ignore ERROR_INVALID_HANDLE from SuspendThread()
Discussed somewhat in the thread at
https://cygwin.com/ml/gdb-patches/2013-06/msg00680.html

This is pretty straightforward to demonstrate on Cygwin currently:

$ cat main.c

int main()
{
  return 0;
}

$ gcc -g -O0 main.c -o main

$ ./gdb ./main
[...]
(gdb) r
Starting program: /wip/binutils-gdb/build.x86_64/gdb/main
warning: SuspendThread (tid=0x1cf0) failed. (winerr 6)
[Inferior 1 (process 976) exited normally]

with this patch applied:

$ ./gdb ./main
[...]
(gdb) r
Starting program: /wip/binutils-gdb/build.x86_64/gdb/main
[Inferior 1 (process 4852) exited normally]

gdb/ChangeLog:

2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>

	* windows-nat.c (thread_rec): Also ignore ERROR_INVALID_HANDLE
	from SuspendThread().

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2015-06-10 13:28:19 +01:00
Jon Turney 040ea00bb0 windows-nat: Trim a trailing '\n' from OutputDebugString before echoing it
For cosmetic purposes, trim a trailing '\n' from OutputDebugString before
echoing it, as warning() will add a '\n', anyhow.

gdb/ChangeLog:

2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>

	* windows-nat.c (handle_output_debug_string): Trim trailing '\n'
	from OutputDebugString.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2015-06-10 13:24:13 +01:00
Walfred Tedeschi 7d73c23c4d Missing Changelogs for last commits
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
2015-06-10 10:52:12 +02:00
Walfred Tedeschi 29c1c24429 Add support for bound table in the Intel MPX context.
Intel(R) Memory protection bound information are located in register
to be tested using the MPX new instructions. Since the number of
bound registers are limited a table is used to provide storage for
bounds during run-time.

In order to investigate the contents of the MPX bound table two new
commands are added to GDB.  "show mpx bound" and "set mpx bound" are
used to display and set values on the MPX bound table.

2015-04-20  Walfred Tedeschi  <walfred.tedeschi@intel.com>
            Mircea Gherzan  <mircea.gherzan@intel.com>

	* i386-tdep.c (MPX_BASE_MASK, MPX_BD_MASK, MPX_BT_MASK, MPX_BD_MASK_32,
	MPX_BT_MASK_32): New macros.
	(i386_mpx_set_bounds): New function that implements
	the command "set-mpx-bound".
	(i386_mpx_enabled) Helper function to test MPX availability.
	(i386_mpx_bd_base) Helper function to calculate the base directory
	address. (i386_mpx_get_bt_entry) Helper function to access a bound
	table entry. (i386_mpx_print_bounds) Effectively display bound
	information. (_initialize_i386_tdep): Qdd new commands
	to commands "set mpx" and "show mpx". (_initialize_i386_tdep):
	Add "bound" to the commands "show mpx" and "set mpx" commands.
	(mpx_set_cmdlist and mpx_show_cmdlist):
	list for the new prefixed "set mpx" and "show mpx" commands.
	* NEWS: List new commands for MPX support.

testsuite:

	* gdb.arch/i386-mpx-map.c: New file.
	* gdb.arch/i386-mpx-map.exp: New File.

doc:
	* gdb.texinfo (i386): Add documentation about "show mpx bound"
	and "set mpx bound".
2015-06-10 09:58:06 +02:00
Walfred Tedeschi 422d944b03 Obvious indentation fixes on test sample and test file for MPX registers.
2015-06-08  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/testsuite:

	* gdb.arch/i386-mpx.c (have_mpx): Indentation fixed.
	* gdb.arch/i386-mpx.exp: Indentation fixed.
2015-06-10 09:58:05 +02:00
Walfred Tedeschi 547a646d67 Improve test for processor feature om MPX registers test.
Skips the MPX register test in case target is not Intel.
Improves the test for MPX feature making MPX and AVX512
tests more similar in terms of initialization.
Indentation was improved on sample file and final return added
to have_mpx.  On test file identation was improved and
gdb_send was exchanged by gdb_test_multiple.

2015-06-08  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/testsuite
	* gdb.arch/i386-mpx.c: Added final return to the have_mpx
	function and improved indentation.
	* gdb.arch/i386-mpx.exp: Exchanging gdb_send and gdb_expect for
	gdb_test_multiple. Added additional tests to skip the test.
2015-06-10 09:58:05 +02:00
Walfred Tedeschi 8b600ba2b4 Fix MPX and AVX512 tests for path changes.
Changes on the path for i386-cpuid.h file lead to failure in compiling
tests for AVX512 and MPX.

2015-06-08  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/testsuite
	* gdb.arch/i386-avx512.c: Change path in include file.
	* gdb.arch/i386-avx512.exp: Change include dir path
	compilation flag.
	* gdb.arch/i386-mpx.c: Change path in include file.
	* gdb.arch/i386-mpx.exp: Change include dir path compilation
	flag.
2015-06-10 09:58:05 +02:00
GDB Administrator e5796f0233 Automatic date update in version.in 2015-06-10 00:00:08 +00:00
Joel Brobecker bb9e16d4bb Fix latest sim/common/ChangeLog entry. 2015-06-09 14:29:09 -04:00
Joel Brobecker f419f52b9b Remove unnecessary empty line in sim/common/ChangeLog 2015-06-09 14:27:58 -04:00
Mike Stump 509c2f329a Fix spelling mistakes in sim/common/sim-events.c error messages.
sim/common/ChangeLog:

        * sim-events.c (sim_events_schedule_after_signal): Fix spelling
        mistake in call to sim_engine_abort.
        (sim_events_schedule_after_signal): Likewise.
2015-06-09 14:27:46 -04:00
Gary Benson 3ac2e371a1 Don't assume File-I/O mode bits match the host's format
inf_child_fileio_open and its gdbserver equivalent both assume that
the mode_t bits defined in gdb/fileio.h are the same as those used
by the open system call, but there is no mechanism to ensure this is
the case.  This commit adds a conversion function to handle systems
where the File-I/O definitions do not align with the host's.

gdb/ChangeLog:

	* common/fileio.h (fileio_to_host_mode): New declaration.
	* common/fileio.c (fileio_to_host_mode): New Function.
	* inf-child.c (inf_child_fileio_open): Process mode argument
	with fileio_to_host_mode.

gdb/gdbserver/ChangeLog:

	* hostio.c (handle_open): Process mode argument with
	fileio_to_host_mode.
2015-06-09 13:24:46 +01:00
Gary Benson ecef18c564 Fix preprocessor conditional
This commit fixes a typo in common/fileio.c where S_IWGRP was
misspelled as S_IWRGRP in a preprocessor conditional, causing
Host-I/O "vFile:fstat:" and File-I/O "Fstat" and "Ffstat"
responses to always indicate files were not group-writable
regardless of their actual status.
2015-06-09 10:12:11 +01:00
GDB Administrator f5316771bd Automatic date update in version.in 2015-06-09 00:00:08 +00:00
Nick Clifton 1e1b2efc46 Update French Translations for LD and GOLD.
ld	* po/fr.po: Updated French Translation.
gold	* po/fr.po: New French Translation.
2015-06-08 15:04:17 +01:00
Nick Clifton f0e8c65e02 Fix RX GAS handling of integer bignums.
* config/tc-rx.c (rx_op): Correct handling of integer bignums.
2015-06-08 11:32:38 +01:00
GDB Administrator 80fb91378c Automatic date update in version.in 2015-06-08 00:00:08 +00:00
Cary Coutant b8cf50755b Fix incorrect handling of STT_COMMON symbols in shared libraries.
The gABI allows STT_COMMON symbols to appear in executables and shared
objects, so that the dynamic loader can resolve commons across modules.
When reading a shared object, however, an STT_COMMON symbol should be
treated as a regular definition at link time.

In a relocatable object, the gABI requires that any STT_COMMON symbols
must also be defined in the special SHN_COMMON section (which we extend
to include target-specific small and large common sections). Thus,
there is no need for gold to treat STT_COMMON symbols as common unless
the st_shndx field is also set to a common section.

gold/
	PR gold/18288
	* resolve.cc (symbol_to_bits): Remove type parameter; adjust all
	callers. Don't use STT_COMMON to check for common symbols.
	(Symbol_table::resolve): Warn if relocatable object has STT_COMMON
	symbol that's not in a common section.
	* symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
	common symbols.
2015-06-07 14:03:52 -07:00
GDB Administrator 66f38e2951 Automatic date update in version.in 2015-06-07 00:00:07 +00:00
GDB Administrator f051a5a3d0 Automatic date update in version.in 2015-06-06 00:00:07 +00:00
Nick Clifton 8fcc61b42b Improves the detection of partial .debug_line sections.
* dwarf.c (read_debug_line_header): Use reloc_at to detect
	incomplete .debug_line headers
2015-06-05 16:58:35 +01:00
Nick Clifton e00a2fbc24 Fixes a typo in the list of targets that should not run the compressed1d test.
* ld-elf/compressed1d.d: Fix typo: iq200 -> iq2000.
2015-06-05 16:48:01 +01:00
Nick Clifton 1ade717569 Fixes computation of MSP430 SYM_DIFF relocs in very small sections.
* elf32-msp430.c (rl78_sym_diff_handler): New function.
	(msp430_howto_table): Use the new function for the SYM_DIFF reloc.
	(msp430x_howto_table): Likewise.
2015-06-05 16:40:37 +01:00
Gary Benson e3dd7556ad Move vgdb special case into remote_filesystem_is_local
Valgrind GDB (vgdb) presents itself as a remote target but works on
the local filesystem.  gdb_bfd_open contained a special case to make
vgdb work with "target:" sysroots, but the implementation meant that
GDB would fall back to the local filesystem if *any* to_fileio_open
method failed with ENOSYS for *any* reason.  This commit moves the
vgdb special case to remote_filesystem_is_local to allow the fallback
to be restricted only to the specific case that remote file transfer
is unsupported.  This commit also adds a warning which is displayed
the first time the fallback is used.

gdb/ChangeLog:

	* gdb_bfd.c (gdb_bfd_open): Move vgdb special case to...
	* remote.c (remote_filesystem_is_local): ...here.
2015-06-05 16:08:05 +01:00
Alan Modra f8b447819b ppc476 linker workaround shared lib fixes
When building a shared lib from non-PIC objects, we'll get dynamic
text relocations.  These need to move with any insns we move.
Otherwise the dynamic reloc will modify the branch, resulting in
crashes and other unpleasant behaviour.

Also, ld -r --ppc476-workaround used with sufficiently aligned PIC
objects needs a fix for emitted REL16 relocs.

bfd/
	* elf64-ppc.c (ppc_elf_relocate_section): Move dynamic text
	relocs with insns moved by --ppc476-workaround.  Correct
	output of REL16 relocs.
ld/testsuite/
	* ld-powerpc/ppc476-shared.s,
	* ld-powerpc/ppc476-shared.lnk,
	* ld-powerpc/ppc476-shared.d,
	* ld-powerpc/ppc476-shared2.d: New tests.
	* ld-powerpc/powerpc.exp: Run them.
2015-06-05 20:12:11 +09:30
Cary Coutant bdd2d2b7e6 Add diststuff target to Makefile.
gold/
	PR gold/18200
	* Makefile.am (diststuff): Add target.
	* Makefile.in: Regenerate.
2015-06-04 22:58:39 -07:00
Cary Coutant cd3c333f43 Change default to discard temporary local symbols in merge sections.
Add --discard-none to keep all local symbols.

gold/
	PR gold/17498
	* object.cc (Sized_relobj_file::do_count_local_symbols): Discard
	temporary locals in merge sections.
	* options.cc (General_options::parse_discard_all): New method.
	(General_options::parse_discard_locals): New method.
	(General_options::parse_discard_none): New method.
	(General_options::General_options): Initialize discard_locals_.
	* options.h (--discard-all): Convert to special option.
	(--discard-locals): Likewise.
	(--discard-none): New option.
	(General_options::discard_all): New method.
	(General_options::discard_locals): New method.
	(General_options::discard_sec_merge): New method.
	(General_options::Discard_locals): New enum.
	(General_options::discard_locals_): New data member.
2015-06-04 20:58:08 -07:00
Peter Bergner dc302c0061 Add hwsync extended mnemonic.
This commit adds a new extended menmonic for "sync 0" (same as "sync").
The ISA documentation doesn't explicitly mention hwsync as an extended
mnemonic (yet), but it does mention "heavyweight sync" and "hwsync" as
the operation that gets performed when the sync's L field is 0.
This is only enabled for POWER4 and later.

opcodes/
	* ppc-opc.c: (powerpc_opcodes) <hwsync>: New extended mnemonic.

gas/testsuite/
	* gas/ppc/a2.d: Fixup test case due to new extended mnemonic.
	* gas/ppc/power4.s <hwsync, lwsync, ptesync, sync>: Add tests.
	* gas/ppc/power4.d: Likewise.
2015-06-04 20:27:03 -05:00
GDB Administrator 0009668917 Automatic date update in version.in 2015-06-05 00:00:07 +00:00
Jan Kratochvil d5eba19a65 compile-print.exp: xfail->kfail for '@' GDB array operator
Patch implementing '@' GDB array operator in GCC has been rejected:
	https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00414.html
and so there is now a GDB tracker to implement it just in GDB:
	https://sourceware.org/bugzilla/show_bug.cgi?id=18489

gdb/testsuite/ChangeLog
2015-06-04  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.compile/compile-print.exp (compile print *vararray@3)
	(compile print *vararrayp@3): Change xfail to kfail compile/18489.
2015-06-04 21:35:43 +02:00
Yao Qi 5b74bf7d63 Regenerate gdbarch.c to sync with gdbarch.sh
When I do something else, I find that gdbarch.c isn't sync'ed with
gdbarch.sh.  This patch just move some statements on
stack_frame_destroyed_p some lines below.

gdb:

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

	* gdbarch.c: Regenerate it.
2015-06-04 17:31:16 +01:00
Nick Clifton 13be46a23c Fixes the check for emulated MSP430 instrucrtions that take no operands.
PR 18474
	* msp430-dis.c (msp430_nooperands): Fix check for emulated insns.
2015-06-04 16:33:12 +01:00
Nick Clifton 239c0f4ceb Fix compile time warning for tc-h8300.c when using gcc 5+.
* config/tc-h8300.c (md_section_align): Fix compile time warning
	about left shifting a negative value.
2015-06-04 16:25:03 +01:00
Matthew Wahab 88f0ea342d [AArch64] Add support for ARMv8.1 command line option 2015-06-04 11:14:07 +01:00
Jiong Wang b968d18a6d [ARM] Use frag's thumb_mode information when available
2015-06-04  Renlin Li  <renlin.li@arm.com>

	* config/tc-arm.c (arm_init_frag): Use frag's thumb_mode information
	when available.
2015-06-04 09:36:35 +01:00
Cary Coutant 8086551f52 Fix SIZEOF_HEADERS in gold.
Gold undercounts the number of program headers it's going to add when
initially evaluating the SIZEOF_HEADERS expression. As a result, scripts
that use it end up skipping a page unnecessarily when the starting address
is too low. The undercounting is because it doesn't count the PT_INTERP
segment.

Then, when finalizing symbols, gold overcounts the program headers: all
segments have already been created, but we still count the headers we
expected to add from the script.

This patch fixes both problems.

gold/
	* script-sections.cc (Script_sections::Script_sections): Initialize
	segments_created_.
	(Script_sections::create_note_and_tls_segments): Set flag when
	segments are created.
	(Script_sections::expected_segment_count): Count PT_INTERP.
	(Script_sections::attach_sections_using_phdrs_clause): Set flag when
	segments are created.
	* script-sections.h (Script_sections::segments_created_): New data
	member.
2015-06-03 20:30:11 -07:00
Cary Coutant 374082dfab Fix gold to group sections correctly via linker script.
In PR 15370, it is noted that gold does not distinguish between
"*(.foo .bar)" and "*(.foo) *(.bar)" in linker scripts. In both
cases, gold groups all .foo sections together, followed by all
.bar sections, whereas in the first case, it should collect all
.foo and .bar sections in the order seen.

If you add sort specs, the Gnu linker has some bizarre corner
cases that I do not try to replicate. In particular,
"*(SORT_BY_NAME(.foo) SORT_BY_NAME(.bar))" does the same thing
as "*(.foo) *(.bar)". But if you apply a sort spec
to just one of several patterns, say, "*(SORT_BY_NAME(.foo) .bar)",
the Gnu linker will collect any .bar section it sees before the
first .foo, then all .foo sections, then all remaining .bar
sections. With this patch, if any of the input patterns have a
sort spec, gold will group them all as it did before; e.g.,
all .foo sections followed by all .bar sections.

2015-06-03  Cary Coutant  <ccoutant@gmail.com>

gold/
	PR gold/15370
	* script-sections.cc
	(Output_section_element_input::set_section_addresses): When there
	are several patterns with no sort spec, put all sections in the same
	bin.
	* testsuite/Makefile.am (script_test_12): New testcase.
	(script_test_12i): New testcase.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/script_test_12.t: New test linker script.
	* testsuite/script_test_12i.t: New test linker script.
	* testsuite/script_test_12a.c: New test source file.
	* testsuite/script_test_12b.c: New test source file.
2015-06-03 19:37:49 -07:00
GDB Administrator a96a7cce18 Automatic date update in version.in 2015-06-04 00:00:08 +00:00
Jan Kratochvil 7f36105668 compile: Use also inferior munmap
Currently inferior memory is allocated by inferior mmap() but it is never
deallocated; despite the injected objfile incl. its symbols is freed.  This was
intentional so that one can do for example:
inferior:
	char *str = "foo";
GDB:
	(gdb) compile code str = "bar";

I believe later patches will be needed to introduce full control over keeping
vs. discarding the injected module as being discussed in:
	compile: objfiles lifetime UI
	https://sourceware.org/ml/gdb/2015-04/msg00051.html
	Message-ID: <20150429135735.GA16974@host1.jankratochvil.net>
	https://sourceware.org/ml/gdb/2015-05/msg00007.html

As decided by Phil it is better not to leak inferior pages as users can
workaround the issue above for example by:
	(gdb) compile code str = strdup ("bar");

I have checked that in fact gdb/doc/ (written by Phil) already expects the
injected code will be unmapped so that does not need to be changed:
	compile code int ff = 5; p = &ff;
	In this example, @code{p} would point to @code{ff} when the
	@code{compile} command is executing the source code provided to it.
	However, as variables in the (example) program persist with their
	assigned values, the variable @code{p} would point to an invalid
	location when the command exists.

gdb/ChangeLog
2015-04-28  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* arch-utils.c (default_infcall_munmap): New.
	* arch-utils.h (default_infcall_munmap): New declaration.
	* compile/compile-object-load.c (struct munmap_list, munmap_list_add)
	(munmap_list_free, munmap_listp_free_cleanup): New.
	(struct setup_sections_data): Add field munmap_list_headp.
	(setup_sections): Call munmap_list_add.
	(compile_object_load): New variable munmap_list_head, initialize
	setup_sections_data.munmap_list_headp, return munmap_list_head.
	* compile/compile-object-load.h (struct munmap_list): New declaration.
	(struct compile_module): Add field munmap_list_head.
	(munmap_list_free): New declaration.
	* compile/compile-object-run.c (struct do_module_cleanup): Add field
	munmap_list_head.
	(do_module_cleanup): Call munmap_list_free.
	(compile_object_run): Pass munmap_list_head to do_module_cleanup.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
	* gdbarch.sh (infcall_munmap): New.
	* linux-tdep.c (linux_infcall_munmap): New.
	(linux_init_abi): Install it.

gdb/testsuite/ChangeLog
2015-04-28  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.compile/compile.exp (keep jit in memory): Rename to ...
	(do not keep jit in memory): ... this.
	(expect 5): Change it to ...
	(expect no 5): ... this.
2015-06-03 21:26:04 +02:00
Matthew Wahab f277626b45 [ARM] Commit approaved testcases missed in previous commit
2015-06-03  Matthew Wahab  <matthew.wahab@arm.com>

	* gas/arm/armv8-a+rdma.d: New.
	* gas/arm/armv8-a+rdma.s: New.
2015-06-03 10:55:29 +01:00
Jiong Wang fbf8de7c4d [AArch64] Revert local changes included in Matthew's commit
When commit the following code for Matthew, I wrongly included my local changes. Revert it. Sorry.

commit a5932920ef
Author: Matthew Wahab <matthew.wahab@arm.com>
Date:   Wed Jun 3 10:03:50 2015 +0100
2015-06-03 10:08:17 +01:00
Matthew Wahab a5932920ef [ARM] Support for ARMv8.1 command line option
2015-06-03  Matthew Wahab  <matthew.wahab@arm.com>

gas/
	* config/tc-arm.c (arm_archs): Add "armv8.1-a".
	* doc/c-arm.texi (ARM Options, -march): Add "armv8.1-a".
	* NEWS: Mention ARMv8.1 support.

include/opcode/
	* arm.h (FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_1): New.
	(ARM_ARCH_V8_1A): New.
	(ARM_ARCH_V8_1A_FP): New.
	(ARM_ARCH_V8_1A_SIMD): New.
	(ARM_ARCH_V8_1A_CRYPTOV1): New.
	(ARM_FEATURE_CORE): New.
2015-06-03 10:03:50 +01:00
GDB Administrator 0220bc5727 Automatic date update in version.in 2015-06-03 00:00:09 +00:00