bfd/mach-o: avoid a crash when num == 0 in reloc.

bfd/
	* mach-o.c (bfd_mach_o_canonicalize_one_reloc): Avoid to crash
	when num == 0.
* dwarf2read.c (read_cutu_die_from_dwo): Improve comment.
daily update
Handle VDSO section headers past end of page

When a VDSO gets large enough that it doesn't entirely fit in one page,
but not so large that the part described by the program header exceeds
one page, then gdb/BFD doesn't read the section headers and symbol
table information.  This patch cures that by passing the size of the
vdso to BFD, and fixes a number of other issues in the BFD code.

bfd/
	* elfcode.h (bfd_from_remote_memory): Add "size" parameter.
	Consolidate code handling possible section headers past end of
	segment.  Don't use p_align for page size guess, instead use
	minpagesize.  Take note of ld.so clearing section headers when
	p_memsz > p_filesz.  Handle file header specifying no section
	headers.  Handle zero p_align throughout.  Default loadbase to
	zero.  Add comments.  Rename contents_size to high_offset, and
	make it a bfd_vma.  Delete unnecessary bfd_set_error calls.
	* bfd-in.h (bfd_elf_bfd_from_remote_memory): Update prototpe.
	* elf-bfd.h (struct elf_backend_data <elf_backend_from_remote_memory>):
	Likewise.
	(_bfd_elf32_bfd_from_remote_memory): Likewise.
	(_bfd_elf64_bfd_from_remote_memory): Likewise.
	* elf.c (bfd_elf_bfd_from_remote_memory): Adjust.
	* bfd-in2.h: Regnerate.
gdb/
	* symfile-mem.c (symbol_file_add_from_memory): Add size parameter.
	Pass to bfd_elf_bfd_from_remote_memory.  Adjust all callers.
	(struct symbol_file_add_from_memory_args): Add size field.
	(find_vdso_size): New function.
	(add_vsyscall_page): Attempt to find vdso size.
mach-o: read and dump: prebound_dylib, prebind_cksum, twolevel_hints.

include/mach-o:
	* external.h (mach_o_prebound_dylib_command_external)
	(mach_o_prebind_cksum_command_external)
	(mach_o_twolevel_hints_command_external): New types.

bfd/
	* mach-o.h (bfd_mach_o_twolevel_hints_command)
	(bfd_mach_o_prebind_cksum_command): New types.
	(bfd_mach_o_prebound_dylib_command): Rewrite.
	(bfd_mach_o_load_command): Add prebind_cksum and twolevel_hints
	fields.
	* mach-o.c (bfd_mach_o_read_prebound_dylib): Read and decode the
	command.
	(bfd_mach_o_read_prebind_cksum): New function.
	(bfd_mach_o_read_twolevel_hints): Ditto.
	(bfd_mach_o_read_command): Handle prebind cksum and twolevel hints
	commands.

binutils/
	* od-macho.c (OPT_TWOLEVEL_HINTS): New macro.
	(options): Add entry for twolevel_hints.
	(dump_data_in_code): Fix error message.
	(dump_twolevel_hints): New function.
	(dump_load_command): Handle prebound dylib, prebind cksum
	and twolevel hints.
	(mach_o_dump): Handle twolevel hints.
This fixes an internal error in GAS, triggered by the test case reported in PR 16765.
The problem was that gcc was generating assembler with missing unwind directives in it,
so that a gas_assert was being triggered.  The patch replaces the assert with an error
message.

	* config/tc-arm.c (create_unwind_entry): Report an error if an
	attempt to recreate an unwind directive is encountered.
Add checks for overfar branches

Check 8 and 16 bit PCREL fixes for overflow, since we bypass the
later overflow checks in write.c.  Direct relocs are left alone,
as gcc has been known to take advantage of the silent overflows
when comparing addresses to constant ranges.
Modify gold testsuite to disable plugins added by GCC driver.

GCC 4.8 now adds linker plugin options by default, which conflict with the
--incremental tests in the testsuite. This patch checks whether the compiler
supports the -fno-use-linker-plugin option, and adds it to all link
commands.

2014-04-02  Cary Coutant  <ccoutant@google.com>

	* configure.ac (HAVE_PUBNAMES): Use C instead of C++.
	(HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
	* configure: Regenerate.
	* testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
	-fno-use-linker-plugin.
	(LINK1, CXXLINK1): Add it to the link command.
	* testsuite/Makefile.in: Regenerate.
daily update
Add new sign-extension instructions to moxie port
2014-04-02  Sriraman Tallam  <tmsriram@google.com>

	* icf.cc (get_section_contents): Replace copies of reloc
	vectors with (const) references.
Fix sim breakage

	* elf-bfd.h (struct elf_backend_data
	<elf_backend_bfd_from_remote_memory>): Replace "size_t size"
	with "bfd_size_type size".
	(_bfd_elf32_bfd_from_remote_memory): Likewise.
	(_bfd_elf64_bfd_from_remote_memory): Likewise.
	* elf.c (bfd_elf_bfd_from_remote_memory): Likewise.
	* elfcode.h (bfd_from_remote_memory): Likewise.
ChangeLog missed from last commit
Fix sim breakage

Replace "size_t size" with "bfd_size_type size".
and here too.

	* bfd-in.h (bfd_elf_bfd_from_remote_memory): Likewise.
	* bfd-in2.h: Regenerate.
Add support for two new moxie sign-extension instructions
Escape backslash in windows path

Hi,
On windows host, we see the following ERROR,

(gdb) PASS: gdb.base/setshow.exp: set history filename ~/foobar.baz
ERROR OCCURED: couldn't compile regular expression pattern: invalid escape \ seq
uence
    while executing
"expect -nobrace -i exp13 -timeout 10 -re {.*A problem internal to GDB has been
detected} {
	    fail "$message (GDB internal error)"
	    gdb_internal..."
    invoked from within
"expect {
-i exp13 -timeout 10
	-re ".*A problem internal to GDB has been detected" {
	    fail "$message (GDB internal error)"
	    gdb_internal_erro..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $body" REGEXP REG_EESCAPE {invalid escape \ sequence} couldn't compile
regular expression pattern: invalid escape \ sequenceERROR: Process no longer ex
ists

which leads to
UNRESOLVED: gdb.base/setshow.exp: show history filename (~/foobar.baz)

and this error is thrown from this test below:

gdb_test "show history filename" \
    "The filename in which to record the command history is \"$HOME/foobar.baz\"..*" \
    "show history filename (~/foobar.baz)"

HOME is a windows path, like C:\foo\bar.  When it is used in gdb_test to match
output, the error is thrown because backslash is a special character in
regular expression.  This patch is to escape backslash to fix this
error by using string_to_regexp.

gdb/testsuite:

2014-04-03  Yao Qi  <yao@codesourcery.com>

	* gdb.base/setshow.exp: Invoke string_to_regexp to HOME and PWD.
mach-o: fix section number while writing symbols.

bfd/
	* mach-o.c (bfd_mach_o_mangle_symbols): Use index from
	output_section.
	(bfd_mach_o_build_seg_command): Add comment.  Realign segment.
	Fix style.
	(bfd_mach_o_build_commands, bfd_mach_o_read_thread): Fix style.
mach-o: fix warnings on 32 bit hosts. Display personality functions.

binutils/
	* od-macho.c (printf_uint64): New function.
	(dump_load_command, dump_obj_compact_unwind): Use it.
	(dump_exe_compact_unwind): Display personality functions.

include/mach-o/
	* unwind.h (mach_o_compact_unwind_64): Fix typo in personality.
This patch allows one to place the gcc's liblto_plugin in the lib/bfd-plugins directory
and have it loaded by default (as long as the --target option isn't used).

	PR binutils/14698
	ar.c: Set plugin_target early if plugins are supported.
	nm.c: Likewise.
This fixes a problem building large (> 2Gb) binaries on 32-bit hosts.  Using a
long type instead of long long meant that bfd_seek (SET) could be called with a
negative offset.

	PR ld/16803
	* elf.c (_bfd_elf_set_section_contents): Use correct type to hold
	file position.