Commit Graph

10974 Commits

Author SHA1 Message Date
Alan Modra 61d1ce24e8 daily update 2014-03-11 09:30:40 +10:30
Tristan Gingold ce15efd88c Remove bfd/ticoff.h (unused)
2013-12-03  Tristan Gingold  <gingold@adacore.com>

	* ticoff.h: Remove.
2014-03-10 15:11:06 +01:00
Alan Modra 592fdf42ef daily update 2014-03-10 09:30:41 +10:30
Alan Modra c5cec84eb3 daily update 2014-03-09 09:31:12 +10:30
Alan Modra 86c9573369 Better overflow checking for powerpc32 relocations
Similar to the powerpc64 patch, this improves overflow checking in
elf32-ppc.c.  Many reloc "howto" entries needed fixes, some just
cosmetic.

The patch also fixes the R_PPC_VLE_SDA21 reloc application code, which
was horribly broken.  In fact, it may still be broken since Power ISA
2.07 says e_li behaves as
   RT <- EXTS(li20 1:4 || li20 5:8 || li20 0 || li20 9:19)
where li20 is a field taken from bits 17..20, 11..15, 21..31 of the
instruction.  Freescale VLEPEM says differently, and I assume
correctly, that
   RT <- EXTS(li20 0:3 || li20 4:8 || li20 9:19)
The VLE_SDA21 relocation description matches this too.

Now the VLE_SDA21 relocation specifies in the case where e_addi16 is
converted to e_li for symbols in .PPC.EMB.sdata0 or .PPC.EMB.sbss0
(no base register), that the field is restricted to 16 bits, with the
sign bit being propagated to the top 4 bits.  I don't see the sense in
restricting the value like this, so have allowed the full 20 bit
signed value.  This of course is compatible with the reloc description
in that values in the 16 bit signed range will result in exactly the
same insn field as when the reloc description is followed to the
letter.

	* elf32-ppc.c (ppc_elf_howto_raw): Correct overflow check for
	many relocations.  Correct bitsize and rightshift too for a number
	of VLE relocs.  Describe R_PPC_VLE_SDA21 and R_PPC_VLE_SDA21_LO.
	Correct dst_mask on R_PPC_VLE_SDA21_LO.
	(ppc_elf_vle_split16): Tidy, delete unnecessary prototype.
	(ppc_elf_relocate_section): Modify overflow test for 16-bit
	fields in instructions to signed/unsigned according to whether
	the field takes a signed or unsigned value.  Tidy vle split16 code.
	Correct R_PPC_VLE_SDA21 and R_PPC_VLE_SDA21_LO handling.
2014-03-08 16:30:43 +10:30
Alan Modra b80eed39e2 Better overflow checking for powerpc64 relocations
R_PPC64_ADDR16 is used in three contexts:
- .short data relocation
- 16-bit signed insn fields, eg. addi
- 16-bit unsigned insn fields, eg. ori
In the first case we want to allow both signed and unsigned 16-bit
values, the latter two ought to error if the field exceeds the range
of values allowed for 16-bit signed and unsigned integers
respectively.  These conflicting requirements meant that ld had to
choose the least restrictive overflow checks, and thus it is possible
to construct testcases where an addi field overflows but is not
reported by ld.  Many relocations dealing with 16-bit insn fields have
this problem.  What's more, some relocations that are only ever used
for signed fields of instructions woodenly copied the lax overflow
checking of R_PPC64_ADDR16.

bfd/
	* elf64-ppc.c (ppc64_elf_howto_raw): Use complain_overflow_signed
	for R_PPC64_ADDR14, R_PPC64_ADDR14_BRTAKEN, R_PPC64_ADDR14_BRNTAKEN,
	R_PPC64_SECTOFF, R_PPC64_ADDR16_DS, R_PPC64_SECTOFF_DS,
	R_PPC64_REL16 entries.  Use complain_overflow_dont for R_PPC64_TOC.
	(ppc64_elf_relocate_section): Modify overflow test for 16-bit
	fields in instructions to signed/unsigned according to whether
	the field takes a signed or unsigned value.
gold/
	* powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
	CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
	(Powerpc_relocate_functions::has_overflow_unsigned): New function.
	(Powerpc_relocate_functions::has_overflow_bitfield,
	overflowed): Use the above.
	(Target_powerpc::Relocate::relocate): Correct overflow checking
	for a number of relocations.  Modify overflow test for 16-bit
	fields in instructions to signed/unsigned according to whether
	the field takes a signed or unsigned value.
2014-03-08 12:57:58 +10:30
Alan Modra 2ba229e2c9 daily update 2014-03-08 09:30:39 +10:30
Pedro Alves c38e85596e AIX 32-bit core loading, high section addresses.
I noticed GDB was failing to enable threading support for 32-bit AIX
cores.  I traced it to failure to read variables from libpthreads.a.
The issue is that data for that library is loaded at a high address,
and bfd is sign extending the section addresses:

 (gdb) info files
 Symbols from "/home/palves/crash".
 Local core dump file:
	 `/home/palves/core', file type aixcoff-rs6000.
	 0x2ff22000 - 0x2ff23000 is .stack
	 0x20000000 - 0x200316e0 is .data
	 0x20000e90 - 0x200016c0 is .data
	 0xfffffffff0254000 - 0xfffffffff0297920 is .data
	 0xfffffffff07b46a8 - 0xfffffffff07b47c8 is .data
	 0xfffffffff0298000 - 0xfffffffff029bfcc is .data
	 0xfffffffff06dafe0 - 0xfffffffff07b3838 is .data
 Local exec file:
	 `/home/palves/crash', file type aixcoff-rs6000.
	 Entry point: 0x20001394
	 0x10000150 - 0x10000e90 is .text
	 0x20000e90 - 0x2000149c is .data
	 0x2000149c - 0x200016c0 is .bss
	 0xd053b124 - 0xd053e15f is .text in /usr/lib/libpthreads.a(shr_comm.o)
	 0xf0254000 - 0xf0297920 is .data in /usr/lib/libpthreads.a(shr_comm.o)
	 0xf0254450 - 0xf0297920 is .bss in /usr/lib/libpthreads.a(shr_comm.o)
	 0xd053a280 - 0xd053aabe is .text in /usr/lib/libcrypt.a(shr.o)
	 0xf07b46a8 - 0xf07b47c8 is .data in /usr/lib/libcrypt.a(shr.o)
	 0xf07b47c8 - 0xf07b47c8 is .bss in /usr/lib/libcrypt.a(shr.o)
	 0xd04fb180 - 0xd053917e is .text in /usr/lib/libpthreads.a(shr_xpg5.o)
	 0xf0298000 - 0xf029bfcc is .data in /usr/lib/libpthreads.a(shr_xpg5.o)
	 0xf029bf64 - 0xf029bfcc is .bss in /usr/lib/libpthreads.a(shr_xpg5.o)
	 0xd0100900 - 0xd04fa39c is .text in /usr/lib/libc.a(shr.o)
	 0xf06dafe0 - 0xf07b3838 is .data in /usr/lib/libc.a(shr.o)
	 0xf0751e94 - 0xf07b3838 is .bss in /usr/lib/libc.a(shr.o)

Notice:
	...
	0xfffffffff0298000 - 0xfffffffff029bfcc is .data
	...

Those are the bfd section start/end addresses.  It't not visible here:

         ...
	 0xf0298000 - 0xf029bfcc is .data in /usr/lib/libpthreads.a(shr_xpg5.o)
         ...

... just because GDB trims that number to 32-bit when printing.

GDB then fails to find the memory for libpthreads.a variables in the
core, and falls back to reading it directly from the executable (which
yields the values as originally initialized in the code).

E.g.:

 (gdb) p &__n_pthreads
 $2 = (<data variable, no debug info> *) 0xf074fda8 <__n_pthreads>
 (gdb) p __n_pthreads
 $1 = -1

That should have returned 2 instead of -1.

bfd/
2014-03-07  Pedro Alves  <palves@redhat.com>

	* rs6000-core.c (rs6000coff_core_p): Cast pointers to bfd_vma
	through ptr_to_uint instead of through long.
2014-03-07 12:11:40 +00:00
Alan Modra d598a9c177 daily update 2014-03-07 09:30:46 +10:30
Nick Clifton e9847026c9 Patch for PR binutils/16664 which triggers a seg-fault when attempting to
display the contents of a corrupt attribute section.

	* readelf.c (process_attributes): Add checks for corrupt
	attribute section names.

	* elf-attrs.c (_bfd_elf_parse_attributes): Add checks for corrupt
	attribute section names.
2014-03-06 10:57:13 +00:00
Alan Modra 9e43f3e57d daily update 2014-03-06 09:31:23 +10:30
Alan Modra 4b95cf5c0c Update copyright years 2014-03-05 22:16:15 +10:30
Alan Modra 45965137be Support R_PPC64_ADDR64_LOCAL
This adds support for "func@localentry", an expression that returns the
ELFv2 local entry point address of function "func".  I've excluded
dynamic relocation support because that obviously would require glibc
changes.

include/elf/
	* ppc64.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
bfd/
	* elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_ADDR64_LOCAL entry.
	(ppc64_elf_reloc_type_lookup): Support R_PPC64_ADDR64_LOCAL.
	(ppc64_elf_check_relocs): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	* Add BFD_RELOC_PPC64_ADDR64_LOCAL.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
gas/
	* config/tc-ppc.c (ppc_elf_suffix): Support @localentry.
	(md_apply_fix): Support R_PPC64_ADDR64_LOCAL.
ld/testsuite/
	* ld-powerpc/elfv2-2a.s, ld-powerpc/elfv2-2b.s: New files.
	* ld-powerpc/elfv2-2exe.d, ld-powerpc/elfv2-2so.d: New files.
	* ld-powerpc/powerpc.exp: Run new test.
elfcpp/
	* powerpc.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
gold/
	* powerpc.cc (Target_powerpc::Scan::local, global): Support
	R_PPC64_ADDR64_LOCAL.
	(Target_powerpc::Relocate::relocate): Likewise.
2014-03-05 19:57:39 +10:30
Alan Modra cfa7ea2a96 daily update 2014-03-05 09:31:07 +10:30
Richard Sandiford cd0c81e90f Fix changelog formatting in last commit -- sorry 2014-03-04 21:30:39 +00:00
Richard Sandiford 4ba154f579 bfd/
2014-02-04  Heiher <r@hev.cc>

	* elfxx-mips.c (mips_set_isa_flags): Use E_MIPS_ARCH_64R2 for
	Loongson-3A.
	(mips_mach_extensions): Make bfd_mach_mips_loongson_3a an
	extension of bfd_mach_mipsisa64r2.

opcodes/
2014-02-04  Heiher <r@hev.cc>

	* mips-dis.c (mips_arch_choices): Usee ISA_MIPS64R2 for Loongson-3A.

gas/
2014-02-04  Heiher <r@hev.cc>

	* config/tc-mips.c (mips_cpu_info_table): Use ISA_MIPS64R2 for
	Loongson-3A.
2014-03-04 21:18:02 +00:00
Nick Clifton eed94f8f8e Install patch for PR ld/16017. This adds support for generating PLT entries
using Thumb2 instructions for those cores which do not support the ARM ISA.

	* elf32-arm.c (elf32_thumb2_plt0_entry): New array.
	(elf32_thumb2_plt_entry): New array.
	(elf32_arm_create_dynamic_sections): Set PLT entry sizes when
	using thumb2 based PLT.
	(elf32_arm_populate_plt_entry): Handle generating Thumb2 based PLT
	entries.
	(elf32_arm_final_link_relocate): Do not bias jumps to Thumb based
	PLT entries.
	(elf32_arm_finish_dynamic_sections): Handle creation of Thumb2
	based PLT 0-entry.
	(elf32_arm_output_plt_map_1): Handle creation of local symbols for
	Thumb2 based PLT 0-entry.
	(elf32_arm_output_arch_local_syms): Handle creation of local
	symbols for Thumb2 based PLT entries.
2014-03-04 15:25:53 +00:00
Alan Modra f97a10f1dc daily update 2014-03-04 09:30:37 +10:30
Alan Modra 74cc2cc592 daily update 2014-03-03 09:30:42 +10:30
Alan Modra 8913591154 daily update 2014-03-02 09:30:37 +10:30
Alan Modra 7b3858e08a daily update 2014-03-01 09:31:08 +10:30
Alan Modra 9850436d9e Fix check_relocs/gc_sweep_hook mismatch
PR ld/16643
	* elflink.c (elf_gc_sweep): Call gc_sweep_hook for exactly
	the same conditions we called check_relocs.
2014-02-28 14:38:27 +10:30
Alan Modra 67496a9c13 daily update 2014-02-28 09:31:17 +10:30
Yuri Gribov 1db37fe627 This patch adds support for ARM PLT entries that support a full 32-bit offset range.
Enabled via the use of a new linker command line option: --long-plt.

	* bfd-in.h: Add export of bfd_elf32_arm_use_long_plt.
	* bfd-in2.h: Regenerate.
	* elf32-arm.c (elf32_arm_plt_entry_long): New array.
	(elf32_arm_link_hash_table_create): Set plt_entry_size to 16 if
	using long PLT entries.
	(bfd_elf32_arm_use_long_plt): New function.
	(elf32_arm_populate_plt_entry): Add support for long PLT entries.

	* emultempl/armelf.em (OPTION_LONG_PLT): Define.
	(PARSE_AND_LIST_LONGOPTS): Add long-plt.
	(PARSE_AND_LIST_OPTIONS): Likewise.
	(PARSE_AND_LIST_ARGS_CASES): Handle long-plt.
	* ld.texinfo: Document --long-plt.

	* ld-arm/long-plt-format.s: New test case.
	* ld-arm/long-plt-format.d: Expected disassembly.
	* ld-arm/arm-elf.exp: Run the new test.
2014-02-27 14:35:37 +00:00
Alan Modra db434ba03e Fix ELF ppc32 targets that don't use ppc32elf.em
5446cbdf82 broke powerpc-lynxos,
powerpc-netware, powerpc-windiss and powerpc-vxworks.

bfd/
	* elf32-ppc.c (ppc_elf_link_hash_table_create): Provide default
	params for targets that don't use ppc32elf.em.
ld/
	* emulparams/elf32ppcvxworks.sh: Source plt_unwind.sh and
	use ppc32elf.em.
	* emultempl/ppc32elf.em (ppc_after_open): Don't compile for
	vxworks.
	(LDEMUL_AFTER_OPEN): Don't set for vxworks.
	(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Exclude
	-secure-plt, -bss-plt and -sdata-got when vxworks.
2014-02-27 23:39:01 +10:30
Alan Modra 2e877f5ecb daily update 2014-02-27 09:31:09 +10:30
Alan Modra cad798bd0d daily update 2014-02-26 09:30:38 +10:30
Alan Modra f91d941da8 daily update 2014-02-25 09:30:39 +10:30
Alan Modra 605a662f6a daily update 2014-02-24 09:30:35 +10:30
Alan Modra cb5111bcea daily update 2014-02-23 09:30:37 +10:30
Alan Modra b103660c45 daily update 2014-02-22 09:30:38 +10:30
Alan Modra 8b5f0ba3a7 daily update 2014-02-21 09:30:38 +10:30
Chung-Lin Tang d9972968c1 2014-02-20 Chung-Lin Tang <cltang@codesourcery.com>
* elf32-nios2.c (nios2_elf32_relocate_section): Fix calculation
        of GOTOFF relocations.
2014-02-19 21:40:21 -08:00
Alan Modra b5ad007edc daily update 2014-02-20 09:30:38 +10:30
H.J. Lu 0ff2b86e7c Create the second PLT for BND relocations
Intel MPX introduces 4 bound registers, which will be used for parameter
passing in x86-64.  Bound registers are cleared by branch instructions.
Branch instructions with BND prefix will keep bound register contents.
This leads to 2 requirements to 64-bit MPX run-time:

1. Dynamic linker (ld.so) should save and restore bound registers during
symbol lookup.
2. Change the current 16-byte PLT0:

  ff 35 08 00 00 00	pushq  GOT+8(%rip)
  ff 25 00 10 00	jmpq  *GOT+16(%rip)
  0f 1f 40 00		nopl   0x0(%rax)

and 16-byte PLT1:

  ff 25 00 00 00 00    	jmpq   *name@GOTPCREL(%rip)
  68 00 00 00 00       	pushq  $index
  e9 00 00 00 00       	jmpq   PLT0

which clear bound registers, to preserve bound registers.

We use 2 new relocations:

to mark branch instructions with BND prefix.

When linker sees any R_X86_64_PC32_BND or R_X86_64_PLT32_BND relocations,
it switches to a different PLT0:

  ff 35 08 00 00 00	pushq  GOT+8(%rip)
  f2 ff 25 00 10 00	bnd jmpq *GOT+16(%rip)
  0f 1f 00		nopl   (%rax)

to preserve bound registers for symbol lookup and it also creates an
external PLT section, .pl.bnd.  Linker will create a BND PLT1 entry
in .plt:

  68 00 00 00 00       	pushq  $index
  f2 e9 00 00 00 00     bnd jmpq PLT0
  0f 1f 44 00 00        nopl 0(%rax,%rax,1)

and a 8-byte BND PLT entry in .plt.bnd:

  f2 ff 25 00 00 00 00  bnd jmpq *name@GOTPCREL(%rip)
  90			nop

Otherwise, linker will create a legacy PLT1 entry in .plt:

  68 00 00 00 00       	pushq  $index
  e9 00 00 00 00        jmpq PLT0
  66 0f 1f 44 00 00     nopw 0(%rax,%rax,1)

and a 8-byte legacy PLT in .plt.bnd:

  ff 25 00 00 00 00     jmpq  *name@GOTPCREL(%rip)
  66 90                 xchg  %ax,%ax

The initial value of the GOT entry for "name" will be set to the the
"pushq" instruction in the corresponding entry in .plt.  Linker will
resolve reference of symbol "name" to the entry in the second PLT,
.plt.bnd.

Prelink stores the offset of pushq of PLT1 (plt_base + 0x10) in GOT[1]
and GOT[1] is stored in GOT[3].  We can undo prelink in GOT by computing
the corresponding the pushq offset with

GOT[1] + (GOT offset - &GOT[3]) * 2

Since for each entry in .plt except for PLT0 we create a 8-byte entry in
.plt.bnd, there is extra 8-byte per PLT symbol.

We also investigated the 16-byte entry for .plt.bnd.  We compared the
8-byte entry vs the the 16-byte entry for .plt.bnd on Sandy Bridge.
There are no performance differences in SPEC CPU 2000/2006 as well as
micro benchmarks.

Pros:
	No change to undo prelink in dynamic linker.
	Only 8-byte memory overhead for each PLT symbol.
Cons:
	Extra .plt.bnd section is needed.
	Extra 8 byte for legacy branches to PLT.
	GDB is unware of the new layout of .plt and .plt.bnd.

bfd/

	* elf64-x86-64.c (elf_x86_64_bnd_plt0_entry): New.
	(elf_x86_64_legacy_plt_entry): Likewise.
	(elf_x86_64_bnd_plt_entry): Likewise.
	(elf_x86_64_legacy_plt2_entry): Likewise.
	(elf_x86_64_bnd_plt2_entry): Likewise.
	(elf_x86_64_bnd_arch_bed): Likewise.
	(elf_x86_64_link_hash_entry): Add has_bnd_reloc and plt_bnd.
	(elf_x86_64_link_hash_table): Add plt_bnd.
	(elf_x86_64_link_hash_newfunc): Initialize has_bnd_reloc and
	plt_bnd.
	(elf_x86_64_copy_indirect_symbol): Also copy has_bnd_reloc.
	(elf_x86_64_check_relocs): Create the second PLT for Intel MPX
	in 64-bit mode.
	(elf_x86_64_allocate_dynrelocs): Handle the second PLT for IFUNC
	symbols.  Resolve call to the second PLT if it is created.
	(elf_x86_64_size_dynamic_sections): Keep the second PLT section.
	(elf_x86_64_relocate_section): Resolve PLT references to the
	second PLT if it is created.
	(elf_x86_64_finish_dynamic_symbol): Use BND PLT0 and fill the
	second PLT entry for BND relocation.
	(elf_x86_64_finish_dynamic_sections): Use MPX backend data if
	the second PLT is created.
	(elf_x86_64_get_synthetic_symtab): New.
	(bfd_elf64_get_synthetic_symtab): Likewise.  Undefine for NaCl.

ld/

	* emulparams/elf_x86_64.sh (TINY_READONLY_SECTION): New.

ld/testsuite/

	* ld-x86-64/mpx.exp: Run bnd-ifunc-1 and bnd-plt-1.
	* ld-x86-64/bnd-ifunc-1.d: New file.
	* ld-x86-64/bnd-ifunc-1.s: Likewise.
	* ld-x86-64/bnd-plt-1.d: Likewise.
2014-02-19 11:48:23 -08:00
Alan Modra 7d4c687d56 Control powerpc64-ld provision of register save/restore
This patch allows the user to override powerpc64-ld's default for
providing linker generated register save and restore functions as used
by gcc -Os code.  Normally these are not provided by ld -r, so Linux
kernel modules have needed to include their own copies.

bfd/
	* elf64-ppc.h (struct ppc64_elf_params): Add save_restore_funcs.
	* elf64-ppc.c (ppc64_elf_func_desc_adjust): Use it to control
	provision of out-of-line register save/restore routines.
ld/
	* emultempl/ppc64elf.em (params): Init new field.
	(ppc_create_output_section_statements): Set params.save_restore_funcs
	default.
	(PARSE_AND_LIST_*): Add support for --save-restore-funcs and
	--no-save-restore-funcs.
2014-02-19 14:53:50 +10:30
Jack Carter 5db3e65d39 The PT_DYNAMIC segment was being hard coded to have read, write, and
execute permission regardless of the underlying PT_LOAD segment permissions.
Deleting this code allows the default linker behavior which is to set the
dynamic segment to the same permissions as the sections that make it up.

This change alters one existing test case to check the segment flags for
PT_DYNAMIC.

bfd/ChangeLog
        * elfxx-mips.c(_bfd_mips_elf_modify_segment_map): Deleted hard coding of
        PT_DYNAMIC segment flags.

ld/testsuite/ChangeLog
	* ld-mips-elf/pic-and-nonpic-3a.sd: Check DYNAMIC segment flags.
2014-02-18 16:23:48 -08:00
Alan Modra ab5baab74e daily update 2014-02-19 09:30:43 +10:30
Alan Modra c395f86f51 daily update 2014-02-18 09:30:41 +10:30
Jan Kratochvil 024a23103f PR binutils/16595
abfd->section_count unexpectedly changes between 218 and 248 in:

150 bfd_simple_get_relocated_section_contents (bfd *abfd,
[...]
218   saved_offsets = malloc (sizeof (struct saved_output_info)
219                           * abfd->section_count);
[...]
230	  _bfd_generic_link_add_symbols (abfd, &link_info);
[...]
248   bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets);

_bfd_generic_link_add_symbols increases section_count

and simple_restore_output_info later reads unallocated part of saved_offsets.

READ of size 8 at 0x601c0000c5c0 thread T0
    #0 0x1124770 in simple_restore_output_info (.../gdb/gdb+0x1124770)
    #1 0x10ecd51 in bfd_map_over_sections (.../gdb/gdb+0x10ecd51)
    #2 0x1125150 in bfd_simple_get_relocated_section_contents (.../gdb/gdb+0x1125150)

bfd/
2014-02-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR binutils/16595
	* simple.c (struct saved_offsets): New.
	(simple_save_output_info): Use it for ptr.
	(simple_restore_output_info): Use it for ptr.  Check section_count.
	(bfd_simple_get_relocated_section_contents): Use it for saved_offsets.
2014-02-17 08:32:22 +01:00
Alan Modra e7d1c40ce5 Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.

bfd/
	* elf64-ppc.h (struct ppc64_elf_params): Define.
	(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
	ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
	ppc64_elf_build_stubs): Update prototype.
	* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
	fields now in params.  Adjust code throughout file.
	(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
	Save params pointer in htab.
	(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
	ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
	ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
	* emultemps/ppc64elf.em (params): New static struct replacing
	various other static vars.  Adjust code throughout file.
2014-02-17 17:11:11 +10:30
Alan Modra 668e22e51b ppc476 workaround for ld -r fixes
This fixes the glaring error that the ppc476 workaround wasn't
actually enabled for ld -r, and adjusts relocations to match moved
code.

bfd/
	* elf32-ppc.c (ppc_elf_relocate_section): Move relocs on insns
	patched for ppc476 workaround.  Reapply branch taken/not taken
	relocs.
ld/
	* emultempl/ppc32elf.em (ppc_after_open_output): Really enable
	ppc476 workaround for ld -r.
2014-02-17 17:00:19 +10:30
Alan Modra 0ec36e11ee daily update 2014-02-17 09:30:40 +10:30
Alan Modra 4ab98b5c97 daily update 2014-02-16 09:30:57 +10:30
Alan Modra 3595cc3e22 daily update 2014-02-15 09:30:42 +10:30
Alan Modra 04ce674586 daily update 2014-02-14 09:30:47 +10:30
Alan Modra 6f569efa61 daily update 2014-02-13 09:30:47 +10:30
Alan Modra 9f7552cff4 Fix bad interaction between --relax and tls optimisation
Adding long-branch stubs for __tls_get_addr calls that are optimised
away is silly.  It also causes assertion failures on newer object files
that use R_PPC_TLSGD and R_PPC_TLSLD marker relocs, and half-optimised
(ie. broken) code for older object files.

	PR 16546
	* elf32-ppc.c (ppc_elf_relax_section): Don't build long-branch
	stubs for calls to __tls_get_addr that we know will later be
	optimised away.
2014-02-12 22:10:09 +10:30
Alan Modra 795bc6b3ea Enable ppc476 workaround for ld -r.
The Linux kernel builds modules using ld -r.  These might need the
ppc476 workaround, so enable it for ld -r if sections have sufficient
alignment to tell location within a page.

bfd/
	* elf32-ppc.c (ppc_elf_relax_section): Enable ppc476 workaround
	for ld -r, when code sections are sufficiently aligned.
	* elf32-ppc.h (struct ppc_elf_params): Delete pagesize.  Add
	pagesize_p2.
ld/
	* emultempl/ppc32elf.em (pagesize): New static var.
	(ppc_after_open_output): Set params.pagesize_p2 from pagesize.
	(PARSE_AND_LIST_ARGS_CASES): Adjust to use pagesize.
2014-02-12 22:10:09 +10:30
Alan Modra b407645f7e PR15530, mark symbol in executables if it matches dynamic_list
For powerpc64 as HJ did earlier for other ELF targets, and a tidy.

	PR gold/15530
	* elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
	--export-dynamic and --dynamic-list marking of symbols.
	* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Reorder
	cheap tests first.
2014-02-12 22:10:09 +10:30