This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] ARC/BFD: Fix a build error from `index' shadowing a global declaration
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: Cupertino Miranda <Cupertino dot Miranda at synopsys dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>, Claudiu Zissulescu <Claudiu dot Zissulescu at synopsys dot com>, Francois Bedard <Francois dot Bedard at synopsys dot com>, "Andrew Burgess (andrew dot burgess at embecosm dot com)" <andrew dot burgess at embecosm dot com>
- Date: Sun, 24 Jan 2016 00:19:46 +0000
- Subject: [PATCH] ARC/BFD: Fix a build error from `index' shadowing a global declaration
- Authentication-results: sourceware.org; auth=none
- References: <EB86EB452ADE4B44B294F7149B8A277702189BB1 at DE02WEMBXB dot internal dot synopsys dot com> <569E5695 dot 4030107 at redhat dot com>
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);
}
}