Revert bfd_get_size checks

	* archive.c (_bfd_slurp_extended_name_table): Revert bfd_get_size check.
	* coffcode.h (coff_set_alignment_hook): Likewise.
	(coff_slurp_line_table): Likewise.
	* coffgen.c (coff_get_normalized_symtab): Likewise.
	(_bfd_coff_get_external_symbols): Likewise.
	* elf.c (bfd_elf_get_str_section): Likewise.
	* tekhex.c (first_phase): Likewise.
Move lookup_block_symbol to block.c, rename to block_lookup_symbol.

There is another function, lookup_symbol_aux_block, and
the names lookup_block_symbol and lookup_symbol_aux_block don't
convey any real difference between them.

The difference is that lookup_block_symbol lives in the lower level
block API, and lookup_symbol_aux_block lives in the higher level symtab API.
This patch makes this distinction clear.

gdb/ChangeLog:

	* symtab.c (lookup_block_symbol): Moved to ...
	* block.c (block_lookup_symbol):  ... here and renamed.
	All callers updated.
	* block.h (block_lookup_symbol): Declare.
	* symtab.h (lookup_block_symbol): Delete.
New macro ALL_BLOCK_SYMBOLS_WITH_NAME.

gdb/ChangeLog:

	* block.h (ALL_BLOCK_SYMBOLS_WITH_NAME): New macro.
	* block.c (block_lookup_symbol): Use it.
	* cp-support.c (make_symbol_overload_list_block): Use it.
	* symtab.c (iterate_over_symbols): Use it.
Rename lookup_symbol_static to lookup_symbol_in_static_block,
and lookup_static_symbol_aux to lookup_static_symbol.

gdb/ChangeLog:

	* symtab.c (lookup_static_symbol): Renamed from
	lookup_static_symbol_aux.  All callers updated.
	(lookup_symbol_in_static_block): Renamed from lookup_symbol_static.
	All callers updated.
lookup_symbol_in_block: Renamed from lookup_symbol_aux_block.

gdb/ChangeLog:

	* symtab.c (lookup_symbol_in_block): Renamed from
	lookup_symbol_aux_block.  All callers updated.
Rename some "aux" functions.

"aux" doesn't contribute anything to the name, and it makes the
reader wonder what it's supposed to mean.

gdb/ChangeLog:

	* symtab.c (lookup_local_symbol): Renamed from lookup_symbol_aux_local.
	All callers updated.
	(lookup_symbol_in_all_objfiles): Renamed from
	lookup_symbol_aux_symtabs.  All callers updated.
	(lookup_symbol_via_quick_fns): Renamed from lookup_symbol_aux_quick.
	All callers updated.
	(lookup_symbol_in_objfile_symtabs): Renamed from
	lookup_symbol_aux_objfile.  All callers updated.
symtab.c (basic_lookup_symbol_nonlocal): Add comment.

gdb/ChangeLog:

	* symtab.c (basic_lookup_symbol_nonlocal): Add comment.
Rename lookup_symbol_global to lookup_global_symbol.

gdb/ChangeLog:

	* symtab.c (lookup_global_symbol): Renamed from lookup_symbol_global.
	All callers updated.
	* symtab.h (lookup_global_symbol): Update decl.
	(lookup_static_symbol): Move decl to better location.
symtab.h (lookup_global_symbol): Improve function comment.

gdb/ChangeLog:

	* symtab.h (lookup_global_symbol): Improve function comment.
aoutx.h tidy

Save a multiplication, and any concern that the buffer allocation
might be smaller than the amount read (as it could be if the header
size isn't a multiple of EXTERNAL_NLIST_SIZE).

	* aoutx.h (aout_get_external_symbols): Tidy allocation of symbol buffer.
tekhex buffer management and symbol types

Dramatically reduces memory consumption and processing time for large
all-zero data segments.  Allows multiple symbol types attached to a
given segment to survive objcopy.

	* tekhex.c (CHUNK_SPAN): Define.
	(struct data_struct <chunk_init>): Use one byte per span, update
	all code accessing this field.
	(find_chunk): Add create param, don't create new entry unless set.
	(insert_byte): Don't save zeros.
	(first_phase): Set section SEC_CODE or SEC_DATA flag depending
	on symbol type.  Create an alternate section if both types of
	symbol are given.  Attach type '2' and '6' symbols to absolute
	section.
	(move_section_contents): Fix caching of chunk.  Don't create chunk
	when reading, or for writing zeros.
	(tekhex_set_section_contents): Don't create initial chunks.
	(tekhex_write_object_contents): Use CHUNK_SPAN.
tekhex architecure

is a don't care.

	* tekhex.c (tekhex_set_arch_mach): Ignore unknown arch errors.
Add more fixes for inavlid memory accesses triggered by corrupt files.

	PR binutils/17531
	* readelf.c (get_data): Avoid allocating memory when we know that
	the read will fail.
	(find_section_by_type): New function.
	(get_unwind_section_word): Check for invalid symbol indicies.
	Check for invalid reloc types.
	(get_32bit_dynamic_section): Add range checks.
	(get_64bit_dynamic_section): Add range checks.
	(process_dynamic_section): Check for a corrupt time value.
	(process_symbol_table): Add range checks.
	(dump_section_as_strings): Add string length range checks.
	(display_tag_value): Likewise.
	(display_arm_attribute): Likewise.
	(display_gnu_attribute): Likewise.
	(display_tic6x_attribute): Likewise.
	(display_msp430x_attribute): Likewise.
	(process_mips_specific): Add range check.
Revert old nexti prologue check and eliminate in_prologue

The in_prologue check in the nexti code is obsolete; this commit
removes that, and then removes the in_prologue function as nothing
else uses it.

Looking at the code in GDB that makes use in_prologue, all we find is
this one caller:

      if ((ecs->event_thread->control.step_over_calls == STEP_OVER_NONE)
	  || ((ecs->event_thread->control.step_range_end == 1)
	      && in_prologue (gdbarch, ecs->event_thread->prev_pc,
			      ecs->stop_func_start)))
	{
	  /* I presume that step_over_calls is only 0 when we're
	     supposed to be stepping at the assembly language level
	     ("stepi").  Just stop.  */
	  /* Also, maybe we just did a "nexti" inside a prolog, so we
	     thought it was a subroutine call but it was not.  Stop as
	     well.  FENN */
	  /* And this works the same backward as frontward.  MVS */
	  end_stepping_range (ecs);
	  return;
	}

This was added by:

 commit 100a02e1deec2f037a15cdf232f026dc79763bf8
 ...
     From Fernando Nasser:
     * infrun.c (handle_inferior_event): Handle "nexti" inside function
     prologues.

The mailing list thread is here:

  https://sourceware.org/ml/gdb-patches/2001-01/msg00047.html

Not much discussion there, and no test, but looking at the code around
what was patched in that revision, we see that the checks that detect
whether the program has just stepped into a subroutine didn't rely on
the unwinders at all back then.

From 'git show 100a02e1:gdb/infrun.c':

    if (stop_pc == ecs->stop_func_start         /* Quick test */
        || (in_prologue (stop_pc, ecs->stop_func_start) &&
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            !IN_SOLIB_RETURN_TRAMPOLINE (stop_pc, ecs->stop_func_name))
        || IN_SOLIB_CALL_TRAMPOLINE (stop_pc, ecs->stop_func_name)
        || ecs->stop_func_name == 0)
      {
        /* It's a subroutine call.  */

        if ((step_over_calls == STEP_OVER_NONE)
            || ((step_range_end == 1)
                && in_prologue (prev_pc, ecs->stop_func_start)))
          {
            /* I presume that step_over_calls is only 0 when we're
               supposed to be stepping at the assembly language level
               ("stepi").  Just stop.  */
            /* Also, maybe we just did a "nexti" inside a prolog,
               so we thought it was a subroutine call but it was not.
               Stop as well.  FENN */
            stop_step = 1;
            print_stop_reason (END_STEPPING_RANGE, 0);
            stop_stepping (ecs);
            return;
          }

Stripping the IN_SOLIB_RETURN_TRAMPOLINE checks for simplicity, we had:

    if (stop_pc == ecs->stop_func_start         /* Quick test */
        || in_prologue (stop_pc, ecs->stop_func_start)
        || ecs->stop_func_name == 0)
      {
        /* It's a subroutine call.  */

That is, detecting a subroutine call was based on prologue detection
back then.  So the in_prologue check in the current tree only made
sense back then as it was undoing a bad decision the in_prologue check
that used to exist above did.

Today, the check for a subroutine call relies on frame ids instead,
which are stable throughout the function.  So we can just remove the
in_prologue check for nexti, and the whole in_prologue function along
with it.

Tested on x86_64 Fedora 20, and also by nexti-ing manually a prologue.

gdb/
2014-11-07  Pedro Alves  <palves@redhat.com>

	* infrun.c (process_event_stop_test) <subroutine check>: Don't
	check if we did a "nexti" inside a prologue.
	* symtab.c (in_prologue): Delete function.
	* symtab.h (in_prologue): Delete declaration.
gdb.base/sigstep.exp: xfail gdb/17511 on i?86 Linux

Running gdb.base/sigstep.exp with --target=i686-pc-linux-gnu on a
64-bit kernel naturally trips on PR gdb/17511 as well, given this is a
kernel bug.

I haven't really tested a real 32-bit kernel/machine, but given the
code in question in the kernel is shared between 32-bit and 64-bit,
I'm quite sure the bug triggers in those cases as well.

So, simply xfail i?86-*-linux* too.

gdb/testsuite/
2014-11-07  Pedro Alves  <palves@redhat.com>

	PR gdb/17511
	* gdb.base/sigstep.exp (in_handler_map) <si+advance>: xfail
	i?86-*-linux*.
X32: Add REX prefix to encode R_X86_64_GOTTPOFF

Structions with R_X86_64_GOTTPOFF relocation must be encoded with REX
prefix even if it isn't required by destination register.  Otherwise
linker can't safely perform IE -> LE optimization.

bfd/

	PR ld/17482
	* elf64-x86-64.c (elf_x86_64_relocate_section): Update comments
	for IE->LE transition.

gas/

	PR ld/17482
	* config/tc-i386.c (output_insn): Add a dummy REX_OPCODE prefix
	for structions with R_X86_64_GOTTPOFF relocation for x32 if needed.

gas/testsuite/

	PR ld/17482
	* gas/i386/ilp32/x32-tls.d: New file.
	* gas/i386/ilp32/x32-tls.s: Likewise.

ld/testsuite/

	PR ld/17482
	* ld-x86-64/tlsie4.dd: Updated.
Cast to unsigned long in range checks

	* peXXigen.c (pe_print_idata): Cast to unsigned long in range
	checks.
Cast time value to unsigned long to print

	* readelf.c (process_dynamic_section): Cast time value to unsigned
	long to print.
daily update
Fix race condition when using --threads with linker plugins.

2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>

gold/
	* plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
	* plugin.h: add lock definition