mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-29 13:04:46 +08:00
* elf-bfd.h (struct elf_link_hash_table): Delete init_refcount and
init_offset. Add init_got_refcount, init_plt_refcount, init_got_offset and init_plt_offset. * elf.c (_bfd_elf_link_hash_newfunc): Adjust for above change. (_bfd_elf_link_hash_hide_symbol): Likewise. (_bfd_elf_link_hash_table_init): Likewise. * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise. * elflink.c (_bfd_elf_adjust_dynamic_symbol): Likewise. (bfd_elf_size_dynamic_sections): Likewise. * elf32-ppc.c (GLINK_PLTRESOLVE): Now 16 insns. (LWZU_0_X_12, LWZ_0_4_30, LWZ_0_X_12, LWZ_11_X_11, LWZ_11_X_30, LWZ_12_4_12, LWZ_12_8_30, LWZ_12_X_12, SUB_11_11_30): Delete. (ADDIS_12_12, BCL_20_31, LWZU_0_12, LWZ_0_12, LWZ_11_11, LWZ_11_30, LWZ_12_12, MFLR_0, MFLR_12, MTLR_0, SUB_11_11_12): Define. (struct plt_entry): New. (ppc_elf_link_hash_table_create): Set new init_plt fields. (ppc_elf_copy_indirect_symbol): Handle merge of plt plist. Don't use _bfd_elf_link_hash_copy_indirect. (update_plt_info, find_plt_ent): New functions. (ppc_elf_check_relocs): Handle R_PPC_PLTREL24 with non-zero addend and adjust for use of plt list rather than refcount. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_adjust_dynamic_symbol): Likewise. (allocate_dynrelocs): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. Adjust R_PPC_PLTREL24 addends when performing a relocatable link. (ppc_elf_finish_dynamic_symbol): Likewise. Write .glink stubs here.. (ppc_elf_finish_dynamic_sections): ..rather than here. Use new pic resolver stub.
This commit is contained in:
parent
b0648eec61
commit
a6aa51957c
@ -1,3 +1,38 @@
|
||||
2005-05-19 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* elf-bfd.h (struct elf_link_hash_table): Delete init_refcount and
|
||||
init_offset. Add init_got_refcount, init_plt_refcount,
|
||||
init_got_offset and init_plt_offset.
|
||||
* elf.c (_bfd_elf_link_hash_newfunc): Adjust for above change.
|
||||
(_bfd_elf_link_hash_hide_symbol): Likewise.
|
||||
(_bfd_elf_link_hash_table_init): Likewise.
|
||||
* elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
|
||||
* elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise.
|
||||
* elflink.c (_bfd_elf_adjust_dynamic_symbol): Likewise.
|
||||
(bfd_elf_size_dynamic_sections): Likewise.
|
||||
* elf32-ppc.c (GLINK_PLTRESOLVE): Now 16 insns.
|
||||
(LWZU_0_X_12, LWZ_0_4_30, LWZ_0_X_12, LWZ_11_X_11, LWZ_11_X_30,
|
||||
LWZ_12_4_12, LWZ_12_8_30, LWZ_12_X_12, SUB_11_11_30): Delete.
|
||||
(ADDIS_12_12, BCL_20_31, LWZU_0_12, LWZ_0_12, LWZ_11_11, LWZ_11_30,
|
||||
LWZ_12_12, MFLR_0, MFLR_12, MTLR_0, SUB_11_11_12): Define.
|
||||
(struct plt_entry): New.
|
||||
(ppc_elf_link_hash_table_create): Set new init_plt fields.
|
||||
(ppc_elf_copy_indirect_symbol): Handle merge of plt plist. Don't
|
||||
use _bfd_elf_link_hash_copy_indirect.
|
||||
(update_plt_info, find_plt_ent): New functions.
|
||||
(ppc_elf_check_relocs): Handle R_PPC_PLTREL24 with non-zero addend
|
||||
and adjust for use of plt list rather than refcount.
|
||||
(ppc_elf_gc_sweep_hook): Likewise.
|
||||
(ppc_elf_tls_optimize): Likewise.
|
||||
(ppc_elf_adjust_dynamic_symbol): Likewise.
|
||||
(allocate_dynrelocs): Likewise.
|
||||
(ppc_elf_relax_section): Likewise.
|
||||
(ppc_elf_relocate_section): Likewise. Adjust R_PPC_PLTREL24 addends
|
||||
when performing a relocatable link.
|
||||
(ppc_elf_finish_dynamic_symbol): Likewise. Write .glink stubs here..
|
||||
(ppc_elf_finish_dynamic_sections): ..rather than here. Use new
|
||||
pic resolver stub.
|
||||
|
||||
2005-05-19 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* elf.c (assign_file_positions_for_segments): Use maximum of
|
||||
|
@ -349,13 +349,15 @@ struct elf_link_hash_table
|
||||
|
||||
/* The value to use when initialising got.refcount/offset and
|
||||
plt.refcount/offset in an elf_link_hash_entry. Set to zero when
|
||||
the values are refcounts. Set to init_offset in
|
||||
size_dynamic_sections when the values may be offsets. */
|
||||
union gotplt_union init_refcount;
|
||||
the values are refcounts. Set to init_got_offset/init_plt_offset
|
||||
in size_dynamic_sections when the values may be offsets. */
|
||||
union gotplt_union init_got_refcount;
|
||||
union gotplt_union init_plt_refcount;
|
||||
|
||||
/* The value to use for got.refcount/offset and plt.refcount/offset
|
||||
when the values may be offsets. Normally (bfd_vma) -1. */
|
||||
union gotplt_union init_offset;
|
||||
union gotplt_union init_got_offset;
|
||||
union gotplt_union init_plt_offset;
|
||||
|
||||
/* The number of symbols found in the link which must be put into
|
||||
the .dynsym section. */
|
||||
|
15
bfd/elf.c
15
bfd/elf.c
@ -1414,7 +1414,8 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
|
||||
/* Set local fields. */
|
||||
ret->indx = -1;
|
||||
ret->dynindx = -1;
|
||||
ret->got = ret->plt = htab->init_refcount;
|
||||
ret->got = htab->init_got_refcount;
|
||||
ret->plt = htab->init_plt_refcount;
|
||||
memset (&ret->size, 0, (sizeof (struct elf_link_hash_entry)
|
||||
- offsetof (struct elf_link_hash_entry, size)));
|
||||
/* Assume that we have been called by a non-ELF symbol reader.
|
||||
@ -1487,7 +1488,7 @@ _bfd_elf_link_hash_hide_symbol (struct bfd_link_info *info,
|
||||
struct elf_link_hash_entry *h,
|
||||
bfd_boolean force_local)
|
||||
{
|
||||
h->plt = elf_hash_table (info)->init_offset;
|
||||
h->plt = elf_hash_table (info)->init_plt_offset;
|
||||
h->needs_plt = 0;
|
||||
if (force_local)
|
||||
{
|
||||
@ -1512,14 +1513,14 @@ _bfd_elf_link_hash_table_init
|
||||
const char *))
|
||||
{
|
||||
bfd_boolean ret;
|
||||
int can_refcount = get_elf_backend_data (abfd)->can_refcount;
|
||||
|
||||
table->dynamic_sections_created = FALSE;
|
||||
table->dynobj = NULL;
|
||||
/* Make sure can_refcount is extended to the width and signedness of
|
||||
init_refcount before we subtract one from it. */
|
||||
table->init_refcount.refcount = get_elf_backend_data (abfd)->can_refcount;
|
||||
table->init_refcount.refcount -= 1;
|
||||
table->init_offset.offset = -(bfd_vma) 1;
|
||||
table->init_got_refcount.refcount = can_refcount - 1;
|
||||
table->init_plt_refcount.refcount = can_refcount - 1;
|
||||
table->init_got_offset.offset = -(bfd_vma) 1;
|
||||
table->init_plt_offset.offset = -(bfd_vma) 1;
|
||||
/* The first dynamic symbol is a dummy. */
|
||||
table->dynsymcount = 1;
|
||||
table->dynstr = NULL;
|
||||
|
@ -1678,7 +1678,7 @@ elf32_hppa_hide_symbol (struct bfd_link_info *info,
|
||||
if (! ((struct elf32_hppa_link_hash_entry *) h)->plabel)
|
||||
{
|
||||
h->needs_plt = 0;
|
||||
h->plt = elf_hash_table (info)->init_refcount;
|
||||
h->plt = elf_hash_table (info)->init_plt_refcount;
|
||||
}
|
||||
}
|
||||
|
||||
|
890
bfd/elf32-ppc.c
890
bfd/elf32-ppc.c
File diff suppressed because it is too large
Load Diff
@ -3520,10 +3520,14 @@ ppc64_elf_link_hash_table_create (bfd *abfd)
|
||||
only care about glist, but when compiled on a 32-bit host the
|
||||
bfd_vma fields are larger. Setting the bfd_vma to zero makes
|
||||
debugger inspection of these fields look nicer. */
|
||||
htab->elf.init_refcount.refcount = 0;
|
||||
htab->elf.init_refcount.glist = NULL;
|
||||
htab->elf.init_offset.offset = 0;
|
||||
htab->elf.init_offset.glist = NULL;
|
||||
htab->elf.init_got_refcount.refcount = 0;
|
||||
htab->elf.init_got_refcount.glist = NULL;
|
||||
htab->elf.init_plt_refcount.refcount = 0;
|
||||
htab->elf.init_plt_refcount.glist = NULL;
|
||||
htab->elf.init_got_offset.offset = 0;
|
||||
htab->elf.init_got_offset.glist = NULL;
|
||||
htab->elf.init_plt_offset.offset = 0;
|
||||
htab->elf.init_plt_offset.glist = NULL;
|
||||
|
||||
return &htab->elf.root;
|
||||
}
|
||||
|
@ -2362,8 +2362,8 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
|
||||
|
||||
if (h->root.type == bfd_link_hash_warning)
|
||||
{
|
||||
h->plt = elf_hash_table (eif->info)->init_offset;
|
||||
h->got = elf_hash_table (eif->info)->init_offset;
|
||||
h->got = elf_hash_table (eif->info)->init_got_offset;
|
||||
h->plt = elf_hash_table (eif->info)->init_plt_offset;
|
||||
|
||||
/* When warning symbols are created, they **replace** the "real"
|
||||
entry in the hash table, thus we never get to see the real
|
||||
@ -2392,7 +2392,7 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
|
||||
|| (!h->ref_regular
|
||||
&& (h->u.weakdef == NULL || h->u.weakdef->dynindx == -1))))
|
||||
{
|
||||
h->plt = elf_hash_table (eif->info)->init_offset;
|
||||
h->plt = elf_hash_table (eif->info)->init_plt_offset;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -4986,7 +4986,10 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
|
||||
/* Any syms created from now on start with -1 in
|
||||
got.refcount/offset and plt.refcount/offset. */
|
||||
elf_hash_table (info)->init_refcount = elf_hash_table (info)->init_offset;
|
||||
elf_hash_table (info)->init_got_refcount
|
||||
= elf_hash_table (info)->init_got_offset;
|
||||
elf_hash_table (info)->init_plt_refcount
|
||||
= elf_hash_table (info)->init_plt_offset;
|
||||
|
||||
/* The backend may have to create some sections regardless of whether
|
||||
we're dynamic or not. */
|
||||
|
Loading…
Reference in New Issue
Block a user