bfd/elf-attrs.c: Fix possible infinite loop parsing attributes

Handle the case of a zero length section or sub-section in
_bfd_elf_parse_attributes and in doing so prevent an infinite loop
in the parser.

bfd/ChangeLog:

2014-11-06  Will Newton  <will.newton@linaro.org>

	* elf-attrs.c (_bfd_elf_parse_attributes): Handle zero
	length sections and sub-sections.
Revert changes in previous deltas that introduced new failures into
the linker testsuite.

	* aoutx.h (slurp_symbol_table): Revert previous delta.
	(slurp_reloc_table): Likewise.
	* compress.c (bfd_get_full_section_contents): Remove file size
	test.
	* coffgen.c (coff_get_normalized_symtab): Allow zero-sized symtabs
	and do not complain about linker generated files.
Prevent archive memebers with illegal pathnames from being extracted from an archive.

	PR binutils/17552, binutils/17533
	* bucomm.c (is_valid_archive_path): New function.  Returns false
	for absolute pathnames and pathnames that include /../.
	* bucomm.h (is_valid_archive_path): Add prototype.
	* ar.c (extract_file): Use new function to check for valid
	pathnames when extracting files from an archive.
	* objcopy.c (copy_archive): Likewise.
	* doc/binutils.texi: Update documentation to mention the
	limitation on pathname of archive members.
Update Nios II prologue analysis to remove detection of long-obsolete
code sequences.

2014-11-06  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* nios2-tdep.c (wild_insn): Delete.
	(profiler_insn, irqentry_insn): Delete.
	(nios2_match_sequence): Delete.
	(nios2_analyze_prologue): Update comments.  Remove matching
	of obsolete profiler_insn and irqentry_insn sequences.
Add mach parameter to nios2_find_opcode_hash.

2014-11-06  Sandra Loosemore  <sandra@codesourcery.com>

	include/opcode/
	* nios2.h (nios2_find_opcode_hash): Add mach parameter to
	declaration.  Fix obsolete comment.

	opcodes/
	* nios2-dis.c (nios2_find_opcode_hash): Add mach parameter.
	(nios2_disassemble): Adjust call to nios2_find_opcode_hash.

	gas/
	* config/tc-nios2.c (nios2_diagnose_overflow): Adjust call to
	nios2_find_opcode_hash.
daily update
solib_global_lookup: Fetch arch from objfile, not target_gdbarch.

gdb/ChangeLog:

	* objfiles.c (get_objfile_arch): Constify.
	* objfiles.h (get_objfile_arch): Update prototype.
	* solib.c (solib_global_lookup): Fetch arch from objfile,
	not target_gdbarch.
Delete TYPE_CODE_CLASS, it's just an alias of TYPE_CODE_STRUCT.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_CODE_CLASS): Delete.  All uses changed to use
	TYPE_CODE_STRUCT.
Forgotten ChangeLog entry for previous commit.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_CODE_CLASS): Delete.  All uses changed to use
	TYPE_CODE_STRUCT.
Use ALL_PRIMARY_SYMTABS instead of ALL_SYMTABS in some places.

Non-primary symtabs share the block vector with their primary symtabs.
In these cases there's no need to use ALL_SYMTABS.

gdb/ChangeLog:

	* ada-lang.c (ada_make_symbol_completion_list): Use
	ALL_PRIMARY_SYMTABS instead of ALL_SYMTABS.
	* symtab.c (lookup_objfile_from_block): Ditto.
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.