Re: [PATCH] alpha: allocate .got contents after relaxation has sized them

Alan Modra <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
This looks good to me.  Just one wart needs fixing.
elf64-alpha.c: In function ‘elf64_alpha_final_link’:
elf64-alpha.c:5101:28: error: declaration of ‘i’ shadows a previous local [-Werror=shadow]
 5101 |               unsigned int i;
      |                            ^
elf64-alpha.c:5045:8: note: shadowed declaration is here
 5045 |   bfd *i;
      |        ^
cc1: all warnings being treated as errors

Merge the following into your patch and it's OK to commit.  Can you do
that or do you need someone to commit it for you?

diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index dd8c8550086..bece99b1b35 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -5042,7 +5042,6 @@ elf64_alpha_final_link (bfd *abfd, struct bfd_link_info *info)
   HDRR *symhdr = &debug.symbolic_header;
   void * mdebug_handle = NULL;
   struct alpha_elf_link_hash_table * htab;
-  bfd *i;
 
   htab = alpha_elf_hash_table (info);
   if (htab == NULL)
@@ -5260,7 +5259,9 @@ elf64_alpha_final_link (bfd *abfd, struct bfd_link_info *info)
      now because the sizes are not final until relaxation has finished
      with them: a re-merge there can grow a subsection even though the
      got as a whole only shrinks.  */
-  for (i = htab->got_list; i != NULL; i = alpha_elf_tdata (i)->got_link_next)
+  for (bfd *i = htab->got_list;
+       i != NULL;
+       i = alpha_elf_tdata (i)->got_link_next)
     {
       asection *sgot = alpha_elf_tdata (i)->got;
 
@@ -5281,7 +5282,7 @@ elf64_alpha_final_link (bfd *abfd, struct bfd_link_info *info)
 
   /* The .got subsections...  */
   bfd *dynobj = elf_hash_table(info)->dynobj;
-  for (i = htab->got_list;
+  for (bfd *i = htab->got_list;
        i != NULL;
        i = alpha_elf_tdata(i)->got_link_next)
     {


-- 
Alan Modra
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.