aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-12-11 13:42:17 +0000
committerNick Clifton <nickc@redhat.com>2009-12-11 13:42:17 +0000
commit91d6fa6a035cc7d0b7be5c99c194a64cb80924b0 (patch)
tree214507c313b77d619b52afcae2af0b02c9fa700b /bfd
parent2009-12-10 Michael Snyder <msnyder@vmware.com> (diff)
downloadbinutils-gdb-91d6fa6a035cc7d0b7be5c99c194a64cb80924b0.tar.gz
binutils-gdb-91d6fa6a035cc7d0b7be5c99c194a64cb80924b0.tar.bz2
binutils-gdb-91d6fa6a035cc7d0b7be5c99c194a64cb80924b0.zip
Add -Wshadow to the gcc command line options used when compiling the binutils.
Fix up all warnings generated by the addition of this switch.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog63
-rw-r--r--bfd/Makefile.in4
-rw-r--r--bfd/aout-arm.c10
-rw-r--r--bfd/aout-tic30.c6
-rw-r--r--bfd/aoutx.h10
-rw-r--r--bfd/archive.c14
-rw-r--r--bfd/coff-alpha.c6
-rw-r--r--bfd/coff-i386.c8
-rw-r--r--bfd/coff-x86_64.c8
-rw-r--r--bfd/coffgen.c10
-rwxr-xr-xbfd/configure2
-rw-r--r--bfd/doc/Makefile.in4
-rw-r--r--bfd/dwarf2.c18
-rw-r--r--bfd/ecoff.c10
-rw-r--r--bfd/elf-eh-frame.c3
-rw-r--r--bfd/elf-m10300.c6
-rw-r--r--bfd/elf.c72
-rw-r--r--bfd/elf32-arm.c85
-rw-r--r--bfd/elf32-avr.c360
-rw-r--r--bfd/elf32-bfin.c1
-rw-r--r--bfd/elf32-cr16.c5
-rw-r--r--bfd/elf32-i386.c6
-rw-r--r--bfd/elf32-ip2k.c16
-rw-r--r--bfd/elf32-lm32.c2
-rw-r--r--bfd/elf32-m68hc1x.c1
-rw-r--r--bfd/elf32-microblaze.c21
-rw-r--r--bfd/elf32-ppc.c55
-rw-r--r--bfd/elf32-rx.c20
-rw-r--r--bfd/elf32-score.c17
-rw-r--r--bfd/elf32-score7.c17
-rw-r--r--bfd/elf32-sh.c12
-rw-r--r--bfd/elf32-spu.c9
-rw-r--r--bfd/elf32-v850.c6
-rw-r--r--bfd/elf32-xtensa.c19
-rw-r--r--bfd/elf64-hppa.c13
-rw-r--r--bfd/elf64-ppc.c10
-rw-r--r--bfd/elf64-x86-64.c5
-rw-r--r--bfd/elflink.c22
-rw-r--r--bfd/elfxx-ia64.c38
-rw-r--r--bfd/elfxx-mips.c50
-rw-r--r--bfd/elfxx-sparc.c26
-rw-r--r--bfd/hash.c34
-rw-r--r--bfd/ieee.c22
-rw-r--r--bfd/libbfd.c10
-rw-r--r--bfd/mach-o.c110
-rw-r--r--bfd/merge.c14
-rw-r--r--bfd/nlm32-sparc.c24
-rw-r--r--bfd/oasys.c14
-rw-r--r--bfd/opncls.c55
-rw-r--r--bfd/pdp11.c10
-rw-r--r--bfd/peXXigen.c6
-rw-r--r--bfd/pef.c16
-rw-r--r--bfd/versados.c6
-rw-r--r--bfd/vms-gsd.c3
-rw-r--r--bfd/vms-hdr.c6
-rw-r--r--bfd/vms-tir.c10
-rw-r--r--bfd/vms.c2
-rw-r--r--bfd/warning.m42
-rw-r--r--bfd/xcofflink.c8
-rw-r--r--bfd/xsym.c106
-rw-r--r--bfd/xtensa-isa.c13
61 files changed, 777 insertions, 764 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1922f7e2e23..d11f19073c3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,66 @@
+2009-12-11 Nick Clifton <nickc@redhat.com>
+
+ * warning.m4 (GCC_WARN_CFLAGS): Add -Wshadow.
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+ * doc/Makefile.in: Regenerate.
+ * aout-arm.c: Fix shadowed variable warnings.
+ * aout-tic30.c: Likewise.
+ * aoutx.h: Likewise.
+ * archive.c: Likewise.
+ * coff-alpha.c: Likewise.
+ * coff-i386.c: Likewise.
+ * coff-x86_64.c: Likewise.
+ * coffgen.c: Likewise.
+ * dwarf2.c: Likewise.
+ * ecoff.c: Likewise.
+ * elf-eh-frame.c: Likewise.
+ * elf-m10300.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-arm.c: Likewise.
+ * elf32-avr.c: Likewise.
+ * elf32-bfin.c: Likewise.
+ * elf32-cr16.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-ip2k.c: Likewise.
+ * elf32-lm32.c: Likewise.
+ * elf32-m68hc1x.c: Likewise.
+ * elf32-microblaze.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-rx.c: Likewise.
+ * elf32-score.c: Likewise.
+ * elf32-score7.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-spu.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf32-xtensa.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elflink.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * elfxx-sparc.c: Likewise.
+ * hash.c: Likewise.
+ * ieee.c: Likewise.
+ * libbfd.c: Likewise.
+ * mach-o.c: Likewise.
+ * merge.c: Likewise.
+ * nlm32-sparc.c: Likewise.
+ * oasys.c: Likewise.
+ * opncls.c: Likewise.
+ * pdp11.c: Likewise.
+ * peXXigen.c: Likewise.
+ * pef.c: Likewise.
+ * versados.c: Likewise.
+ * vms-gsd.c: Likewise.
+ * vms-hdr.c: Likewise.
+ * vms-tir.c: Likewise.
+ * vms.c: Likewise.
+ * xcofflink.c: Likewise.
+ * xsym.c: Likewise.
+ * xtensa-isa.c: Likewise.
+
2009-12-10 Maciej W. Rozycki <macro@codesourcery.com>
* elfxx-mips.c (mips_elf_calculate_relocation): Correct handling
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 5700ed3b17c..233e87e45ab 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -49,6 +49,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -59,7 +60,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
- $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/zlib.m4 \
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c
index a533cd63073..6e99b2ef4c6 100644
--- a/bfd/aout-arm.c
+++ b/bfd/aout-arm.c
@@ -1,6 +1,6 @@
/* BFD back-end for raw ARM a.out binaries.
Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
- 2007 Free Software Foundation, Inc.
+ 2007, 2009 Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
@@ -102,7 +102,7 @@ MY (reloc_howto) (bfd *abfd,
unsigned int r_length;
unsigned int r_pcrel_done;
unsigned int r_neg;
- int index;
+ int howto_index;
*r_pcrel = 0;
if (bfd_header_big_endian (abfd))
@@ -127,11 +127,11 @@ MY (reloc_howto) (bfd *abfd,
r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
>> RELOC_STD_BITS_LENGTH_SH_LITTLE);
}
- index = r_length + 4 * r_pcrel_done + 8 * r_neg;
- if (index == 3)
+ howto_index = r_length + 4 * r_pcrel_done + 8 * r_neg;
+ if (howto_index == 3)
*r_pcrel = 1;
- return MY (howto_table) + index;
+ return MY (howto_table) + howto_index;
}
#define MY_reloc_howto(BFD, REL, IN, EX, PC) \
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index feaec8a8c7d..50d153b5c97 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -296,7 +296,7 @@ tic30_aout_reloc_howto (bfd *abfd,
{
unsigned int r_length;
unsigned int r_pcrel_done;
- int index;
+ int howto_index;
*r_pcrel = 0;
if (bfd_header_big_endian (abfd))
@@ -313,8 +313,8 @@ tic30_aout_reloc_howto (bfd *abfd,
r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) >> RELOC_STD_BITS_LENGTH_SH_LITTLE);
}
- index = r_length + 4 * r_pcrel_done;
- return tic30_aout_howto_table + index;
+ howto_index = r_length + 4 * r_pcrel_done;
+ return tic30_aout_howto_table + howto_index;
}
/* These macros will get 24-bit values from the bfd definition.
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 9521d0a8fa2..74882563bfb 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1808,7 +1808,7 @@ add_to_stringtab (bfd *abfd,
bfd_boolean copy)
{
bfd_boolean hash;
- bfd_size_type index;
+ bfd_size_type str_index;
/* An index of 0 always means the empty string. */
if (str == 0 || *str == '\0')
@@ -1820,14 +1820,14 @@ add_to_stringtab (bfd *abfd,
if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
hash = FALSE;
- index = _bfd_stringtab_add (tab, str, hash, copy);
+ str_index = _bfd_stringtab_add (tab, str, hash, copy);
- if (index != (bfd_size_type) -1)
+ if (str_index != (bfd_size_type) -1)
/* Add BYTES_IN_WORD to the return value to account for the
space taken up by the string table size. */
- index += BYTES_IN_WORD;
+ str_index += BYTES_IN_WORD;
- return index;
+ return str_index;
}
/* Write out a strtab. ABFD is already at the right location in the
diff --git a/bfd/archive.c b/bfd/archive.c
index 36252d57948..4d6746306a5 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -354,15 +354,15 @@ _bfd_find_nested_archive (bfd *arch_bfd, const char *filename)
static char *
get_extended_arelt_filename (bfd *arch, const char *name, file_ptr *originp)
{
- unsigned long index = 0;
+ unsigned long table_index = 0;
const char *endp;
/* Should extract string so that I can guarantee not to overflow into
the next region, but I'm too lazy. */
errno = 0;
/* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */
- index = strtol (name + 1, (char **) &endp, 10);
- if (errno != 0 || index >= bfd_ardata (arch)->extended_names_size)
+ table_index = strtol (name + 1, (char **) &endp, 10);
+ if (errno != 0 || table_index >= bfd_ardata (arch)->extended_names_size)
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
@@ -383,7 +383,7 @@ get_extended_arelt_filename (bfd *arch, const char *name, file_ptr *originp)
else
*originp = 0;
- return bfd_ardata (arch)->extended_names + index;
+ return bfd_ardata (arch)->extended_names + table_index;
}
/* This functions reads an arch header and returns an areltdata pointer, or
@@ -656,14 +656,14 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
}
/* Return the BFD which is referenced by the symbol in ABFD indexed by
- INDEX. INDEX should have been returned by bfd_get_next_mapent. */
+ SYM_INDEX. SYM_INDEX should have been returned by bfd_get_next_mapent. */
bfd *
-_bfd_generic_get_elt_at_index (bfd *abfd, symindex index)
+_bfd_generic_get_elt_at_index (bfd *abfd, symindex sym_index)
{
carsym *entry;
- entry = bfd_ardata (abfd)->symdefs + index;
+ entry = bfd_ardata (abfd)->symdefs + sym_index;
return _bfd_get_elt_at_filepos (abfd, entry->file_offset);
}
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 0d67264cf84..ce217f549b5 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -2272,13 +2272,11 @@ alpha_ecoff_openr_next_archived_file (archive, last_file)
/* Open the archive file given an index into the armap. */
static bfd *
-alpha_ecoff_get_elt_at_index (abfd, index)
- bfd *abfd;
- symindex index;
+alpha_ecoff_get_elt_at_index (bfd *abfd, symindex sym_index)
{
carsym *entry;
- entry = bfd_ardata (abfd)->symdefs + index;
+ entry = bfd_ardata (abfd)->symdefs + sym_index;
return alpha_ecoff_get_elt_at_filepos (abfd, entry->file_offset);
}
diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c
index e512b3fa3ee..e7c4e8a2794 100644
--- a/bfd/coff-i386.c
+++ b/bfd/coff-i386.c
@@ -532,16 +532,16 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
osect_vma = h->root.u.def.section->output_section->vma;
else
{
- asection *sec;
+ asection *s;
int i;
/* Sigh, the only way to get the section to offset against
is to find it the hard way. */
- for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
- sec = sec->next;
+ for (s = abfd->sections, i = 1; i < sym->n_scnum; i++)
+ s = s->next;
- osect_vma = sec->output_section->vma;
+ osect_vma = s->output_section->vma;
}
*addendp -= osect_vma;
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
index 08ada5a6c19..4d500fe7cd5 100644
--- a/bfd/coff-x86_64.c
+++ b/bfd/coff-x86_64.c
@@ -621,15 +621,15 @@ coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
osect_vma = h->root.u.def.section->output_section->vma;
else
{
- asection *sec;
+ asection *s;
int i;
/* Sigh, the only way to get the section to offset against
is to find it the hard way. */
- for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
- sec = sec->next;
+ for (s = abfd->sections, i = 1; i < sym->n_scnum; i++)
+ s = s->next;
- osect_vma = sec->output_section->vma;
+ osect_vma = s->output_section->vma;
}
*addendp -= osect_vma;
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 5f6921d9d91..63053a1dec9 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -307,20 +307,20 @@ coff_object_p (bfd *abfd)
/* Get the BFD section from a COFF symbol section number. */
asection *
-coff_section_from_bfd_index (bfd *abfd, int index)
+coff_section_from_bfd_index (bfd *abfd, int section_index)
{
struct bfd_section *answer = abfd->sections;
- if (index == N_ABS)
+ if (section_index == N_ABS)
return bfd_abs_section_ptr;
- if (index == N_UNDEF)
+ if (section_index == N_UNDEF)
return bfd_und_section_ptr;
- if (index == N_DEBUG)
+ if (section_index == N_DEBUG)
return bfd_abs_section_ptr;
while (answer)
{
- if (answer->target_index == index)
+ if (answer->target_index == section_index)
return answer;
answer = answer->next;
}
diff --git a/bfd/configure b/bfd/configure
index d5c34266ac3..b4bdb3cf3bf 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -12013,7 +12013,7 @@ fi
-GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow"
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index 370fcadb355..12365ab1514 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -46,6 +46,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -56,7 +57,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
- $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/zlib.m4 \
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 5d504c868cc..98e8945d28e 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1468,16 +1468,13 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
line_ptr += 2;
break;
default:
- {
- int i;
-
- /* Unknown standard opcode, ignore it. */
- for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
- {
- (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- }
- }
+ /* Unknown standard opcode, ignore it. */
+ for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
+ {
+ (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ }
+ break;
}
}
@@ -2469,7 +2466,6 @@ place_sections (bfd *abfd, struct dwarf2_debug *stash)
asection *sect;
bfd_vma last_vma = 0, last_dwarf = 0;
bfd_size_type amt;
- struct adjusted_section *p;
i = 0;
for (sect = abfd->sections; sect != NULL; sect = sect->next)
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 48ce98cc77e..472aab1dde1 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -2677,7 +2677,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
else
{
const char *name;
- unsigned int i;
+ unsigned int j;
static struct
{
const char * name;
@@ -2704,14 +2704,14 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
name = bfd_get_section_name (abfd, bfd_get_section (sym));
- for (i = 0; i < ARRAY_SIZE (section_symndx); i++)
- if (streq (name, section_symndx[i].name))
+ for (j = 0; j < ARRAY_SIZE (section_symndx); j++)
+ if (streq (name, section_symndx[j].name))
{
- in.r_symndx = section_symndx[i].r_symndx;
+ in.r_symndx = section_symndx[j].r_symndx;
break;
}
- if (i == ARRAY_SIZE (section_symndx))
+ if (j == ARRAY_SIZE (section_symndx))
abort ();
in.r_extern = 0;
}
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 5d1def943a3..37c92553ce3 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -1629,7 +1629,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
if (ent->set_loc)
{
/* Adjust DW_CFA_set_loc. */
- unsigned int cnt, width;
+ unsigned int cnt;
bfd_vma new_offset;
width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size);
@@ -1639,7 +1639,6 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
for (cnt = 1; cnt <= ent->set_loc[0]; cnt++)
{
- bfd_vma value;
buf = start + ent->set_loc[cnt];
value = read_value (abfd, buf, width,
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 794d329fe80..4a9d4b051e0 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -1274,8 +1274,6 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
&& h->plt.offset != (bfd_vma) -1)
{
- asection * splt;
-
splt = bfd_get_section_by_name (dynobj, ".plt");
value = (splt->output_section->vma
@@ -1297,8 +1295,6 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
&& h->plt.offset != (bfd_vma) -1)
{
- asection * splt;
-
splt = bfd_get_section_by_name (dynobj, ".plt");
value = (splt->output_section->vma
@@ -1321,8 +1317,6 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
case R_MN10300_GOT24:
case R_MN10300_GOT16:
{
- asection * sgot;
-
sgot = bfd_get_section_by_name (dynobj, ".got");
if (h != NULL)
diff --git a/bfd/elf.c b/bfd/elf.c
index 88ebf719266..8378481bf44 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -734,18 +734,18 @@ _bfd_elf_setup_sections (bfd *abfd)
}
else
{
- asection *link = NULL;
+ asection *linksec = NULL;
if (elfsec < elf_numsections (abfd))
{
this_hdr = elf_elfsections (abfd)[elfsec];
- link = this_hdr->bfd_section;
+ linksec = this_hdr->bfd_section;
}
/* PR 1991, 2008:
Some strip/objcopy may leave an incorrect value in
sh_link. We don't want to proceed. */
- if (link == NULL)
+ if (linksec == NULL)
{
(*_bfd_error_handler)
(_("%B: sh_link [%d] in section `%A' is incorrect"),
@@ -753,7 +753,7 @@ _bfd_elf_setup_sections (bfd *abfd)
result = FALSE;
}
- elf_linked_to_section (s) = link;
+ elf_linked_to_section (s) = linksec;
}
}
}
@@ -1961,11 +1961,11 @@ bfd_sym_from_r_symndx (struct sym_cache *cache,
section. */
asection *
-bfd_section_from_elf_index (bfd *abfd, unsigned int index)
+bfd_section_from_elf_index (bfd *abfd, unsigned int sec_index)
{
- if (index >= elf_numsections (abfd))
+ if (sec_index >= elf_numsections (abfd))
return NULL;
- return elf_elfsections (abfd)[index]->bfd_section;
+ return elf_elfsections (abfd)[sec_index]->bfd_section;
}
static const struct bfd_elf_special_section special_sections_b[] =
@@ -2266,7 +2266,7 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec)
bfd_boolean
_bfd_elf_make_section_from_phdr (bfd *abfd,
Elf_Internal_Phdr *hdr,
- int index,
+ int hdr_index,
const char *type_name)
{
asection *newsect;
@@ -2281,7 +2281,7 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
if (hdr->p_filesz > 0)
{
- sprintf (namebuf, "%s%d%s", type_name, index, split ? "a" : "");
+ sprintf (namebuf, "%s%d%s", type_name, hdr_index, split ? "a" : "");
len = strlen (namebuf) + 1;
name = (char *) bfd_alloc (abfd, len);
if (!name)
@@ -2317,7 +2317,7 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
{
bfd_vma align;
- sprintf (namebuf, "%s%d%s", type_name, index, split ? "b" : "");
+ sprintf (namebuf, "%s%d%s", type_name, hdr_index, split ? "b" : "");
len = strlen (namebuf) + 1;
name = (char *) bfd_alloc (abfd, len);
if (!name)
@@ -2356,51 +2356,51 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
}
bfd_boolean
-bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index)
+bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int hdr_index)
{
const struct elf_backend_data *bed;
switch (hdr->p_type)
{
case PT_NULL:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "null");
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "null");
case PT_LOAD:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "load");
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "load");
case PT_DYNAMIC:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "dynamic");
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "dynamic");
case PT_INTERP:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "interp");
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "interp");
case PT_NOTE:
- if (! _bfd_elf_make_section_from_phdr (abfd, hdr, index, "note"))
+ if (! _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "note"))
return FALSE;
if (! elf_read_notes (abfd, hdr->p_offset, hdr->p_filesz))
return FALSE;
return TRUE;
case PT_SHLIB:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "shlib");
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "shlib");
case PT_PHDR:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "phdr");
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "phdr");
case PT_GNU_EH_FRAME:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index,
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index,
"eh_frame_hdr");
case PT_GNU_STACK:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "stack");
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "stack");
case PT_GNU_RELRO:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "relro");
default:
/* Check for any processor-specific program segment types. */
bed = get_elf_backend_data (abfd);
- return bed->elf_backend_section_from_phdr (abfd, hdr, index, "proc");
+ return bed->elf_backend_section_from_phdr (abfd, hdr, hdr_index, "proc");
}
}
@@ -2894,10 +2894,11 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
for (sec = abfd->sections; sec; sec = sec->next)
{
- struct bfd_elf_section_data *d = elf_section_data (sec);
asection *s;
const char *name;
+ d = elf_section_data (sec);
+
i_shdrp[d->this_idx] = &d->this_hdr;
if (d->rel_idx != 0)
i_shdrp[d->rel_idx] = &d->rel_hdr;
@@ -3860,7 +3861,8 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
&& CONST_STRNEQ (s->name, ".note"))
{
asection *s2;
- unsigned count = 1;
+
+ count = 1;
amt = sizeof (struct elf_segment_map);
if (s->alignment_power == 2)
for (s2 = s; s2->next != NULL; s2 = s2->next)
@@ -3903,8 +3905,6 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
/* If there are any SHF_TLS output sections, add PT_TLS segment. */
if (tls_count > 0)
{
- int i;
-
amt = sizeof (struct elf_segment_map);
amt += (tls_count - 1) * sizeof (asection *);
m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
@@ -3916,7 +3916,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
/* Mandated PF_R. */
m->p_flags = PF_R;
m->p_flags_valid = 1;
- for (i = 0; i < tls_count; ++i)
+ for (i = 0; i < (unsigned int) tls_count; ++i)
{
BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL);
m->sections[i] = first_tls;
@@ -5042,34 +5042,34 @@ unsigned int
_bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect)
{
const struct elf_backend_data *bed;
- unsigned int index;
+ unsigned int sec_index;
if (elf_section_data (asect) != NULL
&& elf_section_data (asect)->this_idx != 0)
return elf_section_data (asect)->this_idx;
if (bfd_is_abs_section (asect))
- index = SHN_ABS;
+ sec_index = SHN_ABS;
else if (bfd_is_com_section (asect))
- index = SHN_COMMON;
+ sec_index = SHN_COMMON;
else if (bfd_is_und_section (asect))
- index = SHN_UNDEF;
+ sec_index = SHN_UNDEF;
else
- index = SHN_BAD;
+ sec_index = SHN_BAD;
bed = get_elf_backend_data (abfd);
if (bed->elf_backend_section_from_bfd_section)
{
- int retval = index;
+ int retval = sec_index;
if ((*bed->elf_backend_section_from_bfd_section) (abfd, asect, &retval))
return retval;
}
- if (index == SHN_BAD)
+ if (sec_index == SHN_BAD)
bfd_set_error (bfd_error_nonrepresentable_section);
- return index;
+ return sec_index;
}
/* Given a BFD symbol, return the index in the ELF symbol table, or -1
@@ -9011,7 +9011,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd,
if (p->addend != 0)
{
char buf[30], *a;
- int len;
+
memcpy (names, "+0x", sizeof ("+0x") - 1);
names += sizeof ("+0x") - 1;
bfd_sprintf_vma (abfd, buf, p->addend);
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 2168fc04f47..1921780edb2 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -5693,7 +5693,7 @@ static enum bfd_arm_vfp11_pipe
bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
int *numregs)
{
- enum bfd_arm_vfp11_pipe pipe = VFP11_BAD;
+ enum bfd_arm_vfp11_pipe vpipe = VFP11_BAD;
bfd_boolean is_double = ((insn & 0xf00) == 0xb00) ? 1 : 0;
if ((insn & 0x0f000e10) == 0x0e000a00) /* A data-processing insn. */
@@ -5712,7 +5712,7 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
case 1: /* fnmac[sd]. */
case 2: /* fmsc[sd]. */
case 3: /* fnmsc[sd]. */
- pipe = VFP11_FMAC;
+ vpipe = VFP11_FMAC;
bfd_arm_vfp11_write_mask (destmask, fd);
regs[0] = fd;
regs[1] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */
@@ -5724,11 +5724,11 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
case 5: /* fnmul[sd]. */
case 6: /* fadd[sd]. */
case 7: /* fsub[sd]. */
- pipe = VFP11_FMAC;
+ vpipe = VFP11_FMAC;
goto vfp_binop;
case 8: /* fdiv[sd]. */
- pipe = VFP11_DS;
+ vpipe = VFP11_DS;
vfp_binop:
bfd_arm_vfp11_write_mask (destmask, fd);
regs[0] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */
@@ -5758,14 +5758,14 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
case 27: /* ftosiz[sd]. */
/* These instructions will not bounce due to underflow. */
*numregs = 0;
- pipe = VFP11_FMAC;
+ vpipe = VFP11_FMAC;
break;
case 3: /* fsqrt[sd]. */
/* fsqrt cannot underflow, but it can (perhaps) overwrite
registers to cause the erratum in previous instructions. */
bfd_arm_vfp11_write_mask (destmask, fd);
- pipe = VFP11_DS;
+ vpipe = VFP11_DS;
break;
case 15: /* fcvt{ds,sd}. */
@@ -5780,7 +5780,7 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
*numregs = rnum;
- pipe = VFP11_FMAC;
+ vpipe = VFP11_FMAC;
}
break;
@@ -5810,7 +5810,7 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
}
}
- pipe = VFP11_LS;
+ vpipe = VFP11_LS;
}
else if ((insn & 0x0e100e00) == 0x0c100a00) /* A load insn. */
{
@@ -5845,7 +5845,7 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
return VFP11_BAD;
}
- pipe = VFP11_LS;
+ vpipe = VFP11_LS;
}
/* Single-register transfer. Note L==0. */
else if ((insn & 0x0f100e10) == 0x0e000a10)
@@ -5867,10 +5867,10 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
break;
}
- pipe = VFP11_LS;
+ vpipe = VFP11_LS;
}
- return pipe;
+ return vpipe;
}
@@ -5990,17 +5990,17 @@ bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info)
| (contents[i + 1] << 8)
| contents[i];
unsigned int writemask = 0;
- enum bfd_arm_vfp11_pipe pipe;
+ enum bfd_arm_vfp11_pipe vpipe;
switch (state)
{
case 0:
- pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs,
+ vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs,
&numregs);
/* I'm assuming the VFP11 erratum can trigger with denorm
operands on either the FMAC or the DS pipeline. This might
lead to slightly overenthusiastic veneer insertion. */
- if (pipe == VFP11_FMAC || pipe == VFP11_DS)
+ if (vpipe == VFP11_FMAC || vpipe == VFP11_DS)
{
state = use_vector ? 1 : 2;
first_fmac = i;
@@ -6011,10 +6011,10 @@ bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info)
case 1:
{
int other_regs[3], other_numregs;
- pipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
+ vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
other_regs,
&other_numregs);
- if (pipe != VFP11_BAD
+ if (vpipe != VFP11_BAD
&& bfd_arm_vfp11_antidependency (writemask, regs,
numregs))
state = 3;
@@ -6026,10 +6026,10 @@ bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info)
case 2:
{
int other_regs[3], other_numregs;
- pipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
+ vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
other_regs,
&other_numregs);
- if (pipe != VFP11_BAD
+ if (vpipe != VFP11_BAD
&& bfd_arm_vfp11_antidependency (writemask, regs,
numregs))
state = 3;
@@ -9044,9 +9044,9 @@ elf32_arm_relocate_section (bfd * output_bfd,
return TRUE;
}
-/* Add a new unwind edit to the list described by HEAD, TAIL. If INDEX is zero,
+/* Add a new unwind edit to the list described by HEAD, TAIL. If TINDEX is zero,
adds the edit to the start of the list. (The list must be built in order of
- ascending INDEX: the function's callers are primarily responsible for
+ ascending TINDEX: the function's callers are primarily responsible for
maintaining that condition). */
static void
@@ -9054,16 +9054,16 @@ add_unwind_table_edit (arm_unwind_table_edit **head,
arm_unwind_table_edit **tail,
arm_unwind_edit_type type,
asection *linked_section,
- unsigned int index)
+ unsigned int tindex)
{
arm_unwind_table_edit *new_edit = (arm_unwind_table_edit *)
xmalloc (sizeof (arm_unwind_table_edit));
new_edit->type = type;
new_edit->linked_section = linked_section;
- new_edit->index = index;
+ new_edit->index = tindex;
- if (index > 0)
+ if (tindex > 0)
{
new_edit->next = NULL;
@@ -9173,8 +9173,7 @@ elf32_arm_fix_exidx_coverage (asection **text_section_order,
/* Walk all text sections in order of increasing VMA. Eilminate duplicate
index table entries (EXIDX_CANTUNWIND and inlined unwind opcodes),
- and add EXIDX_CANTUNWIND entries for sections with no unwind table data.
- */
+ and add EXIDX_CANTUNWIND entries for sections with no unwind table data. */
for (i = 0; i < num_text_sections; i++)
{
@@ -13166,7 +13165,7 @@ make_branch_to_a8_stub (struct bfd_hash_entry *gen_entry,
bfd_vma veneered_insn_loc, veneer_entry_loc;
bfd_signed_vma branch_offset;
bfd *abfd;
- unsigned int index;
+ unsigned int target;
stub_entry = (struct elf32_arm_stub_hash_entry *) gen_entry;
data = (struct a8_branch_to_stub_data *) in_arg;
@@ -13191,7 +13190,7 @@ make_branch_to_a8_stub (struct bfd_hash_entry *gen_entry,
branch_offset = veneer_entry_loc - veneered_insn_loc - 4;
abfd = stub_entry->target_section->owner;
- index = stub_entry->target_value;
+ target = stub_entry->target_value;
/* We attempt to avoid this condition by setting stubs_always_after_branch
in elf32_arm_size_stubs if we've enabled the Cortex-A8 erratum workaround.
@@ -13252,8 +13251,8 @@ make_branch_to_a8_stub (struct bfd_hash_entry *gen_entry,
return FALSE;
}
- bfd_put_16 (abfd, (branch_insn >> 16) & 0xffff, &contents[index]);
- bfd_put_16 (abfd, branch_insn & 0xffff, &contents[index + 2]);
+ bfd_put_16 (abfd, (branch_insn >> 16) & 0xffff, &contents[target]);
+ bfd_put_16 (abfd, branch_insn & 0xffff, &contents[target + 2]);
return TRUE;
}
@@ -13295,7 +13294,7 @@ elf32_arm_write_section (bfd *output_bfd,
for (errnode = arm_data->erratumlist; errnode != 0;
errnode = errnode->next)
{
- bfd_vma index = errnode->vma - offset;
+ bfd_vma target = errnode->vma - offset;
switch (errnode->type)
{
@@ -13308,7 +13307,7 @@ elf32_arm_write_section (bfd *output_bfd,
| 0x0a000000;
/* The instruction is before the label. */
- index -= 4;
+ target -= 4;
/* Above offset included in -4 below. */
branch_to_veneer = errnode->u.b.veneer->vma
@@ -13320,10 +13319,10 @@ elf32_arm_write_section (bfd *output_bfd,
"range"), output_bfd);
insn |= (branch_to_veneer >> 2) & 0xffffff;
- contents[endianflip ^ index] = insn & 0xff;
- contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff;
- contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff;
- contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff;
+ contents[endianflip ^ target] = insn & 0xff;
+ contents[endianflip ^ (target + 1)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (target + 2)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (target + 3)] = (insn >> 24) & 0xff;
}
break;
@@ -13343,17 +13342,17 @@ elf32_arm_write_section (bfd *output_bfd,
/* Original instruction. */
insn = errnode->u.v.branch->u.b.vfp_insn;
- contents[endianflip ^ index] = insn & 0xff;
- contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff;
- contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff;
- contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff;
+ contents[endianflip ^ target] = insn & 0xff;
+ contents[endianflip ^ (target + 1)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (target + 2)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (target + 3)] = (insn >> 24) & 0xff;
/* Branch back to insn after original insn. */
insn = 0xea000000 | ((branch_from_veneer >> 2) & 0xffffff);
- contents[endianflip ^ (index + 4)] = insn & 0xff;
- contents[endianflip ^ (index + 5)] = (insn >> 8) & 0xff;
- contents[endianflip ^ (index + 6)] = (insn >> 16) & 0xff;
- contents[endianflip ^ (index + 7)] = (insn >> 24) & 0xff;
+ contents[endianflip ^ (target + 4)] = insn & 0xff;
+ contents[endianflip ^ (target + 5)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (target + 6)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (target + 7)] = (insn >> 24) & 0xff;
}
break;
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index cc063600a57..804033e6a6b 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -775,14 +775,14 @@ static bfd_vma
avr_get_stub_addr (bfd_vma srel,
struct elf32_avr_link_hash_table *htab)
{
- unsigned int index;
+ unsigned int sindex;
bfd_vma stub_sec_addr =
(htab->stub_sec->output_section->vma +
htab->stub_sec->output_offset);
- for (index = 0; index < htab->amt_max_entry_cnt; index ++)
- if (htab->amt_destination_addr[index] == srel)
- return htab->amt_stub_offsets[index] + stub_sec_addr;
+ for (sindex = 0; sindex < htab->amt_max_entry_cnt; sindex ++)
+ if (htab->amt_destination_addr[sindex] == srel)
+ return htab->amt_stub_offsets[sindex] + stub_sec_addr;
/* Return an address that could not be reached by 16 bit relocs. */
return 0x020000;
@@ -1510,7 +1510,6 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
/* A local symbol. */
- Elf_Internal_Sym *isym;
asection *sym_sec;
isym = isymbuf + ELF32_R_SYM (irel->r_info);
@@ -1703,8 +1702,8 @@ elf32_avr_relax_section (bfd *abfd,
bfd_vma symval;
if ( ELF32_R_TYPE (irel->r_info) != R_AVR_13_PCREL
- && ELF32_R_TYPE (irel->r_info) != R_AVR_7_PCREL
- && ELF32_R_TYPE (irel->r_info) != R_AVR_CALL)
+ && ELF32_R_TYPE (irel->r_info) != R_AVR_7_PCREL
+ && ELF32_R_TYPE (irel->r_info) != R_AVR_CALL)
continue;
/* Get the section contents if we haven't done so already. */
@@ -1721,7 +1720,7 @@ elf32_avr_relax_section (bfd *abfd,
}
}
- /* Read this BFD's local symbols if we haven't done so already. */
+ /* Read this BFD's local symbols if we haven't done so already. */
if (isymbuf == NULL && symtab_hdr->sh_info != 0)
{
isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
@@ -1780,9 +1779,9 @@ elf32_avr_relax_section (bfd *abfd,
the linker is run. */
switch (ELF32_R_TYPE (irel->r_info))
{
- /* Try to turn a 22-bit absolute call/jump into an 13-bit
- pc-relative rcall/rjmp. */
- case R_AVR_CALL:
+ /* Try to turn a 22-bit absolute call/jump into an 13-bit
+ pc-relative rcall/rjmp. */
+ case R_AVR_CALL:
{
bfd_vma value = symval + irel->r_addend;
bfd_vma dot, gap;
@@ -1807,27 +1806,27 @@ elf32_avr_relax_section (bfd *abfd,
vaiable avr_pc_wrap_around with the appropriate value.
I.e. 0x4000 for a 16k device. */
{
- /* Shrinking the code size makes the gaps larger in the
- case of wrap-arounds. So we use a heuristical safety
- margin to avoid that during relax the distance gets
- again too large for the short jumps. Let's assume
- a typical code-size reduction due to relax for a
- 16k device of 600 bytes. So let's use twice the
- typical value as safety margin. */
- int rgap;
- int safety_margin;
-
- int assumed_shrink = 600;
- if (avr_pc_wrap_around > 0x4000)
- assumed_shrink = 900;
-
- safety_margin = 2 * assumed_shrink;
-
- rgap = avr_relative_distance_considering_wrap_around (gap);
-
- if (rgap >= (-4092 + safety_margin)
- && rgap <= (4094 - safety_margin))
- distance_short_enough = 1;
+ /* Shrinking the code size makes the gaps larger in the
+ case of wrap-arounds. So we use a heuristical safety
+ margin to avoid that during relax the distance gets
+ again too large for the short jumps. Let's assume
+ a typical code-size reduction due to relax for a
+ 16k device of 600 bytes. So let's use twice the
+ typical value as safety margin. */
+ int rgap;
+ int safety_margin;
+
+ int assumed_shrink = 600;
+ if (avr_pc_wrap_around > 0x4000)
+ assumed_shrink = 900;
+
+ safety_margin = 2 * assumed_shrink;
+
+ rgap = avr_relative_distance_considering_wrap_around (gap);
+
+ if (rgap >= (-4092 + safety_margin)
+ && rgap <= (4094 - safety_margin))
+ distance_short_enough = 1;
}
if (distance_short_enough)
@@ -1921,9 +1920,9 @@ elf32_avr_relax_section (bfd *abfd,
if (irel->r_offset + 3 < sec->size)
{
next_insn_msb =
- bfd_get_8 (abfd, contents + irel->r_offset + 3);
+ bfd_get_8 (abfd, contents + irel->r_offset + 3);
next_insn_lsb =
- bfd_get_8 (abfd, contents + irel->r_offset + 2);
+ bfd_get_8 (abfd, contents + irel->r_offset + 2);
}
if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb))
@@ -1951,9 +1950,9 @@ elf32_avr_relax_section (bfd *abfd,
if (irel->r_offset + 5 < sec->size)
{
next_insn_msb =
- bfd_get_8 (abfd, contents + irel->r_offset + 5);
+ bfd_get_8 (abfd, contents + irel->r_offset + 5);
next_insn_lsb =
- bfd_get_8 (abfd, contents + irel->r_offset + 4);
+ bfd_get_8 (abfd, contents + irel->r_offset + 4);
}
if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb))
@@ -1988,11 +1987,11 @@ elf32_avr_relax_section (bfd *abfd,
if (irel->r_offset + insn_size + 1 < sec->size)
{
next_insn_msb =
- bfd_get_8 (abfd, contents + irel->r_offset
- + insn_size + 1);
+ bfd_get_8 (abfd, contents + irel->r_offset
+ + insn_size + 1);
next_insn_lsb =
- bfd_get_8 (abfd, contents + irel->r_offset
- + insn_size);
+ bfd_get_8 (abfd, contents + irel->r_offset
+ + insn_size);
}
if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb))
@@ -2019,9 +2018,9 @@ elf32_avr_relax_section (bfd *abfd,
unsigned char preceeding_msb;
unsigned char preceeding_lsb;
preceeding_msb =
- bfd_get_8 (abfd, contents + irel->r_offset - 1);
+ bfd_get_8 (abfd, contents + irel->r_offset - 1);
preceeding_lsb =
- bfd_get_8 (abfd, contents + irel->r_offset - 2);
+ bfd_get_8 (abfd, contents + irel->r_offset - 2);
/* sbic. */
if (0x99 == preceeding_msb)
@@ -2033,12 +2032,12 @@ elf32_avr_relax_section (bfd *abfd,
/* sbrc */
if ((0xfc == (preceeding_msb & 0xfe)
- && (0x00 == (preceeding_lsb & 0x08))))
+ && (0x00 == (preceeding_lsb & 0x08))))
there_is_preceeding_non_skip_insn = 0;
/* sbrs */
if ((0xfe == (preceeding_msb & 0xfe)
- && (0x00 == (preceeding_lsb & 0x08))))
+ && (0x00 == (preceeding_lsb & 0x08))))
there_is_preceeding_non_skip_insn = 0;
/* cpse */
@@ -2066,7 +2065,7 @@ elf32_avr_relax_section (bfd *abfd,
int deleting_ret_is_safe = 1;
unsigned int section_offset_of_ret_insn =
- irel->r_offset + insn_size;
+ irel->r_offset + insn_size;
Elf_Internal_Sym *isym, *isymend;
unsigned int sec_shndx;
@@ -2078,145 +2077,140 @@ elf32_avr_relax_section (bfd *abfd,
isymend = isym + symtab_hdr->sh_info;
/* PR 6019: There may not be any local symbols. */
for (; isym != NULL && isym < isymend; isym++)
- {
- if (isym->st_value == section_offset_of_ret_insn
- && isym->st_shndx == sec_shndx)
- {
- deleting_ret_is_safe = 0;
- if (debug_relax)
- printf ("local label prevents deletion of ret "
- "insn at address 0x%x\n",
- (int) dot + insn_size);
- }
- }
-
- /* Now check for global symbols. */
- {
- int symcount;
- struct elf_link_hash_entry **sym_hashes;
- struct elf_link_hash_entry **end_hashes;
-
- symcount = (symtab_hdr->sh_size
- / sizeof (Elf32_External_Sym)
- - symtab_hdr->sh_info);
- sym_hashes = elf_sym_hashes (abfd);
- end_hashes = sym_hashes + symcount;
- for (; sym_hashes < end_hashes; sym_hashes++)
- {
- struct elf_link_hash_entry *sym_hash =
- *sym_hashes;
- if ((sym_hash->root.type == bfd_link_hash_defined
- || sym_hash->root.type ==
+ {
+ if (isym->st_value == section_offset_of_ret_insn
+ && isym->st_shndx == sec_shndx)
+ {
+ deleting_ret_is_safe = 0;
+ if (debug_relax)
+ printf ("local label prevents deletion of ret "
+ "insn at address 0x%x\n",
+ (int) dot + insn_size);
+ }
+ }
+
+ /* Now check for global symbols. */
+ {
+ int symcount;
+ struct elf_link_hash_entry **sym_hashes;
+ struct elf_link_hash_entry **end_hashes;
+
+ symcount = (symtab_hdr->sh_size
+ / sizeof (Elf32_External_Sym)
+ - symtab_hdr->sh_info);
+ sym_hashes = elf_sym_hashes (abfd);
+ end_hashes = sym_hashes + symcount;
+ for (; sym_hashes < end_hashes; sym_hashes++)
+ {
+ struct elf_link_hash_entry *sym_hash =
+ *sym_hashes;
+ if ((sym_hash->root.type == bfd_link_hash_defined
+ || sym_hash->root.type ==
bfd_link_hash_defweak)
- && sym_hash->root.u.def.section == sec
- && sym_hash->root.u.def.value == section_offset_of_ret_insn)
- {
- deleting_ret_is_safe = 0;
- if (debug_relax)
- printf ("global label prevents deletion of "
- "ret insn at address 0x%x\n",
- (int) dot + insn_size);
- }
- }
- }
- /* Now we check for relocations pointing to ret. */
- {
- Elf_Internal_Rela *irel;
- Elf_Internal_Rela *relend;
- Elf_Internal_Shdr *symtab_hdr;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- relend = elf_section_data (sec)->relocs
- + sec->reloc_count;
-
- for (irel = elf_section_data (sec)->relocs;
- irel < relend; irel++)
- {
- bfd_vma reloc_target = 0;
- bfd_vma symval;
- Elf_Internal_Sym *isymbuf = NULL;
-
- /* Read this BFD's local symbols if we haven't
- done so already. */
- if (isymbuf == NULL && symtab_hdr->sh_info != 0)
- {
- isymbuf = (Elf_Internal_Sym *)
- symtab_hdr->contents;
- if (isymbuf == NULL)
- isymbuf = bfd_elf_get_elf_syms
- (abfd,
- symtab_hdr,
- symtab_hdr->sh_info, 0,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- break;
- }
-
- /* Get the value of the symbol referred to
- by the reloc. */
- if (ELF32_R_SYM (irel->r_info)
- < symtab_hdr->sh_info)
- {
- /* A local symbol. */
- Elf_Internal_Sym *isym;
- asection *sym_sec;
-
- isym = isymbuf
- + ELF32_R_SYM (irel->r_info);
- sym_sec = bfd_section_from_elf_index
- (abfd, isym->st_shndx);
- symval = isym->st_value;
-
- /* If the reloc is absolute, it will not
- have a symbol or section associated
- with it. */
-
- if (sym_sec)
- {
- symval +=
- sym_sec->output_section->vma
- + sym_sec->output_offset;
- reloc_target = symval + irel->r_addend;
- }
- else
- {
- reloc_target = symval + irel->r_addend;
- /* Reference symbol is absolute. */
- }
- }
- /* else ... reference symbol is extern. */
-
- if (address_of_ret == reloc_target)
- {
- deleting_ret_is_safe = 0;
- if (debug_relax)
- printf ("ret from "
- "rjmp/jmp ret sequence at address"
- " 0x%x could not be deleted. ret"
- " is target of a relocation.\n",
- (int) address_of_ret);
- }
- }
- }
-
- if (deleting_ret_is_safe)
- {
- if (debug_relax)
- printf ("unreachable ret instruction "
- "at address 0x%x deleted.\n",
- (int) dot + insn_size);
-
- /* Delete two bytes of data. */
- if (!elf32_avr_relax_delete_bytes (abfd, sec,
- irel->r_offset + insn_size, 2))
- goto error_return;
-
- /* That will change things, so, we should relax
- again. Note that this is not required, and it
- may be slow. */
- *again = TRUE;
- break;
- }
+ && sym_hash->root.u.def.section == sec
+ && sym_hash->root.u.def.value == section_offset_of_ret_insn)
+ {
+ deleting_ret_is_safe = 0;
+ if (debug_relax)
+ printf ("global label prevents deletion of "
+ "ret insn at address 0x%x\n",
+ (int) dot + insn_size);
+ }
+ }
+ }
+ /* Now we check for relocations pointing to ret. */
+ {
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+
+ relend = elf_section_data (sec)->relocs
+ + sec->reloc_count;
+
+ for (rel = elf_section_data (sec)->relocs;
+ rel < relend; rel++)
+ {
+ bfd_vma reloc_target = 0;
+
+ /* Read this BFD's local symbols if we haven't
+ done so already. */
+ if (isymbuf == NULL && symtab_hdr->sh_info != 0)
+ {
+ isymbuf = (Elf_Internal_Sym *)
+ symtab_hdr->contents;
+ if (isymbuf == NULL)
+ isymbuf = bfd_elf_get_elf_syms
+ (abfd,
+ symtab_hdr,
+ symtab_hdr->sh_info, 0,
+ NULL, NULL, NULL);
+ if (isymbuf == NULL)
+ break;
+ }
+
+ /* Get the value of the symbol referred to
+ by the reloc. */
+ if (ELF32_R_SYM (rel->r_info)
+ < symtab_hdr->sh_info)
+ {
+ /* A local symbol. */
+ asection *sym_sec;
+
+ isym = isymbuf
+ + ELF32_R_SYM (rel->r_info);
+ sym_sec = bfd_section_from_elf_index
+ (abfd, isym->st_shndx);
+ symval = isym->st_value;
+
+ /* If the reloc is absolute, it will not
+ have a symbol or section associated
+ with it. */
+
+ if (sym_sec)
+ {
+ symval +=
+ sym_sec->output_section->vma
+ + sym_sec->output_offset;
+ reloc_target = symval + rel->r_addend;
+ }
+ else
+ {
+ reloc_target = symval + rel->r_addend;
+ /* Reference symbol is absolute. */
+ }
+ }
+ /* else ... reference symbol is extern. */
+
+ if (address_of_ret == reloc_target)
+ {
+ deleting_ret_is_safe = 0;
+ if (debug_relax)
+ printf ("ret from "
+ "rjmp/jmp ret sequence at address"
+ " 0x%x could not be deleted. ret"
+ " is target of a relocation.\n",
+ (int) address_of_ret);
+ }
+ }
+ }
+
+ if (deleting_ret_is_safe)
+ {
+ if (debug_relax)
+ printf ("unreachable ret instruction "
+ "at address 0x%x deleted.\n",
+ (int) dot + insn_size);
+
+ /* Delete two bytes of data. */
+ if (!elf32_avr_relax_delete_bytes (abfd, sec,
+ irel->r_offset + insn_size, 2))
+ goto error_return;
+
+ /* That will change things, so, we should relax
+ again. Note that this is not required, and it
+ may be slow. */
+ *again = TRUE;
+ break;
+ }
}
}
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index a767749012f..3f9483ac2a6 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -3481,7 +3481,6 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info)
{
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
.plt section. */
- struct elf_link_hash_entry *h;
struct bfd_link_hash_entry *bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index f82d1e902d7..9a4e2a9baee 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -889,17 +889,12 @@ cr16_elf_final_link_relocate (reloc_howto_type *howto,
unsigned short r_type = howto->type;
bfd_byte *hit_data = contents + offset;
bfd_vma reloc_bits, check, Rvalue1;
-
bfd * dynobj;
bfd_vma * local_got_offsets;
- asection * sgot;
dynobj = elf_hash_table (info)->dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
- sgot = NULL;
-
-
switch (r_type)
{
case R_CR16_IMM4:
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 016e04611af..61e3097200d 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1669,7 +1669,6 @@ elf_i386_check_relocs (bfd *abfd,
easily. Oh well. */
void **vpp;
asection *s;
- Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache,
abfd, r_symndx);
@@ -2665,7 +2664,7 @@ elf_i386_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
Elf_Internal_Shdr *hdr,
asection *sec)
{
- register const char *name;
+ const char *name;
name = bfd_get_section_name (abfd, sec);
@@ -3610,7 +3609,7 @@ elf_i386_relocate_section (bfd *output_bfd,
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
- int dr_type, indx;
+ int dr_type;
asection *sreloc;
if (htab->elf.srelgot == NULL)
@@ -3939,7 +3938,6 @@ elf_i386_relocate_section (bfd *output_bfd,
Elf_Internal_Rela outrel;
asection *sreloc;
bfd_byte *loc;
- int indx;
outrel.r_offset = rel->r_offset
+ input_section->output_section->vma
diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c
index 96d0cd5ba90..40c2205d38f 100644
--- a/bfd/elf32-ip2k.c
+++ b/bfd/elf32-ip2k.c
@@ -1,5 +1,5 @@
/* Ubicom IP2xxx specific support for 32-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -347,7 +347,7 @@ ip2k_is_switch_table_128 (bfd *abfd ATTRIBUTE_UNUSED,
bfd_byte *contents)
{
bfd_byte code[4];
- int index = 0;
+ int table_index = 0;
/* Check current page-jmp. */
if (addr + 4 > sec->size)
@@ -369,13 +369,13 @@ ip2k_is_switch_table_128 (bfd *abfd ATTRIBUTE_UNUSED,
ip2k_get_mem (abfd, contents + addr - 4, 4, code);
if ((IS_ADD_W_WREG_OPCODE (code + 0))
&& (IS_ADD_PCL_W_OPCODE (code + 2)))
- return index;
+ return table_index;
if ((! IS_PAGE_OPCODE (code + 0))
|| (! IS_JMP_OPCODE (code + 2)))
return -1;
- index++;
+ table_index++;
addr -= 4;
}
}
@@ -427,7 +427,7 @@ ip2k_is_switch_table_256 (bfd *abfd ATTRIBUTE_UNUSED,
bfd_byte *contents)
{
bfd_byte code[16];
- int index = 0;
+ int table_index = 0;
/* Check current page-jmp. */
if (addr + 4 > sec->size)
@@ -454,7 +454,7 @@ ip2k_is_switch_table_256 (bfd *abfd ATTRIBUTE_UNUSED,
&& (IS_INC_1SP_OPCODE (code + 10))
&& (IS_PAGE_OPCODE (code + 12))
&& (IS_JMP_OPCODE (code + 14)))
- return index;
+ return table_index;
if ((IS_ADD_W_WREG_OPCODE (code + 2))
&& (IS_SNC_OPCODE (code + 4))
@@ -463,13 +463,13 @@ ip2k_is_switch_table_256 (bfd *abfd ATTRIBUTE_UNUSED,
&& (IS_SNC_OPCODE (code + 10))
&& (IS_INC_1SP_OPCODE (code + 12))
&& (IS_JMP_OPCODE (code + 14)))
- return index;
+ return table_index;
if ((! IS_PAGE_OPCODE (code + 0))
|| (! IS_JMP_OPCODE (code + 2)))
return -1;
- index++;
+ table_index++;
addr -= 4;
}
}
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index 7053568721e..6184f49fcda 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -1130,10 +1130,8 @@ lm32_elf_relocate_section (bfd *output_bfd,
if (r != bfd_reloc_ok)
{
- const char *name;
const char *msg = NULL;
arelent bfd_reloc;
- reloc_howto_type *howto;
lm32_info_to_howto_rela (input_bfd, &bfd_reloc, rel);
howto = bfd_reloc.howto;
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index 544db35b7d8..db63856d43d 100644
--- a/bfd/elf32-m68hc1x.c
+++ b/bfd/elf32-m68hc1x.c
@@ -379,7 +379,6 @@ elf32_m68hc11_size_stubs (bfd *output_bfd, bfd *stub_bfd,
input_bfd = input_bfd->link_next, bfd_indx++)
{
Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Sym *local_syms;
struct elf_link_hash_entry ** sym_hashes;
sym_hashes = elf_sym_hashes (input_bfd);
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index c975e76800f..4c5a38da751 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -1284,7 +1284,7 @@ microblaze_elf_relax_section (bfd *abfd,
bfd_byte *free_contents = NULL;
int rel_count;
unsigned int shndx;
- int i, index;
+ int i, sym_index;
asection *o;
struct elf_link_hash_entry *sym_hash;
Elf_Internal_Sym *isymbuf, *isymend;
@@ -1319,8 +1319,7 @@ microblaze_elf_relax_section (bfd *abfd,
0, NULL, NULL, NULL);
BFD_ASSERT (isymbuf != NULL);
- internal_relocs = _bfd_elf_link_read_relocs
- (abfd, sec, NULL, NULL, link_info->keep_memory);
+ internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory);
if (internal_relocs == NULL)
goto error_return;
if (! link_info->keep_memory)
@@ -1364,7 +1363,6 @@ microblaze_elf_relax_section (bfd *abfd,
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
/* A local symbol. */
- Elf_Internal_Sym *isym;
asection *sym_sec;
isym = isymbuf + ELF32_R_SYM (irel->r_info);
@@ -1464,7 +1462,6 @@ microblaze_elf_relax_section (bfd *abfd,
range to be adjusted, and hence must be changed. */
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
- Elf_Internal_Sym *isym;
isym = isymbuf + ELF32_R_SYM (irel->r_info);
/* Only handle relocs against .text. */
if (isym->st_shndx == shndx
@@ -1507,7 +1504,7 @@ microblaze_elf_relax_section (bfd *abfd,
/* Look through all other sections. */
for (o = abfd->sections; o != NULL; o = o->next)
{
- Elf_Internal_Rela *internal_relocs;
+ Elf_Internal_Rela *irelocs;
Elf_Internal_Rela *irelscan, *irelscanend;
bfd_byte *ocontents;
@@ -1519,13 +1516,13 @@ microblaze_elf_relax_section (bfd *abfd,
/* We always cache the relocs. Perhaps, if info->keep_memory is
FALSE, we should free them, if we are permitted to. */
- internal_relocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, TRUE);
- if (internal_relocs == NULL)
+ irelocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, TRUE);
+ if (irelocs == NULL)
goto error_return;
ocontents = NULL;
- irelscanend = internal_relocs + o->reloc_count;
- for (irelscan = internal_relocs; irelscan < irelscanend; irelscan++)
+ irelscanend = irelocs + o->reloc_count;
+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
{
if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
{
@@ -1745,9 +1742,9 @@ microblaze_elf_relax_section (bfd *abfd,
/* Now adjust the global symbols defined in this section. */
isym = isymbuf + symtab_hdr->sh_info;
isymend = isymbuf + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym));
- for (index = 0; isym < isymend; isym++, index++)
+ for (sym_index = 0; isym < isymend; isym++, sym_index++)
{
- sym_hash = elf_sym_hashes (abfd)[index];
+ sym_hash = elf_sym_hashes (abfd)[sym_index];
if (isym->st_shndx == shndx
&& (sym_hash->root.type == bfd_link_hash_defined
|| sym_hash->root.type == bfd_link_hash_defweak)
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 976dd3700d7..e863f7e3402 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -3961,7 +3961,7 @@ ppc_elf_check_relocs (bfd *abfd,
|| !h->def_regular)))
{
struct ppc_elf_dyn_relocs *p;
- struct ppc_elf_dyn_relocs **head;
+ struct ppc_elf_dyn_relocs **rel_head;
#ifdef DEBUG
fprintf (stderr,
@@ -3986,7 +3986,7 @@ ppc_elf_check_relocs (bfd *abfd,
relocations we need for this symbol. */
if (h != NULL)
{
- head = &ppc_elf_hash_entry (h)->dyn_relocs;
+ rel_head = &ppc_elf_hash_entry (h)->dyn_relocs;
}
else
{
@@ -4007,17 +4007,17 @@ ppc_elf_check_relocs (bfd *abfd,
s = sec;
vpp = &elf_section_data (s)->local_dynrel;
- head = (struct ppc_elf_dyn_relocs **) vpp;
+ rel_head = (struct ppc_elf_dyn_relocs **) vpp;
}
- p = *head;
+ p = *rel_head;
if (p == NULL || p->sec != sec)
{
p = bfd_alloc (htab->elf.dynobj, sizeof *p);
if (p == NULL)
return FALSE;
- p->next = *head;
- *head = p;
+ p->next = *rel_head;
+ *rel_head = p;
p->sec = sec;
p->count = 0;
p->pc_count = 0;
@@ -5619,6 +5619,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
local_plt = (struct plt_entry **) end_local_got;
end_local_plt = local_plt + locsymcount;
lgot_masks = (char *) end_local_plt;
+
for (; local_got < end_local_got; ++local_got, ++lgot_masks)
if (*local_got > 0)
{
@@ -5662,7 +5663,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
for (ent = *local_plt; ent != NULL; ent = ent->next)
if (ent->plt.refcount > 0)
{
- asection *s = htab->iplt;
+ s = htab->iplt;
if (!doneone)
{
@@ -6018,7 +6019,7 @@ ppc_elf_relax_section (bfd *abfd,
for (irel = internal_relocs; irel < irelend; irel++)
{
unsigned long r_type = ELF32_R_TYPE (irel->r_info);
- bfd_vma reladdr, toff, roff;
+ bfd_vma toff, roff;
asection *tsec;
struct one_fixup *f;
size_t insn_offset = 0;
@@ -6202,7 +6203,6 @@ ppc_elf_relax_section (bfd *abfd,
continue;
roff = irel->r_offset;
- reladdr = isec->output_section->vma + isec->output_offset + roff;
/* If the branch is in range, no need to do anything. */
if (tsec != bfd_und_section_ptr
@@ -6698,7 +6698,6 @@ ppc_elf_relocate_section (bfd *output_bfd,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
Elf_Internal_Rela outrel;
- bfd_byte *loc;
asection *got2, *sreloc = NULL;
bfd_vma *local_got_offsets;
bfd_boolean ret = TRUE;
@@ -6742,7 +6741,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
reloc_howto_type *howto;
unsigned long r_symndx;
bfd_vma relocation;
- bfd_vma branch_bit, insn, from;
+ bfd_vma branch_bit, from;
bfd_boolean unresolved_reloc;
bfd_boolean warned;
unsigned int tls_type, tls_mask, tls_gd;
@@ -6840,6 +6839,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
&& (tls_mask & TLS_TPREL) == 0)
{
bfd_vma insn;
+
insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset);
insn &= 31 << 21;
insn |= 0x3c020000; /* addis 0,2,0 */
@@ -7055,20 +7055,24 @@ ppc_elf_relocate_section (bfd *output_bfd,
/* Branch not taken prediction relocations. */
case R_PPC_ADDR14_BRNTAKEN:
case R_PPC_REL14_BRNTAKEN:
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
- insn &= ~BRANCH_PREDICT_BIT;
- insn |= branch_bit;
+ {
+ bfd_vma insn;
- from = (rel->r_offset
- + input_section->output_offset
- + input_section->output_section->vma);
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ insn &= ~BRANCH_PREDICT_BIT;
+ insn |= branch_bit;
- /* Invert 'y' bit if not the default. */
- if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
- insn ^= BRANCH_PREDICT_BIT;
+ from = (rel->r_offset
+ + input_section->output_offset
+ + input_section->output_section->vma);
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- break;
+ /* Invert 'y' bit if not the default. */
+ if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
+ insn ^= BRANCH_PREDICT_BIT;
+
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ break;
+ }
}
ifunc = NULL;
@@ -7299,6 +7303,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|| h->root.type != bfd_link_hash_undefweak))
{
asection *rsec = htab->relgot;
+ bfd_byte * loc;
outrel.r_offset = (htab->got->output_section->vma
+ htab->got->output_offset
@@ -7530,7 +7535,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
&& !h->def_regular))
{
int skip;
-
+ bfd_byte * loc;
#ifdef DEBUG
fprintf (stderr, "ppc_elf_relocate_section needs to "
"create relocation for %s\n",
@@ -7920,7 +7925,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
}
if (r_type == R_PPC_EMB_SDA21)
- { /* fill in register field */
+ {
+ bfd_vma insn; /* Fill in register field. */
+
insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index dadd4070347..cab7a145ac9 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -303,7 +303,7 @@ rx_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED,
static bfd_vma
get_symbol_value (const char * name,
- bfd_reloc_status_type * stat,
+ bfd_reloc_status_type * status,
struct bfd_link_info * info,
bfd * input_bfd,
asection * input_section,
@@ -317,7 +317,7 @@ get_symbol_value (const char * name,
if (h == NULL
|| (h->type != bfd_link_hash_defined
&& h->type != bfd_link_hash_defweak))
- * stat = info->callbacks->undefined_symbol
+ * status = info->callbacks->undefined_symbol
(info, name, input_bfd, input_section, offset, TRUE);
else
value = (h->u.def.value
@@ -328,7 +328,7 @@ get_symbol_value (const char * name,
}
static bfd_vma
-get_gp (bfd_reloc_status_type * stat,
+get_gp (bfd_reloc_status_type * status,
struct bfd_link_info * info,
bfd * abfd,
asection * sec,
@@ -339,14 +339,14 @@ get_gp (bfd_reloc_status_type * stat,
if (!cached)
{
- cached_value = get_symbol_value ("__gp", stat, info, abfd, sec, offset);
+ cached_value = get_symbol_value ("__gp", status, info, abfd, sec, offset);
cached = TRUE;
}
return cached_value;
}
static bfd_vma
-get_romstart (bfd_reloc_status_type * stat,
+get_romstart (bfd_reloc_status_type * status,
struct bfd_link_info * info,
bfd * abfd,
asection * sec,
@@ -357,14 +357,14 @@ get_romstart (bfd_reloc_status_type * stat,
if (!cached)
{
- cached_value = get_symbol_value ("_start", stat, info, abfd, sec, offset);
+ cached_value = get_symbol_value ("_start", status, info, abfd, sec, offset);
cached = TRUE;
}
return cached_value;
}
static bfd_vma
-get_ramstart (bfd_reloc_status_type * stat,
+get_ramstart (bfd_reloc_status_type * status,
struct bfd_link_info * info,
bfd * abfd,
asection * sec,
@@ -375,7 +375,7 @@ get_ramstart (bfd_reloc_status_type * stat,
if (!cached)
{
- cached_value = get_symbol_value ("__datastart", stat, info, abfd, sec, offset);
+ cached_value = get_symbol_value ("__datastart", status, info, abfd, sec, offset);
cached = TRUE;
}
return cached_value;
@@ -2062,9 +2062,9 @@ elf32_rx_relax_section (bfd * abfd,
else if (code == 1 && symval/scale <= 31
/* Decodable bits. */
&& (insn[0] & 0xcc) == 0xcc
- /* width */
+ /* Width. */
&& (insn[0] & 0x30) != 3
- /* register MSBs */
+ /* Register MSBs. */
&& (insn[1] & 0x88) == 0x00)
{
int newrel = 0;
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
index a3308286d55..15612d37954 100644
--- a/bfd/elf32-score.c
+++ b/bfd/elf32-score.c
@@ -1755,7 +1755,7 @@ score_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
static bfd_vma
score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
{
- bfd_vma index;
+ bfd_vma got_index;
asection *sgot;
struct score_got_info *g;
long global_got_dynindx = 0;
@@ -1769,16 +1769,19 @@ score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
indices into the GOT. That makes it easy to calculate the GOT
offset. */
BFD_ASSERT (h->dynindx >= global_got_dynindx);
- index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
- BFD_ASSERT (index < sgot->size);
+ got_index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
+ BFD_ASSERT (got_index < sgot->size);
- return index;
+ return got_index;
}
/* Returns the offset for the entry at the INDEXth position in the GOT. */
+
static bfd_vma
-score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
- bfd *input_bfd ATTRIBUTE_UNUSED, bfd_vma index)
+score_elf_got_offset_from_index (bfd *dynobj,
+ bfd *output_bfd,
+ bfd *input_bfd ATTRIBUTE_UNUSED,
+ bfd_vma got_index)
{
asection *sgot;
bfd_vma gp;
@@ -1787,7 +1790,7 @@ score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
g = score_elf_got_info (dynobj, &sgot);
gp = _bfd_get_gp_value (output_bfd);
- return sgot->output_section->vma + sgot->output_offset + index - gp;
+ return sgot->output_section->vma + sgot->output_offset + got_index - gp;
}
/* Follow indirect and warning hash entries so that each got entry
diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c
index af37817dde3..bb74f28c2f5 100644
--- a/bfd/elf32-score7.c
+++ b/bfd/elf32-score7.c
@@ -1650,7 +1650,7 @@ score_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
static bfd_vma
score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
{
- bfd_vma index;
+ bfd_vma got_index;
asection *sgot;
struct score_got_info *g;
long global_got_dynindx = 0;
@@ -1664,17 +1664,19 @@ score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
indices into the GOT. That makes it easy to calculate the GOT
offset. */
BFD_ASSERT (h->dynindx >= global_got_dynindx);
- index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
- BFD_ASSERT (index < sgot->size);
+ got_index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
+ BFD_ASSERT (got_index < sgot->size);
- return index;
+ return got_index;
}
/* Returns the offset for the entry at the INDEXth position in the GOT. */
static bfd_vma
-score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
- bfd *input_bfd ATTRIBUTE_UNUSED, bfd_vma index)
+score_elf_got_offset_from_index (bfd *dynobj,
+ bfd *output_bfd,
+ bfd *input_bfd ATTRIBUTE_UNUSED,
+ bfd_vma got_index)
{
asection *sgot;
bfd_vma gp;
@@ -1683,7 +1685,7 @@ score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
g = score_elf_got_info (dynobj, &sgot);
gp = _bfd_get_gp_value (output_bfd);
- return sgot->output_section->vma + sgot->output_offset + index - gp;
+ return sgot->output_section->vma + sgot->output_offset + got_index - gp;
}
/* Follow indirect and warning hash entries so that each got entry
@@ -2512,7 +2514,6 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd,
if (r_type == R_SCORE_GOT15)
{
- const Elf_Internal_Rela *relend;
const Elf_Internal_Rela *lo16_rel;
const struct elf_backend_data *bed;
bfd_vma lo_addend = 0, lo_value = 0;
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 7b81aab7c94..b16e3e1dd7b 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -2089,9 +2089,9 @@ get_plt_index (const struct elf_sh_plt_info *info, bfd_vma offset)
/* Do the inverse operation. */
static bfd_vma
-get_plt_offset (const struct elf_sh_plt_info *info, bfd_vma index)
+get_plt_offset (const struct elf_sh_plt_info *info, bfd_vma plt_index)
{
- return info->plt0_entry_size + (index * info->symbol_entry_size);
+ return info->plt0_entry_size + (plt_index * info->symbol_entry_size);
}
/* The sh linker needs to keep track of the number of relocs that it
@@ -2316,7 +2316,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
struct elf_sh_link_hash_table *htab;
flagword flags, pltflags;
- register asection *s;
+ asection *s;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
int ptralign = 0;
@@ -4043,7 +4043,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
}
else
{
- int index;
+ int target;
/* IE->LE transition:
mov.l 1f,r0; stc gbr,rN; mov.l @(r0,r12),rM;
@@ -4065,12 +4065,12 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
}
BFD_ASSERT ((insn & 0xff00) == 0xd000);
- index = insn & 0x00ff;
+ target = insn & 0x00ff;
insn = bfd_get_16 (input_bfd, contents + offset + 2);
BFD_ASSERT ((insn & 0xf0ff) == 0x0012);
insn = bfd_get_16 (input_bfd, contents + offset + 4);
BFD_ASSERT ((insn & 0xf0ff) == 0x00ce);
- insn = 0xd000 | (insn & 0x0f00) | index;
+ insn = 0xd000 | (insn & 0x0f00) | target;
bfd_put_16 (output_bfd, insn, contents + offset + 0);
bfd_put_16 (output_bfd, 0x0009, contents + offset + 4);
}
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 250beef3d0f..c6139c9dabf 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -4401,7 +4401,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
struct call_info *call, *pasty;
struct _spu_elf_section_data *sec_data;
struct spu_elf_stack_info *sinfo;
- int k;
+ unsigned int k;
/* See whether we can add this section to the current
overlay without overflowing our overlay buffer. */
@@ -4421,7 +4421,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
{
/* Pasted sections must stay together, so add their
sizes too. */
- struct call_info *pasty = find_pasted_call (sec);
+ pasty = find_pasted_call (sec);
while (pasty != NULL)
{
struct function_info *call_fun = pasty->fun;
@@ -4448,7 +4448,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
pasty = NULL;
sec_data = spu_elf_section_data (sec);
sinfo = sec_data->u.i.stack_info;
- for (k = 0; k < sinfo->num_fun; ++k)
+ for (k = 0; k < (unsigned) sinfo->num_fun; ++k)
for (call = sinfo->fun[k].call_list; call; call = call->next)
if (call->is_pasted)
{
@@ -4478,7 +4478,6 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
num_stubs = 0;
for (call = dummy_caller.call_list; call; call = call->next)
{
- unsigned int k;
unsigned int stub_delta = 1;
if (htab->params->ovly_flavour == ovly_soft_icache)
@@ -5253,7 +5252,7 @@ spu_elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
if ((*p)->p_type == PT_LOAD && (*p)->count == 1
&& spu_elf_section_data ((*p)->sections[0])->u.o.ovl_index != 0)
{
- struct elf_segment_map *m = *p;
+ m = *p;
*p = m->next;
*p_overlay = m;
p_overlay = &m->next;
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index 922698f61a6..2965e290dd6 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -2188,7 +2188,7 @@ v850_elf_relax_delete_bytes (bfd *abfd,
Elf32_External_Sym *extsyms;
Elf32_External_Sym *esym;
Elf32_External_Sym *esymend;
- int index;
+ int sym_index;
unsigned int sec_shndx;
bfd_byte *contents;
Elf_Internal_Rela *irel;
@@ -2336,12 +2336,12 @@ v850_elf_relax_delete_bytes (bfd *abfd,
esym = extsyms + symtab_hdr->sh_info;
esymend = extsyms + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym));
- for (index = 0; esym < esymend; esym ++, index ++)
+ for (sym_index = 0; esym < esymend; esym ++, sym_index ++)
{
Elf_Internal_Sym isym;
bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym);
- sym_hash = elf_sym_hashes (abfd) [index];
+ sym_hash = elf_sym_hashes (abfd) [sym_index];
if (isym.st_shndx == sec_shndx
&& ((sym_hash)->root.type == bfd_link_hash_defined
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 9f961dcde23..1740c355a66 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -1943,9 +1943,8 @@ elf_xtensa_do_reloc (reloc_howto_type *howto,
if (!is_weak_undef)
{
/* Check for windowed CALL across a 1GB boundary. */
- xtensa_opcode opcode =
- get_expanded_call_opcode (contents + address,
- input_size - address, 0);
+ opcode = get_expanded_call_opcode (contents + address,
+ input_size - address, 0);
if (is_windowed_call_opcode (opcode))
{
if ((self_address >> CALL_SEGMENT_BITS)
@@ -2665,7 +2664,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
if (r_type == R_XTENSA_ASM_SIMPLIFY)
{
- char *error_message = NULL;
+ error_message = NULL;
/* Convert ASM_SIMPLIFY into the simpler relocation
so that they never escape a relaxing link. */
r = contract_asm_expansion (contents, input_size, rel,
@@ -3166,18 +3165,18 @@ elf_xtensa_combine_prop_entries (bfd *output_bfd,
for (n = 0; n < num; n++)
{
- bfd_boolean remove = FALSE;
+ bfd_boolean remove_entry = FALSE;
if (table[n].size == 0)
- remove = TRUE;
- else if (n > 0 &&
- (table[n-1].address + table[n-1].size == table[n].address))
+ remove_entry = TRUE;
+ else if (n > 0
+ && (table[n-1].address + table[n-1].size == table[n].address))
{
table[n-1].size += table[n].size;
- remove = TRUE;
+ remove_entry = TRUE;
}
- if (remove)
+ if (remove_entry)
{
for (m = n; m < num - 1; m++)
{
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 637d232fe8c..06a3ae4d129 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -2740,15 +2740,16 @@ elf64_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym,
}
/* Support HP specific sections for core files. */
+
static bfd_boolean
-elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
+elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int sec_index,
const char *typename)
{
if (hdr->p_type == PT_HP_CORE_KERNEL)
{
asection *sect;
- if (!_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename))
+ if (!_bfd_elf_make_section_from_phdr (abfd, hdr, sec_index, typename))
return FALSE;
sect = bfd_make_section_anyway (abfd, ".kernel");
@@ -2771,7 +2772,7 @@ elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
elf_tdata (abfd)->core_signal = sig;
- if (!_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename))
+ if (!_bfd_elf_make_section_from_phdr (abfd, hdr, sec_index, typename))
return FALSE;
/* GDB uses the ".reg" section to read register contents. */
@@ -2784,7 +2785,7 @@ elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
|| hdr->p_type == PT_HP_CORE_MMF)
hdr->p_type = PT_LOAD;
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename);
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, sec_index, typename);
}
/* Hook called by the linker routine which adds symbols from an object
@@ -2800,9 +2801,9 @@ elf_hppa_add_symbol_hook (bfd *abfd,
asection **secp,
bfd_vma *valp)
{
- unsigned int index = sym->st_shndx;
+ unsigned int sec_index = sym->st_shndx;
- switch (index)
+ switch (sec_index)
{
case SHN_PARISC_ANSI_COMMON:
*secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 94f89c57bec..a181c282763 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -5401,8 +5401,6 @@ opd_entry_value (asection *opd_sec,
/* No relocs implies we are linking a --just-symbols object. */
if (opd_sec->reloc_count == 0)
{
- bfd_vma val;
-
if (!bfd_get_section_contents (opd_bfd, opd_sec, &val, offset, 8))
return (bfd_vma) -1;
@@ -8575,8 +8573,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
for (ent = *local_plt; ent != NULL; ent = ent->next)
if (ent->plt.refcount > 0)
{
- asection *s = htab->iplt;
-
+ s = htab->iplt;
ent->plt.offset = s->size;
s->size += PLT_ENTRY_SIZE;
@@ -11920,10 +11917,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
? h->elf.type == STT_GNU_IFUNC
: ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)))
{
- Elf_Internal_Rela outrel;
bfd_boolean skip, relocate;
asection *sreloc;
- bfd_byte *loc;
bfd_vma out_off;
/* When generating a dynamic object, these relocations
@@ -12384,9 +12379,6 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
if (h->needs_copy)
{
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
/* This symbol needs a copy reloc. Set it up. */
if (h->dynindx == -1
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 779ad0f80f4..e6b1f111d53 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1504,7 +1504,6 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
easily. Oh well. */
asection *s;
void **vpp;
- Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache,
abfd, r_symndx);
@@ -4226,11 +4225,11 @@ elf64_x86_64_add_symbol_hook (bfd *abfd,
static bfd_boolean
elf64_x86_64_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED,
- asection *sec, int *index)
+ asection *sec, int *index_return)
{
if (sec == &_bfd_elf_large_com_section)
{
- *index = SHN_X86_64_LCOMMON;
+ *index_return = SHN_X86_64_LCOMMON;
return TRUE;
}
return FALSE;
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 8e29154e6e3..bbdfe5e91f1 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -185,7 +185,7 @@ bfd_boolean
_bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
flagword flags;
- register asection *s;
+ asection *s;
const struct elf_backend_data *bed;
if (! is_elf_hash_table (info->hash))
@@ -570,8 +570,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd,
if (provide && hidden)
{
- const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
-
+ bed = get_elf_backend_data (output_bfd);
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
}
@@ -1184,9 +1183,8 @@ _bfd_elf_merge_symbol (bfd *abfd,
was referenced before. */
if (h->ref_regular)
{
- const struct elf_backend_data *bed
- = get_elf_backend_data (abfd);
struct elf_link_hash_entry *vh = *sym_hash;
+
vh->root.type = h->root.type;
h->root.type = bfd_link_hash_indirect;
(*bed->elf_backend_copy_indirect_symbol) (info, vh, h);
@@ -1548,7 +1546,6 @@ _bfd_elf_merge_symbol (bfd *abfd,
/* Handle the case where we had a versioned symbol in a dynamic
library and now find a definition in a normal object. In this
case, we make the versioned symbol point to the normal one. */
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
flip->root.type = h->root.type;
flip->root.u.undef.abfd = h->root.u.undef.abfd;
h->root.type = bfd_link_hash_indirect;
@@ -10111,9 +10108,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
bfd_boolean emit_relocs;
bfd *dynobj;
struct elf_final_link_info finfo;
- register asection *o;
- register struct bfd_link_order *p;
- register bfd *sub;
+ asection *o;
+ struct bfd_link_order *p;
+ bfd *sub;
bfd_size_type max_contents_size;
bfd_size_type max_external_reloc_size;
bfd_size_type max_internal_reloc_count;
@@ -10562,9 +10559,10 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (size == 0
&& (sec->flags & SEC_HAS_CONTENTS) == 0)
{
- struct bfd_link_order *o = sec->map_tail.link_order;
- if (o != NULL)
- size = o->offset + o->size;
+ struct bfd_link_order *ord = sec->map_tail.link_order;
+
+ if (ord != NULL)
+ size = ord->offset + ord->size;
}
end = sec->vma + size;
}
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 420a0ef1998..f7563329d23 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -1447,7 +1447,7 @@ static bfd_boolean
elfNN_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr,
asection *sec)
{
- register const char *name;
+ const char *name;
name = bfd_get_section_name (abfd, sec);
@@ -2135,7 +2135,7 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
unsigned int count)
{
bfd_vma curr, prev, got_offset;
- unsigned int i, kept, dup, diff, dest, src, len;
+ unsigned int i, kept, dupes, diff, dest, src, len;
qsort (info, count, sizeof (*info), addend_compare);
@@ -2200,35 +2200,35 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
/* Find the next duplicate. SRC will be kept. */
prev = info [src].addend;
got_offset = info [src].got_offset;
- for (dup = src + 1; dup < count; dup++)
+ for (dupes = src + 1; dupes < count; dupes ++)
{
- curr = info [dup].addend;
+ curr = info [dupes].addend;
if (curr == prev)
{
/* Make sure that got_offset is valid. */
if (got_offset == (bfd_vma) -1)
- got_offset = info [dup].got_offset;
+ got_offset = info [dupes].got_offset;
/* For duplicates, make sure that the kept one has
a valid got_offset. */
if (got_offset != (bfd_vma) -1)
- info [dup - 1].got_offset = got_offset;
+ info [dupes - 1].got_offset = got_offset;
break;
}
- got_offset = info [dup].got_offset;
+ got_offset = info [dupes].got_offset;
prev = curr;
}
/* How much to move. */
- len = dup - src;
- i = dup + 1;
+ len = dupes - src;
+ i = dupes + 1;
- if (len == 1 && dup < count)
+ if (len == 1 && dupes < count)
{
/* If we only move 1 element, we combine it with the next
one. There must be at least a duplicate. Find the
next different one. */
- for (diff = dup + 1, src++; diff < count; diff++, src++)
+ for (diff = dupes + 1, src++; diff < count; diff++, src++)
{
if (info [diff].addend != curr)
break;
@@ -2249,18 +2249,18 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
offset. */
prev = info [diff].addend;
got_offset = info [diff].got_offset;
- for (dup = diff + 1; dup < count; dup++)
+ for (dupes = diff + 1; dupes < count; dupes ++)
{
- curr = info [dup].addend;
+ curr = info [dupes].addend;
if (curr == prev)
{
/* For duplicates, make sure that GOT_OFFSET
is valid. */
if (got_offset == (bfd_vma) -1)
- got_offset = info [dup].got_offset;
+ got_offset = info [dupes].got_offset;
break;
}
- got_offset = info [dup].got_offset;
+ got_offset = info [dupes].got_offset;
prev = curr;
diff++;
}
@@ -5241,18 +5241,18 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd,
Elf_Internal_Rela outrel;
bfd_byte *loc;
asection *plt_sec;
- bfd_vma plt_addr, pltoff_addr, gp_val, index;
+ bfd_vma plt_addr, pltoff_addr, gp_val, plt_index;
gp_val = _bfd_get_gp_value (output_bfd);
/* Initialize the minimal PLT entry. */
- index = (dyn_i->plt_offset - PLT_HEADER_SIZE) / PLT_MIN_ENTRY_SIZE;
+ plt_index = (dyn_i->plt_offset - PLT_HEADER_SIZE) / PLT_MIN_ENTRY_SIZE;
plt_sec = ia64_info->root.splt;
loc = plt_sec->contents + dyn_i->plt_offset;
memcpy (loc, plt_min_entry, PLT_MIN_ENTRY_SIZE);
- elfNN_ia64_install_value (loc, index, R_IA64_IMM22);
+ elfNN_ia64_install_value (loc, plt_index, R_IA64_IMM22);
elfNN_ia64_install_value (loc+2, -dyn_i->plt_offset, R_IA64_PCREL21B);
plt_addr = (plt_sec->output_section->vma
@@ -5297,7 +5297,7 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd,
PLT relocations. */
loc = ia64_info->rel_pltoff_sec->contents;
- loc += ((ia64_info->rel_pltoff_sec->reloc_count + index)
+ loc += ((ia64_info->rel_pltoff_sec->reloc_count + plt_index)
* sizeof (ElfNN_External_Rela));
bfd_elfNN_swap_reloca_out (output_bfd, &outrel, loc);
}
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 9df441de7d7..b6492783e16 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -177,7 +177,8 @@ struct mips_got_info
/* Map an input bfd to a got in a multi-got link. */
-struct mips_elf_bfd2got_hash {
+struct mips_elf_bfd2got_hash
+{
bfd *bfd;
struct mips_got_info *g;
};
@@ -3064,7 +3065,7 @@ mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h,
int r_type, struct bfd_link_info *info)
{
struct mips_elf_link_hash_table *htab;
- bfd_vma index;
+ bfd_vma got_index;
struct mips_got_info *g, *gg;
long global_got_dynindx = 0;
@@ -3122,8 +3123,8 @@ mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h,
+ h->root.u.def.section->output_offset
+ h->root.u.def.section->output_section->vma);
- index = mips_tls_got_index (abfd, hm->tls_got_offset, &hm->tls_type,
- r_type, info, hm, value);
+ got_index = mips_tls_got_index (abfd, hm->tls_got_offset, &hm->tls_type,
+ r_type, info, hm, value);
}
else
{
@@ -3132,12 +3133,12 @@ mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h,
indices into the GOT. That makes it easy to calculate the GOT
offset. */
BFD_ASSERT (h->dynindx >= global_got_dynindx);
- index = ((h->dynindx - global_got_dynindx + g->local_gotno)
- * MIPS_ELF_GOT_SIZE (abfd));
+ got_index = ((h->dynindx - global_got_dynindx + g->local_gotno)
+ * MIPS_ELF_GOT_SIZE (abfd));
}
- BFD_ASSERT (index < htab->sgot->size);
+ BFD_ASSERT (got_index < htab->sgot->size);
- return index;
+ return got_index;
}
/* Find a GOT page entry that points to within 32KB of VALUE. These
@@ -3150,7 +3151,7 @@ static bfd_vma
mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
bfd_vma value, bfd_vma *offsetp)
{
- bfd_vma page, index;
+ bfd_vma page, got_index;
struct mips_got_entry *entry;
page = (value + 0x8000) & ~(bfd_vma) 0xffff;
@@ -3160,12 +3161,12 @@ mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
if (!entry)
return MINUS_ONE;
- index = entry->gotidx;
+ got_index = entry->gotidx;
if (offsetp)
*offsetp = value - entry->d.address;
- return index;
+ return got_index;
}
/* Find a local GOT entry for an R_MIPS*_GOT16 relocation against VALUE.
@@ -3201,7 +3202,7 @@ mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
static bfd_vma
mips_elf_got_offset_from_index (struct bfd_link_info *info, bfd *output_bfd,
- bfd *input_bfd, bfd_vma index)
+ bfd *input_bfd, bfd_vma got_index)
{
struct mips_elf_link_hash_table *htab;
asection *sgot;
@@ -3212,7 +3213,7 @@ mips_elf_got_offset_from_index (struct bfd_link_info *info, bfd *output_bfd,
gp = _bfd_get_gp_value (output_bfd)
+ mips_elf_adjust_gp (output_bfd, htab->got_info, input_bfd);
- return sgot->output_section->vma + sgot->output_offset + index - gp;
+ return sgot->output_section->vma + sgot->output_offset + got_index - gp;
}
/* Create and return a local GOT entry for VALUE, which was calculated
@@ -3309,7 +3310,7 @@ mips_elf_create_local_got_entry (bfd *abfd, struct bfd_link_info *info,
{
Elf_Internal_Rela outrel;
asection *s;
- bfd_byte *loc;
+ bfd_byte *rloc;
bfd_vma got_address;
s = mips_elf_rel_dyn_section (info, FALSE);
@@ -3317,11 +3318,11 @@ mips_elf_create_local_got_entry (bfd *abfd, struct bfd_link_info *info,
+ htab->sgot->output_offset
+ entry.gotidx);
- loc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela));
+ rloc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela));
outrel.r_offset = got_address;
outrel.r_info = ELF32_R_INFO (STN_UNDEF, R_MIPS_32);
outrel.r_addend = value;
- bfd_elf32_swap_reloca_out (abfd, &outrel, loc);
+ bfd_elf32_swap_reloca_out (abfd, &outrel, rloc);
}
return *loc;
@@ -8975,8 +8976,6 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (!mips_elf_add_lo16_rel_addend (input_bfd, rel, relend,
contents, &addend))
{
- const char *name;
-
if (h)
name = h->root.root.string;
else
@@ -9122,9 +9121,8 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
&& (howto->type == R_MIPS_GPREL16
|| howto->type == R_MIPS_LITERAL))
{
- const char *msg =
- _("small-data section exceeds 64KB;"
- " lower small-data size limit (see option -G)");
+ msg = _("small-data section exceeds 64KB;"
+ " lower small-data size limit (see option -G)");
htab->small_data_overflow_reported = TRUE;
(*info->callbacks->einfo) ("%P: %s\n", msg);
@@ -10226,22 +10224,22 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
for (g = gg->next; g->next != gg; g = g->next)
{
- bfd_vma index = g->next->local_gotno + g->next->global_gotno
+ bfd_vma got_index = g->next->local_gotno + g->next->global_gotno
+ g->next->tls_gotno;
MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents
- + index++ * MIPS_ELF_GOT_SIZE (output_bfd));
+ + got_index++ * MIPS_ELF_GOT_SIZE (output_bfd));
MIPS_ELF_PUT_WORD (output_bfd, MIPS_ELF_GNU_GOT1_MASK (output_bfd),
sgot->contents
- + index++ * MIPS_ELF_GOT_SIZE (output_bfd));
+ + got_index++ * MIPS_ELF_GOT_SIZE (output_bfd));
if (! info->shared)
continue;
- while (index < g->assigned_gotno)
+ while (got_index < g->assigned_gotno)
{
rel[0].r_offset = rel[1].r_offset = rel[2].r_offset
- = index++ * MIPS_ELF_GOT_SIZE (output_bfd);
+ = got_index++ * MIPS_ELF_GOT_SIZE (output_bfd);
if (!(mips_elf_create_dynamic_relocation
(output_bfd, info, rel, NULL,
bfd_abs_section_ptr,
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index d3fe1bafae0..06ae25e3a4b 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -533,15 +533,15 @@ _bfd_sparc_elf_mkobject (bfd *abfd)
}
static void
-sparc_put_word_32 (bfd *bfd, bfd_vma val, void *ptr)
+sparc_put_word_32 (bfd *abfd, bfd_vma val, void *ptr)
{
- bfd_put_32 (bfd, val, ptr);
+ bfd_put_32 (abfd, val, ptr);
}
static void
-sparc_put_word_64 (bfd *bfd, bfd_vma val, void *ptr)
+sparc_put_word_64 (bfd *abfd, bfd_vma val, void *ptr)
{
- bfd_put_64 (bfd, val, ptr);
+ bfd_put_64 (abfd, val, ptr);
}
static void
@@ -557,10 +557,10 @@ sparc_elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
static bfd_vma
sparc_elf_r_info_64 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED,
- bfd_vma index ATTRIBUTE_UNUSED,
+ bfd_vma rel_index ATTRIBUTE_UNUSED,
bfd_vma type ATTRIBUTE_UNUSED)
{
- return ELF64_R_INFO (index,
+ return ELF64_R_INFO (rel_index,
(in_rel ?
ELF64_R_TYPE_INFO (ELF64_R_TYPE_DATA (in_rel->r_info),
type) : type));
@@ -568,9 +568,9 @@ sparc_elf_r_info_64 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED,
static bfd_vma
sparc_elf_r_info_32 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED,
- bfd_vma index, bfd_vma type)
+ bfd_vma rel_index, bfd_vma type)
{
- return ELF32_R_INFO (index, type);
+ return ELF32_R_INFO (rel_index, type);
}
static bfd_vma
@@ -634,7 +634,7 @@ sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset,
{
unsigned char *entry = splt->contents + offset;
const unsigned int nop = SPARC_NOP;
- int index;
+ int plt_index;
if (offset < (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE))
{
@@ -642,9 +642,9 @@ sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset,
*r_offset = offset;
- index = (offset / PLT64_ENTRY_SIZE);
+ plt_index = (offset / PLT64_ENTRY_SIZE);
- sethi = 0x03000000 | (index * PLT64_ENTRY_SIZE);
+ sethi = 0x03000000 | (plt_index * PLT64_ENTRY_SIZE);
ba = 0x30680000
| (((splt->contents + PLT64_ENTRY_SIZE) - (entry + 4)) / 4 & 0x7ffff);
@@ -691,7 +691,7 @@ sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset,
ofs = offset % block_size;
- index = (PLT64_LARGE_THRESHOLD +
+ plt_index = (PLT64_LARGE_THRESHOLD +
(block * 160) +
(ofs / insn_chunk_size));
@@ -721,7 +721,7 @@ sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset,
bfd_put_64 (output_bfd, (bfd_vma) (splt->contents - (entry + 4)), ptr);
}
- return index - 4;
+ return plt_index - 4;
}
/* The format of the first PLT entry in a VxWorks executable. */
diff --git a/bfd/hash.c b/bfd/hash.c
index 5223e21d2ce..fc05923a5ca 100644
--- a/bfd/hash.c
+++ b/bfd/hash.c
@@ -425,7 +425,7 @@ bfd_hash_lookup (struct bfd_hash_table *table,
unsigned int c;
struct bfd_hash_entry *hashp;
unsigned int len;
- unsigned int index;
+ unsigned int _index;
hash = 0;
len = 0;
@@ -439,8 +439,8 @@ bfd_hash_lookup (struct bfd_hash_table *table,
hash += len + (len << 17);
hash ^= hash >> 2;
- index = hash % table->size;
- for (hashp = table->table[index];
+ _index = hash % table->size;
+ for (hashp = table->table[_index];
hashp != NULL;
hashp = hashp->next)
{
@@ -478,16 +478,16 @@ bfd_hash_insert (struct bfd_hash_table *table,
unsigned long hash)
{
struct bfd_hash_entry *hashp;
- unsigned int index;
+ unsigned int _index;
hashp = (*table->newfunc) (NULL, table, string);
if (hashp == NULL)
return NULL;
hashp->string = string;
hashp->hash = hash;
- index = hash % table->size;
- hashp->next = table->table[index];
- table->table[index] = hashp;
+ _index = hash % table->size;
+ hashp->next = table->table[_index];
+ table->table[_index] = hashp;
table->count++;
if (!table->frozen && table->count > table->size * 3 / 4)
@@ -524,9 +524,9 @@ bfd_hash_insert (struct bfd_hash_table *table,
chain_end = chain_end->next;
table->table[hi] = chain_end->next;
- index = chain->hash % newsize;
- chain_end->next = newtable[index];
- newtable[index] = chain;
+ _index = chain->hash % newsize;
+ chain_end->next = newtable[_index];
+ newtable[_index] = chain;
}
table->table = newtable;
table->size = newsize;
@@ -542,11 +542,11 @@ bfd_hash_replace (struct bfd_hash_table *table,
struct bfd_hash_entry *old,
struct bfd_hash_entry *nw)
{
- unsigned int index;
+ unsigned int _index;
struct bfd_hash_entry **pph;
- index = old->hash % table->size;
- for (pph = &table->table[index];
+ _index = old->hash % table->size;
+ for (pph = &table->table[_index];
(*pph) != NULL;
pph = &(*pph)->next)
{
@@ -617,14 +617,14 @@ bfd_hash_set_default_size (bfd_size_type hash_size)
{
251, 509, 1021, 2039, 4051, 8599, 16699, 32749
};
- size_t index;
+ size_t _index;
/* Work out best prime number near the hash_size. */
- for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index)
- if (hash_size <= hash_size_primes[index])
+ for (_index = 0; _index < ARRAY_SIZE (hash_size_primes) - 1; ++_index)
+ if (hash_size <= hash_size_primes[_index])
break;
- bfd_default_hash_table_size = hash_size_primes[index];
+ bfd_default_hash_table_size = hash_size_primes[_index];
}
/* A few different object file formats (a.out, COFF, ELF) use a string
diff --git a/bfd/ieee.c b/bfd/ieee.c
index 68bdd5ed57a..429572b12e7 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -228,7 +228,7 @@ ieee_write_expression (bfd *abfd,
bfd_vma value,
asymbol *symbol,
bfd_boolean pcrel,
- unsigned int index)
+ unsigned int sindex)
{
unsigned int term_count = 0;
@@ -297,7 +297,7 @@ ieee_write_expression (bfd *abfd,
/* Subtract the pc from here by asking for PC of this section. */
if (! ieee_write_byte (abfd, ieee_variable_P_enum)
|| ! ieee_write_byte (abfd,
- (bfd_byte) (index + IEEE_SECTION_NUMBER_BASE))
+ (bfd_byte) (sindex + IEEE_SECTION_NUMBER_BASE))
|| ! ieee_write_byte (abfd, ieee_function_minus_enum))
return FALSE;
}
@@ -1045,9 +1045,9 @@ ieee_canonicalize_symtab (bfd *abfd, asymbol **location)
}
static asection *
-get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index)
+get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int sindex)
{
- if (index >= ieee->section_table_size)
+ if (sindex >= ieee->section_table_size)
{
unsigned int c, i;
asection **n;
@@ -1056,7 +1056,7 @@ get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index)
c = ieee->section_table_size;
if (c == 0)
c = 20;
- while (c <= index)
+ while (c <= sindex)
c *= 2;
amt = c;
@@ -1072,20 +1072,20 @@ get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index)
ieee->section_table_size = c;
}
- if (ieee->section_table[index] == (asection *) NULL)
+ if (ieee->section_table[sindex] == (asection *) NULL)
{
char *tmp = bfd_alloc (abfd, (bfd_size_type) 11);
asection *section;
if (!tmp)
return NULL;
- sprintf (tmp, " fsec%4d", index);
+ sprintf (tmp, " fsec%4d", sindex);
section = bfd_make_section (abfd, tmp);
- ieee->section_table[index] = section;
- section->target_index = index;
- ieee->section_table[index] = section;
+ ieee->section_table[sindex] = section;
+ section->target_index = sindex;
+ ieee->section_table[sindex] = section;
}
- return ieee->section_table[index];
+ return ieee->section_table[sindex];
}
static void
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index f79e190540c..b378622b6bc 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -1,6 +1,6 @@
/* Assorted BFD support routines, only used internally.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -804,9 +804,9 @@ bfd_put_bits (bfd_uint64_t data, void *p, int bits, bfd_boolean big_p)
bytes = bits / 8;
for (i = 0; i < bytes; i++)
{
- int index = big_p ? bytes - i - 1 : i;
+ int addr_index = big_p ? bytes - i - 1 : i;
- addr[index] = data & 0xff;
+ addr[addr_index] = data & 0xff;
data >>= 8;
}
}
@@ -826,9 +826,9 @@ bfd_get_bits (const void *p, int bits, bfd_boolean big_p)
bytes = bits / 8;
for (i = 0; i < bytes; i++)
{
- int index = big_p ? i : bytes - i - 1;
+ int addr_index = big_p ? i : bytes - i - 1;
- data = (data << 8) | addr[index];
+ data = (data << 8) | addr[addr_index];
}
return data;
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 766fb3d76d9..fb66db0d3e1 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -428,8 +428,7 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd,
for (i = 0; i < mdata->nsects; i++)
{
bfd_mach_o_section *sec = mdata->sections[i];
- unsigned int j, first, last;
- bfd_mach_o_symtab_command *symtab = mdata->symtab;
+ unsigned int first, last;
bfd_vma addr;
bfd_vma entry_size;
@@ -490,7 +489,7 @@ bfd_mach_o_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
void
bfd_mach_o_print_symbol (bfd *abfd,
- PTR afile,
+ void * afile,
asymbol *symbol,
bfd_print_symbol_type how)
{
@@ -504,7 +503,7 @@ bfd_mach_o_print_symbol (bfd *abfd,
fprintf (file, "%s", symbol->name);
break;
default:
- bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, (void *) file, symbol);
if (asym->n_type & BFD_MACH_O_N_STAB)
name = bfd_get_stab_name (asym->n_type);
else
@@ -606,7 +605,7 @@ bfd_mach_o_write_header (bfd *abfd, bfd_mach_o_header *header)
bfd_h_put_32 (abfd, header->reserved, buf + 28);
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bwrite ((PTR) buf, size, abfd) != size)
+ || bfd_bwrite ((void *) buf, size, abfd) != size)
return FALSE;
return TRUE;
@@ -635,7 +634,7 @@ bfd_mach_o_write_thread (bfd *abfd, bfd_mach_o_load_command *command)
bfd_h_put_32 (abfd, (cmd->flavours[i].size / 4), buf + 4);
if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
- || bfd_bwrite ((PTR) buf, 8, abfd) != 8)
+ || bfd_bwrite ((void *) buf, 8, abfd) != 8)
return -1;
offset += cmd->flavours[i].size + 8;
@@ -900,7 +899,7 @@ bfd_mach_o_write_relocs (bfd *abfd, bfd_mach_o_section *section)
bfd_put_32 (abfd, v, buf + 4);
}
- if (bfd_bwrite ((PTR) buf, BFD_MACH_O_RELENT_SIZE, abfd)
+ if (bfd_bwrite ((void *) buf, BFD_MACH_O_RELENT_SIZE, abfd)
!= BFD_MACH_O_RELENT_SIZE)
return FALSE;
}
@@ -924,7 +923,7 @@ bfd_mach_o_write_section_32 (bfd *abfd, bfd_mach_o_section *section)
bfd_h_put_32 (abfd, section->reserved1, buf + 60);
bfd_h_put_32 (abfd, section->reserved2, buf + 64);
- if (bfd_bwrite ((PTR) buf, BFD_MACH_O_SECTION_SIZE, abfd)
+ if (bfd_bwrite ((void *) buf, BFD_MACH_O_SECTION_SIZE, abfd)
!= BFD_MACH_O_SECTION_SIZE)
return -1;
@@ -949,7 +948,7 @@ bfd_mach_o_write_section_64 (bfd *abfd, bfd_mach_o_section *section)
bfd_h_put_32 (abfd, section->reserved2, buf + 72);
bfd_h_put_32 (abfd, section->reserved3, buf + 76);
- if (bfd_bwrite ((PTR) buf, BFD_MACH_O_SECTION_64_SIZE, abfd)
+ if (bfd_bwrite ((void *) buf, BFD_MACH_O_SECTION_64_SIZE, abfd)
!= BFD_MACH_O_SECTION_64_SIZE)
return -1;
@@ -980,7 +979,7 @@ bfd_mach_o_write_segment_32 (bfd *abfd, bfd_mach_o_load_command *command)
bfd_h_put_32 (abfd, seg->flags, buf + 44);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || (bfd_bwrite ((PTR) buf, BFD_MACH_O_LC_SEGMENT_SIZE - 8, abfd)
+ || (bfd_bwrite ((void *) buf, BFD_MACH_O_LC_SEGMENT_SIZE - 8, abfd)
!= BFD_MACH_O_LC_SEGMENT_SIZE - 8))
return -1;
@@ -1015,7 +1014,7 @@ bfd_mach_o_write_segment_64 (bfd *abfd, bfd_mach_o_load_command *command)
bfd_h_put_32 (abfd, seg->flags, buf + 60);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || (bfd_bwrite ((PTR) buf, BFD_MACH_O_LC_SEGMENT_64_SIZE - 8, abfd)
+ || (bfd_bwrite ((void *) buf, BFD_MACH_O_LC_SEGMENT_64_SIZE - 8, abfd)
!= BFD_MACH_O_LC_SEGMENT_64_SIZE - 8))
return -1;
@@ -1055,21 +1054,20 @@ bfd_mach_o_write_symtab (bfd *abfd, bfd_mach_o_load_command *command)
for (i = 0; i < sym->nsyms; i++)
{
- unsigned char buf[16];
- bfd_size_type index;
+ bfd_size_type str_index;
bfd_mach_o_asymbol *s = (bfd_mach_o_asymbol *)symbols[i];
/* Compute name index. */
/* An index of 0 always means the empty string. */
if (s->symbol.name == 0 || s->symbol.name[0] == '\0')
- index = 0;
+ str_index = 0;
else
{
- index = _bfd_stringtab_add (strtab, s->symbol.name, TRUE, FALSE);
- if (index == (bfd_size_type) -1)
+ str_index = _bfd_stringtab_add (strtab, s->symbol.name, TRUE, FALSE);
+ if (str_index == (bfd_size_type) -1)
goto err;
}
- bfd_h_put_32 (abfd, index, buf);
+ bfd_h_put_32 (abfd, str_index, buf);
bfd_h_put_8 (abfd, s->n_type, buf + 4);
bfd_h_put_8 (abfd, s->n_sect, buf + 5);
bfd_h_put_16 (abfd, s->n_desc, buf + 6);
@@ -1078,7 +1076,7 @@ bfd_mach_o_write_symtab (bfd *abfd, bfd_mach_o_load_command *command)
else
bfd_h_put_32 (abfd, s->symbol.section->vma + s->symbol.value, buf + 8);
- if (bfd_bwrite ((PTR) buf, symlen, abfd) != symlen)
+ if (bfd_bwrite ((void *) buf, symlen, abfd) != symlen)
goto err;
}
sym->strsize = _bfd_stringtab_size (strtab);
@@ -1096,7 +1094,7 @@ bfd_mach_o_write_symtab (bfd *abfd, bfd_mach_o_load_command *command)
bfd_h_put_32 (abfd, sym->strsize, buf + 12);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bwrite ((PTR) buf, 16, abfd) != 16)
+ || bfd_bwrite ((void *) buf, 16, abfd) != 16)
return FALSE;
return TRUE;
@@ -1192,7 +1190,7 @@ bfd_mach_o_write_contents (bfd *abfd)
bfd_h_put_32 (abfd, cur->len, buf + 4);
if (bfd_seek (abfd, cur->offset, SEEK_SET) != 0
- || bfd_bwrite ((PTR) buf, 8, abfd) != 8)
+ || bfd_bwrite ((void *) buf, 8, abfd) != 8)
return FALSE;
switch (cur->type)
@@ -1410,7 +1408,7 @@ bfd_mach_o_read_header (bfd *abfd, bfd_mach_o_header *header)
/* Just read the magic number. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 4, abfd) != 4)
+ || bfd_bread ((void *) buf, 4, abfd) != 4)
return FALSE;
if (bfd_getb32 (buf) == BFD_MACH_O_MH_MAGIC)
@@ -1452,7 +1450,7 @@ bfd_mach_o_read_header (bfd *abfd, bfd_mach_o_header *header)
BFD_MACH_O_HEADER_64_SIZE : BFD_MACH_O_HEADER_SIZE;
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, size, abfd) != size)
+ || bfd_bread ((void *) buf, size, abfd) != size)
return FALSE;
header->cputype = (*get32) (buf + 4);
@@ -1530,7 +1528,7 @@ bfd_mach_o_read_section_32 (bfd *abfd,
unsigned char buf[BFD_MACH_O_SECTION_SIZE];
if (bfd_seek (abfd, offset, SEEK_SET) != 0
- || (bfd_bread ((PTR) buf, BFD_MACH_O_SECTION_SIZE, abfd)
+ || (bfd_bread ((void *) buf, BFD_MACH_O_SECTION_SIZE, abfd)
!= BFD_MACH_O_SECTION_SIZE))
return -1;
@@ -1565,7 +1563,7 @@ bfd_mach_o_read_section_64 (bfd *abfd,
unsigned char buf[BFD_MACH_O_SECTION_64_SIZE];
if (bfd_seek (abfd, offset, SEEK_SET) != 0
- || (bfd_bread ((PTR) buf, BFD_MACH_O_SECTION_64_SIZE, abfd)
+ || (bfd_bread ((void *) buf, BFD_MACH_O_SECTION_64_SIZE, abfd)
!= BFD_MACH_O_SECTION_64_SIZE))
return -1;
@@ -1626,7 +1624,7 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd,
BFD_ASSERT (sym->strtab != NULL);
if (bfd_seek (abfd, symoff, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, symwidth, abfd) != symwidth)
+ || bfd_bread ((void *) buf, symwidth, abfd) != symwidth)
{
fprintf (stderr, "bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %lu\n",
symwidth, (unsigned long) symoff);
@@ -1788,7 +1786,7 @@ bfd_mach_o_read_symtab_strtab (bfd *abfd)
return -1;
if (bfd_seek (abfd, sym->stroff, SEEK_SET) != 0
- || bfd_bread ((PTR) sym->strtab, sym->strsize, abfd) != sym->strsize)
+ || bfd_bread ((void *) sym->strtab, sym->strsize, abfd) != sym->strsize)
{
bfd_set_error (bfd_error_file_truncated);
return -1;
@@ -1839,21 +1837,21 @@ bfd_mach_o_read_dysymtab_symbol (bfd *abfd,
unsigned long i)
{
unsigned long isymoff = dysym->indirectsymoff + (i * 4);
- unsigned long symindex;
+ unsigned long sym_index;
unsigned char buf[4];
BFD_ASSERT (i < dysym->nindirectsyms);
if (bfd_seek (abfd, isymoff, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 4, abfd) != 4)
+ || bfd_bread ((void *) buf, 4, abfd) != 4)
{
fprintf (stderr, "bfd_mach_o_read_dysymtab_symbol: unable to read %lu bytes at %lu\n",
(unsigned long) 4, isymoff);
return -1;
}
- symindex = bfd_h_get_32 (abfd, buf);
+ sym_index = bfd_h_get_32 (abfd, buf);
- return bfd_mach_o_read_symtab_symbol (abfd, sym, s, symindex);
+ return bfd_mach_o_read_symtab_symbol (abfd, sym, s, sym_index);
}
static const char *
@@ -1904,7 +1902,7 @@ bfd_mach_o_read_dylinker (bfd *abfd, bfd_mach_o_load_command *command)
|| (command->type == BFD_MACH_O_LC_LOAD_DYLINKER));
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 4, abfd) != 4)
+ || bfd_bread ((void *) buf, 4, abfd) != 4)
return -1;
nameoff = bfd_h_get_32 (abfd, buf + 0);
@@ -1940,7 +1938,7 @@ bfd_mach_o_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
}
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 16, abfd) != 16)
+ || bfd_bread ((void *) buf, 16, abfd) != 16)
return -1;
nameoff = bfd_h_get_32 (abfd, buf + 0);
@@ -1991,7 +1989,7 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 8, abfd) != 8)
+ || bfd_bread ((void *) buf, 8, abfd) != 8)
return -1;
offset += 8 + bfd_h_get_32 (abfd, buf + 4) * 4;
@@ -2016,7 +2014,7 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 8, abfd) != 8)
+ || bfd_bread ((void *) buf, 8, abfd) != 8)
return -1;
cmd->flavours[nflavours].flavour = bfd_h_get_32 (abfd, buf);
@@ -2087,7 +2085,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
BFD_ASSERT (command->type == BFD_MACH_O_LC_DYSYMTAB);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 72, abfd) != 72)
+ || bfd_bread ((void *) buf, 72, abfd) != 72)
return -1;
cmd->ilocalsym = bfd_h_get_32 (abfd, buf + 0);
@@ -2111,7 +2109,6 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
if (cmd->nmodtab != 0)
{
- char buf[56];
unsigned int i;
int wide = bfd_mach_o_wide_p (abfd);
unsigned int module_len = wide ? 56 : 52;
@@ -2129,7 +2126,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
bfd_mach_o_dylib_module *module = &cmd->dylib_module[i];
unsigned long v;
- if (bfd_bread ((PTR) buf, module_len, abfd) != module_len)
+ if (bfd_bread ((void *) buf, module_len, abfd) != module_len)
return -1;
module->module_name_idx = bfd_h_get_32 (abfd, buf + 0);
@@ -2162,7 +2159,6 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
if (cmd->ntoc != 0)
{
- char buf[8];
unsigned int i;
cmd->dylib_toc = bfd_alloc
@@ -2177,7 +2173,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_dylib_table_of_content *toc = &cmd->dylib_toc[i];
- if (bfd_bread ((PTR) buf, 8, abfd) != 8)
+ if (bfd_bread ((void *) buf, 8, abfd) != 8)
return -1;
toc->symbol_index = bfd_h_get_32 (abfd, buf + 0);
@@ -2187,7 +2183,6 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
if (cmd->nindirectsyms != 0)
{
- char buf[4];
unsigned int i;
cmd->indirect_syms = bfd_alloc
@@ -2202,7 +2197,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
{
unsigned int *is = &cmd->indirect_syms[i];
- if (bfd_bread ((PTR) buf, 4, abfd) != 4)
+ if (bfd_bread ((void *) buf, 4, abfd) != 4)
return -1;
*is = bfd_h_get_32 (abfd, buf + 0);
@@ -2211,7 +2206,6 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
if (cmd->nextrefsyms != 0)
{
- char buf[4];
unsigned long v;
unsigned int i;
@@ -2227,7 +2221,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_dylib_reference *ref = &cmd->ext_refs[i];
- if (bfd_bread ((PTR) buf, 4, abfd) != 4)
+ if (bfd_bread ((void *) buf, 4, abfd) != 4)
return -1;
/* Fields isym and flags are written as bit-fields, thus we need
@@ -2263,7 +2257,7 @@ bfd_mach_o_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
BFD_ASSERT (command->type == BFD_MACH_O_LC_SYMTAB);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 16, abfd) != 16)
+ || bfd_bread ((void *) buf, 16, abfd) != 16)
return -1;
symtab->symoff = bfd_h_get_32 (abfd, buf);
@@ -2293,7 +2287,7 @@ bfd_mach_o_read_uuid (bfd *abfd, bfd_mach_o_load_command *command)
BFD_ASSERT (command->type == BFD_MACH_O_LC_UUID);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bread ((PTR) cmd->uuid, 16, abfd) != 16)
+ || bfd_bread ((void *) cmd->uuid, 16, abfd) != 16)
return -1;
sname = bfd_alloc (abfd, strlen (prefix) + 1);
@@ -2323,7 +2317,7 @@ bfd_mach_o_read_linkedit (bfd *abfd, bfd_mach_o_load_command *command)
char buf[8];
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 8, abfd) != 8)
+ || bfd_bread ((void *) buf, 8, abfd) != 8)
return -1;
cmd->dataoff = bfd_get_32 (abfd, buf + 0);
@@ -2339,7 +2333,7 @@ bfd_mach_o_read_str (bfd *abfd, bfd_mach_o_load_command *command)
unsigned long off;
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 4, abfd) != 4)
+ || bfd_bread ((void *) buf, 4, abfd) != 4)
return -1;
off = bfd_get_32 (abfd, buf + 0);
@@ -2349,7 +2343,7 @@ bfd_mach_o_read_str (bfd *abfd, bfd_mach_o_load_command *command)
if (cmd->str == NULL)
return -1;
if (bfd_seek (abfd, cmd->stroff, SEEK_SET) != 0
- || bfd_bread ((PTR) cmd->str, cmd->str_len, abfd) != cmd->str_len)
+ || bfd_bread ((void *) cmd->str, cmd->str_len, abfd) != cmd->str_len)
return -1;
return 0;
}
@@ -2361,7 +2355,7 @@ bfd_mach_o_read_dyld_info (bfd *abfd, bfd_mach_o_load_command *command)
char buf[40];
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, sizeof (buf), abfd) != sizeof (buf))
+ || bfd_bread ((void *) buf, sizeof (buf), abfd) != sizeof (buf))
return -1;
cmd->rebase_off = bfd_get_32 (abfd, buf + 0);
@@ -2391,7 +2385,7 @@ bfd_mach_o_read_segment (bfd *abfd,
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT_64);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 64, abfd) != 64)
+ || bfd_bread ((void *) buf, 64, abfd) != 64)
return -1;
memcpy (seg->segname, buf, 16);
@@ -2411,7 +2405,7 @@ bfd_mach_o_read_segment (bfd *abfd,
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 48, abfd) != 48)
+ || bfd_bread ((void *) buf, 48, abfd) != 48)
return -1;
memcpy (seg->segname, buf, 16);
@@ -2472,7 +2466,7 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command)
/* Read command type and length. */
if (bfd_seek (abfd, command->offset, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 8, abfd) != 8)
+ || bfd_bread ((void *) buf, 8, abfd) != 8)
return -1;
command->type = bfd_h_get_32 (abfd, buf) & ~BFD_MACH_O_LC_REQ_DYLD;
@@ -2900,7 +2894,7 @@ bfd_mach_o_archive_p (bfd *abfd)
unsigned long i;
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 8, abfd) != 8)
+ || bfd_bread ((void *) buf, 8, abfd) != 8)
goto error;
adata = bfd_alloc (abfd, sizeof (mach_o_fat_data_struct));
@@ -2925,7 +2919,7 @@ bfd_mach_o_archive_p (bfd *abfd)
for (i = 0; i < adata->nfat_arch; i++)
{
if (bfd_seek (abfd, 8 + 20 * i, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 20, abfd) != 20)
+ || bfd_bread ((void *) buf, 20, abfd) != 20)
goto error;
adata->archentries[i].cputype = bfd_getb32 (buf);
adata->archentries[i].cpusubtype = bfd_getb32 (buf + 4);
@@ -3709,7 +3703,7 @@ bfd_mach_o_print_dyld_info (bfd *abfd ATTRIBUTE_UNUSED,
}
bfd_boolean
-bfd_mach_o_bfd_print_private_bfd_data (bfd *abfd, PTR ptr)
+bfd_mach_o_bfd_print_private_bfd_data (bfd *abfd, void * ptr)
{
bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
FILE *file = (FILE *) ptr;
@@ -3733,10 +3727,10 @@ bfd_mach_o_bfd_print_private_bfd_data (bfd *abfd, PTR ptr)
case BFD_MACH_O_LC_UUID:
{
bfd_mach_o_uuid_command *uuid = &cmd->command.uuid;
- unsigned int i;
+ unsigned int j;
- for (i = 0; i < sizeof (uuid->uuid); i++)
- fprintf (file, " %02x", uuid->uuid[i]);
+ for (j = 0; j < sizeof (uuid->uuid); j ++)
+ fprintf (file, " %02x", uuid->uuid[j]);
fputc ('\n', file);
}
break;
diff --git a/bfd/merge.c b/bfd/merge.c
index 80f80b83a00..7aa088ff947 100644
--- a/bfd/merge.c
+++ b/bfd/merge.c
@@ -136,12 +136,12 @@ static struct sec_merge_hash_entry *
sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string,
unsigned int alignment, bfd_boolean create)
{
- register const unsigned char *s;
- register unsigned long hash;
- register unsigned int c;
+ const unsigned char *s;
+ unsigned long hash;
+ unsigned int c;
struct sec_merge_hash_entry *hashp;
unsigned int len, i;
- unsigned int index;
+ unsigned int _index;
hash = 0;
len = 0;
@@ -192,8 +192,8 @@ sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string,
len = table->entsize;
}
- index = hash % table->table.size;
- for (hashp = (struct sec_merge_hash_entry *) table->table.table[index];
+ _index = hash % table->table.size;
+ for (hashp = (struct sec_merge_hash_entry *) table->table.table[_index];
hashp != NULL;
hashp = (struct sec_merge_hash_entry *) hashp->root.next)
{
@@ -263,7 +263,7 @@ static struct sec_merge_hash_entry *
sec_merge_add (struct sec_merge_hash *tab, const char *str,
unsigned int alignment, struct sec_merge_sec_info *secinfo)
{
- register struct sec_merge_hash_entry *entry;
+ struct sec_merge_hash_entry *entry;
entry = sec_merge_hash_lookup (tab, str, alignment, TRUE);
if (entry == NULL)
diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c
index b818cfd0481..42c0c5bda60 100644
--- a/bfd/nlm32-sparc.c
+++ b/bfd/nlm32-sparc.c
@@ -1,6 +1,6 @@
/* Support for 32-bit SPARC NLM (NetWare Loadable Module)
Copyright 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007 Free Software Foundation, Inc.
+ 2007, 2009 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -93,7 +93,7 @@ nlm_sparc_read_reloc (bfd *abfd,
arelent *rel)
{
bfd_vma val, addend;
- unsigned int index;
+ unsigned int howto_index;
unsigned int type;
struct nlm32_sparc_reloc_ext tmp_reloc;
asection *code_sec, *data_sec;
@@ -114,12 +114,12 @@ nlm_sparc_read_reloc (bfd *abfd,
rel->addend = addend;
rel->howto = NULL;
- for (index = 0;
- index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
- index++)
- if (nlm32_sparc_howto_table[index].type == type)
+ for (howto_index = 0;
+ howto_index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
+ howto_index++)
+ if (nlm32_sparc_howto_table[howto_index].type == type)
{
- rel->howto = &nlm32_sparc_howto_table[index];
+ rel->howto = &nlm32_sparc_howto_table[howto_index];
break;
}
@@ -139,15 +139,15 @@ nlm_sparc_write_reloc (bfd * abfd, asection * sec, arelent * rel)
{
bfd_vma val;
struct nlm32_sparc_reloc_ext tmp_reloc;
- unsigned int index;
+ unsigned int howto_index;
int type = -1;
reloc_howto_type *tmp;
- for (index = 0;
- index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
- index++)
+ for (howto_index = 0;
+ howto_index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
+ howto_index++)
{
- tmp = &nlm32_sparc_howto_table[index];
+ tmp = &nlm32_sparc_howto_table[howto_index];
if (tmp->rightshift == rel->howto->rightshift
&& tmp->size == rel->howto->size
diff --git a/bfd/oasys.c b/bfd/oasys.c
index 17714ec2078..a3ef7526e9b 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -786,7 +786,7 @@ oasys_write_syms (bfd *abfd)
{
unsigned int count;
asymbol **generic = bfd_get_outsymbols (abfd);
- unsigned int index = 0;
+ unsigned int sym_index = 0;
for (count = 0; count < bfd_get_symcount (abfd); count++)
{
@@ -799,8 +799,8 @@ oasys_write_syms (bfd *abfd)
if (bfd_is_com_section (g->section))
{
symbol.relb = RELOCATION_TYPE_COM;
- H_PUT_16 (abfd, index, symbol.refno);
- index++;
+ H_PUT_16 (abfd, sym_index, symbol.refno);
+ sym_index++;
}
else if (bfd_is_abs_section (g->section))
{
@@ -810,9 +810,9 @@ oasys_write_syms (bfd *abfd)
else if (bfd_is_und_section (g->section))
{
symbol.relb = RELOCATION_TYPE_UND;
- H_PUT_16 (abfd, index, symbol.refno);
- /* Overload the value field with the output index number */
- index++;
+ H_PUT_16 (abfd, sym_index, symbol.refno);
+ /* Overload the value field with the output sym_index number */
+ sym_index++;
}
else if (g->flags & BSF_DEBUGGING)
/* Throw it away. */
@@ -859,7 +859,7 @@ oasys_write_syms (bfd *abfd)
name[0]) + l))
return FALSE;
}
- g->value = index - 1;
+ g->value = sym_index - 1;
}
return TRUE;
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 4afde881888..7a884c206d1 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -523,19 +523,12 @@ static const struct bfd_iovec opncls_iovec = {
bfd *
bfd_openr_iovec (const char *filename, const char *target,
- void *(*open) (struct bfd *nbfd,
- void *open_closure),
+ void *(*_open) (struct bfd *, void *),
void *open_closure,
- file_ptr (*pread) (struct bfd *abfd,
- void *stream,
- void *buf,
- file_ptr nbytes,
- file_ptr offset),
- int (*close) (struct bfd *nbfd,
- void *stream),
- int (*stat) (struct bfd *abfd,
- void *stream,
- struct stat *sb))
+ file_ptr (*_pread) (struct bfd *, void *, void *, file_ptr,
+ file_ptr),
+ int (*_close) (struct bfd *, void *),
+ int (*_stat) (struct bfd *, void *, struct stat *))
{
bfd *nbfd;
const bfd_target *target_vec;
@@ -557,7 +550,7 @@ bfd_openr_iovec (const char *filename, const char *target,
nbfd->direction = read_direction;
/* `open (...)' would get expanded by an the open(2) syscall macro. */
- stream = (*open) (nbfd, open_closure);
+ stream = (*_open) (nbfd, open_closure);
if (stream == NULL)
{
_bfd_delete_bfd (nbfd);
@@ -566,9 +559,9 @@ bfd_openr_iovec (const char *filename, const char *target,
vec = (struct opncls *) bfd_zalloc (nbfd, sizeof (struct opncls));
vec->stream = stream;
- vec->pread = pread;
- vec->close = close;
- vec->stat = stat;
+ vec->pread = _pread;
+ vec->close = _close;
+ vec->stat = _stat;
nbfd->iovec = &opncls_iovec;
nbfd->iostream = vec;
@@ -1234,7 +1227,7 @@ DESCRIPTION
static char *
find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
{
- char *basename;
+ char *base;
char *dir;
char *debugfile;
char *canon_dir;
@@ -1253,13 +1246,13 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
return NULL;
}
- basename = get_debug_link_info (abfd, & crc32);
- if (basename == NULL)
+ base = get_debug_link_info (abfd, & crc32);
+ if (base == NULL)
return NULL;
- if (basename[0] == '\0')
+ if (base[0] == '\0')
{
- free (basename);
+ free (base);
bfd_set_error (bfd_error_no_debug_section);
return NULL;
}
@@ -1271,7 +1264,7 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
dir = (char *) bfd_malloc (dirlen + 1);
if (dir == NULL)
{
- free (basename);
+ free (base);
return NULL;
}
memcpy (dir, abfd->filename, dirlen);
@@ -1289,11 +1282,11 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
bfd_malloc (strlen (debug_file_directory) + 1
+ (canon_dirlen > dirlen ? canon_dirlen : dirlen)
+ strlen (".debug/")
- + strlen (basename)
+ + strlen (base)
+ 1);
if (debugfile == NULL)
{
- free (basename);
+ free (base);
free (dir);
free (canon_dir);
return NULL;
@@ -1301,11 +1294,11 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
/* First try in the same directory as the original file: */
strcpy (debugfile, dir);
- strcat (debugfile, basename);
+ strcat (debugfile, base);
if (separate_debug_file_exists (debugfile, crc32))
{
- free (basename);
+ free (base);
free (dir);
free (canon_dir);
return debugfile;
@@ -1314,11 +1307,11 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
/* Then try in a subdirectory called .debug. */
strcpy (debugfile, dir);
strcat (debugfile, ".debug/");
- strcat (debugfile, basename);
+ strcat (debugfile, base);
if (separate_debug_file_exists (debugfile, crc32))
{
- free (basename);
+ free (base);
free (dir);
free (canon_dir);
return debugfile;
@@ -1332,18 +1325,18 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
&& canon_dir[0] != '/')
strcat (debugfile, "/");
strcat (debugfile, canon_dir);
- strcat (debugfile, basename);
+ strcat (debugfile, base);
if (separate_debug_file_exists (debugfile, crc32))
{
- free (basename);
+ free (base);
free (dir);
free (canon_dir);
return debugfile;
}
free (debugfile);
- free (basename);
+ free (base);
free (dir);
free (canon_dir);
return NULL;
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index e4096f32c6f..8f448728e88 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -1569,7 +1569,7 @@ add_to_stringtab (bfd *abfd,
bfd_boolean copy)
{
bfd_boolean hash;
- bfd_size_type index;
+ bfd_size_type str_index;
/* An index of 0 always means the empty string. */
if (str == 0 || *str == '\0')
@@ -1581,14 +1581,14 @@ add_to_stringtab (bfd *abfd,
if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
hash = FALSE;
- index = _bfd_stringtab_add (tab, str, hash, copy);
+ str_index = _bfd_stringtab_add (tab, str, hash, copy);
- if (index != (bfd_size_type) -1)
+ if (str_index != (bfd_size_type) -1)
/* Add BYTES_IN_LONG to the return value to account for the
space taken up by the string table size. */
- index += BYTES_IN_LONG;
+ str_index += BYTES_IN_LONG;
- return index;
+ return str_index;
}
/* Write out a strtab. ABFD is already at the right location in the
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 63ca3c0a3db..87e66d7c45f 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1784,7 +1784,7 @@ _bfd_XX_print_ce_compressed_pdata (bfd * abfd, void * vfile)
bfd_size_type i;
bfd_size_type start, stop;
int onaline = PDATA_ROW_SIZE;
- struct sym_cache sym_cache = {0, 0} ;
+ struct sym_cache cache = {0, 0} ;
if (section == NULL
|| coff_section_data (abfd, section) == NULL
@@ -1870,7 +1870,7 @@ _bfd_XX_print_ce_compressed_pdata (bfd * abfd, void * vfile)
fprintf (file, "%08x", (unsigned int) eh_data);
if (eh != 0)
{
- const char *s = my_symbol_for_address (abfd, eh, &sym_cache);
+ const char *s = my_symbol_for_address (abfd, eh, &cache);
if (s)
fprintf (file, " (%s) ", s);
@@ -1890,7 +1890,7 @@ _bfd_XX_print_ce_compressed_pdata (bfd * abfd, void * vfile)
free (data);
- cleanup_syms (& sym_cache);
+ cleanup_syms (& cache);
return TRUE;
#undef PDATA_ROW_SIZE
diff --git a/bfd/pef.c b/bfd/pef.c
index b7156f06234..788388cbf75 100644
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -730,14 +730,11 @@ bfd_pef_parse_function_stubs (bfd *abfd,
asymbol **csym)
{
const char *const sprefix = "__stub_";
-
size_t codepos = 0;
unsigned long count = 0;
-
bfd_pef_loader_header header;
bfd_pef_imported_library *libraries = NULL;
bfd_pef_imported_symbol *imports = NULL;
-
unsigned long i;
int ret;
@@ -783,8 +780,7 @@ bfd_pef_parse_function_stubs (bfd *abfd,
asymbol sym;
const char *symname;
char *name;
- unsigned long index;
- int ret;
+ unsigned long sym_index;
if (csym && (csym[count] == NULL))
break;
@@ -802,14 +798,14 @@ bfd_pef_parse_function_stubs (bfd *abfd,
if ((codepos + 4) > codelen)
break;
- ret = bfd_pef_parse_function_stub (abfd, codebuf + codepos, 24, &index);
+ ret = bfd_pef_parse_function_stub (abfd, codebuf + codepos, 24, &sym_index);
if (ret < 0)
{
codepos += 24;
continue;
}
- if (index >= header.total_imported_symbol_count)
+ if (sym_index >= header.total_imported_symbol_count)
{
codepos += 24;
continue;
@@ -819,12 +815,12 @@ bfd_pef_parse_function_stubs (bfd *abfd,
size_t max, namelen;
const char *s;
- if (loaderlen < (header.loader_strings_offset + imports[index].name))
+ if (loaderlen < (header.loader_strings_offset + imports[sym_index].name))
goto error;
- max = loaderlen - (header.loader_strings_offset + imports[index].name);
+ max = loaderlen - (header.loader_strings_offset + imports[sym_index].name);
symname = (char *) loaderbuf;
- symname += header.loader_strings_offset + imports[index].name;
+ symname += header.loader_strings_offset + imports[sym_index].name;
namelen = 0;
for (s = symname; s < (symname + max); s++)
{
diff --git a/bfd/versados.c b/bfd/versados.c
index f3de87188bb..d7a5d47f05e 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -399,9 +399,9 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass)
for (j = 0; j < esdids; j++)
{
- int esdid = *srcp++;
+ int id = *srcp++;
- if (esdid)
+ if (id)
{
int rn = EDATA (abfd, otr->esdid - 1).relocs++;
@@ -416,7 +416,7 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass)
EDATA (abfd, otr->esdid - 1).section->relocation + rn;
n->address = dst_idx;
- n->sym_ptr_ptr = (asymbol **) (size_t) esdid;
+ n->sym_ptr_ptr = (asymbol **) (size_t) id;
n->addend = 0;
n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1);
}
diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c
index e641d0de422..ba75bbf41ba 100644
--- a/bfd/vms-gsd.c
+++ b/bfd/vms-gsd.c
@@ -729,7 +729,8 @@ _bfd_vms_slurp_gsd (bfd * abfd, int objtype)
if (symbol->flags & BSF_FUNCTION)
{
asymbol *en_sym;
- char *name = bfd_alloc (abfd, strlen (symbol->name) + 5);
+
+ name = bfd_alloc (abfd, strlen (symbol->name) + 5);
en_sym = bfd_make_empty_symbol (abfd);
if (en_sym == 0)
diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c
index 407fa7fdff9..49e680962a7 100644
--- a/bfd/vms-hdr.c
+++ b/bfd/vms-hdr.c
@@ -1179,13 +1179,13 @@ build_module_list (bfd *abfd)
of debug info in the DST section, as well as the count of
program sections (i.e. address spans) it contains. */
int modbeg = bfd_getl32 (ptr + DBG_S_L_DMT_MODBEG);
- int size = bfd_getl32 (ptr + DBG_S_L_DST_SIZE);
+ int msize = bfd_getl32 (ptr + DBG_S_L_DST_SIZE);
int count = bfd_getl16 (ptr + DBG_S_W_DMT_PSECT_COUNT);
ptr += DBG_S_C_DMT_HEADER_SIZE;
#if VMS_DEBUG
_bfd_vms_debug (3, "module: modbeg = %d, size = %d, count = %d\n",
- modbeg, size, count);
+ modbeg, msize, count);
#endif
/* We create a 'module' structure for each program section since
@@ -1199,7 +1199,7 @@ build_module_list (bfd *abfd)
int length = bfd_getl32 (ptr + DBG_S_L_DMT_PSECT_LENGTH);
module = new_module (abfd);
module->modbeg = modbeg;
- module->size = size;
+ module->size = msize;
module->low = start;
module->high = start + length;
module->next = list;
diff --git a/bfd/vms-tir.c b/bfd/vms-tir.c
index 5bc61da87aa..86b55ced409 100644
--- a/bfd/vms-tir.c
+++ b/bfd/vms-tir.c
@@ -2318,7 +2318,7 @@ static void etir_output_check (bfd *abfd, asection *section, bfd_vma vaddr,
/* Start ETIR record for section #index at virtual addr offset. */
static void
-start_etir_record (bfd * abfd, int index, uquad offset, bfd_boolean justoffset)
+start_etir_record (bfd * abfd, int sec_index, uquad offset, bfd_boolean justoffset)
{
if (!justoffset)
{
@@ -2329,7 +2329,7 @@ start_etir_record (bfd * abfd, int index, uquad offset, bfd_boolean justoffset)
/* Push start offset. */
_bfd_vms_output_begin (abfd, ETIR_S_C_STA_PQ, -1);
- _bfd_vms_output_long (abfd, (unsigned long) index);
+ _bfd_vms_output_long (abfd, (unsigned long) sec_index);
_bfd_vms_output_quad (abfd, (uquad) offset);
_bfd_vms_output_flush (abfd);
@@ -2346,11 +2346,11 @@ end_etir_record (bfd * abfd)
}
/* Output a STO_IMM command for SSIZE bytes of data from CPR at virtual
- address VADDR in section specified by INDEX and NAME. */
+ address VADDR in section specified by SEC_INDEX and NAME. */
static void
sto_imm (bfd *abfd, bfd_size_type ssize, unsigned char *cptr, bfd_vma vaddr,
- int index, const char *name)
+ int sec_index, const char *name)
{
bfd_size_type size;
@@ -2372,7 +2372,7 @@ sto_imm (bfd *abfd, bfd_size_type ssize, unsigned char *cptr, bfd_vma vaddr,
if (name [0] && name[1] == 'v' && !strcmp (name, ".vmsdebug"))
start_another_etbt_record (abfd);
else
- start_etir_record (abfd, index, vaddr, FALSE);
+ start_etir_record (abfd, sec_index, vaddr, FALSE);
size = _bfd_vms_output_check (abfd, 0); /* get max size */
if (size > ssize) /* more than what's left ? */
diff --git a/bfd/vms.c b/bfd/vms.c
index 2d49ba019d5..a2886dd2c2b 100644
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -603,7 +603,7 @@ vms_new_section_hook (bfd * abfd, asection *section)
if (section_count > PRIV (section_count))
{
- bfd_size_type amt = section_count;
+ amt = section_count;
amt *= sizeof (asection *);
PRIV (sections) = bfd_realloc_or_free (PRIV (sections), amt);
if (PRIV (sections) == NULL)
diff --git a/bfd/warning.m4 b/bfd/warning.m4
index 0b0bf2f7f8b..b4a2f48f8ba 100644
--- a/bfd/warning.m4
+++ b/bfd/warning.m4
@@ -1,7 +1,7 @@
dnl Common configure.in fragment
AC_DEFUN([AM_BINUTILS_WARNINGS],[
-GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow"
AC_ARG_ENABLE(werror,
[ --enable-werror treat compile warnings as errors],
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 8885ca305c0..6ad148b5836 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -687,12 +687,12 @@ bfd_boolean
bfd_xcoff_split_import_path (bfd *abfd, const char *filename,
const char **imppath, const char **impfile)
{
- const char *basename;
+ const char *base;
size_t length;
char *path;
- basename = lbasename (filename);
- length = basename - filename;
+ base = lbasename (filename);
+ length = base - filename;
if (length == 0)
/* The filename has no directory component, so use an empty path. */
*imppath = "";
@@ -711,7 +711,7 @@ bfd_xcoff_split_import_path (bfd *abfd, const char *filename,
path[length - 1] = 0;
*imppath = path;
}
- *impfile = basename;
+ *impfile = base;
return TRUE;
}
diff --git a/bfd/xsym.c b/bfd/xsym.c
index dd1ffd77731..6d56729a1b8 100644
--- a/bfd/xsym.c
+++ b/bfd/xsym.c
@@ -84,11 +84,11 @@ static unsigned long
compute_offset (unsigned long first_page,
unsigned long page_size,
unsigned long entry_size,
- unsigned long index)
+ unsigned long sym_index)
{
unsigned long entries_per_page = page_size / entry_size;
- unsigned long page_number = first_page + (index / entries_per_page);
- unsigned long page_offset = (index % entries_per_page) * entry_size;
+ unsigned long page_number = first_page + (sym_index / entries_per_page);
+ unsigned long page_offset = (sym_index % entries_per_page) * entry_size;
return (page_number * page_size) + page_offset;
}
@@ -530,7 +530,7 @@ bfd_sym_parse_type_table_entry_v32 (unsigned char *buf,
int
bfd_sym_fetch_resources_table_entry (bfd *abfd,
bfd_sym_resources_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_resources_table_entry *);
unsigned long offset;
@@ -542,7 +542,7 @@ bfd_sym_fetch_resources_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
@@ -566,7 +566,7 @@ bfd_sym_fetch_resources_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_rte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -581,7 +581,7 @@ bfd_sym_fetch_resources_table_entry (bfd *abfd,
int
bfd_sym_fetch_modules_table_entry (bfd *abfd,
bfd_sym_modules_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_modules_table_entry *);
unsigned long offset;
@@ -593,7 +593,7 @@ bfd_sym_fetch_modules_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
@@ -617,7 +617,7 @@ bfd_sym_fetch_modules_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_mte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -632,7 +632,7 @@ bfd_sym_fetch_modules_table_entry (bfd *abfd,
int
bfd_sym_fetch_file_references_table_entry (bfd *abfd,
bfd_sym_file_references_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_file_references_table_entry *);
unsigned long offset;
@@ -644,7 +644,7 @@ bfd_sym_fetch_file_references_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
@@ -667,7 +667,7 @@ bfd_sym_fetch_file_references_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_frte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -682,7 +682,7 @@ bfd_sym_fetch_file_references_table_entry (bfd *abfd,
int
bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
bfd_sym_contained_modules_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry *);
unsigned long offset;
@@ -694,7 +694,7 @@ bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
@@ -717,7 +717,7 @@ bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_cmte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -732,7 +732,7 @@ bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
int
bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
bfd_sym_contained_variables_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry *);
unsigned long offset;
@@ -744,7 +744,7 @@ bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
@@ -767,7 +767,7 @@ bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_cvte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -782,7 +782,7 @@ bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
int
bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
bfd_sym_contained_statements_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry *);
unsigned long offset;
@@ -794,7 +794,7 @@ bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
@@ -817,7 +817,7 @@ bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_csnte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -832,7 +832,7 @@ bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
int
bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
bfd_sym_contained_labels_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry *);
unsigned long offset;
@@ -844,7 +844,7 @@ bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
@@ -867,7 +867,7 @@ bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_clte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -882,7 +882,7 @@ bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
int
bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
bfd_sym_contained_types_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_contained_types_table_entry *);
unsigned long offset;
@@ -894,7 +894,7 @@ bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
@@ -917,7 +917,7 @@ bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_ctte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -932,7 +932,7 @@ bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
int
bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
bfd_sym_file_references_index_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry *);
unsigned long offset;
@@ -944,7 +944,7 @@ bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
@@ -967,7 +967,7 @@ bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_fite.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -982,7 +982,7 @@ bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
int
bfd_sym_fetch_constant_pool_entry (bfd *abfd,
bfd_sym_constant_pool_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_constant_pool_entry *);
unsigned long offset;
@@ -994,7 +994,7 @@ bfd_sym_fetch_constant_pool_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
@@ -1017,7 +1017,7 @@ bfd_sym_fetch_constant_pool_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_fite.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -1032,7 +1032,7 @@ bfd_sym_fetch_constant_pool_entry (bfd *abfd,
int
bfd_sym_fetch_type_table_entry (bfd *abfd,
bfd_sym_type_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_type_table_entry *);
unsigned long offset;
@@ -1064,7 +1064,7 @@ bfd_sym_fetch_type_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_tte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
@@ -1124,7 +1124,7 @@ bfd_sym_fetch_type_information_table_entry (bfd *abfd,
int
bfd_sym_fetch_type_table_information (bfd *abfd,
bfd_sym_type_information_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
bfd_sym_type_table_entry tindex;
bfd_sym_data_struct *sdata = NULL;
@@ -1134,10 +1134,10 @@ bfd_sym_fetch_type_table_information (bfd *abfd,
if (sdata->header.dshb_tte.dti_object_count <= 99)
return -1;
- if (index < 100)
+ if (sym_index < 100)
return -1;
- if (bfd_sym_fetch_type_table_entry (abfd, &tindex, index - 100) < 0)
+ if (bfd_sym_fetch_type_table_entry (abfd, &tindex, sym_index - 100) < 0)
return -1;
if (bfd_sym_fetch_type_information_table_entry (abfd, entry, tindex) < 0)
return -1;
@@ -1146,30 +1146,30 @@ bfd_sym_fetch_type_table_information (bfd *abfd,
}
const unsigned char *
-bfd_sym_symbol_name (bfd *abfd, unsigned long index)
+bfd_sym_symbol_name (bfd *abfd, unsigned long sym_index)
{
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return (const unsigned char *) "";
- index *= 2;
- if ((index / sdata->header.dshb_page_size)
+ sym_index *= 2;
+ if ((sym_index / sdata->header.dshb_page_size)
> sdata->header.dshb_nte.dti_page_count)
return (const unsigned char *) "\09[INVALID]";
- return (const unsigned char *) sdata->name_table + index;
+ return (const unsigned char *) sdata->name_table + sym_index;
}
const unsigned char *
-bfd_sym_module_name (bfd *abfd, unsigned long index)
+bfd_sym_module_name (bfd *abfd, unsigned long sym_index)
{
bfd_sym_modules_table_entry entry;
- if (bfd_sym_fetch_modules_table_entry (abfd, &entry, index) < 0)
+ if (bfd_sym_fetch_modules_table_entry (abfd, &entry, sym_index) < 0)
return (const unsigned char *) "\09[INVALID]";
return bfd_sym_symbol_name (abfd, entry.mte_nte_index);
@@ -1859,24 +1859,24 @@ bfd_sym_display_name_table_entry (bfd *abfd,
FILE *f,
unsigned char *entry)
{
- unsigned long index;
+ unsigned long sym_index;
unsigned long offset;
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- index = (entry - sdata->name_table) / 2;
+ sym_index = (entry - sdata->name_table) / 2;
if (sdata->version >= BFD_SYM_VERSION_3_4 && entry[0] == 255 && entry[1] == 0)
{
unsigned short length = bfd_getb16 (entry + 2);
- fprintf (f, "[%8lu] \"%.*s\"\n", index, length, entry + 4);
+ fprintf (f, "[%8lu] \"%.*s\"\n", sym_index, length, entry + 4);
offset = 2 + length + 1;
}
else
{
if (! (entry[0] == 0 || (entry[0] == 1 && entry[1] == '\0')))
- fprintf (f, "[%8lu] \"%.*s\"\n", index, entry[0], entry + 1);
+ fprintf (f, "[%8lu] \"%.*s\"\n", sym_index, entry[0], entry + 1);
if (sdata->version >= BFD_SYM_VERSION_3_4)
offset = entry[0] + 2;
@@ -2178,7 +2178,7 @@ void
bfd_sym_display_type_information_table (bfd *abfd, FILE *f)
{
unsigned long i;
- bfd_sym_type_table_entry index;
+ bfd_sym_type_table_entry sym_index;
bfd_sym_type_information_table_entry entry;
bfd_sym_data_struct *sdata = NULL;
@@ -2196,13 +2196,13 @@ bfd_sym_display_type_information_table (bfd *abfd, FILE *f)
for (i = 100; i <= sdata->header.dshb_tte.dti_object_count; i++)
{
- if (bfd_sym_fetch_type_table_entry (abfd, &index, i - 100) < 0)
+ if (bfd_sym_fetch_type_table_entry (abfd, &sym_index, i - 100) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
- fprintf (f, " [%8lu] (TINFO %lu) ", i, index);
+ fprintf (f, " [%8lu] (TINFO %lu) ", i, sym_index);
- if (bfd_sym_fetch_type_information_table_entry (abfd, &entry, index) < 0)
+ if (bfd_sym_fetch_type_information_table_entry (abfd, &entry, sym_index) < 0)
fprintf (f, "[INVALID]");
else
bfd_sym_print_type_information_table_entry (abfd, f, &entry);
diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c
index 138f6eceb72..26deaaa7eac 100644
--- a/bfd/xtensa-isa.c
+++ b/bfd/xtensa-isa.c
@@ -1,5 +1,5 @@
/* Configurable Xtensa ISA support.
- Copyright 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -1028,15 +1028,14 @@ xtensa_operand_encode (xtensa_isa isa, xtensa_opcode opc, int opnd,
uint32 test_val, orig_val;
intop = get_operand (intisa, opc, opnd);
- if (!intop) return -1;
+ if (!intop)
+ return -1;
if (!intop->encode)
{
/* This is a default operand for a field. How can we tell if the
value fits in the field? Write the value into the field,
read it back, and then make sure we get the same value. */
-
- xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
static xtensa_insnbuf tmpbuf = 0;
int slot_id;
@@ -1081,9 +1080,9 @@ xtensa_operand_encode (xtensa_isa isa, xtensa_opcode opc, int opnd,
was successfully encoded is to decode it and check if it matches
the original value. */
orig_val = *valp;
- if ((*intop->encode) (valp) ||
- (test_val = *valp, (*intop->decode) (&test_val)) ||
- test_val != orig_val)
+ if ((*intop->encode) (valp)
+ || (test_val = *valp, (*intop->decode) (&test_val))
+ || test_val != orig_val)
{
xtisa_errno = xtensa_isa_bad_value;
sprintf (xtisa_error_msg, "cannot encode operand value 0x%08x", *valp);