This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] ARC/BFD: Fix a build error from `index' shadowing a global declaration


On Tue, 19 Jan 2016, Nick Clifton wrote:

> The patch itself is OK, and I have checked it in - although I think that I
> messed up the names in the changelog entries.  If so please let me know and I
> will fix them.
> 
> There were two problems exposed by the patch:
> 
>   * arc_elf_copy_private_bfd_data was not calling
> _bfd_elf_copy_private_bfd_data to perform the generic parts of the ELF header
> copying operation.  (This resulted in an unexpected failure in the binutils
> testsuite).
> 
>   * You had not updated readelf to recognise the new flag bits in the ELF
> e_flags header field.
> 
> I fixed both of these problems as part of the commit.

 Another issue, perhaps system-dependent is:

cc1: warnings being treated as errors
.../bfd/elf32-arc.c: In function 'elf_arc_finish_dynamic_symbol':
.../bfd/elf32-arc.c:2195: error: declaration of 'index' shadows a global declaration
/usr/include/string.h:303: error: shadowed declaration is here
make[4]: *** [elf32-arc.lo] Error 1
make[4]: Leaving directory `.../bfd'

This is with an x86_64-linux-gnu build system and the arc-elf target.

	bfd/
	* elf32-arc.c (elf_arc_finish_dynamic_symbol): Rename `index' to
	`dynindx'.

 OK to apply?

  Maciej

binutils-arc-bfd-index.diff
Index: binutils/bfd/elf32-arc.c
===================================================================
--- binutils.orig/bfd/elf32-arc.c	2016-01-23 21:52:12.000000000 +0000
+++ binutils/bfd/elf32-arc.c	2016-01-24 00:02:24.505667025 +0000
@@ -2192,10 +2192,10 @@ elf_arc_finish_dynamic_symbol (bfd * out
 	      BFD_ASSERT (list->type != GOT_TLS_GD
 			  || list->existing_entries == MOD_AND_OFF);
 
-	      bfd_vma index = h->dynindx == -1 ? 0 : h->dynindx;
+	      bfd_vma dynindx = h->dynindx == -1 ? 0 : h->dynindx;
 	      if (e == MOD_AND_OFF || e == MOD)
 		{
-		  ADD_RELA (output_bfd, got, got_offset, index,
+		  ADD_RELA (output_bfd, got, got_offset, dynindx,
 			    R_ARC_TLS_DTPMOD, 0);
 		  ARC_DEBUG ("arc_info: TLS_DYNRELOC: type = %d, \
 GOT_OFFSET = 0x%x, GOT_VMA = 0x%x, INDEX = %d, ADDEND = 0x%x\n",
@@ -2203,7 +2203,7 @@ GOT_OFFSET = 0x%x, GOT_VMA = 0x%x, INDEX
 			     got_offset,
 			     htab->sgot->output_section->vma
 			     + htab->sgot->output_offset + got_offset,
-			     index, 0);
+			     dynindx, 0);
 		}
 	      if (e == MOD_AND_OFF || e == OFF)
 		{
@@ -2214,7 +2214,7 @@ GOT_OFFSET = 0x%x, GOT_VMA = 0x%x, INDEX
 
 		  ADD_RELA (output_bfd, got,
 			    got_offset + (e == MOD_AND_OFF ? 4 : 0),
-			    index,
+			    dynindx,
 			    (list->type == GOT_TLS_IE ?
 			     R_ARC_TLS_TPOFF : R_ARC_TLS_DTPOFF),
 			    addend);
@@ -2225,7 +2225,7 @@ GOT_OFFSET = 0x%x, GOT_VMA = 0x%x, INDEX
 			     got_offset,
 			     htab->sgot->output_section->vma
 			     + htab->sgot->output_offset + got_offset,
-			     index, addend);
+			     dynindx, addend);
 		}
 	    }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]