mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 19:50:13 +08:00
More PowerPC64 ELFv2 --just-symbols fixes
I don't know what I was thinking here to omit the save of r2. Possibly I was looking at -msave-toc-indirect code at the time, where r2 is saved in the function prologue. * elf64-ppc.c (ppc_build_one_stub <ppc_stub_plt_branch_r2off>): Don't omit saving of r2 for ELFv2. Don't addi 2,2,0. (ppc_size_one_stub <ppc_stub_plt_branch_r2off>): Adjust to suit.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2013-12-03 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* elf64-ppc.c (ppc_build_one_stub <ppc_stub_plt_branch_r2off>):
|
||||||
|
Don't omit saving of r2 for ELFv2. Don't addi 2,2,0.
|
||||||
|
(ppc_size_one_stub <ppc_stub_plt_branch_r2off>): Adjust to suit.
|
||||||
|
|
||||||
2013-12-03 Alan Modra <amodra@gmail.com>
|
2013-12-03 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* elf64-ppc.c (ppc64_elf_link_just_syms): Remove .got check.
|
* elf64-ppc.c (ppc64_elf_link_just_syms): Remove .got check.
|
||||||
|
@ -10597,8 +10597,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
r[0].r_offset = loc - stub_entry->stub_sec->contents;
|
r[0].r_offset = loc - stub_entry->stub_sec->contents;
|
||||||
if (bfd_big_endian (info->output_bfd))
|
if (bfd_big_endian (info->output_bfd))
|
||||||
r[0].r_offset += 2;
|
r[0].r_offset += 2;
|
||||||
if (stub_entry->stub_type == ppc_stub_plt_branch_r2off
|
if (stub_entry->stub_type == ppc_stub_plt_branch_r2off)
|
||||||
&& htab->opd_abi)
|
|
||||||
r[0].r_offset += 4;
|
r[0].r_offset += 4;
|
||||||
r[0].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_DS);
|
r[0].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_DS);
|
||||||
r[0].r_addend = dest;
|
r[0].r_addend = dest;
|
||||||
@ -10611,8 +10610,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stub_entry->stub_type != ppc_stub_plt_branch_r2off
|
if (stub_entry->stub_type != ppc_stub_plt_branch_r2off)
|
||||||
|| !htab->opd_abi)
|
|
||||||
{
|
{
|
||||||
if (PPC_HA (off) != 0)
|
if (PPC_HA (off) != 0)
|
||||||
{
|
{
|
||||||
@ -10631,7 +10629,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
{
|
{
|
||||||
bfd_vma r2off = get_r2off (info, stub_entry);
|
bfd_vma r2off = get_r2off (info, stub_entry);
|
||||||
|
|
||||||
if (r2off == 0)
|
if (r2off == 0 && htab->opd_abi)
|
||||||
{
|
{
|
||||||
htab->stub_error = TRUE;
|
htab->stub_error = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -10639,29 +10637,30 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
|
|
||||||
bfd_put_32 (htab->stub_bfd, STD_R2_0R1 + STK_TOC (htab), loc);
|
bfd_put_32 (htab->stub_bfd, STD_R2_0R1 + STK_TOC (htab), loc);
|
||||||
loc += 4;
|
loc += 4;
|
||||||
size = 20;
|
size = 16;
|
||||||
if (PPC_HA (off) != 0)
|
if (PPC_HA (off) != 0)
|
||||||
{
|
{
|
||||||
size += 4;
|
size += 4;
|
||||||
bfd_put_32 (htab->stub_bfd, ADDIS_R11_R2 | PPC_HA (off), loc);
|
bfd_put_32 (htab->stub_bfd, ADDIS_R11_R2 | PPC_HA (off), loc);
|
||||||
loc += 4;
|
loc += 4;
|
||||||
bfd_put_32 (htab->stub_bfd, LD_R12_0R11 | PPC_LO (off), loc);
|
bfd_put_32 (htab->stub_bfd, LD_R12_0R11 | PPC_LO (off), loc);
|
||||||
loc += 4;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
bfd_put_32 (htab->stub_bfd, LD_R12_0R2 | PPC_LO (off), loc);
|
bfd_put_32 (htab->stub_bfd, LD_R12_0R2 | PPC_LO (off), loc);
|
||||||
loc += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PPC_HA (r2off) != 0)
|
if (PPC_HA (r2off) != 0)
|
||||||
{
|
{
|
||||||
size += 4;
|
size += 4;
|
||||||
bfd_put_32 (htab->stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc);
|
|
||||||
loc += 4;
|
loc += 4;
|
||||||
|
bfd_put_32 (htab->stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc);
|
||||||
}
|
}
|
||||||
|
if (PPC_LO (r2off) != 0)
|
||||||
|
{
|
||||||
|
size += 4;
|
||||||
|
loc += 4;
|
||||||
bfd_put_32 (htab->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc);
|
bfd_put_32 (htab->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
loc += 4;
|
loc += 4;
|
||||||
bfd_put_32 (htab->stub_bfd, MTCTR_R12, loc);
|
bfd_put_32 (htab->stub_bfd, MTCTR_R12, loc);
|
||||||
loc += 4;
|
loc += 4;
|
||||||
@ -10954,8 +10953,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
stub_entry->stub_sec->flags |= SEC_RELOC;
|
stub_entry->stub_sec->flags |= SEC_RELOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stub_entry->stub_type != ppc_stub_plt_branch_r2off
|
if (stub_entry->stub_type != ppc_stub_plt_branch_r2off)
|
||||||
|| !htab->opd_abi)
|
|
||||||
{
|
{
|
||||||
size = 12;
|
size = 12;
|
||||||
if (PPC_HA (off) != 0)
|
if (PPC_HA (off) != 0)
|
||||||
@ -10963,12 +10961,14 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size = 20;
|
size = 16;
|
||||||
if (PPC_HA (off) != 0)
|
if (PPC_HA (off) != 0)
|
||||||
size += 4;
|
size += 4;
|
||||||
|
|
||||||
if (PPC_HA (r2off) != 0)
|
if (PPC_HA (r2off) != 0)
|
||||||
size += 4;
|
size += 4;
|
||||||
|
if (PPC_LO (r2off) != 0)
|
||||||
|
size += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (info->emitrelocations)
|
else if (info->emitrelocations)
|
||||||
|
Reference in New Issue
Block a user