[AArch64] Cortex-A53 Erratum 835769 -- sort maps

2014-11-24  Tejas Belagod  <tejas.belagod@arm.com>

  bfd/
    * elfnn-aarch64.c (elf_aarch64_compare_mapping): New.
    (erratum_835769_scan): Sort map list.
Automatic date update in version.in
Automatic date update in version.in
Fix corrupted .eh_frame section with LTO and --gc-sections.

Backport from trunk:

When --gc-sections is turned on during an LTO link, the .eh_frame sections
from deferred files are processed before those from the replacement files.
As a result, the section end-cap from crtendS.o is placed ahead of
the .eh_frame data from the replacement files. This patch fixes the bug
by skipping the layout of the deferred sections during GC pass 2.

gold/
	PR gold/17639
	* object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
	(Sized_relobj_file::do_layout): Handle deferred sections properly
	during GC pass 1. Don't add reloc sections to deferred list twice.
	* object.h (Sized_relobj_file::is_deferred_layout): New function.
	(Sized_relobj_file::is_deferred_layout_): New data member.
[GOLD] PowerPC relaxation corner case

It's possible for the section grouping code to decide that the last
section looked at (the first section by address) doesn't fit into a
group.  In one case that section is already a group owner and that is
handled correctly.  In other cases the section should be put into its
own group.  Like this:

	* powerpc.cc (Stub_control::set_output_and_owner): New function.
	(Target_powerpc::group_sections): Use it.
Automatic date update in version.in
Automatic date update in version.in
Automatic date update in version.in
Automatic date update in version.in
Don't output symbol version definitions for non-DT_NEEDED libs

	PR 16452, 16457
	* elflink.c (_bfd_elf_link_find_version_dependencies): Exclude
	symbols from libraries that won't be listed in DT_NEEDED.
	(elf_link_output_extsym): Don't output verdefs for such symbols.
Don't deprecate powerpc mftb insn

mftb is marked phased out in the architecture manual, but we can keep
it as an extended mnemonic for mftbl.

	* ppc-opc.c (powerpc_opcodes <mftb>): Don't deprecate for power7.
	(TB): Delete.
	(insert_tbr, extract_tbr): Validate tbr number.
Power4 should treat mftb as extended mfspr mnemonic

On further reading of ISA manual it appears gas should have been
treating mftb and mftbu as extended mnemonics for mfspr, for ISA 2.03
and later.

opcodes/
	* ppc-opc.c (powerpc_opcodes): Make mftb* generate mfspr for
	power4 and later.
gas/testsuite/
	* gas/ppc/a2.d: Update for mftb change.
	* gas/ppc/476.d: Likewise.
Automatic date update in version.in
Add tests for PR ld/16452 and PR ld/16457

	PR ld/16452
	PR ld/16457
	* ld-elf/pr16452.map: New file.
	* ld-elf/pr16452.od: Likewise.
	* ld-elf/pr16452a.c: Likewise.
	* ld-elf/pr16452b.c: Likewise.
	* ld-elf/pr16457.od: Likewise.

	* ld-elf/shared.exp (build_tests): Add tests for PR ld/16452 and
	PR ld/16457.
Automatic date update in version.in
Automatic date update in version.in
X86-64: Allow copy relocs for building PIE

This patch allows copy relocs for non-GOT pc-relative relocation in PIE.

bfd/

	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Always
	allow copy relocs for building executables.
	(elf_x86_64_adjust_dynamic_symbol): Allocate copy relocs for
	PIE.
	(elf_x86_64_allocate_dynrelocs): For PIE, discard space for
	relocs against symbols which turn out to need copy relocs.
	(elf_x86_64_relocate_section): Don't copy a pc-relative
	relocation into the output file if the symbol needs copy reloc.

ld/testsuite/

	* ld-x86-64/copyreloc-lib.c: New file.
	* ld-x86-64/copyreloc-main.c: Likewise.
	* ld-x86-64/copyreloc-main.out: Likewise.
	* ld-x86-64/copyreloc-main1.rd: Likewise.
	* ld-x86-64/copyreloc-main2.rd: Likewise.

	* ld-x86-64/x86-64.exp: Run copyreloc tests.
powerpc gold, fix pr17566

Code stolen from arm.cc.

	PR 17566
	* powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
	when adding dynamic relocations against section symbols.
Reformat elf_x86_64_create_dynamic_sections

	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Reformat.
Replace copyreloc-main.c with copyreloc-main.S

	* ld-x86-64/copyreloc-main.c: Removed.
	* ld-x86-64/copyreloc-main.S: New.
	* ld-x86-64/x86-64.exp: Replace copyreloc-main.c with
	copyreloc-main.S.