[PATCH] S/390: Remove struct elf_s390_dyn_relocs
Andreas Krebbel
krebbel@linux.vnet.ibm.com
Tue Mar 27 08:22:00 GMT 2012
Hi,
the attached patch removes the "struct elf_s390_dyn_relocs"
declaration from the s390 bfd back-end. All elements are available in
the generic "struct elf_dyn_relocs" structure already. So there is no
point in having a platform specific variant.
I'll wait a couple of days before committing to give other a chance to
veto.
Bye,
-Andreas-
2012-03-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* elf32-s390.c (struct elf_s390_dyn_relocs): Remove.
Rename all occurrences in the file to elf_dyn_relocs.
* elf64-s390.c: Likewise.
---
bfd/elf32-s390.c | 49 +++++++++++++++----------------------------------
bfd/elf64-s390.c | 49 +++++++++++++++----------------------------------
2 files changed, 30 insertions(+), 68 deletions(-)
Index: bfd/elf32-s390.c
===================================================================
--- bfd/elf32-s390.c.orig
+++ bfd/elf32-s390.c
@@ -631,25 +631,6 @@ PLT0:
#define PLT_FIRST_ENTRY_WORD4 0x58101008
#define PLT_FIRST_ENTRY_WORD5 0x07f10000
-/* The s390 linker needs to keep track of the number of relocs that it
- decides to copy as dynamic relocs in check_relocs for each symbol.
- This is so that it can later discard them if they are found to be
- unnecessary. We store the information in a field extending the
- regular ELF linker hash table. */
-
-struct elf_s390_dyn_relocs
-{
- struct elf_s390_dyn_relocs *next;
-
- /* The input section of the reloc. */
- asection *sec;
-
- /* Total number of relocs copied for the input section. */
- bfd_size_type count;
-
- /* Number of pc-relative relocs copied for the input section. */
- bfd_size_type pc_count;
-};
/* s390 ELF linker hash entry. */
@@ -658,7 +639,7 @@ struct elf_s390_link_hash_entry
struct elf_link_hash_entry elf;
/* Track dynamic relocs copied for this symbol. */
- struct elf_s390_dyn_relocs *dyn_relocs;
+ struct elf_dyn_relocs *dyn_relocs;
/* Number of GOTPLT references for a function. */
bfd_signed_vma gotplt_refcount;
@@ -877,14 +858,14 @@ elf_s390_copy_indirect_symbol (info, dir
{
if (edir->dyn_relocs != NULL)
{
- struct elf_s390_dyn_relocs **pp;
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs **pp;
+ struct elf_dyn_relocs *p;
/* Add reloc counts against the indirect sym to the direct sym
list. Merge any entries against the same section. */
for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
{
- struct elf_s390_dyn_relocs *q;
+ struct elf_dyn_relocs *q;
for (q = edir->dyn_relocs; q != NULL; q = q->next)
if (q->sec == p->sec)
@@ -1265,8 +1246,8 @@ elf_s390_check_relocs (abfd, info, sec,
&& (h->root.type == bfd_link_hash_defweak
|| !h->def_regular)))
{
- struct elf_s390_dyn_relocs *p;
- struct elf_s390_dyn_relocs **head;
+ struct elf_dyn_relocs *p;
+ struct elf_dyn_relocs **head;
/* We must copy these reloc types into the output file.
Create a reloc section in dynobj and make room for
@@ -1308,7 +1289,7 @@ elf_s390_check_relocs (abfd, info, sec,
s = sec;
vpp = &elf_section_data (s)->local_dynrel;
- head = (struct elf_s390_dyn_relocs **) vpp;
+ head = (struct elf_dyn_relocs **) vpp;
}
p = *head;
@@ -1316,7 +1297,7 @@ elf_s390_check_relocs (abfd, info, sec,
{
bfd_size_type amt = sizeof *p;
- p = ((struct elf_s390_dyn_relocs *)
+ p = ((struct elf_dyn_relocs *)
bfd_alloc (htab->elf.dynobj, amt));
if (p == NULL)
return FALSE;
@@ -1414,8 +1395,8 @@ elf_s390_gc_sweep_hook (bfd *abfd,
if (r_symndx >= symtab_hdr->sh_info)
{
struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs **pp;
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs **pp;
+ struct elf_dyn_relocs *p;
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
while (h->root.type == bfd_link_hash_indirect
@@ -1628,7 +1609,7 @@ elf_s390_adjust_dynamic_symbol (info, h)
if (ELIMINATE_COPY_RELOCS)
{
struct elf_s390_link_hash_entry * eh;
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs *p;
eh = (struct elf_s390_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
@@ -1684,7 +1665,7 @@ allocate_dynrelocs (h, inf)
struct bfd_link_info *info;
struct elf_s390_link_hash_table *htab;
struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs *p;
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
@@ -1824,7 +1805,7 @@ allocate_dynrelocs (h, inf)
{
if (SYMBOL_CALLS_LOCAL (info, h))
{
- struct elf_s390_dyn_relocs **pp;
+ struct elf_dyn_relocs **pp;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
{
@@ -1907,7 +1888,7 @@ readonly_dynrelocs (h, inf)
PTR inf;
{
struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs *p;
eh = (struct elf_s390_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
@@ -1974,7 +1955,7 @@ elf_s390_size_dynamic_sections (output_b
for (s = ibfd->sections; s != NULL; s = s->next)
{
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs *p;
for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next)
{
Index: bfd/elf64-s390.c
===================================================================
--- bfd/elf64-s390.c.orig
+++ bfd/elf64-s390.c
@@ -586,25 +586,6 @@ elf_s390_is_local_label_name (abfd, name
#define PLT_FIRST_ENTRY_WORD6 (bfd_vma) 0x07f10700
#define PLT_FIRST_ENTRY_WORD7 (bfd_vma) 0x07000700
-/* The s390 linker needs to keep track of the number of relocs that it
- decides to copy as dynamic relocs in check_relocs for each symbol.
- This is so that it can later discard them if they are found to be
- unnecessary. We store the information in a field extending the
- regular ELF linker hash table. */
-
-struct elf_s390_dyn_relocs
-{
- struct elf_s390_dyn_relocs *next;
-
- /* The input section of the reloc. */
- asection *sec;
-
- /* Total number of relocs copied for the input section. */
- bfd_size_type count;
-
- /* Number of pc-relative relocs copied for the input section. */
- bfd_size_type pc_count;
-};
/* s390 ELF linker hash entry. */
@@ -613,7 +594,7 @@ struct elf_s390_link_hash_entry
struct elf_link_hash_entry elf;
/* Track dynamic relocs copied for this symbol. */
- struct elf_s390_dyn_relocs *dyn_relocs;
+ struct elf_dyn_relocs *dyn_relocs;
/* Number of GOTPLT references for a function. */
bfd_signed_vma gotplt_refcount;
@@ -835,14 +816,14 @@ elf_s390_copy_indirect_symbol (info, dir
{
if (edir->dyn_relocs != NULL)
{
- struct elf_s390_dyn_relocs **pp;
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs **pp;
+ struct elf_dyn_relocs *p;
/* Add reloc counts against the indirect sym to the direct sym
list. Merge any entries against the same section. */
for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
{
- struct elf_s390_dyn_relocs *q;
+ struct elf_dyn_relocs *q;
for (q = edir->dyn_relocs; q != NULL; q = q->next)
if (q->sec == p->sec)
@@ -1237,8 +1218,8 @@ elf_s390_check_relocs (bfd *abfd,
&& (h->root.type == bfd_link_hash_defweak
|| !h->def_regular)))
{
- struct elf_s390_dyn_relocs *p;
- struct elf_s390_dyn_relocs **head;
+ struct elf_dyn_relocs *p;
+ struct elf_dyn_relocs **head;
/* We must copy these reloc types into the output file.
Create a reloc section in dynobj and make room for
@@ -1280,14 +1261,14 @@ elf_s390_check_relocs (bfd *abfd,
s = sec;
vpp = &elf_section_data (s)->local_dynrel;
- head = (struct elf_s390_dyn_relocs **) vpp;
+ head = (struct elf_dyn_relocs **) vpp;
}
p = *head;
if (p == NULL || p->sec != sec)
{
bfd_size_type amt = sizeof *p;
- p = ((struct elf_s390_dyn_relocs *)
+ p = ((struct elf_dyn_relocs *)
bfd_alloc (htab->elf.dynobj, amt));
if (p == NULL)
return FALSE;
@@ -1391,8 +1372,8 @@ elf_s390_gc_sweep_hook (bfd *abfd,
if (r_symndx >= symtab_hdr->sh_info)
{
struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs **pp;
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs **pp;
+ struct elf_dyn_relocs *p;
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
while (h->root.type == bfd_link_hash_indirect
@@ -1611,7 +1592,7 @@ elf_s390_adjust_dynamic_symbol (struct b
if (ELIMINATE_COPY_RELOCS)
{
struct elf_s390_link_hash_entry * eh;
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs *p;
eh = (struct elf_s390_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
@@ -1668,7 +1649,7 @@ allocate_dynrelocs (struct elf_link_hash
struct bfd_link_info *info;
struct elf_s390_link_hash_table *htab;
struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs *p;
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
@@ -1810,7 +1791,7 @@ allocate_dynrelocs (struct elf_link_hash
{
if (SYMBOL_CALLS_LOCAL (info, h))
{
- struct elf_s390_dyn_relocs **pp;
+ struct elf_dyn_relocs **pp;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
{
@@ -1892,7 +1873,7 @@ readonly_dynrelocs (h, inf)
PTR inf;
{
struct elf_s390_link_hash_entry *eh;
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs *p;
eh = (struct elf_s390_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
@@ -1961,7 +1942,7 @@ elf_s390_size_dynamic_sections (bfd *out
for (s = ibfd->sections; s != NULL; s = s->next)
{
- struct elf_s390_dyn_relocs *p;
+ struct elf_dyn_relocs *p;
for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next)
{
More information about the Binutils
mailing list