[committed] ARM/BFD: Correct an `index' global shadowing error

Maciej W. Rozycki macro@imgtec.com
Tue Oct 18 03:45:00 GMT 2016


Fix a commit 5025eb7c0d87 ("Delete relocations associatesd with deleted 
exidx entries.") build regression:

cc1: warnings being treated as errors
.../bfd/elf32-arm.c: In function 'elf32_arm_update_relocs':
.../bfd/elf32-arm.c:14951: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:304: warning: shadowed declaration is here
make[3]: *** [elf32-arm.lo] Error 1

in a way following commit 91d6fa6a035c ("Add -Wshadow to the gcc command 
line options used when compiling the binutils.").

	bfd/
	* elf32-arm.c (elf32_arm_update_relocs): Rename `index' local
	variable to `reloc_index'.
---
 Discovered in an `--enable-targets=all' build and committed as obvious.

  Maciej

binutils-arm-bfd-reloc-index-fix.diff
Index: binutils/bfd/elf32-arm.c
===================================================================
--- binutils.orig/bfd/elf32-arm.c	2016-10-07 03:26:23.000000000 +0100
+++ binutils/bfd/elf32-arm.c	2016-10-14 18:14:30.671334055 +0100
@@ -14948,15 +14948,15 @@ elf32_arm_update_relocs (asection *o,
 		{
 		  arm_unwind_table_edit *edit_node, *edit_next;
 		  bfd_vma bias;
-		  bfd_vma index;
+		  bfd_vma reloc_index;
 
 		  (*swap_in) (abfd, erela, irela);
-		  index = (irela->r_offset - offset) / 8;
+		  reloc_index = (irela->r_offset - offset) / 8;
 
 		  bias = 0;
 		  edit_node = edit_list;
 		  for (edit_next = edit_list;
-		       edit_next && edit_next->index <= index;
+		       edit_next && edit_next->index <= reloc_index;
 		       edit_next = edit_node->next)
 		    {
 		      bias++;
@@ -14964,7 +14964,7 @@ elf32_arm_update_relocs (asection *o,
 		    }
 
 		  if (edit_node->type != DELETE_EXIDX_ENTRY
-		      || edit_node->index != index)
+		      || edit_node->index != reloc_index)
 		    {
 		      irela->r_offset -= bias * 8;
 		      irela++;



More information about the Binutils mailing list