diff mbox

bfd/elf64-aarch64.c: Remove dead code.

Message ID 5190D5BB.3040601@linaro.org
State Accepted
Headers show

Commit Message

Will Newton May 13, 2013, 11:59 a.m. UTC
The relocs_copied member is never assigned a non-NULL value, so
this code does not appear to be used.

2013-05-13  Will Newton  <will.newton@linaro.org>

	* bfd/elf64-aarch64.c (elf64_aarch64_link_hash_entry): Remove
	relocs_copied member.
	(elf64_aarch64_link_hash_newfunc): Remove initialization of
	relocs_copied member.
	(elf64_aarch64_copy_indirect_symbol): Remove code to copy
	relocs_copied member.
---
 bfd/elf64-aarch64.c | 55 -----------------------------------------------------
 1 file changed, 55 deletions(-)

Comments

Will Newton May 20, 2013, 8:20 a.m. UTC | #1
On 13 May 2013 12:59, Will Newton <will.newton@linaro.org> wrote:
>
> The relocs_copied member is never assigned a non-NULL value, so
> this code does not appear to be used.
>
> 2013-05-13  Will Newton  <will.newton@linaro.org>
>
>         * bfd/elf64-aarch64.c (elf64_aarch64_link_hash_entry): Remove
>         relocs_copied member.
>         (elf64_aarch64_link_hash_newfunc): Remove initialization of
>         relocs_copied member.
>         (elf64_aarch64_copy_indirect_symbol): Remove code to copy
>         relocs_copied member.
> ---
>  bfd/elf64-aarch64.c | 55 -----------------------------------------------------
>  1 file changed, 55 deletions(-)

Ping?

--
Will Newton
Toolchain Working Group, Linaro
Yufeng Zhang May 20, 2013, 12:23 p.m. UTC | #2
Looks OK to me (but I cannot approve it).

Yufeng

On 05/20/13 09:20, Will Newton wrote:
> On 13 May 2013 12:59, Will Newton<will.newton@linaro.org>  wrote:
>>
>> The relocs_copied member is never assigned a non-NULL value, so
>> this code does not appear to be used.
>>
>> 2013-05-13  Will Newton<will.newton@linaro.org>
>>
>>          * bfd/elf64-aarch64.c (elf64_aarch64_link_hash_entry): Remove
>>          relocs_copied member.
>>          (elf64_aarch64_link_hash_newfunc): Remove initialization of
>>          relocs_copied member.
>>          (elf64_aarch64_copy_indirect_symbol): Remove code to copy
>>          relocs_copied member.
>> ---
>>   bfd/elf64-aarch64.c | 55 -----------------------------------------------------
>>   1 file changed, 55 deletions(-)
>
> Ping?
>
> --
> Will Newton
> Toolchain Working Group, Linaro
>
Marcus Shawcroft May 20, 2013, 1:16 p.m. UTC | #3
OK
/Marcus

On 13 May 2013 12:59, Will Newton <will.newton@linaro.org> wrote:
>
> The relocs_copied member is never assigned a non-NULL value, so
> this code does not appear to be used.
>
> 2013-05-13  Will Newton  <will.newton@linaro.org>
>
>         * bfd/elf64-aarch64.c (elf64_aarch64_link_hash_entry): Remove
>         relocs_copied member.
>         (elf64_aarch64_link_hash_newfunc): Remove initialization of
>         relocs_copied member.
>         (elf64_aarch64_copy_indirect_symbol): Remove code to copy
>         relocs_copied member.
> ---
>  bfd/elf64-aarch64.c | 55 -----------------------------------------------------
>  1 file changed, 55 deletions(-)
>
> diff --git a/bfd/elf64-aarch64.c b/bfd/elf64-aarch64.c
> index e3cae95..4a9dda5 100644
> --- a/bfd/elf64-aarch64.c
> +++ b/bfd/elf64-aarch64.c
> @@ -1730,26 +1730,6 @@ elf64_aarch64_mkobject (bfd *abfd)
>                                   AARCH64_ELF_DATA);
>  }
>
> -/* The AArch64 linker needs to keep track of the number of relocs that it
> -   decides to copy in check_relocs for each symbol.  This is so that
> -   it can discard PC relative relocs if it doesn't need them when
> -   linking with -Bsymbolic.  We store the information in a field
> -   extending the regular ELF linker hash table.  */
> -
> -/* This structure keeps track of the number of relocs we have copied
> -   for a given symbol.  */
> -struct elf64_aarch64_relocs_copied
> -{
> -  /* Next section.  */
> -  struct elf64_aarch64_relocs_copied *next;
> -  /* A section in dynobj.  */
> -  asection *section;
> -  /* Number of relocs copied in this section.  */
> -  bfd_size_type count;
> -  /* Number of PC-relative relocs copied in this section.  */
> -  bfd_size_type pc_count;
> -};
> -
>  #define elf64_aarch64_hash_entry(ent) \
>    ((struct elf64_aarch64_link_hash_entry *)(ent))
>
> @@ -1769,9 +1749,6 @@ struct elf64_aarch64_link_hash_entry
>    /* Track dynamic relocs copied for this symbol.  */
>    struct elf_dyn_relocs *dyn_relocs;
>
> -  /* Number of PC relative relocs copied for this symbol.  */
> -  struct elf64_aarch64_relocs_copied *relocs_copied;
> -
>    /* Since PLT entries have variable size, we need to record the
>       index into .got.plt instead of recomputing it from the PLT
>       offset.  */
> @@ -1950,7 +1927,6 @@ elf64_aarch64_link_hash_newfunc (struct bfd_hash_entry *entry,
>    if (ret != NULL)
>      {
>        ret->dyn_relocs = NULL;
> -      ret->relocs_copied = NULL;
>        ret->got_type = GOT_UNKNOWN;
>        ret->plt_got_offset = (bfd_vma) - 1;
>        ret->stub_cache = NULL;
> @@ -2041,37 +2017,6 @@ elf64_aarch64_copy_indirect_symbol (struct bfd_link_info *info,
>        eind->dyn_relocs = NULL;
>      }
>
> -  if (eind->relocs_copied != NULL)
> -    {
> -      if (edir->relocs_copied != NULL)
> -       {
> -         struct elf64_aarch64_relocs_copied **pp;
> -         struct elf64_aarch64_relocs_copied *p;
> -
> -         /* Add reloc counts against the indirect sym to the direct sym
> -            list.  Merge any entries against the same section.  */
> -         for (pp = &eind->relocs_copied; (p = *pp) != NULL;)
> -           {
> -             struct elf64_aarch64_relocs_copied *q;
> -
> -             for (q = edir->relocs_copied; q != NULL; q = q->next)
> -               if (q->section == p->section)
> -                 {
> -                   q->pc_count += p->pc_count;
> -                   q->count += p->count;
> -                   *pp = p->next;
> -                   break;
> -                 }
> -             if (q == NULL)
> -               pp = &p->next;
> -           }
> -         *pp = edir->relocs_copied;
> -       }
> -
> -      edir->relocs_copied = eind->relocs_copied;
> -      eind->relocs_copied = NULL;
> -    }
> -
>    if (ind->root.type == bfd_link_hash_indirect)
>      {
>        /* Copy over PLT info.  */
> --
> 1.8.1.4
>
Will Newton May 20, 2013, 1:27 p.m. UTC | #4
Thanks, applied.

On 20 May 2013 14:16, Marcus Shawcroft <marcus.shawcroft@gmail.com> wrote:
> OK
> /Marcus
>
> On 13 May 2013 12:59, Will Newton <will.newton@linaro.org> wrote:
>>
>> The relocs_copied member is never assigned a non-NULL value, so
>> this code does not appear to be used.
>>
>> 2013-05-13  Will Newton  <will.newton@linaro.org>
>>
>>         * bfd/elf64-aarch64.c (elf64_aarch64_link_hash_entry): Remove
>>         relocs_copied member.
>>         (elf64_aarch64_link_hash_newfunc): Remove initialization of
>>         relocs_copied member.
>>         (elf64_aarch64_copy_indirect_symbol): Remove code to copy
>>         relocs_copied member.
>> ---
>>  bfd/elf64-aarch64.c | 55 -----------------------------------------------------
>>  1 file changed, 55 deletions(-)
>>
>> diff --git a/bfd/elf64-aarch64.c b/bfd/elf64-aarch64.c
>> index e3cae95..4a9dda5 100644
>> --- a/bfd/elf64-aarch64.c
>> +++ b/bfd/elf64-aarch64.c
>> @@ -1730,26 +1730,6 @@ elf64_aarch64_mkobject (bfd *abfd)
>>                                   AARCH64_ELF_DATA);
>>  }
>>
>> -/* The AArch64 linker needs to keep track of the number of relocs that it
>> -   decides to copy in check_relocs for each symbol.  This is so that
>> -   it can discard PC relative relocs if it doesn't need them when
>> -   linking with -Bsymbolic.  We store the information in a field
>> -   extending the regular ELF linker hash table.  */
>> -
>> -/* This structure keeps track of the number of relocs we have copied
>> -   for a given symbol.  */
>> -struct elf64_aarch64_relocs_copied
>> -{
>> -  /* Next section.  */
>> -  struct elf64_aarch64_relocs_copied *next;
>> -  /* A section in dynobj.  */
>> -  asection *section;
>> -  /* Number of relocs copied in this section.  */
>> -  bfd_size_type count;
>> -  /* Number of PC-relative relocs copied in this section.  */
>> -  bfd_size_type pc_count;
>> -};
>> -
>>  #define elf64_aarch64_hash_entry(ent) \
>>    ((struct elf64_aarch64_link_hash_entry *)(ent))
>>
>> @@ -1769,9 +1749,6 @@ struct elf64_aarch64_link_hash_entry
>>    /* Track dynamic relocs copied for this symbol.  */
>>    struct elf_dyn_relocs *dyn_relocs;
>>
>> -  /* Number of PC relative relocs copied for this symbol.  */
>> -  struct elf64_aarch64_relocs_copied *relocs_copied;
>> -
>>    /* Since PLT entries have variable size, we need to record the
>>       index into .got.plt instead of recomputing it from the PLT
>>       offset.  */
>> @@ -1950,7 +1927,6 @@ elf64_aarch64_link_hash_newfunc (struct bfd_hash_entry *entry,
>>    if (ret != NULL)
>>      {
>>        ret->dyn_relocs = NULL;
>> -      ret->relocs_copied = NULL;
>>        ret->got_type = GOT_UNKNOWN;
>>        ret->plt_got_offset = (bfd_vma) - 1;
>>        ret->stub_cache = NULL;
>> @@ -2041,37 +2017,6 @@ elf64_aarch64_copy_indirect_symbol (struct bfd_link_info *info,
>>        eind->dyn_relocs = NULL;
>>      }
>>
>> -  if (eind->relocs_copied != NULL)
>> -    {
>> -      if (edir->relocs_copied != NULL)
>> -       {
>> -         struct elf64_aarch64_relocs_copied **pp;
>> -         struct elf64_aarch64_relocs_copied *p;
>> -
>> -         /* Add reloc counts against the indirect sym to the direct sym
>> -            list.  Merge any entries against the same section.  */
>> -         for (pp = &eind->relocs_copied; (p = *pp) != NULL;)
>> -           {
>> -             struct elf64_aarch64_relocs_copied *q;
>> -
>> -             for (q = edir->relocs_copied; q != NULL; q = q->next)
>> -               if (q->section == p->section)
>> -                 {
>> -                   q->pc_count += p->pc_count;
>> -                   q->count += p->count;
>> -                   *pp = p->next;
>> -                   break;
>> -                 }
>> -             if (q == NULL)
>> -               pp = &p->next;
>> -           }
>> -         *pp = edir->relocs_copied;
>> -       }
>> -
>> -      edir->relocs_copied = eind->relocs_copied;
>> -      eind->relocs_copied = NULL;
>> -    }
>> -
>>    if (ind->root.type == bfd_link_hash_indirect)
>>      {
>>        /* Copy over PLT info.  */
>> --
>> 1.8.1.4
>>
diff mbox

Patch

diff --git a/bfd/elf64-aarch64.c b/bfd/elf64-aarch64.c
index e3cae95..4a9dda5 100644
--- a/bfd/elf64-aarch64.c
+++ b/bfd/elf64-aarch64.c
@@ -1730,26 +1730,6 @@  elf64_aarch64_mkobject (bfd *abfd)
 				  AARCH64_ELF_DATA);
 }

-/* The AArch64 linker needs to keep track of the number of relocs that it
-   decides to copy in check_relocs for each symbol.  This is so that
-   it can discard PC relative relocs if it doesn't need them when
-   linking with -Bsymbolic.  We store the information in a field
-   extending the regular ELF linker hash table.  */
-
-/* This structure keeps track of the number of relocs we have copied
-   for a given symbol.  */
-struct elf64_aarch64_relocs_copied
-{
-  /* Next section.  */
-  struct elf64_aarch64_relocs_copied *next;
-  /* A section in dynobj.  */
-  asection *section;
-  /* Number of relocs copied in this section.  */
-  bfd_size_type count;
-  /* Number of PC-relative relocs copied in this section.  */
-  bfd_size_type pc_count;
-};
-
 #define elf64_aarch64_hash_entry(ent) \
   ((struct elf64_aarch64_link_hash_entry *)(ent))

@@ -1769,9 +1749,6 @@  struct elf64_aarch64_link_hash_entry
   /* Track dynamic relocs copied for this symbol.  */
   struct elf_dyn_relocs *dyn_relocs;

-  /* Number of PC relative relocs copied for this symbol.  */
-  struct elf64_aarch64_relocs_copied *relocs_copied;
-
   /* Since PLT entries have variable size, we need to record the
      index into .got.plt instead of recomputing it from the PLT
      offset.  */
@@ -1950,7 +1927,6 @@  elf64_aarch64_link_hash_newfunc (struct bfd_hash_entry *entry,
   if (ret != NULL)
     {
       ret->dyn_relocs = NULL;
-      ret->relocs_copied = NULL;
       ret->got_type = GOT_UNKNOWN;
       ret->plt_got_offset = (bfd_vma) - 1;
       ret->stub_cache = NULL;
@@ -2041,37 +2017,6 @@  elf64_aarch64_copy_indirect_symbol (struct bfd_link_info *info,
       eind->dyn_relocs = NULL;
     }

-  if (eind->relocs_copied != NULL)
-    {
-      if (edir->relocs_copied != NULL)
-	{
-	  struct elf64_aarch64_relocs_copied **pp;
-	  struct elf64_aarch64_relocs_copied *p;
-
-	  /* Add reloc counts against the indirect sym to the direct sym
-	     list.  Merge any entries against the same section.  */
-	  for (pp = &eind->relocs_copied; (p = *pp) != NULL;)
-	    {
-	      struct elf64_aarch64_relocs_copied *q;
-
-	      for (q = edir->relocs_copied; q != NULL; q = q->next)
-		if (q->section == p->section)
-		  {
-		    q->pc_count += p->pc_count;
-		    q->count += p->count;
-		    *pp = p->next;
-		    break;
-		  }
-	      if (q == NULL)
-		pp = &p->next;
-	    }
-	  *pp = edir->relocs_copied;
-	}
-
-      edir->relocs_copied = eind->relocs_copied;
-      eind->relocs_copied = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect)
     {
       /* Copy over PLT info.  */