From 5413b5486ba77949122a8bfd6067d31626e330f3 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 11 Dec 2009 13:41:59 +0000 Subject: [PATCH] Add -Wshadow to the gcc command line options used when compiling the binutils. Fix up all warnings generated by the addition of this switch. --- bfd/ChangeLog | 63 +++++ bfd/Makefile.in | 4 +- bfd/aout-arm.c | 10 +- bfd/aout-tic30.c | 6 +- bfd/aoutx.h | 10 +- bfd/archive.c | 14 +- bfd/coff-alpha.c | 6 +- bfd/coff-i386.c | 8 +- bfd/coff-x86_64.c | 8 +- bfd/coffgen.c | 10 +- bfd/configure | 2 +- bfd/doc/Makefile.in | 4 +- bfd/dwarf2.c | 18 +- bfd/ecoff.c | 10 +- bfd/elf-eh-frame.c | 3 +- bfd/elf-m10300.c | 6 - bfd/elf.c | 72 ++--- bfd/elf32-arm.c | 85 +++--- bfd/elf32-avr.c | 360 ++++++++++++------------ bfd/elf32-bfin.c | 1 - bfd/elf32-cr16.c | 5 - bfd/elf32-i386.c | 6 +- bfd/elf32-ip2k.c | 16 +- bfd/elf32-lm32.c | 2 - bfd/elf32-m68hc1x.c | 1 - bfd/elf32-microblaze.c | 21 +- bfd/elf32-ppc.c | 55 ++-- bfd/elf32-rx.c | 20 +- bfd/elf32-score.c | 17 +- bfd/elf32-score7.c | 17 +- bfd/elf32-sh.c | 12 +- bfd/elf32-spu.c | 9 +- bfd/elf32-v850.c | 6 +- bfd/elf32-xtensa.c | 19 +- bfd/elf64-hppa.c | 13 +- bfd/elf64-ppc.c | 10 +- bfd/elf64-x86-64.c | 5 +- bfd/elflink.c | 22 +- bfd/elfxx-ia64.c | 38 +-- bfd/elfxx-mips.c | 50 ++-- bfd/elfxx-sparc.c | 26 +- bfd/hash.c | 34 +-- bfd/ieee.c | 22 +- bfd/libbfd.c | 10 +- bfd/mach-o.c | 110 ++++---- bfd/merge.c | 14 +- bfd/nlm32-sparc.c | 24 +- bfd/oasys.c | 14 +- bfd/opncls.c | 55 ++-- bfd/pdp11.c | 10 +- bfd/peXXigen.c | 6 +- bfd/pef.c | 16 +- bfd/versados.c | 6 +- bfd/vms-gsd.c | 3 +- bfd/vms-hdr.c | 6 +- bfd/vms-tir.c | 10 +- bfd/vms.c | 2 +- bfd/warning.m4 | 2 +- bfd/xcofflink.c | 8 +- bfd/xsym.c | 106 +++---- bfd/xtensa-isa.c | 13 +- binutils/ChangeLog | 27 ++ binutils/Makefile.in | 2 + binutils/ar.c | 6 +- binutils/bucomm.c | 12 +- binutils/coffgrok.c | 9 +- binutils/configure | 2 +- binutils/dlltool.c | 24 +- binutils/dllwrap.c | 9 +- binutils/doc/Makefile.in | 2 + binutils/dwarf.c | 229 ++++++++------- binutils/ieee.c | 14 +- binutils/nlmconv.c | 10 +- binutils/nm.c | 38 +-- binutils/objcopy.c | 34 +-- binutils/objdump.c | 224 +++++++-------- binutils/prdbg.c | 10 +- binutils/readelf.c | 201 +++++++------- binutils/resbin.c | 20 +- binutils/resrc.c | 4 +- binutils/resres.c | 20 +- binutils/srconv.c | 41 +-- binutils/stabs.c | 14 +- binutils/sysdump.c | 20 +- binutils/sysinfo.y | 40 ++- binutils/wrstabs.c | 156 +++++------ cpu/ChangeLog | 5 + cpu/frv.opc | 12 +- cpu/m32c.opc | 69 +++-- elfcpp/ChangeLog | 4 + elfcpp/elfcpp_file.h | 10 +- gas/ChangeLog | 46 ++++ gas/Makefile.in | 3 + gas/config/bfin-parse.y | 10 +- gas/config/obj-coff.c | 11 +- gas/config/tc-arm.c | 69 ++--- gas/config/tc-bfin.c | 82 +++--- gas/config/tc-cr16.c | 122 ++++---- gas/config/tc-crx.c | 34 +-- gas/config/tc-d10v.c | 4 +- gas/config/tc-d30v.c | 21 +- gas/config/tc-frv.c | 8 +- gas/config/tc-i370.c | 35 ++- gas/config/tc-i386-intel.c | 46 ++-- gas/config/tc-i386.c | 159 +++++------ gas/config/tc-ia64.c | 82 +++--- gas/config/tc-m32r.c | 10 +- gas/config/tc-m68hc11.c | 30 +- gas/config/tc-mips.c | 72 +++-- gas/config/tc-mn10200.c | 14 +- gas/config/tc-mn10300.c | 12 +- gas/config/tc-ns32k.c | 138 +++++----- gas/config/tc-ppc.c | 17 +- gas/config/tc-score.c | 13 +- gas/config/tc-score7.c | 5 +- gas/config/tc-sh.c | 26 +- gas/config/tc-sh64.c | 8 +- gas/config/tc-sparc.c | 27 +- gas/config/tc-tic30.c | 62 ++--- gas/config/tc-tic4x.c | 130 ++++----- gas/config/tc-tic54x.c | 83 +++--- gas/config/tc-xtensa.c | 111 ++++---- gas/config/tc-z8k.c | 32 +-- gas/configure | 2 +- gas/doc/Makefile.in | 3 + gas/dw2gencfi.c | 1 - gas/dwarf2dbg.c | 190 ++++++------- gas/expr.c | 8 +- gas/hash.c | 26 +- gas/listing.c | 2 +- gas/macro.c | 10 +- gas/read.c | 15 +- gas/stabs.c | 6 +- gas/symbols.c | 28 +- gas/write.c | 10 +- gold/ChangeLog | 51 ++++ gold/archive.cc | 60 ++-- gold/arm.cc | 508 +++++++++++++++++----------------- gold/compressed_output.cc | 14 +- gold/compressed_output.h | 8 +- gold/configure | 2 +- gold/dwarf_reader.cc | 11 +- gold/dynobj.cc | 70 ++--- gold/dynobj.h | 24 +- gold/ehframe.cc | 58 ++-- gold/ehframe.h | 6 +- gold/errors.cc | 6 +- gold/expression.cc | 14 +- gold/fileread.cc | 46 ++-- gold/fileread.h | 12 +- gold/freebsd.h | 8 +- gold/i386.cc | 8 +- gold/icf.cc | 6 +- gold/incremental.h | 4 +- gold/layout.cc | 36 +-- gold/layout.h | 12 +- gold/mapfile.cc | 2 +- gold/merge.cc | 32 +-- gold/merge.h | 26 +- gold/object.cc | 316 ++++++++++----------- gold/object.h | 54 ++-- gold/options.h | 40 +-- gold/output.cc | 464 +++++++++++++++---------------- gold/output.h | 298 ++++++++++---------- gold/parameters.cc | 26 +- gold/plugin.cc | 42 +-- gold/powerpc.cc | 20 +- gold/reduced_debug_output.cc | 22 +- gold/reduced_debug_output.h | 14 +- gold/reloc.cc | 180 ++++++------ gold/reloc.h | 6 +- gold/resolve.cc | 38 +-- gold/script-sections.cc | 64 ++--- gold/script.cc | 58 ++-- gold/script.h | 8 +- gold/sparc.cc | 132 ++++----- gold/symtab.cc | 644 +++++++++++++++++++++---------------------- gold/symtab.h | 44 +-- gold/target-select.cc | 10 +- gold/target-select.h | 6 +- gold/token.h | 4 +- gold/workqueue.cc | 20 +- gold/workqueue.h | 4 +- gold/x86_64.cc | 6 +- gprof/ChangeLog | 9 + gprof/Makefile.in | 2 + gprof/cg_arcs.c | 118 ++++---- gprof/cg_dfn.c | 6 +- gprof/cg_print.c | 170 ++++++------ gprof/configure | 2 +- gprof/hist.c | 36 +-- ld/ChangeLog | 10 + ld/Makefile.in | 3 + ld/configure | 2 +- ld/deffilep.y | 213 +++++++------- ld/emultempl/elf32.em | 30 +- ld/ldlang.c | 10 +- ld/ldmain.c | 14 +- ld/pe-dll.c | 40 +-- opcodes/ChangeLog | 31 +++ opcodes/Makefile.in | 1 + opcodes/arm-dis.c | 10 +- opcodes/cgen-opc.c | 14 +- opcodes/configure | 2 +- opcodes/cr16-dis.c | 46 ++-- opcodes/crx-dis.c | 30 +- opcodes/d30v-dis.c | 10 +- opcodes/fr30-dis.c | 8 +- opcodes/frv-opc.c | 12 +- opcodes/h8500-dis.c | 22 +- opcodes/i386-dis.c | 64 ++--- opcodes/i960-dis.c | 18 +- opcodes/ia64-gen.c | 4 +- opcodes/ia64-opc.c | 12 +- opcodes/m32c-asm.c | 65 ++--- opcodes/m32c-dis.c | 6 +- opcodes/m68k-dis.c | 1 - opcodes/maxq-dis.c | 16 +- opcodes/mcore-dis.c | 66 ++--- opcodes/mep-asm.c | 25 +- opcodes/microblaze-dis.c | 66 ++--- opcodes/mmix-dis.c | 5 +- opcodes/ns32k-dis.c | 19 +- opcodes/or32-opc.c | 16 +- opcodes/s390-dis.c | 2 - opcodes/sh64-dis.c | 2 - opcodes/spu-dis.c | 52 ++-- opcodes/tic30-dis.c | 20 +- 228 files changed, 4824 insertions(+), 4662 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1922f7e2e..d11f19073 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,66 @@ +2009-12-11 Nick Clifton + + * 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 * elfxx-mips.c (mips_elf_calculate_relocation): Correct handling diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 5700ed3b1..233e87e45 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 a533cd630..6e99b2ef4 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 feaec8a8c..50d153b5c 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 9521d0a8f..74882563b 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 36252d579..4d6746306 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 0d67264cf..ce217f549 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 e512b3fa3..e7c4e8a27 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 08ada5a6c..4d500fe7c 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 5f6921d9d..63053a1de 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 d5c34266a..b4bdb3cf3 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 370fcadb3..12365ab15 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 5d504c868..98e8945d2 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 48ce98cc7..472aab1dd 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 5d1def943..37c92553c 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 794d329fe..4a9d4b051 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 88ebf7192..8378481bf 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 2168fc04f..1921780ed 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 cc063600a..804033e6a 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 a76774901..3f9483ac2 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 f82d1e902..9a4e2a9ba 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 016e04611..61e309720 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 96d0cd5ba..40c2205d3 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 705356872..6184f49fc 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 544db35b7..db63856d4 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 c975e7680..4c5a38da7 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 976dd3700..e863f7e34 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 dadd40703..cab7a145a 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 a3308286d..15612d379 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 af37817dd..bb74f28c2 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 7b81aab7c..b16e3e1dd 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 250beef3d..c6139c9da 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 922698f61..2965e290d 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 9f961dcde..1740c355a 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 637d232fe..06a3ae4d1 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 94f89c57b..a181c2827 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 779ad0f80..e6b1f111d 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 8e29154e6..bbdfe5e91 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 420a0ef19..f7563329d 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 9df441de7..b6492783e 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 d3fe1bafa..06ae25e3a 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 5223e21d2..fc05923a5 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 68bdd5ed5..429572b12 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 f79e19054..b378622b6 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 766fb3d76..fb66db0d3 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 80f80b83a..7aa088ff9 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 b818cfd04..42c0c5bda 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 17714ec20..a3ef7526e 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 4afde8818..7a884c206 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 e4096f32c..8f448728e 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 63ca3c0a3..87e66d7c4 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 b7156f062..788388cbf 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 f3de87188..d7a5d47f0 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 e641d0de4..ba75bbf41 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 407fa7fdf..49e680962 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 5bc61da87..86b55ced4 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 2d49ba019..a2886dd2c 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 0b0bf2f7f..b4a2f48f8 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 8885ca305..6ad148b58 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 dd1ffd777..6d56729a1 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 138f6eceb..26deaaa7e 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); diff --git a/binutils/ChangeLog b/binutils/ChangeLog index e295fcac7..9ed437602 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,30 @@ +2009-12-11 Nick Clifton + + * Makefile.in: Regenerate. + * doc/Makefile.in: Regenerate. + * ar.c: Fix shadowed variable warnings. + * bucomm.c: Likewise. + * coffgrok.c: Likewise. + * configure: Likewise. + * dlltool.c: Likewise. + * dllwrap.c: Likewise. + * dwarf.c: Likewise. + * ieee.c: Likewise. + * nlmconv.c: Likewise. + * nm.c: Likewise. + * objcopy.c: Likewise. + * objdump.c: Likewise. + * prdbg.c: Likewise. + * readelf.c: Likewise. + * resbin.c: Likewise. + * resrc.c: Likewise. + * resres.c: Likewise. + * srconv.c: Likewise. + * stabs.c: Likewise. + * sysdump.c: Likewise. + * sysinfo.y: Likewise. + * wrstabs.c: Likewise. + 2009-12-10 Tristan Gingold * addr2line.c (pretty_print): New variable. diff --git a/binutils/Makefile.in b/binutils/Makefile.in index dcda20fa3..5b29a026f 100644 --- a/binutils/Makefile.in +++ b/binutils/Makefile.in @@ -54,10 +54,12 @@ DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \ rcparse.h rcparse.c $(srcdir)/../depcomp $(srcdir)/../ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/zlib.m4 \ $(top_srcdir)/../bfd/warning.m4 \ $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \ $(top_srcdir)/../config/iconv.m4 \ + $(top_srcdir)/../config/largefile.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lib-ld.m4 \ $(top_srcdir)/../config/lib-link.m4 \ diff --git a/binutils/ar.c b/binutils/ar.c index 5bffd50a6..15a7b477b 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -1168,14 +1168,14 @@ move_members (bfd *arch, char **files_to_move) { /* Move this file to the end of the list - first cut from where it is. */ - bfd *link; + bfd *link_bfd; *current_ptr_ptr = current_ptr->archive_next; /* Now glue to end */ after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL); - link = *after_bfd; + link_bfd = *after_bfd; *after_bfd = current_ptr; - current_ptr->archive_next = link; + current_ptr->archive_next = link_bfd; if (verbose) printf ("m - %s\n", *files_to_move); diff --git a/binutils/bucomm.c b/binutils/bucomm.c index 64653d65a..e568b031a 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -70,12 +70,12 @@ bfd_nonfatal (const char *string) PROGRAM:file: bfd-error-message PROGRAM:file[section]: bfd-error-message PROGRAM:file: printf-message: bfd-error-message - PROGRAM:file[section]: printf-message: bfd-error-message -*/ + PROGRAM:file[section]: printf-message: bfd-error-message. */ void bfd_nonfatal_message (const char *filename, - const bfd *bfd, const asection *section, + const bfd *abfd, + const asection *section, const char *format, ...) { const char *errmsg = bfd_errmsg (bfd_get_error ()); @@ -85,12 +85,12 @@ bfd_nonfatal_message (const char *filename, va_start (args, format); fprintf (stderr, "%s", program_name); - if (bfd) + if (abfd) { if (!filename) - filename = bfd_get_archive_filename (bfd); + filename = bfd_get_archive_filename (abfd); if (section) - section_name = bfd_get_section_name (bfd, section); + section_name = bfd_get_section_name (abfd, section); } if (section_name) fprintf (stderr, ":%s[%s]", filename, section_name); diff --git a/binutils/coffgrok.c b/binutils/coffgrok.c index cc425f0fd..97574e7d0 100644 --- a/binutils/coffgrok.c +++ b/binutils/coffgrok.c @@ -1,6 +1,6 @@ /* coffgrok.c - Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2007 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, + 2007, 2009 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -96,10 +96,11 @@ empty_symbol (void) /*int l;*/ static void -push_scope (int link) +push_scope (int slink) { struct coff_scope *n = empty_scope (); - if (link) + + if (slink) { if (top_scope) { diff --git a/binutils/configure b/binutils/configure index 65d22ce3f..cb54f078e 100755 --- a/binutils/configure +++ b/binutils/configure @@ -11440,7 +11440,7 @@ esac 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/binutils/dlltool.c b/binutils/dlltool.c index b9d717fb2..280edc14d 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -879,9 +879,9 @@ inform VPARAMS ((const char * message, ...)) } static const char * -rvaafter (int machine) +rvaafter (int mach) { - switch (machine) + switch (mach) { case MARM: case M386: @@ -898,16 +898,16 @@ rvaafter (int machine) break; default: /* xgettext:c-format */ - fatal (_("Internal error: Unknown machine type: %d"), machine); + fatal (_("Internal error: Unknown machine type: %d"), mach); break; } return ""; } static const char * -rvabefore (int machine) +rvabefore (int mach) { - switch (machine) + switch (mach) { case MARM: case M386: @@ -924,16 +924,16 @@ rvabefore (int machine) return ".rva\t"; default: /* xgettext:c-format */ - fatal (_("Internal error: Unknown machine type: %d"), machine); + fatal (_("Internal error: Unknown machine type: %d"), mach); break; } return ""; } static const char * -asm_prefix (int machine, const char *name) +asm_prefix (int mach, const char *name) { - switch (machine) + switch (mach) { case MARM: case MPPC: @@ -955,7 +955,7 @@ asm_prefix (int machine, const char *name) return "_"; default: /* xgettext:c-format */ - fatal (_("Internal error: Unknown machine type: %d"), machine); + fatal (_("Internal error: Unknown machine type: %d"), mach); break; } return ""; @@ -1155,7 +1155,7 @@ def_stacksize (int reserve, int commit) import_list. It is used by def_import. */ static void -append_import (const char *symbol_name, const char *dll_name, int func_ordinal, +append_import (const char *symbol_name, const char *dllname, int func_ordinal, const char *its_name) { iheadtype **pq; @@ -1163,7 +1163,7 @@ append_import (const char *symbol_name, const char *dll_name, int func_ordinal, for (pq = &import_list; *pq != NULL; pq = &(*pq)->next) { - if (strcmp ((*pq)->dllname, dll_name) == 0) + if (strcmp ((*pq)->dllname, dllname) == 0) { q = *pq; q->functail->next = xmalloc (sizeof (ifunctype)); @@ -1178,7 +1178,7 @@ append_import (const char *symbol_name, const char *dll_name, int func_ordinal, } q = xmalloc (sizeof (iheadtype)); - q->dllname = xstrdup (dll_name); + q->dllname = xstrdup (dllname); q->nfuncs = 1; q->funchead = xmalloc (sizeof (ifunctype)); q->functail = q->funchead; diff --git a/binutils/dllwrap.c b/binutils/dllwrap.c index 50bbeb563..c807f49c2 100644 --- a/binutils/dllwrap.c +++ b/binutils/dllwrap.c @@ -1,5 +1,5 @@ /* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc. Contributed by Mumit Khan (khan@xraylith.wisc.edu). @@ -182,20 +182,20 @@ warn VPARAMS ((const char *format, ...)) appropriate. */ static char * -look_for_prog (const char *prog_name, const char *prefix, int end_prefix) +look_for_prog (const char *progname, const char *prefix, int end_prefix) { struct stat s; char *cmd; cmd = xmalloc (strlen (prefix) - + strlen (prog_name) + + strlen (progname) #ifdef HAVE_EXECUTABLE_SUFFIX + strlen (EXECUTABLE_SUFFIX) #endif + 10); strcpy (cmd, prefix); - sprintf (cmd + end_prefix, "%s", prog_name); + sprintf (cmd + end_prefix, "%s", progname); if (strchr (cmd, '/') != NULL) { @@ -973,7 +973,6 @@ Creating one, but that may not be what you want")); if (! def_file_seen) { - int i; dyn_string_t step_pre1; step_pre1 = dyn_string_new (1024); diff --git a/binutils/doc/Makefile.in b/binutils/doc/Makefile.in index f2d63c87f..897e5d8be 100644 --- a/binutils/doc/Makefile.in +++ b/binutils/doc/Makefile.in @@ -38,10 +38,12 @@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/zlib.m4 \ $(top_srcdir)/../bfd/warning.m4 \ $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \ $(top_srcdir)/../config/iconv.m4 \ + $(top_srcdir)/../config/largefile.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lib-ld.m4 \ $(top_srcdir)/../config/lib-link.m4 \ diff --git a/binutils/dwarf.c b/binutils/dwarf.c index e2e85bc31..eb6c2d709 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -438,23 +438,23 @@ static abbrev_entry *last_abbrev = NULL; static void free_abbrevs (void) { - abbrev_entry *abbrev; + abbrev_entry *abbrv; - for (abbrev = first_abbrev; abbrev;) + for (abbrv = first_abbrev; abbrv;) { - abbrev_entry *next = abbrev->next; + abbrev_entry *next_abbrev = abbrv->next; abbrev_attr *attr; - for (attr = abbrev->first_attr; attr;) + for (attr = abbrv->first_attr; attr;) { - abbrev_attr *next = attr->next; + abbrev_attr *next_attr = attr->next; free (attr); - attr = next; + attr = next_attr; } - free (abbrev); - abbrev = next; + free (abbrv); + abbrv = next_abbrev; } last_abbrev = first_abbrev = NULL; @@ -1355,19 +1355,19 @@ read_and_display_attr_value (unsigned long attribute, if (form == DW_FORM_data4 || form == DW_FORM_data8) { /* Process location list. */ - unsigned int max = debug_info_p->max_loc_offsets; + unsigned int lmax = debug_info_p->max_loc_offsets; unsigned int num = debug_info_p->num_loc_offsets; - if (max == 0 || num >= max) + if (lmax == 0 || num >= lmax) { - max += 1024; + lmax += 1024; debug_info_p->loc_offsets = (long unsigned int *) xcrealloc (debug_info_p->loc_offsets, - max, sizeof (*debug_info_p->loc_offsets)); + lmax, sizeof (*debug_info_p->loc_offsets)); debug_info_p->have_frame_base = (int *) xcrealloc (debug_info_p->have_frame_base, - max, sizeof (*debug_info_p->have_frame_base)); - debug_info_p->max_loc_offsets = max; + lmax, sizeof (*debug_info_p->have_frame_base)); + debug_info_p->max_loc_offsets = lmax; } debug_info_p->loc_offsets [num] = uvalue; debug_info_p->have_frame_base [num] = have_frame_base; @@ -1384,16 +1384,16 @@ read_and_display_attr_value (unsigned long attribute, if (form == DW_FORM_data4 || form == DW_FORM_data8) { /* Process range list. */ - unsigned int max = debug_info_p->max_range_lists; + unsigned int lmax = debug_info_p->max_range_lists; unsigned int num = debug_info_p->num_range_lists; - if (max == 0 || num >= max) + if (lmax == 0 || num >= lmax) { - max += 1024; + lmax += 1024; debug_info_p->range_lists = (long unsigned int *) xcrealloc (debug_info_p->range_lists, - max, sizeof (*debug_info_p->range_lists)); - debug_info_p->max_range_lists = max; + lmax, sizeof (*debug_info_p->range_lists)); + debug_info_p->max_range_lists = lmax; } debug_info_p->range_lists [num] = uvalue; debug_info_p->num_range_lists++; @@ -2226,7 +2226,7 @@ display_debug_lines_raw (struct dwarf_section *section, while (data < end) { - DWARF2_Internal_LineInfo info; + DWARF2_Internal_LineInfo linfo; unsigned char *standard_opcodes; unsigned char *end_of_sequence; unsigned char *hdrptr; @@ -2239,13 +2239,13 @@ display_debug_lines_raw (struct dwarf_section *section, hdroff = hdrptr - start; /* Check the length of the block. */ - info.li_length = byte_get (hdrptr, 4); + linfo.li_length = byte_get (hdrptr, 4); hdrptr += 4; - if (info.li_length == 0xffffffff) + if (linfo.li_length == 0xffffffff) { /* This section is 64-bit DWARF 3. */ - info.li_length = byte_get (hdrptr, 8); + linfo.li_length = byte_get (hdrptr, 8); hdrptr += 8; offset_size = 8; initial_length_size = 12; @@ -2256,7 +2256,7 @@ display_debug_lines_raw (struct dwarf_section *section, initial_length_size = 4; } - if (info.li_length + initial_length_size > section->size) + if (linfo.li_length + initial_length_size > section->size) { warn (_("The information in section %s appears to be corrupt - the section is too small\n"), @@ -2265,55 +2265,55 @@ display_debug_lines_raw (struct dwarf_section *section, } /* Check its version number. */ - info.li_version = byte_get (hdrptr, 2); + linfo.li_version = byte_get (hdrptr, 2); hdrptr += 2; - if (info.li_version != 2 && info.li_version != 3) + if (linfo.li_version != 2 && linfo.li_version != 3) { warn (_("Only DWARF version 2 and 3 line info is currently supported.\n")); return 0; } - info.li_prologue_length = byte_get (hdrptr, offset_size); + linfo.li_prologue_length = byte_get (hdrptr, offset_size); hdrptr += offset_size; - info.li_min_insn_length = byte_get (hdrptr, 1); + linfo.li_min_insn_length = byte_get (hdrptr, 1); hdrptr++; - info.li_default_is_stmt = byte_get (hdrptr, 1); + linfo.li_default_is_stmt = byte_get (hdrptr, 1); hdrptr++; - info.li_line_base = byte_get (hdrptr, 1); + linfo.li_line_base = byte_get (hdrptr, 1); hdrptr++; - info.li_line_range = byte_get (hdrptr, 1); + linfo.li_line_range = byte_get (hdrptr, 1); hdrptr++; - info.li_opcode_base = byte_get (hdrptr, 1); + linfo.li_opcode_base = byte_get (hdrptr, 1); hdrptr++; /* Sign extend the line base field. */ - info.li_line_base <<= 24; - info.li_line_base >>= 24; + linfo.li_line_base <<= 24; + linfo.li_line_base >>= 24; printf (_(" Offset: 0x%lx\n"), hdroff); - printf (_(" Length: %ld\n"), info.li_length); - printf (_(" DWARF Version: %d\n"), info.li_version); - printf (_(" Prologue Length: %d\n"), info.li_prologue_length); - printf (_(" Minimum Instruction Length: %d\n"), info.li_min_insn_length); - printf (_(" Initial value of 'is_stmt': %d\n"), info.li_default_is_stmt); - printf (_(" Line Base: %d\n"), info.li_line_base); - printf (_(" Line Range: %d\n"), info.li_line_range); - printf (_(" Opcode Base: %d\n"), info.li_opcode_base); + printf (_(" Length: %ld\n"), linfo.li_length); + printf (_(" DWARF Version: %d\n"), linfo.li_version); + printf (_(" Prologue Length: %d\n"), linfo.li_prologue_length); + printf (_(" Minimum Instruction Length: %d\n"), linfo.li_min_insn_length); + printf (_(" Initial value of 'is_stmt': %d\n"), linfo.li_default_is_stmt); + printf (_(" Line Base: %d\n"), linfo.li_line_base); + printf (_(" Line Range: %d\n"), linfo.li_line_range); + printf (_(" Opcode Base: %d\n"), linfo.li_opcode_base); - end_of_sequence = data + info.li_length + initial_length_size; + end_of_sequence = data + linfo.li_length + initial_length_size; - reset_state_machine (info.li_default_is_stmt); + reset_state_machine (linfo.li_default_is_stmt); /* Display the contents of the Opcodes table. */ standard_opcodes = hdrptr; printf (_("\n Opcodes:\n")); - for (i = 1; i < info.li_opcode_base; i++) + for (i = 1; i < linfo.li_opcode_base; i++) printf (_(" Opcode %d has %d args\n"), i, standard_opcodes[i - 1]); /* Display the contents of the Directory table. */ - data = standard_opcodes + info.li_opcode_base - 1; + data = standard_opcodes + linfo.li_opcode_base - 1; if (*data == 0) printf (_("\n The Directory Table is empty.\n")); @@ -2375,14 +2375,14 @@ display_debug_lines_raw (struct dwarf_section *section, op_code = *data++; - if (op_code >= info.li_opcode_base) + if (op_code >= linfo.li_opcode_base) { - op_code -= info.li_opcode_base; - uladv = (op_code / info.li_line_range) * info.li_min_insn_length; + op_code -= linfo.li_opcode_base; + uladv = (op_code / linfo.li_line_range) * linfo.li_min_insn_length; state_machine_regs.address += uladv; printf (_(" Special opcode %d: advance Address by %lu to 0x%lx"), op_code, uladv, state_machine_regs.address); - adv = (op_code % info.li_line_range) + info.li_line_base; + adv = (op_code % linfo.li_line_range) + linfo.li_line_base; state_machine_regs.line += adv; printf (_(" and Line by %d to %d\n"), adv, state_machine_regs.line); @@ -2390,7 +2390,7 @@ display_debug_lines_raw (struct dwarf_section *section, else switch (op_code) { case DW_LNS_extended_op: - data += process_extended_line_op (data, info.li_default_is_stmt); + data += process_extended_line_op (data, linfo.li_default_is_stmt); break; case DW_LNS_copy: @@ -2399,7 +2399,7 @@ display_debug_lines_raw (struct dwarf_section *section, case DW_LNS_advance_pc: uladv = read_leb128 (data, & bytes_read, 0); - uladv *= info.li_min_insn_length; + uladv *= linfo.li_min_insn_length; data += bytes_read; state_machine_regs.address += uladv; printf (_(" Advance PC by %lu to 0x%lx\n"), uladv, @@ -2442,8 +2442,8 @@ display_debug_lines_raw (struct dwarf_section *section, break; case DW_LNS_const_add_pc: - uladv = (((255 - info.li_opcode_base) / info.li_line_range) - * info.li_min_insn_length); + uladv = (((255 - linfo.li_opcode_base) / linfo.li_line_range) + * linfo.li_min_insn_length); state_machine_regs.address += uladv; printf (_(" Advance PC by constant %lu to 0x%lx\n"), uladv, state_machine_regs.address); @@ -2511,7 +2511,7 @@ display_debug_lines_decoded (struct dwarf_section *section, while (data < end) { /* This loop amounts to one iteration per compilation unit. */ - DWARF2_Internal_LineInfo info; + DWARF2_Internal_LineInfo linfo; unsigned char *standard_opcodes; unsigned char *end_of_sequence; unsigned char *hdrptr; @@ -2528,13 +2528,13 @@ display_debug_lines_decoded (struct dwarf_section *section, (section 6.2.4 in the Dwarf3 doc). */ /* Get the length of this CU's line number information block. */ - info.li_length = byte_get (hdrptr, 4); + linfo.li_length = byte_get (hdrptr, 4); hdrptr += 4; - if (info.li_length == 0xffffffff) + if (linfo.li_length == 0xffffffff) { /* This section is 64-bit DWARF 3. */ - info.li_length = byte_get (hdrptr, 8); + linfo.li_length = byte_get (hdrptr, 8); hdrptr += 8; offset_size = 8; initial_length_size = 12; @@ -2545,7 +2545,7 @@ display_debug_lines_decoded (struct dwarf_section *section, initial_length_size = 4; } - if (info.li_length + initial_length_size > section->size) + if (linfo.li_length + initial_length_size > section->size) { warn (_("The line info appears to be corrupt - " "the section is too small\n")); @@ -2553,47 +2553,46 @@ display_debug_lines_decoded (struct dwarf_section *section, } /* Get this CU's Line Number Block version number. */ - info.li_version = byte_get (hdrptr, 2); + linfo.li_version = byte_get (hdrptr, 2); hdrptr += 2; - if (info.li_version != 2 && info.li_version != 3) + if (linfo.li_version != 2 && linfo.li_version != 3) { warn (_("Only DWARF version 2 and 3 line info is currently " "supported.\n")); return 0; } - info.li_prologue_length = byte_get (hdrptr, offset_size); + linfo.li_prologue_length = byte_get (hdrptr, offset_size); hdrptr += offset_size; - info.li_min_insn_length = byte_get (hdrptr, 1); + linfo.li_min_insn_length = byte_get (hdrptr, 1); hdrptr++; - info.li_default_is_stmt = byte_get (hdrptr, 1); + linfo.li_default_is_stmt = byte_get (hdrptr, 1); hdrptr++; - info.li_line_base = byte_get (hdrptr, 1); + linfo.li_line_base = byte_get (hdrptr, 1); hdrptr++; - info.li_line_range = byte_get (hdrptr, 1); + linfo.li_line_range = byte_get (hdrptr, 1); hdrptr++; - info.li_opcode_base = byte_get (hdrptr, 1); + linfo.li_opcode_base = byte_get (hdrptr, 1); hdrptr++; /* Sign extend the line base field. */ - info.li_line_base <<= 24; - info.li_line_base >>= 24; + linfo.li_line_base <<= 24; + linfo.li_line_base >>= 24; /* Find the end of this CU's Line Number Information Block. */ - end_of_sequence = data + info.li_length + initial_length_size; + end_of_sequence = data + linfo.li_length + initial_length_size; - reset_state_machine (info.li_default_is_stmt); + reset_state_machine (linfo.li_default_is_stmt); /* Save a pointer to the contents of the Opcodes table. */ standard_opcodes = hdrptr; /* Traverse the Directory table just to count entries. */ - data = standard_opcodes + info.li_opcode_base - 1; + data = standard_opcodes + linfo.li_opcode_base - 1; if (*data != 0) { unsigned int n_directories = 0; unsigned char *ptr_directory_table = data; - int i; while (*data != 0) { @@ -2621,7 +2620,6 @@ display_debug_lines_decoded (struct dwarf_section *section, { unsigned int n_files = 0; unsigned char *ptr_file_name_table = data; - int i; while (*data != 0) { @@ -2700,13 +2698,13 @@ display_debug_lines_decoded (struct dwarf_section *section, op_code = *data++; prev_line = state_machine_regs.line; - if (op_code >= info.li_opcode_base) + if (op_code >= linfo.li_opcode_base) { - op_code -= info.li_opcode_base; - uladv = (op_code / info.li_line_range) * info.li_min_insn_length; + op_code -= linfo.li_opcode_base; + uladv = (op_code / linfo.li_line_range) * linfo.li_min_insn_length; state_machine_regs.address += uladv; - adv = (op_code % info.li_line_range) + info.li_line_base; + adv = (op_code % linfo.li_line_range) + linfo.li_line_base; state_machine_regs.line += adv; is_special_opcode = 1; } @@ -2715,7 +2713,6 @@ display_debug_lines_decoded (struct dwarf_section *section, case DW_LNS_extended_op: { unsigned int ext_op_code_len; - unsigned int bytes_read; unsigned char ext_op_code; unsigned char *op_code_data = data; @@ -2733,7 +2730,7 @@ display_debug_lines_decoded (struct dwarf_section *section, switch (ext_op_code) { case DW_LNE_end_sequence: - reset_state_machine (info.li_default_is_stmt); + reset_state_machine (linfo.li_default_is_stmt); break; case DW_LNE_set_address: state_machine_regs.address = @@ -2766,7 +2763,7 @@ display_debug_lines_decoded (struct dwarf_section *section, case DW_LNS_advance_pc: uladv = read_leb128 (data, & bytes_read, 0); - uladv *= info.li_min_insn_length; + uladv *= linfo.li_min_insn_length; data += bytes_read; state_machine_regs.address += uladv; break; @@ -2813,8 +2810,8 @@ display_debug_lines_decoded (struct dwarf_section *section, break; case DW_LNS_const_add_pc: - uladv = (((255 - info.li_opcode_base) / info.li_line_range) - * info.li_min_insn_length); + uladv = (((255 - linfo.li_opcode_base) / linfo.li_line_range) + * linfo.li_min_insn_length); state_machine_regs.address += uladv; break; @@ -2949,7 +2946,7 @@ static int display_debug_pubnames (struct dwarf_section *section, void *file ATTRIBUTE_UNUSED) { - DWARF2_Internal_PubNames pubnames; + DWARF2_Internal_PubNames names; unsigned char *start = section->start; unsigned char *end = start + section->size; @@ -2967,11 +2964,11 @@ display_debug_pubnames (struct dwarf_section *section, data = start; - pubnames.pn_length = byte_get (data, 4); + names.pn_length = byte_get (data, 4); data += 4; - if (pubnames.pn_length == 0xffffffff) + if (names.pn_length == 0xffffffff) { - pubnames.pn_length = byte_get (data, 8); + names.pn_length = byte_get (data, 8); data += 8; offset_size = 8; initial_length_size = 12; @@ -2982,24 +2979,24 @@ display_debug_pubnames (struct dwarf_section *section, initial_length_size = 4; } - pubnames.pn_version = byte_get (data, 2); + names.pn_version = byte_get (data, 2); data += 2; - pubnames.pn_offset = byte_get (data, offset_size); + names.pn_offset = byte_get (data, offset_size); data += offset_size; if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE && num_debug_info_entries > 0 - && find_debug_info_for_offset (pubnames.pn_offset) == NULL) + && find_debug_info_for_offset (names.pn_offset) == NULL) warn (_(".debug_info offset of 0x%lx in %s section does not point to a CU header.\n"), - pubnames.pn_offset, section->name); + names.pn_offset, section->name); - pubnames.pn_size = byte_get (data, offset_size); + names.pn_size = byte_get (data, offset_size); data += offset_size; - start += pubnames.pn_length + initial_length_size; + start += names.pn_length + initial_length_size; - if (pubnames.pn_version != 2 && pubnames.pn_version != 3) + if (names.pn_version != 2 && names.pn_version != 3) { static int warned = 0; @@ -3013,13 +3010,13 @@ display_debug_pubnames (struct dwarf_section *section, } printf (_(" Length: %ld\n"), - pubnames.pn_length); + names.pn_length); printf (_(" Version: %d\n"), - pubnames.pn_version); + names.pn_version); printf (_(" Offset into .debug_info section: 0x%lx\n"), - pubnames.pn_offset); + names.pn_offset); printf (_(" Size of area in .debug_info section: %ld\n"), - pubnames.pn_size); + names.pn_size); printf (_("\n Offset\tName\n")); @@ -3464,7 +3461,7 @@ display_debug_aranges (struct dwarf_section *section, { unsigned char *hdrptr; DWARF2_Internal_ARange arange; - unsigned char *ranges; + unsigned char *addr_ranges; dwarf_vma length; dwarf_vma address; unsigned char address_size; @@ -3536,24 +3533,24 @@ display_debug_aranges (struct dwarf_section *section, else printf (_("\n Address Length\n")); - ranges = hdrptr; + addr_ranges = hdrptr; /* Must pad to an alignment boundary that is twice the address size. */ excess = (hdrptr - start) % (2 * address_size); if (excess) - ranges += (2 * address_size) - excess; + addr_ranges += (2 * address_size) - excess; start += arange.ar_length + initial_length_size; - while (ranges + 2 * address_size <= start) + while (addr_ranges + 2 * address_size <= start) { - address = byte_get (ranges, address_size); + address = byte_get (addr_ranges, address_size); - ranges += address_size; + addr_ranges += address_size; - length = byte_get (ranges, address_size); + length = byte_get (addr_ranges, address_size); - ranges += address_size; + addr_ranges += address_size; printf (" "); print_dwarf_vma (address, address_size); @@ -3880,11 +3877,11 @@ frame_display_row (Frame_Chunk *fc, int *need_col_headers, int *max_regs) if (*need_col_headers) { - static const char *loc = " LOC"; + static const char *sloc = " LOC"; *need_col_headers = 0; - printf ("%-*s CFA ", eh_addr_size * 2, loc); + printf ("%-*s CFA ", eh_addr_size * 2, sloc); for (r = 0; r < *max_regs; r++) if (fc->col_type[r] != DW_CFA_unreferenced) @@ -4218,7 +4215,7 @@ display_debug_frames (struct dwarf_section *section, while (start < block_end) { unsigned op, opa; - unsigned long reg, tmp; + unsigned long reg, temp; op = *start++; opa = op & 0x3f; @@ -4289,14 +4286,14 @@ display_debug_frames (struct dwarf_section *section, LEB (); break; case DW_CFA_def_cfa_expression: - tmp = LEB (); - start += tmp; + temp = LEB (); + start += temp; break; case DW_CFA_expression: case DW_CFA_val_expression: reg = LEB (); - tmp = LEB (); - start += tmp; + temp = LEB (); + start += temp; if (frame_need_space (fc, reg) >= 0) fc->col_type[reg] = DW_CFA_undefined; break; @@ -4918,10 +4915,10 @@ dwarf_select_sections_by_names (const char *names) void dwarf_select_sections_by_letters (const char *letters) { - unsigned int index = 0; + unsigned int lindex = 0; - while (letters[index]) - switch (letters[index++]) + while (letters[lindex]) + switch (letters[lindex++]) { case 'i': do_debug_info = 1; diff --git a/binutils/ieee.c b/binutils/ieee.c index fd8374b33..9a5bb5541 100644 --- a/binutils/ieee.c +++ b/binutils/ieee.c @@ -2616,7 +2616,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, case 'b': { bfd_vma flags, cinline; - const char *basename, *fieldname; + const char *base, *fieldname; unsigned long baselen, fieldlen; char *basecopy; debug_type basetype; @@ -2628,7 +2628,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, /* This represents a base or friend class. */ if (! ieee_require_asn (info, pp, &flags) - || ! ieee_require_atn65 (info, pp, &basename, &baselen) + || ! ieee_require_atn65 (info, pp, &base, &baselen) || ! ieee_require_asn (info, pp, &cinline) || ! ieee_require_atn65 (info, pp, &fieldname, &fieldlen)) return FALSE; @@ -2650,7 +2650,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, return FALSE; } - basecopy = savestring (basename, baselen); + basecopy = savestring (base, baselen); basetype = debug_find_tagged_type (dhandle, basecopy, DEBUG_KIND_ILLEGAL); free (basecopy); @@ -3113,7 +3113,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, case 'z': { - const char *vname, *basename; + const char *vname, *base; unsigned long vnamelen, baselen; bfd_vma vsize, control; @@ -3121,7 +3121,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, if (! ieee_require_atn65 (info, pp, &vname, &vnamelen) || ! ieee_require_asn (info, pp, &vsize) - || ! ieee_require_atn65 (info, pp, &basename, &baselen) + || ! ieee_require_atn65 (info, pp, &base, &baselen) || ! ieee_require_asn (info, pp, &control)) return FALSE; count -= 4; @@ -3138,7 +3138,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, { char *basecopy; - basecopy = savestring (basename, baselen); + basecopy = savestring (base, baselen); vptrbase = debug_find_tagged_type (dhandle, basecopy, DEBUG_KIND_ILLEGAL); free (basecopy); @@ -5980,8 +5980,6 @@ ieee_struct_field (void *p, const char *name, bfd_vma bitpos, bfd_vma bitsize, if (referencep) { - unsigned int nindx; - /* We need to output a record recording that this field is really of reference type. We put this on the refs field of classdef, so that it can be appended to the C++ diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c index c10eb1207..a675f61b6 100644 --- a/binutils/nlmconv.c +++ b/binutils/nlmconv.c @@ -2039,7 +2039,7 @@ powerpc_mangle_relocs (bfd *outbfd, asection *insec, file. */ static char * -link_inputs (struct string_list *inputs, char *ld, char * map_file) +link_inputs (struct string_list *inputs, char *ld, char * mfile) { size_t c; struct string_list *q; @@ -2088,12 +2088,12 @@ link_inputs (struct string_list *inputs, char *ld, char * map_file) argv[3] = unlink_on_exit; /* If we have been given the name of a mapfile and that name is not 'stderr' then pass it on to the linker. */ - if (map_file - && * map_file - && strcmp (map_file, "stderr") == 0) + if (mfile + && * mfile + && strcmp (mfile, "stderr") == 0) { argv[4] = (char *) "-Map"; - argv[5] = map_file; + argv[5] = mfile; i = 6; } else diff --git a/binutils/nm.c b/binutils/nm.c index c838b0a2b..5ad9c2060 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -343,11 +343,11 @@ get_symbol_type (unsigned int type) } } -/* Print symbol name NAME, read from ABFD, with printf format FORMAT, +/* Print symbol name NAME, read from ABFD, with printf format FORM, demangling it if requested. */ static void -print_symname (const char *format, const char *name, bfd *abfd) +print_symname (const char *form, const char *name, bfd *abfd) { if (do_demangle && *name) { @@ -355,13 +355,13 @@ print_symname (const char *format, const char *name, bfd *abfd) if (res != NULL) { - printf (format, res); + printf (form, res); free (res); return; } } - printf (format, name); + printf (form, name); } static void @@ -397,7 +397,7 @@ print_symdef_entry (bfd *abfd) Return the number of symbols to be printed. */ static long -filter_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, +filter_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, long symcount, unsigned int size) { bfd_byte *from, *fromend, *to; @@ -418,7 +418,7 @@ filter_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, PROGRESS (1); - sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const void *) from, store); + sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, (const void *) from, store); if (sym == NULL) bfd_fatal (bfd_get_filename (abfd)); @@ -659,7 +659,7 @@ size_forward2 (const void *P_x, const void *P_y) size. */ static long -sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms, +sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, long symcount, unsigned int size, struct size_sym **symsizesp) { @@ -686,7 +686,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms, if (from < fromend) { - sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const void *) from, + sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, (const void *) from, store_sym); if (sym == NULL) bfd_fatal (bfd_get_filename (abfd)); @@ -702,7 +702,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms, if (from + size < fromend) { next = bfd_minisymbol_to_symbol (abfd, - dynamic, + is_dynamic, (const void *) (from + size), store_next); if (next == NULL) @@ -861,7 +861,7 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) if (relocs == NULL) { - struct get_relocs_info info; + struct get_relocs_info rinfo; seccount = bfd_count_sections (abfd); @@ -869,11 +869,11 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) relocs = (arelent ***) xmalloc (seccount * sizeof *relocs); relcount = (long *) xmalloc (seccount * sizeof *relcount); - info.secs = secs; - info.relocs = relocs; - info.relcount = relcount; - info.syms = syms; - bfd_map_over_sections (abfd, get_relocs, (void *) &info); + rinfo.secs = secs; + rinfo.relocs = relocs; + rinfo.relcount = relcount; + rinfo.syms = syms; + bfd_map_over_sections (abfd, get_relocs, (void *) &rinfo); lineno_cache_rel_bfd = abfd; } @@ -923,7 +923,7 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) /* Print the symbols when sorting by size. */ static void -print_size_symbols (bfd *abfd, bfd_boolean dynamic, +print_size_symbols (bfd *abfd, bfd_boolean is_dynamic, struct size_sym *symsizes, long symcount, bfd *archive_bfd) { @@ -941,7 +941,7 @@ print_size_symbols (bfd *abfd, bfd_boolean dynamic, asymbol *sym; bfd_vma ssize; - sym = bfd_minisymbol_to_symbol (abfd, dynamic, from->minisym, store); + sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, from->minisym, store); if (sym == NULL) bfd_fatal (bfd_get_filename (abfd)); @@ -960,7 +960,7 @@ print_size_symbols (bfd *abfd, bfd_boolean dynamic, containing ABFD. */ static void -print_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, long symcount, +print_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, long symcount, unsigned int size, bfd *archive_bfd) { asymbol *store; @@ -976,7 +976,7 @@ print_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, long symcount, { asymbol *sym; - sym = bfd_minisymbol_to_symbol (abfd, dynamic, from, store); + sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, from, store); if (sym == NULL) bfd_fatal (bfd_get_filename (abfd)); diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 9732b86fa..20f867c01 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -2295,28 +2295,28 @@ static void add_section_rename (const char * old_name, const char * new_name, flagword flags) { - section_rename * rename; + section_rename * srename; /* Check for conflicts first. */ - for (rename = section_rename_list; rename != NULL; rename = rename->next) - if (strcmp (rename->old_name, old_name) == 0) + for (srename = section_rename_list; srename != NULL; srename = srename->next) + if (strcmp (srename->old_name, old_name) == 0) { /* Silently ignore duplicate definitions. */ - if (strcmp (rename->new_name, new_name) == 0 - && rename->flags == flags) + if (strcmp (srename->new_name, new_name) == 0 + && srename->flags == flags) return; fatal (_("Multiple renames of section %s"), old_name); } - rename = (section_rename *) xmalloc (sizeof (* rename)); + srename = (section_rename *) xmalloc (sizeof (* srename)); - rename->old_name = old_name; - rename->new_name = new_name; - rename->flags = flags; - rename->next = section_rename_list; + srename->old_name = old_name; + srename->new_name = new_name; + srename->flags = flags; + srename->next = section_rename_list; - section_rename_list = rename; + section_rename_list = srename; } /* Check the section rename list for a new name of the input section @@ -2328,18 +2328,18 @@ find_section_rename (bfd * ibfd ATTRIBUTE_UNUSED, sec_ptr isection, flagword * returned_flags) { const char * old_name = bfd_section_name (ibfd, isection); - section_rename * rename; + section_rename * srename; /* Default to using the flags of the input section. */ * returned_flags = bfd_get_section_flags (ibfd, isection); - for (rename = section_rename_list; rename != NULL; rename = rename->next) - if (strcmp (rename->old_name, old_name) == 0) + for (srename = section_rename_list; srename != NULL; srename = srename->next) + if (strcmp (srename->old_name, old_name) == 0) { - if (rename->flags != (flagword) -1) - * returned_flags = rename->flags; + if (srename->flags != (flagword) -1) + * returned_flags = srename->flags; - return rename->new_name; + return srename->new_name; } return old_name; diff --git a/binutils/objdump.c b/binutils/objdump.c index 42d8961b9..79be66501 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -667,14 +667,14 @@ compare_relocs (const void *ap, const void *bp) If SKIP_ZEROES is TRUE, omit leading zeroes. */ static void -objdump_print_value (bfd_vma vma, struct disassemble_info *info, +objdump_print_value (bfd_vma vma, struct disassemble_info *inf, bfd_boolean skip_zeroes) { char buf[30]; char *p; struct objdump_disasm_info *aux; - aux = (struct objdump_disasm_info *) info->application_data; + aux = (struct objdump_disasm_info *) inf->application_data; bfd_sprintf_vma (aux->abfd, buf, vma); if (! skip_zeroes) p = buf; @@ -685,13 +685,13 @@ objdump_print_value (bfd_vma vma, struct disassemble_info *info, if (*p == '\0') --p; } - (*info->fprintf_func) (info->stream, "%s", p); + (*inf->fprintf_func) (inf->stream, "%s", p); } /* Print the name of a symbol. */ static void -objdump_print_symname (bfd *abfd, struct disassemble_info *info, +objdump_print_symname (bfd *abfd, struct disassemble_info *inf, asymbol *sym) { char *alloc; @@ -707,8 +707,8 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *info, name = alloc; } - if (info != NULL) - (*info->fprintf_func) (info->stream, "%s", name); + if (inf != NULL) + (*inf->fprintf_func) (inf->stream, "%s", name); else printf ("%s", name); @@ -724,7 +724,7 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *info, static asymbol * find_symbol_for_address (bfd_vma vma, - struct disassemble_info *info, + struct disassemble_info *inf, long *place) { /* @@ Would it speed things up to cache the last two symbols returned, @@ -734,7 +734,7 @@ find_symbol_for_address (bfd_vma vma, /* Indices in `sorted_syms'. */ long min = 0; - long max = sorted_symcount; + long max_count = sorted_symcount; long thisplace; struct objdump_disasm_info *aux; bfd *abfd; @@ -745,22 +745,22 @@ find_symbol_for_address (bfd_vma vma, if (sorted_symcount < 1) return NULL; - aux = (struct objdump_disasm_info *) info->application_data; + aux = (struct objdump_disasm_info *) inf->application_data; abfd = aux->abfd; sec = aux->sec; - opb = info->octets_per_byte; + opb = inf->octets_per_byte; /* Perform a binary search looking for the closest symbol to the - required value. We are searching the range (min, max]. */ - while (min + 1 < max) + required value. We are searching the range (min, max_count]. */ + while (min + 1 < max_count) { asymbol *sym; - thisplace = (max + min) / 2; + thisplace = (max_count + min) / 2; sym = sorted_syms[thisplace]; if (bfd_asymbol_value (sym) > vma) - max = thisplace; + max_count = thisplace; else if (bfd_asymbol_value (sym) < vma) min = thisplace; else @@ -783,12 +783,12 @@ find_symbol_for_address (bfd_vma vma, with the same value, as can occur with overlays or zero size sections. */ min = thisplace; - while (min < max + while (min < max_count && (bfd_asymbol_value (sorted_syms[min]) == bfd_asymbol_value (sorted_syms[thisplace]))) { if (sorted_syms[min]->section == sec - && info->symbol_is_valid (sorted_syms[min], info)) + && inf->symbol_is_valid (sorted_syms[min], inf)) { thisplace = min; @@ -816,7 +816,7 @@ find_symbol_for_address (bfd_vma vma, && vma < (bfd_get_section_vma (abfd, sec) + bfd_section_size (abfd, sec) / opb))); if ((sorted_syms[thisplace]->section != sec && want_section) - || !info->symbol_is_valid (sorted_syms[thisplace], info)) + || ! inf->symbol_is_valid (sorted_syms[thisplace], inf)) { long i; long newplace = sorted_symcount; @@ -824,7 +824,7 @@ find_symbol_for_address (bfd_vma vma, for (i = min - 1; i >= 0; i--) { if ((sorted_syms[i]->section == sec || !want_section) - && info->symbol_is_valid (sorted_syms[i], info)) + && inf->symbol_is_valid (sorted_syms[i], inf)) { if (newplace == sorted_symcount) newplace = i; @@ -848,7 +848,7 @@ find_symbol_for_address (bfd_vma vma, for (i = thisplace + 1; i < sorted_symcount; i++) { if ((sorted_syms[i]->section == sec || !want_section) - && info->symbol_is_valid (sorted_syms[i], info)) + && inf->symbol_is_valid (sorted_syms[i], inf)) { thisplace = i; break; @@ -857,7 +857,7 @@ find_symbol_for_address (bfd_vma vma, } if ((sorted_syms[thisplace]->section != sec && want_section) - || !info->symbol_is_valid (sorted_syms[thisplace], info)) + || ! inf->symbol_is_valid (sorted_syms[thisplace], inf)) /* There is no suitable symbol. */ return NULL; } @@ -872,49 +872,49 @@ find_symbol_for_address (bfd_vma vma, static void objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym, - bfd_vma vma, struct disassemble_info *info, + bfd_vma vma, struct disassemble_info *inf, bfd_boolean skip_zeroes) { - objdump_print_value (vma, info, skip_zeroes); + objdump_print_value (vma, inf, skip_zeroes); if (sym == NULL) { bfd_vma secaddr; - (*info->fprintf_func) (info->stream, " <%s", - bfd_get_section_name (abfd, sec)); + (*inf->fprintf_func) (inf->stream, " <%s", + bfd_get_section_name (abfd, sec)); secaddr = bfd_get_section_vma (abfd, sec); if (vma < secaddr) { - (*info->fprintf_func) (info->stream, "-0x"); - objdump_print_value (secaddr - vma, info, TRUE); + (*inf->fprintf_func) (inf->stream, "-0x"); + objdump_print_value (secaddr - vma, inf, TRUE); } else if (vma > secaddr) { - (*info->fprintf_func) (info->stream, "+0x"); - objdump_print_value (vma - secaddr, info, TRUE); + (*inf->fprintf_func) (inf->stream, "+0x"); + objdump_print_value (vma - secaddr, inf, TRUE); } - (*info->fprintf_func) (info->stream, ">"); + (*inf->fprintf_func) (inf->stream, ">"); } else { - (*info->fprintf_func) (info->stream, " <"); - objdump_print_symname (abfd, info, sym); + (*inf->fprintf_func) (inf->stream, " <"); + objdump_print_symname (abfd, inf, sym); if (bfd_asymbol_value (sym) > vma) { - (*info->fprintf_func) (info->stream, "-0x"); - objdump_print_value (bfd_asymbol_value (sym) - vma, info, TRUE); + (*inf->fprintf_func) (inf->stream, "-0x"); + objdump_print_value (bfd_asymbol_value (sym) - vma, inf, TRUE); } else if (vma > bfd_asymbol_value (sym)) { - (*info->fprintf_func) (info->stream, "+0x"); - objdump_print_value (vma - bfd_asymbol_value (sym), info, TRUE); + (*inf->fprintf_func) (inf->stream, "+0x"); + objdump_print_value (vma - bfd_asymbol_value (sym), inf, TRUE); } - (*info->fprintf_func) (info->stream, ">"); + (*inf->fprintf_func) (inf->stream, ">"); } if (display_file_offsets) - info->fprintf_func (info->stream, _(" (File Offset: 0x%lx)"), + inf->fprintf_func (inf->stream, _(" (File Offset: 0x%lx)"), (long int)(sec->filepos + (vma - sec->vma))); } @@ -923,23 +923,23 @@ objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym, static void objdump_print_addr (bfd_vma vma, - struct disassemble_info *info, + struct disassemble_info *inf, bfd_boolean skip_zeroes) { struct objdump_disasm_info *aux; asymbol *sym = NULL; bfd_boolean skip_find = FALSE; - aux = (struct objdump_disasm_info *) info->application_data; + aux = (struct objdump_disasm_info *) inf->application_data; if (sorted_symcount < 1) { - (*info->fprintf_func) (info->stream, "0x"); - objdump_print_value (vma, info, skip_zeroes); + (*inf->fprintf_func) (inf->stream, "0x"); + objdump_print_value (vma, inf, skip_zeroes); if (display_file_offsets) - info->fprintf_func (info->stream, _(" (File Offset: 0x%lx)"), - (long int)(aux->sec->filepos + (vma - aux->sec->vma))); + inf->fprintf_func (inf->stream, _(" (File Offset: 0x%lx)"), + (long int)(aux->sec->filepos + (vma - aux->sec->vma))); return; } @@ -957,9 +957,9 @@ objdump_print_addr (bfd_vma vma, } if (!skip_find) - sym = find_symbol_for_address (vma, info, NULL); + sym = find_symbol_for_address (vma, inf, NULL); - objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, info, + objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, inf, skip_zeroes); } @@ -967,19 +967,19 @@ objdump_print_addr (bfd_vma vma, routine. */ static void -objdump_print_address (bfd_vma vma, struct disassemble_info *info) +objdump_print_address (bfd_vma vma, struct disassemble_info *inf) { - objdump_print_addr (vma, info, ! prefix_addresses); + objdump_print_addr (vma, inf, ! prefix_addresses); } /* Determine if the given address has a symbol associated with it. */ static int -objdump_symbol_at_address (bfd_vma vma, struct disassemble_info * info) +objdump_symbol_at_address (bfd_vma vma, struct disassemble_info * inf) { asymbol * sym; - sym = find_symbol_for_address (vma, info, NULL); + sym = find_symbol_for_address (vma, inf, NULL); return (sym != NULL && (bfd_asymbol_value (sym) == vma)); } @@ -1191,15 +1191,15 @@ update_source_path (const char *filename) /* Print a source file line. */ static void -print_line (struct print_file_list *p, unsigned int line) +print_line (struct print_file_list *p, unsigned int linenum) { const char *l; size_t len; - --line; - if (line >= p->maxline) + --linenum; + if (linenum >= p->maxline) return; - l = p->linemap [line]; + l = p->linemap [linenum]; /* Test fwrite return value to quiet glibc warning. */ len = strcspn (l, "\n\r"); if (len == 0 || fwrite (l, len, 1, stdout) == 1) @@ -1228,14 +1228,14 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) { const char *filename; const char *functionname; - unsigned int line; + unsigned int linenumber; bfd_boolean reloc; if (! with_line_numbers && ! with_source_code) return; if (! bfd_find_nearest_line (abfd, section, syms, addr_offset, &filename, - &functionname, &line)) + &functionname, &linenumber)) return; if (filename != NULL && *filename == '\0') @@ -1287,13 +1287,13 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) && (prev_functionname == NULL || strcmp (functionname, prev_functionname) != 0)) printf ("%s():\n", functionname); - if (line > 0 && line != prev_line) - printf ("%s:%u\n", filename == NULL ? "???" : filename, line); + if (linenumber > 0 && linenumber != prev_line) + printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber); } if (with_source_code && filename != NULL - && line > 0) + && linenumber > 0) { struct print_file_list **pp, *p; unsigned l; @@ -1310,20 +1310,20 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) p = update_source_path (filename); } - if (p != NULL && line != p->last_line) + if (p != NULL && linenumber != p->last_line) { if (file_start_context && p->first) l = 1; else { - l = line - SHOW_PRECEDING_CONTEXT_LINES; - if (l >= line) + l = linenumber - SHOW_PRECEDING_CONTEXT_LINES; + if (l >= linenumber) l = 1; - if (p->last_line >= l && p->last_line <= line) + if (p->last_line >= l && p->last_line <= linenumber) l = p->last_line + 1; } - dump_lines (p, l, line); - p->last_line = line; + dump_lines (p, l, linenumber); + p->last_line = linenumber; p->first = 0; } } @@ -1338,8 +1338,8 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) strcpy (prev_functionname, functionname); } - if (line > 0 && line != prev_line) - prev_line = line; + if (linenumber > 0 && linenumber != prev_line) + prev_line = linenumber; } /* Pseudo FILE object for strings. */ @@ -1394,7 +1394,7 @@ objdump_sprintf (SFILE *f, const char *format, ...) /* Disassemble some data in memory between given values. */ static void -disassemble_bytes (struct disassemble_info * info, +disassemble_bytes (struct disassemble_info * inf, disassembler_ftype disassemble_fn, bfd_boolean insns, bfd_byte * data, @@ -1410,13 +1410,13 @@ disassemble_bytes (struct disassemble_info * info, bfd_boolean done_dot; int skip_addr_chars; bfd_vma addr_offset; - unsigned int opb = info->octets_per_byte; - unsigned int skip_zeroes = info->skip_zeroes; - unsigned int skip_zeroes_at_end = info->skip_zeroes_at_end; + unsigned int opb = inf->octets_per_byte; + unsigned int skip_zeroes = inf->skip_zeroes; + unsigned int skip_zeroes_at_end = inf->skip_zeroes_at_end; int octets = opb; SFILE sfile; - aux = (struct objdump_disasm_info *) info->application_data; + aux = (struct objdump_disasm_info *) inf->application_data; section = aux->sec; sfile.alloc = 120; @@ -1452,7 +1452,7 @@ disassemble_bytes (struct disassemble_info * info, skip_addr_chars = (skip_addr_chars - 1) & -4; } - info->insn_info_valid = 0; + inf->insn_info_valid = 0; done_dot = FALSE; addr_offset = start_offset; @@ -1472,8 +1472,8 @@ disassemble_bytes (struct disassemble_info * info, if (data[z] != 0) break; if (! disassemble_zeroes - && (info->insn_info_valid == 0 - || info->branch_delay_insns == 0) + && (inf->insn_info_valid == 0 + || inf->branch_delay_insns == 0) && (z - addr_offset * opb >= skip_zeroes || (z == stop_offset * opb && z - addr_offset * opb < skip_zeroes_at_end))) @@ -1523,7 +1523,7 @@ disassemble_bytes (struct disassemble_info * info, else { aux->require_sec = TRUE; - objdump_print_address (section->vma + addr_offset, info); + objdump_print_address (section->vma + addr_offset, inf); aux->require_sec = FALSE; putchar (' '); } @@ -1531,15 +1531,15 @@ disassemble_bytes (struct disassemble_info * info, if (insns) { sfile.pos = 0; - info->fprintf_func = (fprintf_ftype) objdump_sprintf; - info->stream = &sfile; - info->bytes_per_line = 0; - info->bytes_per_chunk = 0; - info->flags = disassemble_all ? DISASSEMBLE_DATA : 0; + inf->fprintf_func = (fprintf_ftype) objdump_sprintf; + inf->stream = &sfile; + inf->bytes_per_line = 0; + inf->bytes_per_chunk = 0; + inf->flags = disassemble_all ? DISASSEMBLE_DATA : 0; if (machine) - info->flags |= USER_SPECIFIED_MACHINE_TYPE; + inf->flags |= USER_SPECIFIED_MACHINE_TYPE; - if (info->disassembler_needs_relocs + if (inf->disassembler_needs_relocs && (bfd_get_file_flags (aux->abfd) & EXEC_P) == 0 && (bfd_get_file_flags (aux->abfd) & DYNAMIC) == 0 && *relppp < relppend) @@ -1566,18 +1566,18 @@ disassemble_bytes (struct disassemble_info * info, || (distance_to_rel > 0 && distance_to_rel < (bfd_signed_vma) (previous_octets/ opb))) { - info->flags |= INSN_HAS_RELOC; + inf->flags |= INSN_HAS_RELOC; aux->reloc = **relppp; } else aux->reloc = NULL; } - octets = (*disassemble_fn) (section->vma + addr_offset, info); - info->fprintf_func = (fprintf_ftype) fprintf; - info->stream = stdout; - if (insn_width == 0 && info->bytes_per_line != 0) - octets_per_line = info->bytes_per_line; + octets = (*disassemble_fn) (section->vma + addr_offset, inf); + inf->fprintf_func = (fprintf_ftype) fprintf; + inf->stream = stdout; + if (insn_width == 0 && inf->bytes_per_line != 0) + octets_per_line = inf->bytes_per_line; if (octets < 0) { if (sfile.pos) @@ -1615,8 +1615,8 @@ disassemble_bytes (struct disassemble_info * info, if (pb > octets_per_line && ! prefix_addresses && ! wide_output) pb = octets_per_line; - if (info->bytes_per_chunk) - bpc = info->bytes_per_chunk; + if (inf->bytes_per_chunk) + bpc = inf->bytes_per_chunk; else bpc = 1; @@ -1624,7 +1624,7 @@ disassemble_bytes (struct disassemble_info * info, { int k; - if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE) + if (bpc > 1 && inf->display_endian == BFD_ENDIAN_LITTLE) { for (k = bpc - 1; k >= 0; k--) printf ("%02x", (unsigned) data[j + k]); @@ -1685,7 +1685,7 @@ disassemble_bytes (struct disassemble_info * info, { int k; - if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE) + if (bpc > 1 && inf->display_endian == BFD_ENDIAN_LITTLE) { for (k = bpc - 1; k >= 0; k--) printf ("%02x", (unsigned) data[j + k]); @@ -1722,7 +1722,7 @@ disassemble_bytes (struct disassemble_info * info, printf ("\t\t\t"); objdump_print_value (section->vma - rel_offset + q->address, - info, TRUE); + inf, TRUE); if (q->howto == NULL) printf (": *unknown*\t"); @@ -1739,7 +1739,7 @@ disassemble_bytes (struct disassemble_info * info, sym_name = bfd_asymbol_name (*q->sym_ptr_ptr); if (sym_name != NULL && *sym_name != '\0') - objdump_print_symname (aux->abfd, info, *q->sym_ptr_ptr); + objdump_print_symname (aux->abfd, inf, *q->sym_ptr_ptr); else { asection *sym_sec; @@ -1755,7 +1755,7 @@ disassemble_bytes (struct disassemble_info * info, if (q->addend) { printf ("+0x"); - objdump_print_value (q->addend, info, TRUE); + objdump_print_value (q->addend, inf, TRUE); } printf ("\n"); @@ -1774,11 +1774,11 @@ disassemble_bytes (struct disassemble_info * info, } static void -disassemble_section (bfd *abfd, asection *section, void *info) +disassemble_section (bfd *abfd, asection *section, void *inf) { const struct elf_backend_data * bed; bfd_vma sign_adjust = 0; - struct disassemble_info * pinfo = (struct disassemble_info *) info; + struct disassemble_info * pinfo = (struct disassemble_info *) inf; struct objdump_disasm_info * paux; unsigned int opb = pinfo->octets_per_byte; bfd_byte * data = NULL; @@ -1888,7 +1888,7 @@ disassemble_section (bfd *abfd, asection *section, void *info) /* Find the nearest symbol forwards from our current position. */ paux->require_sec = TRUE; sym = (asymbol *) find_symbol_for_address (section->vma + addr_offset, - (struct disassemble_info *) info, + (struct disassemble_info *) inf, &place); paux->require_sec = FALSE; @@ -2056,12 +2056,12 @@ disassemble_data (bfd *abfd) if (machine != NULL) { - const bfd_arch_info_type *info = bfd_scan_arch (machine); + const bfd_arch_info_type *inf = bfd_scan_arch (machine); - if (info == NULL) + if (inf == NULL) fatal (_("Can't use supplied machine %s"), machine); - abfd->arch_info = info; + abfd->arch_info = inf; } if (endian != BFD_ENDIAN_UNKNOWN) @@ -2665,26 +2665,26 @@ static void dump_symbols (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean dynamic) { asymbol **current; - long max; + long max_count; long count; if (dynamic) { current = dynsyms; - max = dynsymcount; + max_count = dynsymcount; printf ("DYNAMIC SYMBOL TABLE:\n"); } else { current = syms; - max = symcount; + max_count = symcount; printf ("SYMBOL TABLE:\n"); } - if (max == 0) + if (max_count == 0) printf (_("no symbols\n")); - for (count = 0; count < max; count++) + for (count = 0; count < max_count; count++) { bfd *cur_bfd; @@ -2759,7 +2759,7 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) { arelent *q = *p; const char *filename, *functionname; - unsigned int line; + unsigned int linenumber; const char *sym_name; const char *section_name; @@ -2773,7 +2773,7 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) if (with_line_numbers && sec != NULL && bfd_find_nearest_line (abfd, sec, syms, q->address, - &filename, &functionname, &line)) + &filename, &functionname, &linenumber)) { if (functionname != NULL && (last_functionname == NULL @@ -2785,14 +2785,14 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) last_functionname = xstrdup (functionname); } - if (line > 0 - && (line != last_line + if (linenumber > 0 + && (linenumber != last_line || (filename != NULL && last_filename != NULL && strcmp (filename, last_filename) != 0))) { - printf ("%s:%u\n", filename == NULL ? "???" : filename, line); - last_line = line; + printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber); + last_line = linenumber; if (last_filename != NULL) free (last_filename); if (filename == NULL) diff --git a/binutils/prdbg.c b/binutils/prdbg.c index 59313bb82..78a8fc751 100644 --- a/binutils/prdbg.c +++ b/binutils/prdbg.c @@ -1947,13 +1947,13 @@ translate_addresses (bfd *abfd, char *addr_hex, FILE *f, asymbol **syms) /* Start a new compilation unit. */ static bfd_boolean -tg_start_compilation_unit (void * p, const char *filename ATTRIBUTE_UNUSED) +tg_start_compilation_unit (void * p, const char *fname ATTRIBUTE_UNUSED) { struct pr_handle *info = (struct pr_handle *) p; free (info->filename); /* Should it be relative? best way to do it here?. */ - info->filename = strdup (filename); + info->filename = strdup (fname); return TRUE; } @@ -1961,13 +1961,13 @@ tg_start_compilation_unit (void * p, const char *filename ATTRIBUTE_UNUSED) /* Start a source file within a compilation unit. */ static bfd_boolean -tg_start_source (void *p, const char *filename) +tg_start_source (void *p, const char *fname) { struct pr_handle *info = (struct pr_handle *) p; free (info->filename); /* Should it be relative? best way to do it here?. */ - info->filename = strdup (filename); + info->filename = strdup (fname); return TRUE; } @@ -2744,7 +2744,7 @@ tg_start_block (void *p, bfd_vma addr) /* Write out line number information. */ static bfd_boolean -tg_lineno (void *p ATTRIBUTE_UNUSED, const char *filename ATTRIBUTE_UNUSED, +tg_lineno (void *p ATTRIBUTE_UNUSED, const char *fname ATTRIBUTE_UNUSED, unsigned long lineno ATTRIBUTE_UNUSED, bfd_vma addr ATTRIBUTE_UNUSED) { diff --git a/binutils/readelf.c b/binutils/readelf.c index 92a214217..689cd8acc 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -729,13 +729,13 @@ slurp_rela_relocs (FILE * file, little-endian symbol index followed by four individual byte fields. Reorder INFO accordingly. */ - bfd_vma info = relas[i].r_info; - info = (((info & 0xffffffff) << 32) - | ((info >> 56) & 0xff) - | ((info >> 40) & 0xff00) - | ((info >> 24) & 0xff0000) - | ((info >> 8) & 0xff000000)); - relas[i].r_info = info; + bfd_vma inf = relas[i].r_info; + inf = (((inf & 0xffffffff) << 32) + | ((inf >> 56) & 0xff) + | ((inf >> 40) & 0xff00) + | ((inf >> 24) & 0xff0000) + | ((inf >> 8) & 0xff000000)); + relas[i].r_info = inf; } #endif /* BFD64 */ } @@ -825,13 +825,13 @@ slurp_rel_relocs (FILE * file, little-endian symbol index followed by four individual byte fields. Reorder INFO accordingly. */ - bfd_vma info = rels[i].r_info; - info = (((info & 0xffffffff) << 32) - | ((info >> 56) & 0xff) - | ((info >> 40) & 0xff00) - | ((info >> 24) & 0xff0000) - | ((info >> 8) & 0xff000000)); - rels[i].r_info = info; + bfd_vma inf = rels[i].r_info; + inf = (((inf & 0xffffffff) << 32) + | ((inf >> 56) & 0xff) + | ((inf >> 40) & 0xff00) + | ((inf >> 24) & 0xff0000) + | ((inf >> 8) & 0xff000000)); + rels[i].r_info = inf; } #endif /* BFD64 */ } @@ -942,21 +942,21 @@ dump_relocations (FILE * file, { const char * rtype; bfd_vma offset; - bfd_vma info; + bfd_vma inf; bfd_vma symtab_index; bfd_vma type; offset = rels[i].r_offset; - info = rels[i].r_info; + inf = rels[i].r_info; - type = get_reloc_type (info); - symtab_index = get_reloc_symindex (info); + type = get_reloc_type (inf); + symtab_index = get_reloc_symindex (inf); if (is_32bit_elf) { printf ("%8.8lx %8.8lx ", (unsigned long) offset & 0xffffffff, - (unsigned long) info & 0xffffffff); + (unsigned long) inf & 0xffffffff); } else { @@ -964,18 +964,18 @@ dump_relocations (FILE * file, printf (do_wide ? "%16.16lx %16.16lx " : "%12.12lx %12.12lx ", - offset, info); + offset, inf); #elif BFD_HOST_64BIT_LONG_LONG #ifndef __MSVCRT__ printf (do_wide ? "%16.16llx %16.16llx " : "%12.12llx %12.12llx ", - offset, info); + offset, inf); #else printf (do_wide ? "%16.16I64x %16.16I64x " : "%12.12I64x %12.12I64x ", - offset, info); + offset, inf); #endif #else printf (do_wide @@ -983,8 +983,8 @@ dump_relocations (FILE * file, : "%4.4lx%8.8lx %4.4lx%8.8lx ", _bfd_int64_high (offset), _bfd_int64_low (offset), - _bfd_int64_high (info), - _bfd_int64_low (info)); + _bfd_int64_high (inf), + _bfd_int64_low (inf)); #endif } @@ -1355,12 +1355,12 @@ dump_relocations (FILE * file, if (is_rela) { - long offset = (long) (bfd_signed_vma) rels[i].r_addend; + long off = (long) (bfd_signed_vma) rels[i].r_addend; - if (offset < 0) - printf (" - %lx", - offset); + if (off < 0) + printf (" - %lx", - off); else - printf (" + %lx", offset); + printf (" + %lx", off); } } } @@ -1374,15 +1374,15 @@ dump_relocations (FILE * file, if (elf_header.e_machine == EM_SPARCV9 && rtype != NULL && streq (rtype, "R_SPARC_OLO10")) - printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (info)); + printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (inf)); putchar ('\n'); #ifdef BFD64 if (! is_32bit_elf && elf_header.e_machine == EM_MIPS) { - bfd_vma type2 = ELF64_MIPS_R_TYPE2 (info); - bfd_vma type3 = ELF64_MIPS_R_TYPE3 (info); + bfd_vma type2 = ELF64_MIPS_R_TYPE2 (inf); + bfd_vma type3 = ELF64_MIPS_R_TYPE3 (inf); const char * rtype2 = elf_mips_reloc_type (type2); const char * rtype3 = elf_mips_reloc_type (type3); @@ -3368,7 +3368,7 @@ process_file_header (void) static int -get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) +get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * pheaders) { Elf32_External_Phdr * phdrs; Elf32_External_Phdr * external; @@ -3382,7 +3382,7 @@ get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) if (!phdrs) return 0; - for (i = 0, internal = program_headers, external = phdrs; + for (i = 0, internal = pheaders, external = phdrs; i < elf_header.e_phnum; i++, internal++, external++) { @@ -3402,7 +3402,7 @@ get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) } static int -get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) +get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * pheaders) { Elf64_External_Phdr * phdrs; Elf64_External_Phdr * external; @@ -3416,7 +3416,7 @@ get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) if (!phdrs) return 0; - for (i = 0, internal = program_headers, external = phdrs; + for (i = 0, internal = pheaders, external = phdrs; i < elf_header.e_phnum; i++, internal++, external++) { @@ -3959,7 +3959,8 @@ get_elf_section_flags (bfd_vma sh_flags) static char buff[1024]; char * p = buff; int field_size = is_32bit_elf ? 8 : 16; - int index, size = sizeof (buff) - (field_size + 4 + 1); + int sindex; + int size = sizeof (buff) - (field_size + 4 + 1); bfd_vma os_flags = 0; bfd_vma proc_flags = 0; bfd_vma unknown_flags = 0; @@ -4013,36 +4014,36 @@ get_elf_section_flags (bfd_vma sh_flags) { switch (flag) { - case SHF_WRITE: index = 0; break; - case SHF_ALLOC: index = 1; break; - case SHF_EXECINSTR: index = 2; break; - case SHF_MERGE: index = 3; break; - case SHF_STRINGS: index = 4; break; - case SHF_INFO_LINK: index = 5; break; - case SHF_LINK_ORDER: index = 6; break; - case SHF_OS_NONCONFORMING: index = 7; break; - case SHF_GROUP: index = 8; break; - case SHF_TLS: index = 9; break; + case SHF_WRITE: sindex = 0; break; + case SHF_ALLOC: sindex = 1; break; + case SHF_EXECINSTR: sindex = 2; break; + case SHF_MERGE: sindex = 3; break; + case SHF_STRINGS: sindex = 4; break; + case SHF_INFO_LINK: sindex = 5; break; + case SHF_LINK_ORDER: sindex = 6; break; + case SHF_OS_NONCONFORMING: sindex = 7; break; + case SHF_GROUP: sindex = 8; break; + case SHF_TLS: sindex = 9; break; default: - index = -1; + sindex = -1; switch (elf_header.e_machine) { case EM_IA_64: if (flag == SHF_IA_64_SHORT) - index = 10; + sindex = 10; else if (flag == SHF_IA_64_NORECOV) - index = 11; + sindex = 11; #ifdef BFD64 else if (elf_header.e_ident[EI_OSABI] == ELFOSABI_OPENVMS) switch (flag) { - case SHF_IA_64_VMS_GLOBAL: index = 12; break; - case SHF_IA_64_VMS_OVERLAID: index = 13; break; - case SHF_IA_64_VMS_SHARED: index = 14; break; - case SHF_IA_64_VMS_VECTOR: index = 15; break; - case SHF_IA_64_VMS_ALLOC_64BIT: index = 16; break; - case SHF_IA_64_VMS_PROTECTED: index = 17; break; + case SHF_IA_64_VMS_GLOBAL: sindex = 12; break; + case SHF_IA_64_VMS_OVERLAID: sindex = 13; break; + case SHF_IA_64_VMS_SHARED: sindex = 14; break; + case SHF_IA_64_VMS_VECTOR: sindex = 15; break; + case SHF_IA_64_VMS_ALLOC_64BIT: sindex = 16; break; + case SHF_IA_64_VMS_PROTECTED: sindex = 17; break; default: break; } #endif @@ -4056,16 +4057,16 @@ get_elf_section_flags (bfd_vma sh_flags) case EM_SPARCV9: case EM_SPARC: if (flag == SHF_EXCLUDE) - index = 18; + sindex = 18; else if (flag == SHF_ORDERED) - index = 19; + sindex = 19; break; default: break; } } - if (index != -1) + if (sindex != -1) { if (p != buff + field_size + 4) { @@ -4076,8 +4077,8 @@ get_elf_section_flags (bfd_vma sh_flags) *p++ = ' '; } - size -= flags [index].len; - p = stpcpy (p, flags [index].str); + size -= flags [sindex].len; + p = stpcpy (p, flags [sindex].str); } else if (flag & SHF_MASKOS) os_flags |= flag; @@ -5804,8 +5805,8 @@ dynamic_section_mips_val (Elf_Internal_Dyn * entry) char timebuf[20]; struct tm * tmp; - time_t time = entry->d_un.d_val; - tmp = gmtime (&time); + time_t atime = entry->d_un.d_val; + tmp = gmtime (&atime); snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); @@ -6559,9 +6560,9 @@ process_dynamic_section (FILE * file) if (do_dynamic) { struct tm * tmp; - time_t time = entry->d_un.d_val; + time_t atime = entry->d_un.d_val; - tmp = gmtime (&time); + tmp = gmtime (&atime); printf ("%04u-%02u-%02uT%02u:%02u:%02u\n", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); @@ -7722,9 +7723,9 @@ process_symbol_table (FILE * file) Elf_Internal_Verdef ivd; Elf_Internal_Verdaux ivda; Elf_External_Verdaux evda; - unsigned long offset; + unsigned long off; - offset = offset_from_vma + off = offset_from_vma (file, version_info[DT_VERSIONTAGIDX (DT_VERDEF)], sizeof (Elf_External_Verdef)); @@ -7733,22 +7734,22 @@ process_symbol_table (FILE * file) { Elf_External_Verdef evd; - get_data (&evd, file, offset, sizeof (evd), + get_data (&evd, file, off, sizeof (evd), 1, _("version def")); ivd.vd_ndx = BYTE_GET (evd.vd_ndx); ivd.vd_aux = BYTE_GET (evd.vd_aux); ivd.vd_next = BYTE_GET (evd.vd_next); - offset += ivd.vd_next; + off += ivd.vd_next; } while (ivd.vd_ndx != (vers_data & VERSYM_VERSION) && ivd.vd_next != 0); - offset -= ivd.vd_next; - offset += ivd.vd_aux; + off -= ivd.vd_next; + off += ivd.vd_aux; - get_data (&evda, file, offset, sizeof (evda), + get_data (&evda, file, off, sizeof (evda), 1, _("version def aux")); ivda.vda_name = BYTE_GET (evda.vda_name); @@ -8445,7 +8446,7 @@ apply_relocations (void * file, bfd_vma addend; unsigned int reloc_type; unsigned int reloc_size; - unsigned char * loc; + unsigned char * rloc; reloc_type = get_reloc_type (rp->r_info); @@ -8470,8 +8471,8 @@ apply_relocations (void * file, continue; } - loc = start + rp->r_offset; - if ((loc + reloc_size) > end) + rloc = start + rp->r_offset; + if ((rloc + reloc_size) > end) { warn (_("skipping invalid relocation offset 0x%lx in section %s\n"), (unsigned long) rp->r_offset, @@ -8514,7 +8515,7 @@ apply_relocations (void * file, || ((elf_header.e_machine == EM_PJ || elf_header.e_machine == EM_PJ_OLD) && reloc_type == 1)) - addend += byte_get (loc, reloc_size); + addend += byte_get (rloc, reloc_size); if (is_32bit_pcrel_reloc (reloc_type) || is_64bit_pcrel_reloc (reloc_type)) @@ -8522,11 +8523,11 @@ apply_relocations (void * file, /* On HPPA, all pc-relative relocations are biased by 8. */ if (elf_header.e_machine == EM_PARISC) addend -= 8; - byte_put (loc, (addend + sym->st_value) - rp->r_offset, + byte_put (rloc, (addend + sym->st_value) - rp->r_offset, reloc_size); } else - byte_put (loc, addend + sym->st_value, reloc_size); + byte_put (rloc, addend + sym->st_value, reloc_size); } free (symtab); @@ -9585,10 +9586,10 @@ process_attributes (FILE * file, do_numlist: for (;;) { - unsigned int i; + unsigned int j; - val = read_uleb128 (p, &i); - p += i; + val = read_uleb128 (p, &j); + p += j; if (val == 0) break; printf (" %d", val); @@ -9787,17 +9788,17 @@ process_mips_specific (FILE * file) for (cnt = 0; cnt < liblistno; ++cnt) { Elf32_Lib liblist; - time_t time; + time_t atime; char timebuf[20]; struct tm * tmp; liblist.l_name = BYTE_GET (elib[cnt].l_name); - time = BYTE_GET (elib[cnt].l_time_stamp); + atime = BYTE_GET (elib[cnt].l_time_stamp); liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum); liblist.l_version = BYTE_GET (elib[cnt].l_version); liblist.l_flags = BYTE_GET (elib[cnt].l_flags); - tmp = gmtime (&time); + tmp = gmtime (&atime); snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, @@ -10120,12 +10121,12 @@ process_mips_specific (FILE * file) if (pltgot != 0 && local_gotno != 0) { - bfd_vma entry, local_end, global_end; + bfd_vma ent, local_end, global_end; size_t i, offset; unsigned char * data; int addr_size; - entry = pltgot; + ent = pltgot; addr_size = (is_32bit_elf ? 4 : 8); local_end = pltgot + local_gotno * addr_size; global_end = local_end + (symtabno - gotsym) * addr_size; @@ -10142,26 +10143,26 @@ process_mips_specific (FILE * file) printf (_(" %*s %10s %*s Purpose\n"), addr_size * 2, "Address", "Access", addr_size * 2, "Initial"); - entry = print_mips_got_entry (data, pltgot, entry); + ent = print_mips_got_entry (data, pltgot, ent); printf (" Lazy resolver\n"); if (data - && (byte_get (data + entry - pltgot, addr_size) + && (byte_get (data + ent - pltgot, addr_size) >> (addr_size * 8 - 1)) != 0) { - entry = print_mips_got_entry (data, pltgot, entry); + ent = print_mips_got_entry (data, pltgot, ent); printf (" Module pointer (GNU extension)\n"); } printf ("\n"); - if (entry < local_end) + if (ent < local_end) { printf (_(" Local entries:\n")); printf (_(" %*s %10s %*s\n"), addr_size * 2, "Address", "Access", addr_size * 2, "Initial"); - while (entry < local_end) + while (ent < local_end) { - entry = print_mips_got_entry (data, pltgot, entry); + ent = print_mips_got_entry (data, pltgot, ent); printf ("\n"); } printf ("\n"); @@ -10182,7 +10183,7 @@ process_mips_specific (FILE * file) Elf_Internal_Sym * psym; psym = dynamic_symbols + i; - entry = print_mips_got_entry (data, pltgot, entry); + ent = print_mips_got_entry (data, pltgot, ent); printf (" "); print_vma (psym->st_value, LONG_HEX); printf (" %-7s %3s ", @@ -10203,7 +10204,7 @@ process_mips_specific (FILE * file) if (mips_pltgot != 0 && jmprel != 0 && pltrel != 0 && pltrelsz != 0) { - bfd_vma entry, end; + bfd_vma ent, end; size_t offset, rel_offset; unsigned long count, i; unsigned char * data; @@ -10222,7 +10223,7 @@ process_mips_specific (FILE * file) return 0; } - entry = mips_pltgot; + ent = mips_pltgot; addr_size = (is_32bit_elf ? 4 : 8); end = mips_pltgot + (2 + count) * addr_size; @@ -10233,9 +10234,9 @@ process_mips_specific (FILE * file) printf (_(" Reserved entries:\n")); printf (_(" %*s %*s Purpose\n"), addr_size * 2, "Address", addr_size * 2, "Initial"); - entry = print_mips_pltgot_entry (data, mips_pltgot, entry); + ent = print_mips_pltgot_entry (data, mips_pltgot, ent); printf (" PLT lazy resolver\n"); - entry = print_mips_pltgot_entry (data, mips_pltgot, entry); + ent = print_mips_pltgot_entry (data, mips_pltgot, ent); printf (" Module pointer\n"); printf ("\n"); @@ -10250,7 +10251,7 @@ process_mips_specific (FILE * file) Elf_Internal_Sym * psym; psym = dynamic_symbols + get_reloc_symindex (rels[i].r_info); - entry = print_mips_pltgot_entry (data, mips_pltgot, entry); + ent = print_mips_pltgot_entry (data, mips_pltgot, ent); printf (" "); print_vma (psym->st_value, LONG_HEX); printf (" %-7s %3s ", @@ -10326,17 +10327,17 @@ process_gnu_liblist (FILE * file) ++cnt) { Elf32_Lib liblist; - time_t time; + time_t atime; char timebuf[20]; struct tm * tmp; liblist.l_name = BYTE_GET (elib[cnt].l_name); - time = BYTE_GET (elib[cnt].l_time_stamp); + atime = BYTE_GET (elib[cnt].l_time_stamp); liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum); liblist.l_version = BYTE_GET (elib[cnt].l_version); liblist.l_flags = BYTE_GET (elib[cnt].l_flags); - tmp = gmtime (&time); + tmp = gmtime (&atime); snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, diff --git a/binutils/resbin.c b/binutils/resbin.c index ad819069e..1db98d066 100644 --- a/binutils/resbin.c +++ b/binutils/resbin.c @@ -1,5 +1,5 @@ /* resbin.c -- manipulate the Windows binary resource format. - Copyright 1997, 1998, 1999, 2002, 2003, 2005, 2006, 2007 + Copyright 1997, 1998, 1999, 2002, 2003, 2005, 2006, 2007, 2009 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Rewritten by Kai Tietz, Onevision. @@ -227,7 +227,7 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length) { rc_res_resource *r; rc_menu *m; - rc_uint_type version, read; + rc_uint_type version, got; r = (rc_res_resource *) res_alloc (sizeof *r); r->type = RES_TYPE_MENU; @@ -245,7 +245,7 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length) if (length < 4) toosmall (_("menu header")); m->help = 0; - m->items = bin_to_res_menuitems (wrbfd, data + 4, length - 4, &read); + m->items = bin_to_res_menuitems (wrbfd, data + 4, length - 4, &got); } else if (version == 1) { @@ -258,7 +258,7 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length) if (offset + 4 >= length) toosmall (_("menuex offset")); m->items = bin_to_res_menuexitems (wrbfd, data + 4 + offset, - length - (4 + offset), &read); + length - (4 + offset), &got); } else fatal (_("unsupported menu version %d"), (int) version); @@ -270,14 +270,14 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length) static rc_menuitem * bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length, - rc_uint_type *read) + rc_uint_type *got) { rc_menuitem *first, **pp; first = NULL; pp = &first; - *read = 0; + *got = 0; while (length > 0) { @@ -334,7 +334,7 @@ bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type len data += itemlen; length -= itemlen; - *read += itemlen; + *got += itemlen; if ((flags & MENUITEM_ENDMENU) != 0) return first; @@ -347,14 +347,14 @@ bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type len static rc_menuitem * bin_to_res_menuexitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length, - rc_uint_type *read) + rc_uint_type *got) { rc_menuitem *first, **pp; first = NULL; pp = &first; - *read = 0; + *got = 0; while (length > 0) { @@ -408,7 +408,7 @@ bin_to_res_menuexitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type l data += itemlen; length -= itemlen; - *read += itemlen; + *got += itemlen; if ((flags & 0x80) != 0) return first; diff --git a/binutils/resrc.c b/binutils/resrc.c index fcd15c70f..a72a23f63 100644 --- a/binutils/resrc.c +++ b/binutils/resrc.c @@ -1926,7 +1926,7 @@ indent (FILE *e, int c) without the need to store it somewhere externally. */ void -write_rc_file (const char *filename, const rc_res_directory *resources) +write_rc_file (const char *filename, const rc_res_directory *res_dir) { FILE *e; rc_uint_type language; @@ -1941,7 +1941,7 @@ write_rc_file (const char *filename, const rc_res_directory *resources) } language = (rc_uint_type) ((bfd_signed_vma) -1); - write_rc_directory (e, resources, (const rc_res_id *) NULL, + write_rc_directory (e, res_dir, (const rc_res_id *) NULL, (const rc_res_id *) NULL, &language, 1); } diff --git a/binutils/resres.c b/binutils/resres.c index c4eb7227b..9f90df0a5 100644 --- a/binutils/resres.c +++ b/binutils/resres.c @@ -647,7 +647,7 @@ res_add_resource (rc_res_resource *r, const rc_res_id *type, const rc_res_id *id and modified to add an existing resource. */ static void -res_append_resource (rc_res_directory **resources, rc_res_resource *resource, +res_append_resource (rc_res_directory **res_dirs, rc_res_resource *resource, int cids, const rc_res_id *ids, int dupok) { rc_res_entry *re = NULL; @@ -658,7 +658,7 @@ res_append_resource (rc_res_directory **resources, rc_res_resource *resource, { rc_res_entry **pp; - if (*resources == NULL) + if (*res_dirs == NULL) { static unsigned long timeval; @@ -667,16 +667,16 @@ res_append_resource (rc_res_directory **resources, rc_res_resource *resource, if (timeval == 0) timeval = time (NULL); - *resources = ((rc_res_directory *) + *res_dirs = ((rc_res_directory *) res_alloc (sizeof (rc_res_directory))); - (*resources)->characteristics = 0; - (*resources)->time = timeval; - (*resources)->major = 0; - (*resources)->minor = 0; - (*resources)->entries = NULL; + (*res_dirs)->characteristics = 0; + (*res_dirs)->time = timeval; + (*res_dirs)->major = 0; + (*res_dirs)->minor = 0; + (*res_dirs)->entries = NULL; } - for (pp = &(*resources)->entries; *pp != NULL; pp = &(*pp)->next) + for (pp = &(*res_dirs)->entries; *pp != NULL; pp = &(*pp)->next) if (res_id_cmp ((*pp)->id, ids[i]) == 0) break; @@ -711,7 +711,7 @@ res_append_resource (rc_res_directory **resources, rc_res_resource *resource, xexit (1); } - resources = &re->u.dir; + res_dirs = &re->u.dir; } } diff --git a/binutils/srconv.c b/binutils/srconv.c index efccd6643..c288fd5df 100644 --- a/binutils/srconv.c +++ b/binutils/srconv.c @@ -1,6 +1,6 @@ /* srconv.c -- Sysroff conversion program Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2007, 2008 Free Software Foundation, Inc. + 2005, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -158,17 +158,17 @@ strip_suffix (const char *name) /* IT LEN stuff CS */ static void -checksum (FILE *file, unsigned char *ptr, int size, int code) +checksum (FILE *ffile, unsigned char *ptr, int size, int ccode) { int j; int last; int sum = 0; int bytes = size / 8; - last = !(code & 0xff00); + last = !(ccode & 0xff00); if (size & 0x7) abort (); - ptr[0] = code | (last ? 0x80 : 0); + ptr[0] = ccode | (last ? 0x80 : 0); ptr[1] = bytes + 1; for (j = 0; j < bytes; j++) @@ -176,14 +176,14 @@ checksum (FILE *file, unsigned char *ptr, int size, int code) /* Glue on a checksum too. */ ptr[bytes] = ~sum; - if (fwrite (ptr, bytes + 1, 1, file) != 1) + if (fwrite (ptr, bytes + 1, 1, ffile) != 1) /* FIXME: Return error status. */ abort (); } static void -writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *file) +writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *ffile) { int byte = *idx / 8; @@ -195,7 +195,7 @@ writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *file) if (byte > 240) { /* Lets write out that record and do another one. */ - checksum (file, ptr, *idx, code | 0x1000); + checksum (ffile, ptr, *idx, code | 0x1000); *idx = 16; byte = *idx / 8; } @@ -242,24 +242,24 @@ writeBITS (int val, unsigned char *ptr, int *idx, int size) static void writeBARRAY (barray data, unsigned char *ptr, int *idx, - int size ATTRIBUTE_UNUSED, FILE *file) + int size ATTRIBUTE_UNUSED, FILE *ffile) { int i; - writeINT (data.len, ptr, idx, 1, file); + writeINT (data.len, ptr, idx, 1, ffile); for (i = 0; i < data.len; i++) - writeINT (data.data[i], ptr, idx, 1, file); + writeINT (data.data[i], ptr, idx, 1, ffile); } static void -writeCHARS (char *string, unsigned char *ptr, int *idx, int size, FILE *file) +writeCHARS (char *string, unsigned char *ptr, int *idx, int size, FILE *ffile) { int i = *idx / 8; if (i > 240) { /* Lets write out that record and do another one. */ - checksum (file, ptr, *idx, code | 0x1000); + checksum (ffile, ptr, *idx, code | 0x1000); *idx = 16; i = *idx / 8; } @@ -1697,21 +1697,22 @@ align (int x) ordinary defs - dunno why, but thats what hitachi does with 'em. */ static void -prescan (struct coff_ofile *tree) +prescan (struct coff_ofile *otree) { struct coff_symbol *s; struct coff_section *common_section; /* Find the common section - always section 3. */ - common_section = tree->sections + 3; + common_section = otree->sections + 3; - for (s = tree->symbol_list_head; + for (s = otree->symbol_list_head; s; s = s->next_in_ofile_list) { if (s->visible->type == coff_vis_common) { struct coff_where *w = s->where; + /* s->visible->type = coff_vis_ext_def; leave it as common */ common_section->size = align (common_section->size); w->offset = common_section->size + common_section->address; @@ -1725,11 +1726,11 @@ prescan (struct coff_ofile *tree) char *program_name; static void -show_usage (FILE *file, int status) +show_usage (FILE *ffile, int status) { - fprintf (file, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name); - fprintf (file, _("Convert a COFF object file into a SYSROFF object file\n")); - fprintf (file, _(" The options are:\n\ + fprintf (ffile, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name); + fprintf (ffile, _("Convert a COFF object file into a SYSROFF object file\n")); + fprintf (ffile, _(" The options are:\n\ -q --quick (Obsolete - ignored)\n\ -n --noprescan Do not perform a scan to convert commons into defs\n\ -d --debug Display information about what is being done\n\ @@ -1738,7 +1739,7 @@ show_usage (FILE *file, int status) -v --version Print the program's version number\n")); if (REPORT_BUGS_TO[0] && status == 0) - fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO); + fprintf (ffile, _("Report bugs to %s\n"), REPORT_BUGS_TO); exit (status); } diff --git a/binutils/stabs.c b/binutils/stabs.c index c2bb26615..3089545dc 100644 --- a/binutils/stabs.c +++ b/binutils/stabs.c @@ -3277,26 +3277,26 @@ static debug_type * stab_find_slot (struct stab_handle *info, const int *typenums) { int filenum; - int index; + int tindex; struct stab_types **ps; filenum = typenums[0]; - index = typenums[1]; + tindex = typenums[1]; if (filenum < 0 || (unsigned int) filenum >= info->files) { fprintf (stderr, _("Type file number %d out of range\n"), filenum); return NULL; } - if (index < 0) + if (tindex < 0) { - fprintf (stderr, _("Type index number %d out of range\n"), index); + fprintf (stderr, _("Type index number %d out of range\n"), tindex); return NULL; } ps = info->file_types + filenum; - while (index >= STAB_TYPES_SLOTS) + while (tindex >= STAB_TYPES_SLOTS) { if (*ps == NULL) { @@ -3304,7 +3304,7 @@ stab_find_slot (struct stab_handle *info, const int *typenums) memset (*ps, 0, sizeof **ps); } ps = &(*ps)->next; - index -= STAB_TYPES_SLOTS; + tindex -= STAB_TYPES_SLOTS; } if (*ps == NULL) { @@ -3312,7 +3312,7 @@ stab_find_slot (struct stab_handle *info, const int *typenums) memset (*ps, 0, sizeof **ps); } - return (*ps)->types + index; + return (*ps)->types + tindex; } /* Find a type given a type number. If the type has not been diff --git a/binutils/sysdump.c b/binutils/sysdump.c index 9f50d6568..b9778a6dd 100644 --- a/binutils/sysdump.c +++ b/binutils/sysdump.c @@ -211,9 +211,9 @@ getBITS (unsigned char *ptr, int *idx, int size, int max) } static void -itheader (char *name, int code) +itheader (char *name, int icode) { - printf ("\n%s 0x%02x\n", name, code); + printf ("\n%s 0x%02x\n", name, icode); } static int indent; @@ -641,16 +641,16 @@ module (void) char *program_name; static void -show_usage (FILE *file, int status) +show_usage (FILE *ffile, int status) { - fprintf (file, _("Usage: %s [option(s)] in-file\n"), program_name); - fprintf (file, _("Print a human readable interpretation of a SYSROFF object file\n")); - fprintf (file, _(" The options are:\n\ + fprintf (ffile, _("Usage: %s [option(s)] in-file\n"), program_name); + fprintf (ffile, _("Print a human readable interpretation of a SYSROFF object file\n")); + fprintf (ffile, _(" The options are:\n\ -h --help Display this information\n\ -v --version Print the program's version number\n")); if (REPORT_BUGS_TO[0] && status == 0) - fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO); + fprintf (ffile, _("Report bugs to %s\n"), REPORT_BUGS_TO); exit (status); } @@ -658,7 +658,7 @@ int main (int ac, char **av) { char *input_file = NULL; - int opt; + int option; static struct option long_options[] = { {"help", no_argument, 0, 'h'}, @@ -680,9 +680,9 @@ main (int ac, char **av) expandargv (&ac, &av); - while ((opt = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF) + while ((option = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF) { - switch (opt) + switch (option) { case 'H': case 'h': diff --git a/binutils/sysinfo.y b/binutils/sysinfo.y index 1e6f75bc8..bab635ed7 100644 --- a/binutils/sysinfo.y +++ b/binutils/sysinfo.y @@ -1,4 +1,4 @@ -/* Copyright 2001, 2003, 2005, 2007 Free Software Foundation, Inc. +/* Copyright 2001, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com). This file is part of GNU binutils. @@ -102,45 +102,39 @@ it: case 'd': printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code); printf("struct IT_%s;\n", it); - printf("extern void sysroff_swap_%s_in PARAMS ((struct IT_%s *));\n", + printf("extern void sysroff_swap_%s_in (struct IT_%s *);\n", $2, it); - printf("extern void sysroff_swap_%s_out PARAMS ((FILE *, struct IT_%s *));\n", + printf("extern void sysroff_swap_%s_out (FILE *, struct IT_%s *);\n", $2, it); - printf("extern void sysroff_print_%s_out PARAMS ((struct IT_%s *));\n", + printf("extern void sysroff_print_%s_out (struct IT_%s *);\n", $2, it); printf("struct IT_%s { \n", it); break; case 'i': - printf("void sysroff_swap_%s_in(ptr)\n",$2); - printf("struct IT_%s *ptr;\n", it); + printf("void sysroff_swap_%s_in (struct IT_%s * ptr)\n",$2,it); printf("{\n"); - printf("unsigned char raw[255];\n"); - printf("\tint idx = 0 ;\n"); + printf("\tunsigned char raw[255];\n"); + printf("\tint idx = 0;\n"); printf("\tint size;\n"); - printf("memset(raw,0,255);\n"); - printf("memset(ptr,0,sizeof(*ptr));\n"); - printf("size = fillup(raw);\n"); + printf("\tmemset(raw,0,255);\n"); + printf("\tmemset(ptr,0,sizeof(*ptr));\n"); + printf("\tsize = fillup(raw);\n"); break; case 'g': - printf("void sysroff_swap_%s_out(file,ptr)\n",$2); - printf("FILE * file;\n"); - printf("struct IT_%s *ptr;\n", it); + printf("void sysroff_swap_%s_out (FILE * ffile, struct IT_%s * ptr)\n",$2,it); printf("{\n"); printf("\tunsigned char raw[255];\n"); - printf("\tint idx = 16 ;\n"); + printf("\tint idx = 16;\n"); printf("\tmemset (raw, 0, 255);\n"); printf("\tcode = IT_%s_CODE;\n", it); break; case 'o': - printf("void sysroff_swap_%s_out(abfd,ptr)\n",$2); - printf("bfd * abfd;\n"); - printf("struct IT_%s *ptr;\n",it); + printf("void sysroff_swap_%s_out (bfd * abfd, struct IT_%s * ptr)\n",$2, it); printf("{\n"); - printf("int idx = 0 ;\n"); + printf("\tint idx = 0;\n"); break; case 'c': - printf("void sysroff_print_%s_out(ptr)\n",$2); - printf("struct IT_%s *ptr;\n", it); + printf("void sysroff_print_%s_out (struct IT_%s *ptr)\n",$2,it); printf("{\n"); printf("itheader(\"%s\", IT_%s_CODE);\n",$2,$2); break; @@ -158,7 +152,7 @@ it: printf("};\n"); break; case 'g': - printf("\tchecksum(file,raw, idx, IT_%s_CODE);\n", it); + printf("\tchecksum(ffile,raw, idx, IT_%s_CODE);\n", it); case 'i': @@ -274,7 +268,7 @@ char *ptr = pnames[rdepth]; } else { - printf("\twrite%s(ptr->%s%s,raw,&idx,%d,file);\n", + printf("\twrite%s(ptr->%s%s,raw,&idx,%d,ffile);\n", type, id, names[rdepth],size/8); diff --git a/binutils/wrstabs.c b/binutils/wrstabs.c index 027cad273..fd2283f2e 100644 --- a/binutils/wrstabs.c +++ b/binutils/wrstabs.c @@ -394,13 +394,13 @@ stab_write_symbol (struct stab_write_handle *info, int type, int desc, static bfd_boolean stab_push_string (struct stab_write_handle *info, const char *string, - long index, bfd_boolean definition, unsigned int size) + long tindex, bfd_boolean definition, unsigned int size) { struct stab_type_stack *s; s = (struct stab_type_stack *) xmalloc (sizeof *s); s->string = xstrdup (string); - s->index = index; + s->index = tindex; s->definition = definition; s->size = size; @@ -418,13 +418,13 @@ stab_push_string (struct stab_write_handle *info, const char *string, /* Push a type index which has already been defined. */ static bfd_boolean -stab_push_defined_type (struct stab_write_handle *info, long index, +stab_push_defined_type (struct stab_write_handle *info, long tindex, unsigned int size) { char buf[20]; - sprintf (buf, "%ld", index); - return stab_push_string (info, buf, index, FALSE, size); + sprintf (buf, "%ld", tindex); + return stab_push_string (info, buf, tindex, FALSE, size); } /* Pop a type off the type stack. The caller is responsible for @@ -586,15 +586,15 @@ stab_empty_type (void *p) return stab_push_defined_type (info, info->type_cache.void_type, 0); else { - long index; + long tindex; char buf[40]; - index = info->type_index; + tindex = info->type_index; ++info->type_index; - sprintf (buf, "%ld=%ld", index, index); + sprintf (buf, "%ld=%ld", tindex, tindex); - return stab_push_string (info, buf, index, FALSE, 0); + return stab_push_string (info, buf, tindex, FALSE, 0); } } @@ -609,17 +609,17 @@ stab_void_type (void *p) return stab_push_defined_type (info, info->type_cache.void_type, 0); else { - long index; + long tindex; char buf[40]; - index = info->type_index; + tindex = info->type_index; ++info->type_index; - info->type_cache.void_type = index; + info->type_cache.void_type = tindex; - sprintf (buf, "%ld=%ld", index, index); + sprintf (buf, "%ld=%ld", tindex, tindex); - return stab_push_string (info, buf, index, TRUE, 0); + return stab_push_string (info, buf, tindex, TRUE, 0); } } @@ -646,15 +646,15 @@ stab_int_type (void *p, unsigned int size, bfd_boolean unsignedp) return stab_push_defined_type (info, cache[size - 1], size); else { - long index; + long tindex; char buf[100]; - index = info->type_index; + tindex = info->type_index; ++info->type_index; - cache[size - 1] = index; + cache[size - 1] = tindex; - sprintf (buf, "%ld=r%ld;", index, index); + sprintf (buf, "%ld=r%ld;", tindex, tindex); if (unsignedp) { strcat (buf, "0;"); @@ -679,7 +679,7 @@ stab_int_type (void *p, unsigned int size, bfd_boolean unsignedp) abort (); } - return stab_push_string (info, buf, index, TRUE, size); + return stab_push_string (info, buf, tindex, TRUE, size); } } @@ -699,7 +699,7 @@ stab_float_type (void *p, unsigned int size) size); else { - long index; + long tindex; char *int_type; char buf[50]; @@ -708,19 +708,19 @@ stab_float_type (void *p, unsigned int size) return FALSE; int_type = stab_pop_type (info); - index = info->type_index; + tindex = info->type_index; ++info->type_index; if (size > 0 && size - 1 < (sizeof info->type_cache.float_types / sizeof info->type_cache.float_types[0])) - info->type_cache.float_types[size - 1] = index; + info->type_cache.float_types[size - 1] = tindex; - sprintf (buf, "%ld=r%s;%u;0;", index, int_type, size); + sprintf (buf, "%ld=r%s;%u;0;", tindex, int_type, size); free (int_type); - return stab_push_string (info, buf, index, TRUE, size); + return stab_push_string (info, buf, tindex, TRUE, size); } } @@ -731,14 +731,14 @@ stab_complex_type (void *p, unsigned int size) { struct stab_write_handle *info = (struct stab_write_handle *) p; char buf[50]; - long index; + long tindex; - index = info->type_index; + tindex = info->type_index; ++info->type_index; - sprintf (buf, "%ld=r%ld;%u;0;", index, index, size); + sprintf (buf, "%ld=r%ld;%u;0;", tindex, tindex, size); - return stab_push_string (info, buf, index, TRUE, size * 2); + return stab_push_string (info, buf, tindex, TRUE, size * 2); } /* Push a bfd_boolean type. We use an XCOFF predefined type, since gdb @@ -748,29 +748,29 @@ static bfd_boolean stab_bool_type (void *p, unsigned int size) { struct stab_write_handle *info = (struct stab_write_handle *) p; - long index; + long tindex; switch (size) { case 1: - index = -21; + tindex = -21; break; case 2: - index = -22; + tindex = -22; break; default: case 4: - index = -16; + tindex = -16; break; case 8: - index = -33; + tindex = -33; break; } - return stab_push_defined_type (info, index, size); + return stab_push_defined_type (info, tindex, size); } /* Push an enum type. */ @@ -783,7 +783,7 @@ stab_enum_type (void *p, const char *tag, const char **names, size_t len; const char **pn; char *buf; - long index = 0; + long tindex = 0; bfd_signed_vma *pv; if (names == NULL) @@ -811,9 +811,9 @@ stab_enum_type (void *p, const char *tag, const char **names, strcpy (buf, "e"); else { - index = info->type_index; + tindex = info->type_index; ++info->type_index; - sprintf (buf, "%s:T%ld=e", tag, index); + sprintf (buf, "%s:T%ld=e", tag, tindex); } for (pn = names, pv = vals; *pn != NULL; pn++, pv++) @@ -830,7 +830,7 @@ stab_enum_type (void *p, const char *tag, const char **names, { /* FIXME: The size is just a guess. */ if (! stab_write_symbol (info, N_LSYM, 0, 0, buf) - || ! stab_push_defined_type (info, index, 4)) + || ! stab_push_defined_type (info, tindex, 4)) return FALSE; } @@ -847,7 +847,7 @@ stab_modify_type (struct stab_write_handle *info, int mod, unsigned int size, long **cache, size_t *cache_alloc) { long targindex; - long index; + long tindex; char *s, *buf; assert (info->type_stack != NULL); @@ -887,8 +887,8 @@ stab_modify_type (struct stab_write_handle *info, int mod, *cache_alloc = alloc; } - index = (*cache)[targindex]; - if (index != 0 && ! info->type_stack->definition) + tindex = (*cache)[targindex]; + if (tindex != 0 && ! info->type_stack->definition) { /* We have already defined a modification of this type, and the entry on the type stack is not a definition, so we @@ -897,22 +897,22 @@ stab_modify_type (struct stab_write_handle *info, int mod, is a struct which we did not define at the time it was referenced). */ free (stab_pop_type (info)); - if (! stab_push_defined_type (info, index, size)) + if (! stab_push_defined_type (info, tindex, size)) return FALSE; } else { - index = info->type_index; + tindex = info->type_index; ++info->type_index; s = stab_pop_type (info); buf = (char *) xmalloc (strlen (s) + 20); - sprintf (buf, "%ld=%c%s", index, mod, s); + sprintf (buf, "%ld=%c%s", tindex, mod, s); free (s); - (*cache)[targindex] = index; + (*cache)[targindex] = tindex; - if (! stab_push_string (info, buf, index, TRUE, size)) + if (! stab_push_string (info, buf, tindex, TRUE, size)) return FALSE; free (buf); @@ -1019,7 +1019,7 @@ stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high, bfd_boolean definition; unsigned int element_size; char *range, *element, *buf; - long index; + long tindex; unsigned int size; definition = info->type_stack->definition; @@ -1033,17 +1033,17 @@ stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high, if (! stringp) { - index = 0; + tindex = 0; *buf = '\0'; } else { /* We need to define a type in order to include the string attribute. */ - index = info->type_index; + tindex = info->type_index; ++info->type_index; definition = TRUE; - sprintf (buf, "%ld=@S;", index); + sprintf (buf, "%ld=@S;", tindex); } sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s", @@ -1055,7 +1055,7 @@ stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high, size = 0; else size = element_size * ((high - low) + 1); - if (! stab_push_string (info, buf, index, definition, size)) + if (! stab_push_string (info, buf, tindex, definition, size)) return FALSE; free (buf); @@ -1071,7 +1071,7 @@ stab_set_type (void *p, bfd_boolean bitstringp) struct stab_write_handle *info = (struct stab_write_handle *) p; bfd_boolean definition; char *s, *buf; - long index; + long tindex; definition = info->type_stack->definition; @@ -1081,22 +1081,22 @@ stab_set_type (void *p, bfd_boolean bitstringp) if (! bitstringp) { *buf = '\0'; - index = 0; + tindex = 0; } else { /* We need to define a type in order to include the string attribute. */ - index = info->type_index; + tindex = info->type_index; ++info->type_index; definition = TRUE; - sprintf (buf, "%ld=@S;", index); + sprintf (buf, "%ld=@S;", tindex); } sprintf (buf + strlen (buf), "S%s", s); free (s); - if (! stab_push_string (info, buf, index, definition, 0)) + if (! stab_push_string (info, buf, tindex, definition, 0)) return FALSE; free (buf); @@ -1309,7 +1309,7 @@ stab_start_struct_type (void *p, const char *tag, unsigned int id, bfd_boolean structp, unsigned int size) { struct stab_write_handle *info = (struct stab_write_handle *) p; - long index; + long tindex; bfd_boolean definition; char *buf; @@ -1317,17 +1317,17 @@ stab_start_struct_type (void *p, const char *tag, unsigned int id, if (id == 0) { - index = 0; + tindex = 0; *buf = '\0'; definition = FALSE; } else { - index = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL, + tindex = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL, &size); - if (index < 0) + if (tindex < 0) return FALSE; - sprintf (buf, "%ld=", index); + sprintf (buf, "%ld=", tindex); definition = TRUE; } @@ -1335,7 +1335,7 @@ stab_start_struct_type (void *p, const char *tag, unsigned int id, structp ? 's' : 'u', size); - if (! stab_push_string (info, buf, index, definition, size)) + if (! stab_push_string (info, buf, tindex, definition, size)) return FALSE; info->type_stack->fields = (char *) xmalloc (1); @@ -1414,14 +1414,14 @@ stab_end_struct_type (void *p) { struct stab_write_handle *info = (struct stab_write_handle *) p; bfd_boolean definition; - long index; + long tindex; unsigned int size; char *fields, *first, *buf; assert (info->type_stack != NULL && info->type_stack->fields != NULL); definition = info->type_stack->definition; - index = info->type_stack->index; + tindex = info->type_stack->index; size = info->type_stack->size; fields = info->type_stack->fields; first = stab_pop_type (info); @@ -1431,7 +1431,7 @@ stab_end_struct_type (void *p) free (first); free (fields); - if (! stab_push_string (info, buf, index, definition, size)) + if (! stab_push_string (info, buf, tindex, definition, size)) return FALSE; free (buf); @@ -1867,14 +1867,14 @@ stab_tag_type (void *p, const char *name, unsigned int id, enum debug_type_kind kind) { struct stab_write_handle *info = (struct stab_write_handle *) p; - long index; + long tindex; unsigned int size = 0; - index = stab_get_struct_index (info, name, id, kind, &size); - if (index < 0) + tindex = stab_get_struct_index (info, name, id, kind, &size); + if (tindex < 0) return FALSE; - return stab_push_defined_type (info, index, size); + return stab_push_defined_type (info, tindex, size); } /* Define a typedef. */ @@ -1883,24 +1883,24 @@ static bfd_boolean stab_typdef (void *p, const char *name) { struct stab_write_handle *info = (struct stab_write_handle *) p; - long index; + long tindex; unsigned int size; char *s, *buf; struct string_hash_entry *h; - index = info->type_stack->index; + tindex = info->type_stack->index; size = info->type_stack->size; s = stab_pop_type (info); buf = (char *) xmalloc (strlen (name) + strlen (s) + 20); - if (index > 0) + if (tindex > 0) sprintf (buf, "%s:t%s", name, s); else { - index = info->type_index; + tindex = info->type_index; ++info->type_index; - sprintf (buf, "%s:t%ld=%s", name, index, s); + sprintf (buf, "%s:t%ld=%s", name, tindex, s); } free (s); @@ -1920,7 +1920,7 @@ stab_typdef (void *p, const char *name) /* I don't think we care about redefinitions. */ - h->index = index; + h->index = tindex; h->size = size; return TRUE; @@ -2050,12 +2050,12 @@ stab_variable (void *p, const char *name, enum debug_var_kind kind, if (! ISDIGIT (*s)) { char *n; - long index; + long tindex; - index = info->type_index; + tindex = info->type_index; ++info->type_index; n = (char *) xmalloc (strlen (s) + 20); - sprintf (n, "%ld=%s", index, s); + sprintf (n, "%ld=%s", tindex, s); free (s); s = n; } diff --git a/cpu/ChangeLog b/cpu/ChangeLog index a627b4403..355cc7c5f 100644 --- a/cpu/ChangeLog +++ b/cpu/ChangeLog @@ -1,3 +1,8 @@ +2009-12-11 Nick Clifton + + * frv.opc: Fix shadowed variable warnings. + * m32c.opc: Fix shadowed variable warnings. + 2009-11-14 Doug Evans Must use VOID expression in VOID context. diff --git a/cpu/frv.opc b/cpu/frv.opc index 0b9c93c8d..3dfadb3b9 100644 --- a/cpu/frv.opc +++ b/cpu/frv.opc @@ -842,7 +842,7 @@ check_insn_major_constraints (FRV_VLIW *vliw, int frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) { - int index; + int slot_index; CGEN_ATTR_VALUE_ENUM_TYPE major; CGEN_ATTR_VALUE_ENUM_TYPE unit; VLIW_COMBO *new_vliw; @@ -850,8 +850,8 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) if (vliw->constraint_violation || CGEN_INSN_INVALID_P (insn)) return 1; - index = vliw->next_slot; - if (index >= FRV_VLIW_SIZE) + slot_index = vliw->next_slot; + if (slot_index >= FRV_VLIW_SIZE) return 1; unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT); @@ -878,7 +878,7 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) break; } - if (index <= 0) + if (slot_index <= 0) { /* Any insn can be added to slot 0. */ while (! match_unit (vliw, unit, (*vliw->current_vliw)[0])) @@ -898,8 +898,8 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) if (new_vliw && check_insn_major_constraints (vliw, major, insn)) { vliw->current_vliw = new_vliw; - vliw->major[index] = major; - vliw->insn[index] = insn; + vliw->major[slot_index] = major; + vliw->insn[slot_index] = insn; vliw->next_slot++; return 0; } diff --git a/cpu/m32c.opc b/cpu/m32c.opc index bc983ea3e..d2b073db0 100644 --- a/cpu/m32c.opc +++ b/cpu/m32c.opc @@ -156,27 +156,26 @@ parse_unsigned8 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { const char *errmsg = 0; - unsigned long value; + unsigned long value = 0; long have_zero = 0; if (strncasecmp (*strp, "%dsp8(", 6) == 0) { enum cgen_parse_operand_result result_type; - bfd_vma value; - const char *errmsg; + bfd_vma val; *strp += 6; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_8, - & result_type, & value); + & result_type, & val); if (**strp != ')') return _("missing `)'"); (*strp) ++; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - { - return _("%dsp8() takes a symbolic address, not a number"); - } + return _("%dsp8() takes a symbolic address, not a number"); + + value = val; *valuep = value; return errmsg; } @@ -253,26 +252,25 @@ parse_signed8 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) { const char *errmsg = 0; - signed long value; + signed long value = 0; if (strncasecmp (*strp, "%hi8(", 5) == 0) { enum cgen_parse_operand_result result_type; - bfd_vma value; - const char *errmsg; + bfd_vma val; *strp += 5; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_M32C_HI8, - & result_type, & value); + & result_type, & val); if (**strp != ')') return _("missing `)'"); (*strp) ++; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - { - value >>= 16; - } + val >>= 16; + + value = val; *valuep = value; return errmsg; } @@ -294,27 +292,26 @@ parse_unsigned16 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { const char *errmsg = 0; - unsigned long value; + unsigned long value = 0; long have_zero = 0; if (strncasecmp (*strp, "%dsp16(", 7) == 0) { enum cgen_parse_operand_result result_type; - bfd_vma value; - const char *errmsg; + bfd_vma val; *strp += 7; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_16, - & result_type, & value); + & result_type, & val); if (**strp != ')') return _("missing `)'"); (*strp) ++; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - { - return _("%dsp16() takes a symbolic address, not a number"); - } + return _("%dsp16() takes a symbolic address, not a number"); + + value = val; *valuep = value; return errmsg; } @@ -354,26 +351,25 @@ parse_signed16 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) { const char *errmsg = 0; - signed long value; + signed long value = 0; if (strncasecmp (*strp, "%lo16(", 6) == 0) { enum cgen_parse_operand_result result_type; - bfd_vma value; - const char *errmsg; + bfd_vma val; *strp += 6; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16, - & result_type, & value); + & result_type, & val); if (**strp != ')') return _("missing `)'"); (*strp) ++; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - { - value &= 0xffff; - } + value &= 0xffff; + + value = val; *valuep = value; return errmsg; } @@ -381,21 +377,20 @@ parse_signed16 (CGEN_CPU_DESC cd, const char **strp, if (strncasecmp (*strp, "%hi16(", 6) == 0) { enum cgen_parse_operand_result result_type; - bfd_vma value; - const char *errmsg; + bfd_vma val; *strp += 6; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16, - & result_type, & value); + & result_type, & val); if (**strp != ')') return _("missing `)'"); (*strp) ++; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - { - value >>= 16; - } + val >>= 16; + + value = val; *valuep = value; return errmsg; } @@ -1121,7 +1116,7 @@ print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, }; disassemble_info *info = dis_info; int mask; - int index = 0; + int reg_index = 0; char* comma = ""; if (push) @@ -1135,7 +1130,7 @@ print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, comma = ","; } - for (index = 1; index <= 7; ++index) + for (reg_index = 1; reg_index <= 7; ++reg_index) { if (push) mask >>= 1; @@ -1145,7 +1140,7 @@ print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, if (value & mask) { (*info->fprintf_func) (info->stream, "%s%s", comma, - m16c_register_names [index]); + m16c_register_names [reg_index]); comma = ","; } } diff --git a/elfcpp/ChangeLog b/elfcpp/ChangeLog index ca6b78b90..c9ca9f53f 100644 --- a/elfcpp/ChangeLog +++ b/elfcpp/ChangeLog @@ -1,3 +1,7 @@ +2009-12-11 Nick Clifton + + * elfcpp_file.h: Fix shadowed variable warnings. + 2009-12-10 Doug Kwan * arm.h: New enums for EABI object attribute tags and values. diff --git a/elfcpp/elfcpp_file.h b/elfcpp/elfcpp_file.h index 8dd7ad5cc..d7650d6cc 100644 --- a/elfcpp/elfcpp_file.h +++ b/elfcpp/elfcpp_file.h @@ -449,10 +449,10 @@ template unsigned int Elf_file::find_section_by_type(unsigned int type) { - unsigned int shnum = this->shnum(); + unsigned int tshnum = this->shnum(); typename File::View v(this->file_->view(this->shoff_, - This::shdr_size * shnum)); - for (unsigned int i = 0; i < shnum; i++) + This::shdr_size * tshnum)); + for (unsigned int i = 0; i < tshnum; i++) { Ef_shdr shdr(v.data() + This::shdr_size * i); if (shdr.get_sh_type() == type) @@ -494,8 +494,8 @@ Elf_file::section_name(unsigned int shndx) off_t shstr_off; typename Elf_types::Elf_WXword shstr_size; { - const unsigned int shstrndx = this->shstrndx_; - typename File::View v(file->view(this->section_header_offset(shstrndx), + const unsigned int fshstrndx = this->shstrndx_; + typename File::View v(file->view(this->section_header_offset(fshstrndx), This::shdr_size)); Ef_shdr shstr_shdr(v.data()); shstr_off = shstr_shdr.get_sh_offset(); diff --git a/gas/ChangeLog b/gas/ChangeLog index 5c1a5566f..c38f445f0 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,49 @@ +2009-12-11 Nick Clifton + + * Makefile.in: Regenerate. + * doc/Makefile.in: Regenerate. + * configure: Regenerate. + * dw2gencfi.c: Fix shadowed variable warnings. + * dwarf2dbg.c: Likewise. + * expr.c: Likewise. + * hash.c: Likewise. + * listing.c: Likewise. + * macro.c: Likewise. + * read.c: Likewise. + * stabs.c: Likewise. + * symbols.c: Likewise. + * write.c: Likewise. + * config/bfin-parse.y: Likewise. + * config/obj-coff.c: Likewise. + * config/tc-arm.c: Likewise. + * config/tc-bfin.c: Likewise. + * config/tc-cr16.c: Likewise. + * config/tc-crx.c: Likewise. + * config/tc-d10v.c: Likewise. + * config/tc-d30v.c: Likewise. + * config/tc-frv.c: Likewise. + * config/tc-i370.c: Likewise. + * config/tc-i386-intel.c: Likewise. + * config/tc-i386.c: Likewise. + * config/tc-ia64.c: Likewise. + * config/tc-m32r.c: Likewise. + * config/tc-m68hc11.c: Likewise. + * config/tc-mips.c: Likewise. + * config/tc-mn10200.c: Likewise. + * config/tc-mn10300.c: Likewise. + * config/tc-ns32k.c: Likewise. + * config/tc-ppc.c: Likewise. + * config/tc-score.c: Likewise. + * config/tc-score7.c: Likewise. + * config/tc-sh.c: Likewise. + * config/tc-sh64.c: Likewise. + * config/tc-sparc.c: Likewise. + * config/tc-tic30.c: Likewise. + * config/tc-tic4x.c: Likewise. + * config/tc-tic54x.c: Likewise. + * config/tc-xtensa.c: Likewise. + * config/tc-z8k.c: Likewise. + 2009-12-09 H.J. Lu * config/tc-i386.c (arch_entry): Add len and skip. diff --git a/gas/Makefile.in b/gas/Makefile.in index 5aa485e0b..f75424cf1 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -48,12 +48,15 @@ DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \ $(srcdir)/../ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/zlib.m4 \ $(top_srcdir)/../bfd/warning.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 \ + $(top_srcdir)/../config/plugins.m4 \ $(top_srcdir)/../config/po.m4 \ $(top_srcdir)/../config/progtest.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ diff --git a/gas/config/bfin-parse.y b/gas/config/bfin-parse.y index 003e41ac7..311246080 100644 --- a/gas/config/bfin-parse.y +++ b/gas/config/bfin-parse.y @@ -193,10 +193,10 @@ yyerror (char *msg) } static int -in_range_p (Expr_Node *expr, int from, int to, unsigned int mask) +in_range_p (Expr_Node *exp, int from, int to, unsigned int mask) { - int val = EXPR_VALUE (expr); - if (expr->type != Expr_Node_Constant) + int val = EXPR_VALUE (exp); + if (exp->type != Expr_Node_Constant) return 0; if (val < from || val > to) return 0; @@ -4411,13 +4411,13 @@ mkexpr (int x, SYMBOL_T s) } static int -value_match (Expr_Node *expr, int sz, int sign, int mul, int issigned) +value_match (Expr_Node *exp, int sz, int sign, int mul, int issigned) { int umax = (1 << sz) - 1; int min = -1 << (sz - 1); int max = (1 << (sz - 1)) - 1; - int v = (EXPR_VALUE (expr)) & 0xffffffff; + int v = (EXPR_VALUE (exp)) & 0xffffffff; if ((v % mul) != 0) { diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index d4fb10dbc..aa621b96d 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -621,14 +621,11 @@ obj_coff_def (int what ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); } -unsigned int dim_index; - static void obj_coff_endef (int ignore ATTRIBUTE_UNUSED) { symbolS *symbolP = NULL; - dim_index = 0; if (def_symbol_in_progress == NULL) { as_warn (_(".endef pseudo-op used outside of .def/.endef: ignored.")); @@ -861,7 +858,7 @@ obj_coff_endef (int ignore ATTRIBUTE_UNUSED) static void obj_coff_dim (int ignore ATTRIBUTE_UNUSED) { - int dim_index; + int d_index; if (def_symbol_in_progress == NULL) { @@ -872,10 +869,10 @@ obj_coff_dim (int ignore ATTRIBUTE_UNUSED) S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); - for (dim_index = 0; dim_index < DIMNUM; dim_index++) + for (d_index = 0; d_index < DIMNUM; d_index++) { SKIP_WHITESPACES (); - SA_SET_SYM_DIMEN (def_symbol_in_progress, dim_index, + SA_SET_SYM_DIMEN (def_symbol_in_progress, d_index, get_absolute_expression ()); switch (*input_line_pointer) @@ -889,7 +886,7 @@ obj_coff_dim (int ignore ATTRIBUTE_UNUSED) /* Fall through. */ case '\n': case ';': - dim_index = DIMNUM; + d_index = DIMNUM; break; } } diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 076c82b02..16e65d213 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -1052,10 +1052,10 @@ md_atof (int type, char * litP, int * sizeP) /* We handle all bad expressions here, so that we can report the faulty instruction in the error message. */ void -md_operand (expressionS * expr) +md_operand (expressionS * exp) { if (in_my_get_expression) - expr->X_op = O_illegal; + exp->X_op = O_illegal; } /* Immediate values. */ @@ -1583,23 +1583,23 @@ parse_reg_list (char ** strp) } else { - expressionS expr; + expressionS exp; - if (my_get_expression (&expr, &str, GE_NO_PREFIX)) + if (my_get_expression (&exp, &str, GE_NO_PREFIX)) return FAIL; - if (expr.X_op == O_constant) + if (exp.X_op == O_constant) { - if (expr.X_add_number - != (expr.X_add_number & 0x0000ffff)) + if (exp.X_add_number + != (exp.X_add_number & 0x0000ffff)) { inst.error = _("invalid register mask"); return FAIL; } - if ((range & expr.X_add_number) != 0) + if ((range & exp.X_add_number) != 0) { - int regno = range & expr.X_add_number; + int regno = range & exp.X_add_number; regno &= -regno; regno = (1 << regno) - 1; @@ -1608,7 +1608,7 @@ parse_reg_list (char ** strp) regno); } - range |= expr.X_add_number; + range |= exp.X_add_number; } else { @@ -1618,7 +1618,7 @@ parse_reg_list (char ** strp) return FAIL; } - memcpy (&inst.reloc.exp, &expr, sizeof (expressionS)); + memcpy (&inst.reloc.exp, &exp, sizeof (expressionS)); inst.reloc.type = BFD_RELOC_ARM_MULTI; inst.reloc.pc_rel = 0; } @@ -4711,7 +4711,7 @@ static int parse_shifter_operand (char **str, int i) { int value; - expressionS expr; + expressionS exp; if ((value = arm_reg_parse (str, REG_TYPE_RN)) != FAIL) { @@ -4735,16 +4735,16 @@ parse_shifter_operand (char **str, int i) if (skip_past_comma (str) == SUCCESS) { /* #x, y -- ie explicit rotation by Y. */ - if (my_get_expression (&expr, str, GE_NO_PREFIX)) + if (my_get_expression (&exp, str, GE_NO_PREFIX)) return FAIL; - if (expr.X_op != O_constant || inst.reloc.exp.X_op != O_constant) + if (exp.X_op != O_constant || inst.reloc.exp.X_op != O_constant) { inst.error = _("constant expression expected"); return FAIL; } - value = expr.X_add_number; + value = exp.X_add_number; if (value < 0 || value > 30 || value % 2 != 0) { inst.error = _("invalid rotation"); @@ -14163,12 +14163,13 @@ do_neon_mov (void) case NS_SR: /* case 4. */ { unsigned bcdebits = 0; - struct neon_type_el et = neon_check_type (2, NS_NULL, - N_8 | N_16 | N_32 | N_KEY, N_EQK); - int logsize = neon_logbits (et.size); + int logsize; unsigned dn = NEON_SCALAR_REG (inst.operands[0].reg); unsigned x = NEON_SCALAR_INDEX (inst.operands[0].reg); + et = neon_check_type (2, NS_NULL, N_8 | N_16 | N_32 | N_KEY, N_EQK); + logsize = neon_logbits (et.size); + constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_vfp_ext_v1), _(BAD_FPU)); constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_v1) @@ -14210,13 +14211,15 @@ do_neon_mov (void) case NS_RS: /* case 6. */ { - struct neon_type_el et = neon_check_type (2, NS_NULL, - N_EQK, N_S8 | N_S16 | N_U8 | N_U16 | N_32 | N_KEY); - unsigned logsize = neon_logbits (et.size); + unsigned logsize; unsigned dn = NEON_SCALAR_REG (inst.operands[1].reg); unsigned x = NEON_SCALAR_INDEX (inst.operands[1].reg); unsigned abcdebits = 0; + et = neon_check_type (2, NS_NULL, + N_EQK, N_S8 | N_S16 | N_U8 | N_U16 | N_32 | N_KEY); + logsize = neon_logbits (et.size); + constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_vfp_ext_v1), _(BAD_FPU)); constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_v1) @@ -19126,12 +19129,12 @@ tc_arm_regname_to_dw2regnum (char *regname) void tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size) { - expressionS expr; + expressionS exp; - expr.X_op = O_secrel; - expr.X_add_symbol = symbol; - expr.X_add_number = 0; - emit_expr (&expr, size); + exp.X_op = O_secrel; + exp.X_add_symbol = symbol; + exp.X_add_number = 0; + emit_expr (&exp, size); } #endif @@ -22602,18 +22605,18 @@ aeabi_set_public_attributes (void) /* Tag_CPU_name. */ if (selected_cpu_name[0]) { - char *p; + char *q; - p = selected_cpu_name; - if (strncmp (p, "armv", 4) == 0) + q = selected_cpu_name; + if (strncmp (q, "armv", 4) == 0) { int i; - p += 4; - for (i = 0; p[i]; i++) - p[i] = TOUPPER (p[i]); + q += 4; + for (i = 0; q[i]; i++) + q[i] = TOUPPER (q[i]); } - aeabi_set_attribute_string (Tag_CPU_name, p); + aeabi_set_attribute_string (Tag_CPU_name, q); } /* Tag_CPU_arch. */ diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index adbc3e4b8..d9888907d 100644 --- a/gas/config/tc-bfin.c +++ b/gas/config/tc-bfin.c @@ -1134,6 +1134,7 @@ Expr_Node_Gen_Reloc_R (Expr_Node * head) #define INIT(t) t c_code = init_##t #define ASSIGN(x) c_code.opcode |= ((x & c_code.mask_##x)<regno & CODE_MASK) : 0) & c_code.mask_##x)<> 16) & 0xffff) @@ -1302,13 +1303,13 @@ bfin_gen_calla (Expr_Node * addr, int S) { int val; int high_val; - int reloc = 0; + int rel = 0; INIT (CALLa); switch(S){ - case 0 : reloc = BFD_RELOC_BFIN_24_PCREL_JUMP_L; break; - case 1 : reloc = BFD_RELOC_24_PCREL; break; - case 2 : reloc = BFD_RELOC_BFIN_PLTPC; break; + case 0 : rel = BFD_RELOC_BFIN_24_PCREL_JUMP_L; break; + case 1 : rel = BFD_RELOC_24_PCREL; break; + case 2 : rel = BFD_RELOC_BFIN_PLTPC; break; default : break; } @@ -1318,7 +1319,7 @@ bfin_gen_calla (Expr_Node * addr, int S) high_val = val >> 16; return conscode (gencode (HI (c_code.opcode) | (high_val & 0xff)), - Expr_Node_Gen_Reloc (addr, reloc)); + Expr_Node_Gen_Reloc (addr, rel)); } INSTR_T @@ -1336,7 +1337,7 @@ bfin_gen_linkage (int R, int framesize) /* Load and Store. */ INSTR_T -bfin_gen_ldimmhalf (REG_T reg, int H, int S, int Z, Expr_Node * phword, int reloc) +bfin_gen_ldimmhalf (REG_T reg, int H, int S, int Z, Expr_Node * phword, int rel) { int grp, hword; unsigned val = EXPR_VALUE (phword); @@ -1349,11 +1350,11 @@ bfin_gen_ldimmhalf (REG_T reg, int H, int S, int Z, Expr_Node * phword, int relo ASSIGN_R (reg); grp = (GROUP (reg)); ASSIGN (grp); - if (reloc == 2) + if (rel == 2) { return conscode (gencode (HI (c_code.opcode)), Expr_Node_Gen_Reloc (phword, BFD_RELOC_BFIN_16_IMM)); } - else if (reloc == 1) + else if (rel == 1) { return conscode (gencode (HI (c_code.opcode)), Expr_Node_Gen_Reloc (phword, IS_H (*reg) ? BFD_RELOC_BFIN_16_HIGH : BFD_RELOC_BFIN_16_LOW)); } @@ -1450,20 +1451,19 @@ bfin_gen_ldst (REG_T ptr, REG_T reg, int aop, int sz, int Z, int W) } INSTR_T -bfin_gen_ldstii (REG_T ptr, REG_T reg, Expr_Node * poffset, int W, int op) +bfin_gen_ldstii (REG_T ptr, REG_T reg, Expr_Node * poffset, int W, int opc) { int offset; int value = 0; INIT (LDSTii); - if (!IS_PREG (*ptr)) { fprintf (stderr, "Warning: possible mixup of Preg/Dreg\n"); return 0; } - switch (op) + switch (opc) { case 1: case 2: @@ -1481,7 +1481,7 @@ bfin_gen_ldstii (REG_T ptr, REG_T reg, Expr_Node * poffset, int W, int op) offset = value; ASSIGN (offset); ASSIGN (W); - ASSIGN (op); + ASSIGNF (opc, op); return GEN_OPCODE16 (); } @@ -1580,48 +1580,48 @@ bfin_gen_alu2op (REG_T dst, REG_T src, int opc) } INSTR_T -bfin_gen_compi2opd (REG_T dst, int src, int op) +bfin_gen_compi2opd (REG_T dst, int src, int opc) { INIT (COMPI2opD); ASSIGN_R (dst); ASSIGN (src); - ASSIGN (op); + ASSIGNF (opc, op); return GEN_OPCODE16 (); } INSTR_T -bfin_gen_compi2opp (REG_T dst, int src, int op) +bfin_gen_compi2opp (REG_T dst, int src, int opc) { INIT (COMPI2opP); ASSIGN_R (dst); ASSIGN (src); - ASSIGN (op); + ASSIGNF (opc, op); return GEN_OPCODE16 (); } INSTR_T -bfin_gen_dagmodik (REG_T i, int op) +bfin_gen_dagmodik (REG_T i, int opc) { INIT (DagMODik); ASSIGN_R (i); - ASSIGN (op); + ASSIGNF (opc, op); return GEN_OPCODE16 (); } INSTR_T -bfin_gen_dagmodim (REG_T i, REG_T m, int op, int br) +bfin_gen_dagmodim (REG_T i, REG_T m, int opc, int br) { INIT (DagMODim); ASSIGN_R (i); ASSIGN_R (m); - ASSIGN (op); + ASSIGNF (opc, op); ASSIGN (br); return GEN_OPCODE16 (); @@ -1684,12 +1684,12 @@ bfin_gen_ccmv (REG_T src, REG_T dst, int T) } INSTR_T -bfin_gen_cc2stat (int cbit, int op, int D) +bfin_gen_cc2stat (int cbit, int opc, int D) { INIT (CC2stat); ASSIGN (cbit); - ASSIGN (op); + ASSIGNF (opc, op); ASSIGN (D); return GEN_OPCODE16 (); @@ -1713,11 +1713,11 @@ bfin_gen_regmv (REG_T src, REG_T dst) } INSTR_T -bfin_gen_cc2dreg (int op, REG_T reg) +bfin_gen_cc2dreg (int opc, REG_T reg) { INIT (CC2dreg); - ASSIGN (op); + ASSIGNF (opc, op); ASSIGN_R (reg); return GEN_OPCODE16 (); @@ -1735,13 +1735,13 @@ bfin_gen_progctrl (int prgfunc, int poprnd) } INSTR_T -bfin_gen_cactrl (REG_T reg, int a, int op) +bfin_gen_cactrl (REG_T reg, int a, int opc) { INIT (CaCTRL); ASSIGN_R (reg); ASSIGN (a); - ASSIGN (op); + ASSIGNF (opc, op); return GEN_OPCODE16 (); } @@ -1841,14 +1841,14 @@ bfin_gen_multi_instr (INSTR_T dsp32, INSTR_T dsp16_grp1, INSTR_T dsp16_grp2) } INSTR_T -bfin_gen_loop (Expr_Node *expr, REG_T reg, int rop, REG_T preg) +bfin_gen_loop (Expr_Node *exp, REG_T reg, int rop, REG_T preg) { const char *loopsym; char *lbeginsym, *lendsym; Expr_Node_Value lbeginval, lendval; Expr_Node *lbegin, *lend; - loopsym = expr->value.s_value; + loopsym = exp->value.s_value; lbeginsym = (char *) xmalloc (strlen (loopsym) + strlen ("__BEGIN") + 5); lendsym = (char *) xmalloc (strlen (loopsym) + strlen ("__END") + 5); @@ -1875,14 +1875,14 @@ bfin_gen_loop (Expr_Node *expr, REG_T reg, int rop, REG_T preg) } void -bfin_loop_beginend (Expr_Node *expr, int begin) +bfin_loop_beginend (Expr_Node *exp, int begin) { const char *loopsym; char *label_name; - symbolS *line_label; + symbolS *linelabel; const char *suffix = begin ? "__BEGIN" : "__END"; - loopsym = expr->value.s_value; + loopsym = exp->value.s_value; label_name = (char *) xmalloc (strlen (loopsym) + strlen (suffix) + 5); label_name[0] = 0; @@ -1891,12 +1891,12 @@ bfin_loop_beginend (Expr_Node *expr, int begin) strcat (label_name, loopsym); strcat (label_name, suffix); - line_label = colon (label_name); + linelabel = colon (label_name); /* LOOP_END follows the last instruction in the loop. Adjust label address. */ if (!begin) - ((struct local_symbol *) line_label)->lsy_value -= last_insn_size; + ((struct local_symbol *) linelabel)->lsy_value -= last_insn_size; } bfd_boolean @@ -2018,9 +2018,9 @@ decode_dagMODim_0 (int iw0) | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |.br| 1 | 1 |.op|.m.....|.i.....| +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */ int i = ((iw0 >> DagMODim_i_bits) & DagMODim_i_mask); - int op = ((iw0 >> DagMODim_op_bits) & DagMODim_op_mask); + int opc = ((iw0 >> DagMODim_op_bits) & DagMODim_op_mask); - if (op == 0 || op == 1) + if (opc == 0 || opc == 1) return IREG_MASK (i); else return 0; @@ -2199,18 +2199,18 @@ decode_LDSTii_0 (int iw0) | 1 | 0 | 1 |.W.|.op....|.offset........|.ptr.......|.reg.......| +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */ int reg = ((iw0 >> LDSTii_reg_bit) & LDSTii_reg_mask); - int op = ((iw0 >> LDSTii_op_bit) & LDSTii_op_mask); + int opc = ((iw0 >> LDSTii_op_bit) & LDSTii_op_mask); int W = ((iw0 >> LDSTii_W_bit) & LDSTii_W_mask); - if (W == 0 && op != 3) + if (W == 0 && opc != 3) return DREG_MASK (reg); - else if (W == 0 && op == 3) + else if (W == 0 && opc == 3) return 0; - else if (W == 1 && op == 0) + else if (W == 1 && opc == 0) return 0; - else if (W == 1 && op == 1) + else if (W == 1 && opc == 1) return 0; - else if (W == 1 && op == 3) + else if (W == 1 && opc == 3) return 0; abort (); diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c index 1ed74cda4..2a5b2f70b 100644 --- a/gas/config/tc-cr16.c +++ b/gas/config/tc-cr16.c @@ -317,12 +317,12 @@ get_cc (char *cc_name) static reg get_register (char *reg_name) { - const reg_entry *reg; + const reg_entry *rreg; - reg = (const reg_entry *) hash_find (reg_hash, reg_name); + rreg = (const reg_entry *) hash_find (reg_hash, reg_name); - if (reg != NULL) - return reg->value.reg_val; + if (rreg != NULL) + return rreg->value.reg_val; return nullregister; } @@ -331,7 +331,7 @@ get_register (char *reg_name) static reg get_register_pair (char *reg_name) { - const reg_entry *reg; + const reg_entry *rreg; char tmp_rp[16]="\0"; /* Add '(' and ')' to the reg pair, if its not present. */ @@ -340,13 +340,13 @@ get_register_pair (char *reg_name) tmp_rp[0] = '('; strcat (tmp_rp, reg_name); strcat (tmp_rp,")"); - reg = (const reg_entry *) hash_find (regp_hash, tmp_rp); + rreg = (const reg_entry *) hash_find (regp_hash, tmp_rp); } else - reg = (const reg_entry *) hash_find (regp_hash, reg_name); + rreg = (const reg_entry *) hash_find (regp_hash, reg_name); - if (reg != NULL) - return reg->value.reg_val; + if (rreg != NULL) + return rreg->value.reg_val; return nullregister; } @@ -356,13 +356,13 @@ get_register_pair (char *reg_name) static reg get_index_register (char *reg_name) { - const reg_entry *reg; + const reg_entry *rreg; - reg = (const reg_entry *) hash_find (reg_hash, reg_name); + rreg = (const reg_entry *) hash_find (reg_hash, reg_name); - if ((reg != NULL) - && ((reg->value.reg_val == 12) || (reg->value.reg_val == 13))) - return reg->value.reg_val; + if ((rreg != NULL) + && ((rreg->value.reg_val == 12) || (rreg->value.reg_val == 13))) + return rreg->value.reg_val; return nullregister; } @@ -371,17 +371,17 @@ get_index_register (char *reg_name) static reg get_index_register_pair (char *reg_name) { - const reg_entry *reg; + const reg_entry *rreg; - reg = (const reg_entry *) hash_find (regp_hash, reg_name); + rreg = (const reg_entry *) hash_find (regp_hash, reg_name); - if (reg != NULL) + if (rreg != NULL) { - if ((reg->value.reg_val != 1) || (reg->value.reg_val != 7) - || (reg->value.reg_val != 9) || (reg->value.reg_val > 10)) - return reg->value.reg_val; + if ((rreg->value.reg_val != 1) || (rreg->value.reg_val != 7) + || (rreg->value.reg_val != 9) || (rreg->value.reg_val > 10)) + return rreg->value.reg_val; - as_bad (_("Unknown register pair - index relative mode: `%d'"), reg->value.reg_val); + as_bad (_("Unknown register pair - index relative mode: `%d'"), rreg->value.reg_val); } return nullregister; @@ -392,12 +392,12 @@ get_index_register_pair (char *reg_name) static preg get_pregister (char *preg_name) { - const reg_entry *preg; + const reg_entry *prreg; - preg = (const reg_entry *) hash_find (preg_hash, preg_name); + prreg = (const reg_entry *) hash_find (preg_hash, preg_name); - if (preg != NULL) - return preg->value.preg_val; + if (prreg != NULL) + return prreg->value.preg_val; return nullpregister; } @@ -407,12 +407,12 @@ get_pregister (char *preg_name) static preg get_pregisterp (char *preg_name) { - const reg_entry *preg; + const reg_entry *prreg; - preg = (const reg_entry *) hash_find (pregp_hash, preg_name); + prreg = (const reg_entry *) hash_find (pregp_hash, preg_name); - if (preg != NULL) - return preg->value.preg_val; + if (prreg != NULL) + return prreg->value.preg_val; return nullpregister; } @@ -797,20 +797,20 @@ initialise_reg_hash_table (struct hash_control ** hash_table, const reg_entry * register_table, const unsigned int num_entries) { - const reg_entry * reg; + const reg_entry * rreg; const char *hashret; if ((* hash_table = hash_new ()) == NULL) as_fatal (_("Virtual memory exhausted")); - for (reg = register_table; - reg < (register_table + num_entries); - reg++) + for (rreg = register_table; + rreg < (register_table + num_entries); + rreg++) { - hashret = hash_insert (* hash_table, reg->name, (char *) reg); + hashret = hash_insert (* hash_table, rreg->name, (char *) rreg); if (hashret) as_fatal (_("Internal Error: Can't hash %s: %s"), - reg->name, hashret); + rreg->name, hashret); } } @@ -1105,20 +1105,20 @@ process_label_constant (char *str, ins * cr16_ins) static int getreg_image (reg r) { - const reg_entry *reg; + const reg_entry *rreg; char *reg_name; int is_procreg = 0; /* Nonzero means argument should be processor reg. */ /* Check whether the register is in registers table. */ if (r < MAX_REG) - reg = cr16_regtab + r; + rreg = cr16_regtab + r; else /* Register not found. */ { as_bad (_("Unknown register: `%d'"), r); return 0; } - reg_name = reg->name; + reg_name = rreg->name; /* Issue a error message when register is illegal. */ #define IMAGE_ERR \ @@ -1126,16 +1126,16 @@ getreg_image (reg r) reg_name, ins_parse); \ break; - switch (reg->type) + switch (rreg->type) { case CR16_R_REGTYPE: if (! is_procreg) - return reg->image; + return rreg->image; else IMAGE_ERR; case CR16_P_REGTYPE: - return reg->image; + return rreg->image; break; default: @@ -1579,12 +1579,12 @@ check_cinv_options (char * operand) static int getregp_image (reg r) { - const reg_entry *reg; + const reg_entry *rreg; char *reg_name; /* Check whether the register is in registers table. */ if (r < MAX_REG) - reg = cr16_regptab + r; + rreg = cr16_regptab + r; /* Register not found. */ else { @@ -1592,7 +1592,7 @@ getregp_image (reg r) return 0; } - reg_name = reg->name; + reg_name = rreg->name; /* Issue a error message when register pair is illegal. */ #define RPAIR_IMAGE_ERR \ @@ -1600,10 +1600,10 @@ getregp_image (reg r) reg_name, ins_parse); \ break; - switch (reg->type) + switch (rreg->type) { case CR16_RP_REGTYPE: - return reg->image; + return rreg->image; default: RPAIR_IMAGE_ERR; } @@ -1618,12 +1618,12 @@ getregp_image (reg r) static int getidxregp_image (reg r) { - const reg_entry *reg; + const reg_entry *rreg; char *reg_name; /* Check whether the register is in registers table. */ if (r < MAX_REG) - reg = cr16_regptab + r; + rreg = cr16_regptab + r; /* Register not found. */ else { @@ -1631,16 +1631,16 @@ getidxregp_image (reg r) return 0; } - reg_name = reg->name; + reg_name = rreg->name; /* Issue a error message when register pair is illegal. */ #define IDX_RPAIR_IMAGE_ERR \ as_bad (_("Illegal index register pair (`%s') in Instruction: `%s'"), \ reg_name, ins_parse); \ - if (reg->type == CR16_RP_REGTYPE) + if (rreg->type == CR16_RP_REGTYPE) { - switch (reg->image) + switch (rreg->image) { case 0: return 0; break; case 2: return 1; break; @@ -1665,12 +1665,12 @@ getidxregp_image (reg r) static int getprocreg_image (reg r) { - const reg_entry *reg; + const reg_entry *rreg; char *reg_name; /* Check whether the register is in registers table. */ if (r < MAX_PREG) - reg = &cr16_pregtab[r - MAX_REG]; + rreg = &cr16_pregtab[r - MAX_REG]; /* Register not found. */ else { @@ -1678,7 +1678,7 @@ getprocreg_image (reg r) return 0; } - reg_name = reg->name; + reg_name = rreg->name; /* Issue a error message when register pair is illegal. */ #define PROCREG_IMAGE_ERR \ @@ -1686,10 +1686,10 @@ getprocreg_image (reg r) reg_name, ins_parse); \ break; - switch (reg->type) + switch (rreg->type) { case CR16_P_REGTYPE: - return reg->image; + return rreg->image; default: PROCREG_IMAGE_ERR; } @@ -1703,7 +1703,7 @@ getprocreg_image (reg r) static int getprocregp_image (reg r) { - const reg_entry *reg; + const reg_entry *rreg; char *reg_name; int pregptab_disp = 0; @@ -1725,7 +1725,7 @@ getprocregp_image (reg r) pregptab_disp = 5; break; default: break; } - reg = &cr16_pregptab[r - pregptab_disp]; + rreg = &cr16_pregptab[r - pregptab_disp]; } /* Register not found. */ else @@ -1734,7 +1734,7 @@ getprocregp_image (reg r) return 0; } - reg_name = reg->name; + reg_name = rreg->name; /* Issue a error message when register pair is illegal. */ #define PROCREGP_IMAGE_ERR \ @@ -1742,10 +1742,10 @@ getprocregp_image (reg r) reg_name, ins_parse); \ break; - switch (reg->type) + switch (rreg->type) { case CR16_P_REGTYPE: - return reg->image; + return rreg->image; default: PROCREGP_IMAGE_ERR; } diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c index e95aa05f5..fd93f410e 100644 --- a/gas/config/tc-crx.c +++ b/gas/config/tc-crx.c @@ -205,12 +205,12 @@ get_opflags (operand_type op) static reg get_register (char *reg_name) { - const reg_entry *reg; + const reg_entry *rreg; - reg = (const reg_entry *) hash_find (reg_hash, reg_name); + rreg = (const reg_entry *) hash_find (reg_hash, reg_name); - if (reg != NULL) - return reg->value.reg_val; + if (rreg != NULL) + return rreg->value.reg_val; else return nullregister; } @@ -220,12 +220,12 @@ get_register (char *reg_name) static copreg get_copregister (char *copreg_name) { - const reg_entry *copreg; + const reg_entry *coreg; - copreg = (const reg_entry *) hash_find (copreg_hash, copreg_name); + coreg = (const reg_entry *) hash_find (copreg_hash, copreg_name); - if (copreg != NULL) - return copreg->value.copreg_val; + if (coreg != NULL) + return coreg->value.copreg_val; else return nullcopregister; } @@ -1106,7 +1106,7 @@ get_cinv_parameters (char * operand) static int getreg_image (reg r) { - const reg_entry *reg; + const reg_entry *rreg; char *reg_name; int is_procreg = 0; /* Nonzero means argument should be processor reg. */ @@ -1116,10 +1116,10 @@ getreg_image (reg r) /* Check whether the register is in registers table. */ if (r < MAX_REG) - reg = &crx_regtab[r]; + rreg = &crx_regtab[r]; /* Check whether the register is in coprocessor registers table. */ else if (r < MAX_COPREG) - reg = &crx_copregtab[r-MAX_REG]; + rreg = &crx_copregtab[r-MAX_REG]; /* Register not found. */ else { @@ -1127,7 +1127,7 @@ getreg_image (reg r) return 0; } - reg_name = reg->name; + reg_name = rreg->name; /* Issue a error message when register is illegal. */ #define IMAGE_ERR \ @@ -1135,29 +1135,29 @@ getreg_image (reg r) reg_name, ins_parse); \ break; - switch (reg->type) + switch (rreg->type) { case CRX_U_REGTYPE: if (is_procreg || (instruction->flags & USER_REG)) - return reg->image; + return rreg->image; else IMAGE_ERR; case CRX_CFG_REGTYPE: if (is_procreg) - return reg->image; + return rreg->image; else IMAGE_ERR; case CRX_R_REGTYPE: if (! is_procreg) - return reg->image; + return rreg->image; else IMAGE_ERR; case CRX_C_REGTYPE: case CRX_CS_REGTYPE: - return reg->image; + return rreg->image; break; default: diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c index 339eb7489..d0c312986 100644 --- a/gas/config/tc-d10v.c +++ b/gas/config/tc-d10v.c @@ -1201,7 +1201,9 @@ find_opcode (struct d10v_opcode *opcode, expressionS myops[]) for (i = 0; opcode->operands[i + 1]; i++) { int bits = d10v_operands[next_opcode->operands[opnum]].bits; - int flags = d10v_operands[next_opcode->operands[opnum]].flags; + + flags = d10v_operands[next_opcode->operands[opnum]].flags; + if (flags & OPERAND_ADDR) bits += 2; diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c index 8d90d467f..1874147ad 100644 --- a/gas/config/tc-d30v.c +++ b/gas/config/tc-d30v.c @@ -1133,7 +1133,7 @@ find_format (struct d30v_opcode *opcode, int fsize, int cmp_hack) { - int numops, match, index, i = 0, j, k; + int numops, match, opcode_index, i = 0, j, k; struct d30v_format *fm; if (opcode == NULL) @@ -1142,17 +1142,17 @@ find_format (struct d30v_opcode *opcode, /* Get all the operands and save them as expressions. */ numops = get_operands (myops, cmp_hack); - while ((index = opcode->format[i++]) != 0) + while ((opcode_index = opcode->format[i++]) != 0) { - if (fsize == FORCE_SHORT && index >= LONG) + if (fsize == FORCE_SHORT && opcode_index >= LONG) continue; - if (fsize == FORCE_LONG && index < LONG) + if (fsize == FORCE_LONG && opcode_index < LONG) continue; - fm = (struct d30v_format *) &d30v_format_table[index]; - k = index; - while (fm->form == index) + fm = (struct d30v_format *) &d30v_format_table[opcode_index]; + k = opcode_index; + while (fm->form == opcode_index) { match = 1; /* Now check the operands for compatibility. */ @@ -1346,13 +1346,14 @@ do_assemble (char *str, if (!strncmp (name, "cmp", 3)) { int p, i; - char **str = (char **) d30v_cc_names; + char **d30v_str = (char **) d30v_cc_names; + if (name[3] == 'u') p = 4; else p = 3; - for (i = 1; *str && strncmp (*str, &name[p], 2); i++, str++) + for (i = 1; *d30v_str && strncmp (*d30v_str, &name[p], 2); i++, d30v_str++) ; /* cmpu only supports some condition codes. */ @@ -1365,7 +1366,7 @@ do_assemble (char *str, } } - if (!*str) + if (!*d30v_str) { name[p + 2] = 0; as_bad (_("unknown condition code: %s"), &name[p]); diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c index e29810c42..9cdbe2651 100644 --- a/gas/config/tc-frv.c +++ b/gas/config/tc-frv.c @@ -897,9 +897,7 @@ workaround_top: if (vliw1->insn_count == 2) { - struct vliw_insn_list *this_insn; - - /* check vliw1 for a label. */ + /* Check vliw1 for a label. */ for (this_insn = vliw1->insn_list; this_insn; this_insn = this_insn->next) { if (this_insn->type == VLIW_LABEL_TYPE) @@ -1041,9 +1039,9 @@ fr550_check_insn_acc_range (frv_insn *insn, int low, int hi) } static int -fr550_check_acc_range (FRV_VLIW *vliw, frv_insn *insn) +fr550_check_acc_range (FRV_VLIW *vlw, frv_insn *insn) { - switch ((*vliw->current_vliw)[vliw->next_slot - 1]) + switch ((*vlw->current_vliw)[vlw->next_slot - 1]) { case UNIT_FM0: case UNIT_FM2: diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c index 3c7b1403f..c3c97fc81 100644 --- a/gas/config/tc-i370.c +++ b/gas/config/tc-i370.c @@ -900,6 +900,7 @@ i370_dc (int unused ATTRIBUTE_UNUSED) int nbytes=0; expressionS exp; char type=0; + char * clse; if (is_it_end_of_statement ()) { @@ -929,24 +930,20 @@ i370_dc (int unused ATTRIBUTE_UNUSED) /* Get rid of pesky quotes. */ if ('\'' == *input_line_pointer) { - char * close; - ++input_line_pointer; - close = strchr (input_line_pointer, '\''); - if (close) - *close= ' '; + clse = strchr (input_line_pointer, '\''); + if (clse) + *clse= ' '; else as_bad (_("missing end-quote")); } if ('\"' == *input_line_pointer) { - char * close; - ++input_line_pointer; - close = strchr (input_line_pointer, '\"'); - if (close) - *close= ' '; + clse = strchr (input_line_pointer, '\"'); + if (clse) + *clse= ' '; else as_bad (_("missing end-quote")); } @@ -1523,21 +1520,23 @@ i370_addr_cons (expressionS *exp) /* Get rid of pesky quotes. */ if ('\'' == *input_line_pointer) { - char * close; + char * clse; + ++input_line_pointer; - close = strchr (input_line_pointer, '\''); - if (close) - *close= ' '; + clse = strchr (input_line_pointer, '\''); + if (clse) + *clse= ' '; else as_bad (_("missing end-quote")); } if ('\"' == *input_line_pointer) { - char * close; + char * clse; + ++input_line_pointer; - close = strchr (input_line_pointer, '\"'); - if (close) - *close= ' '; + clse = strchr (input_line_pointer, '\"'); + if (clse) + *clse= ' '; else as_bad (_("missing end-quote")); } diff --git a/gas/config/tc-i386-intel.c b/gas/config/tc-i386-intel.c index df749b836..b3cdcd36d 100644 --- a/gas/config/tc-i386-intel.c +++ b/gas/config/tc-i386-intel.c @@ -154,7 +154,7 @@ operatorT i386_operator (const char *name, unsigned int operands, char *pc) } for (j = 0; i386_operators[j].name; ++j) - if (strcasecmp(i386_operators[j].name, name) == 0) + if (strcasecmp (i386_operators[j].name, name) == 0) { if (i386_operators[j].operands && i386_operators[j].operands != operands) @@ -163,16 +163,16 @@ operatorT i386_operator (const char *name, unsigned int operands, char *pc) } for (j = 0; i386_types[j].name; ++j) - if (strcasecmp(i386_types[j].name, name) == 0) + if (strcasecmp (i386_types[j].name, name) == 0) break; if (i386_types[j].name && *pc == ' ') { - char *name = ++input_line_pointer; + char *pname = ++input_line_pointer; char c = get_symbol_end (); - if (strcasecmp (name, "ptr") == 0) + if (strcasecmp (pname, "ptr") == 0) { - name[-1] = *pc; + pname[-1] = *pc; *pc = c; if (intel_syntax > 0 || operands != 1) return O_illegal; @@ -180,7 +180,7 @@ operatorT i386_operator (const char *name, unsigned int operands, char *pc) } *input_line_pointer = c; - input_line_pointer = name - 1; + input_line_pointer = pname - 1; } return O_absent; @@ -188,13 +188,13 @@ operatorT i386_operator (const char *name, unsigned int operands, char *pc) static int i386_intel_parse_name (const char *name, expressionS *e) { - unsigned int i; + unsigned int j; - for (i = 0; i386_types[i].name; ++i) - if (strcasecmp(i386_types[i].name, name) == 0) + for (j = 0; i386_types[j].name; ++j) + if (strcasecmp(i386_types[j].name, name) == 0) { e->X_op = O_constant; - e->X_add_number = i386_types[i].sz[flag_code]; + e->X_add_number = i386_types[j].sz[flag_code]; e->X_add_symbol = NULL; e->X_op_symbol = NULL; return 1; @@ -203,12 +203,12 @@ static int i386_intel_parse_name (const char *name, expressionS *e) return 0; } -static INLINE int i386_intel_check (const reg_entry *reg, +static INLINE int i386_intel_check (const reg_entry *rreg, const reg_entry *base, - const reg_entry *index) + const reg_entry *iindex) { - if ((this_operand >= 0 && reg != i.op[this_operand].regs) - || base != intel_state.base || index != intel_state.index) + if ((this_operand >= 0 && rreg != i.op[this_operand].regs) + || base != intel_state.base || iindex != intel_state.index) { as_bad (_("invalid use of register")); return 0; @@ -249,9 +249,9 @@ static INLINE int i386_intel_simplify_symbol(symbolS *sym) static int i386_intel_simplify (expressionS *e) { - const reg_entry *reg = this_operand >= 0 ? i.op[this_operand].regs : NULL; + const reg_entry *the_reg = this_operand >= 0 ? i.op[this_operand].regs : NULL; const reg_entry *base = intel_state.base; - const reg_entry *index = intel_state.index; + const reg_entry *state_index = intel_state.index; int ret; if (!intel_syntax) @@ -263,7 +263,7 @@ static int i386_intel_simplify (expressionS *e) if (e->X_add_symbol) { if (!i386_intel_simplify_symbol (e->X_add_symbol) - || !i386_intel_check(reg, intel_state.base, intel_state.index)) + || !i386_intel_check(the_reg, intel_state.base, intel_state.index)) return 0;; } if (!intel_state.in_offset) @@ -284,7 +284,7 @@ static int i386_intel_simplify (expressionS *e) ++intel_state.in_offset; ret = i386_intel_simplify_symbol (e->X_add_symbol); --intel_state.in_offset; - if (!ret || !i386_intel_check(reg, base, index)) + if (!ret || !i386_intel_check(the_reg, base, state_index)) return 0; i386_intel_fold (e, e->X_add_symbol); return ret; @@ -321,7 +321,7 @@ static int i386_intel_simplify (expressionS *e) return 0; } if (!i386_intel_simplify_symbol (e->X_op_symbol) - || !i386_intel_check(reg, intel_state.base, intel_state.index)) + || !i386_intel_check(the_reg, intel_state.base, intel_state.index)) return 0; if (!intel_state.in_offset) intel_state.seg = e->X_add_symbol; @@ -425,13 +425,13 @@ static int i386_intel_simplify (expressionS *e) if (e->X_op == O_add || e->X_op == O_subtract) { base = intel_state.base; - index = intel_state.index; + state_index = intel_state.index; } - if (!i386_intel_check (reg, base, index) + if (!i386_intel_check (the_reg, base, state_index) || (e->X_op_symbol && !i386_intel_simplify_symbol (e->X_op_symbol)) - || !i386_intel_check (reg, + || !i386_intel_check (the_reg, e->X_op != O_add ? base : intel_state.base, - e->X_op != O_add ? index : intel_state.index)) + e->X_op != O_add ? state_index : intel_state.index)) return 0; break; } diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 0dc1c57f3..efdd8c242 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2023,20 +2023,20 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED) { char *string = input_line_pointer; int e = get_symbol_end (); - unsigned int i; + unsigned int j; i386_cpu_flags flags; - for (i = 0; i < ARRAY_SIZE (cpu_arch); i++) + for (j = 0; j < ARRAY_SIZE (cpu_arch); j++) { - if (strcmp (string, cpu_arch[i].name) == 0) + if (strcmp (string, cpu_arch[j].name) == 0) { - check_cpu_arch_compatible (string, cpu_arch[i].flags); + check_cpu_arch_compatible (string, cpu_arch[j].flags); if (*string != '.') { - cpu_arch_name = cpu_arch[i].name; + cpu_arch_name = cpu_arch[j].name; cpu_sub_arch_name = NULL; - cpu_arch_flags = cpu_arch[i].flags; + cpu_arch_flags = cpu_arch[j].flags; if (flag_code == CODE_64BIT) { cpu_arch_flags.bitfield.cpu64 = 1; @@ -2047,8 +2047,8 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED) cpu_arch_flags.bitfield.cpu64 = 0; cpu_arch_flags.bitfield.cpuno64 = 1; } - cpu_arch_isa = cpu_arch[i].type; - cpu_arch_isa_flags = cpu_arch[i].flags; + cpu_arch_isa = cpu_arch[j].type; + cpu_arch_isa_flags = cpu_arch[j].flags; if (!cpu_arch_tune_set) { cpu_arch_tune = cpu_arch_isa; @@ -2059,22 +2059,22 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED) if (strncmp (string + 1, "no", 2)) flags = cpu_flags_or (cpu_arch_flags, - cpu_arch[i].flags); + cpu_arch[j].flags); else flags = cpu_flags_and_not (cpu_arch_flags, - cpu_arch[i].flags); + cpu_arch[j].flags); if (!cpu_flags_equal (&flags, &cpu_arch_flags)) { if (cpu_sub_arch_name) { char *name = cpu_sub_arch_name; cpu_sub_arch_name = concat (name, - cpu_arch[i].name, + cpu_arch[j].name, (const char *) NULL); free (name); } else - cpu_sub_arch_name = xstrdup (cpu_arch[i].name); + cpu_sub_arch_name = xstrdup (cpu_arch[j].name); cpu_arch_flags = flags; } *input_line_pointer = e; @@ -2082,7 +2082,7 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED) return; } } - if (i >= ARRAY_SIZE (cpu_arch)) + if (j >= ARRAY_SIZE (cpu_arch)) as_bad (_("no such architecture: `%s'"), string); *input_line_pointer = e; @@ -2454,7 +2454,7 @@ reloc (unsigned int size, { if (other != NO_RELOC) { - reloc_howto_type *reloc; + reloc_howto_type *rel; if (size == 8) switch (other) @@ -2485,18 +2485,18 @@ reloc (unsigned int size, if (size == 4 && flag_code != CODE_64BIT) sign = -1; - reloc = bfd_reloc_type_lookup (stdoutput, other); - if (!reloc) + rel = bfd_reloc_type_lookup (stdoutput, other); + if (!rel) as_bad (_("unknown relocation (%u)"), other); - else if (size != bfd_get_reloc_size (reloc)) + else if (size != bfd_get_reloc_size (rel)) as_bad (_("%u-byte relocation cannot be applied to %u-byte field"), - bfd_get_reloc_size (reloc), + bfd_get_reloc_size (rel), size); - else if (pcrel && !reloc->pc_relative) + else if (pcrel && !rel->pc_relative) as_bad (_("non-pc-relative relocation for pc-relative field")); - else if ((reloc->complain_on_overflow == complain_overflow_signed + else if ((rel->complain_on_overflow == complain_overflow_signed && !sign) - || (reloc->complain_on_overflow == complain_overflow_unsigned + || (rel->complain_on_overflow == complain_overflow_unsigned && sign > 0)) as_bad (_("relocated field and relocation type differ in signedness")); else @@ -3639,28 +3639,28 @@ optimize_disp (void) { if (i.op[op].disps->X_op == O_constant) { - offsetT disp = i.op[op].disps->X_add_number; + offsetT op_disp = i.op[op].disps->X_add_number; if (i.types[op].bitfield.disp16 - && (disp & ~(offsetT) 0xffff) == 0) + && (op_disp & ~(offsetT) 0xffff) == 0) { /* If this operand is at most 16 bits, convert to a signed 16 bit number and don't use 64bit displacement. */ - disp = (((disp & 0xffff) ^ 0x8000) - 0x8000); + op_disp = (((op_disp & 0xffff) ^ 0x8000) - 0x8000); i.types[op].bitfield.disp64 = 0; } if (i.types[op].bitfield.disp32 - && (disp & ~(((offsetT) 2 << 31) - 1)) == 0) + && (op_disp & ~(((offsetT) 2 << 31) - 1)) == 0) { /* If this operand is at most 32 bits, convert to a signed 32 bit number and don't use 64bit displacement. */ - disp &= (((offsetT) 2 << 31) - 1); - disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31); + op_disp &= (((offsetT) 2 << 31) - 1); + op_disp = (op_disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31); i.types[op].bitfield.disp64 = 0; } - if (!disp && i.types[op].bitfield.baseindex) + if (!op_disp && i.types[op].bitfield.baseindex) { i.types[op].bitfield.disp8 = 0; i.types[op].bitfield.disp16 = 0; @@ -3672,19 +3672,19 @@ optimize_disp (void) } else if (flag_code == CODE_64BIT) { - if (fits_in_signed_long (disp)) + if (fits_in_signed_long (op_disp)) { i.types[op].bitfield.disp64 = 0; i.types[op].bitfield.disp32s = 1; } if (i.prefix[ADDR_PREFIX] - && fits_in_unsigned_long (disp)) + && fits_in_unsigned_long (op_disp)) i.types[op].bitfield.disp32 = 1; } if ((i.types[op].bitfield.disp32 || i.types[op].bitfield.disp32s || i.types[op].bitfield.disp16) - && fits_in_signed_byte (disp)) + && fits_in_signed_byte (op_disp)) i.types[op].bitfield.disp8 = 1; } else if (i.reloc[op] == BFD_RELOC_386_TLS_DESC_CALL @@ -4683,13 +4683,14 @@ finalize_imm (void) static int bad_implicit_operand (int xmm) { - const char *reg = xmm ? "xmm0" : "ymm0"; + const char *ireg = xmm ? "xmm0" : "ymm0"; + if (intel_syntax) as_bad (_("the last operand of `%s' must be `%s%s'"), - i.tm.name, register_prefix, reg); + i.tm.name, register_prefix, ireg); else as_bad (_("the first operand of `%s' must be `%s%s'"), - i.tm.name, register_prefix, reg); + i.tm.name, register_prefix, ireg); return 0; } @@ -4705,13 +4706,13 @@ process_operands (void) && (i.tm.opcode_modifier.vexnds || i.tm.opcode_modifier.vexndd)) { - unsigned int dup = i.operands; - unsigned int dest = dup - 1; + unsigned int dupl = i.operands; + unsigned int dest = dupl - 1; unsigned int j; /* The destination must be an xmm register. */ gas_assert (i.reg_operands - && MAX_OPERANDS > dup + && MAX_OPERANDS > dupl && operand_type_equal (&i.types[dest], ®xmm)); if (i.tm.opcode_modifier.firstxmm0) @@ -4742,7 +4743,7 @@ process_operands (void) } else if (i.tm.opcode_modifier.implicit1stxmm0) { - gas_assert ((MAX_OPERANDS - 1) > dup + gas_assert ((MAX_OPERANDS - 1) > dupl && i.tm.opcode_modifier.vex3sources); /* Add the implicit xmm0 for instructions with VEX prefix @@ -4762,11 +4763,11 @@ process_operands (void) i.reg_operands += 2; i.tm.operands += 2; - dup++; + dupl++; dest++; - i.op[dup] = i.op[dest]; - i.types[dup] = i.types[dest]; - i.tm.operand_types[dup] = i.tm.operand_types[dest]; + i.op[dupl] = i.op[dest]; + i.types[dupl] = i.types[dest]; + i.tm.operand_types[dupl] = i.tm.operand_types[dest]; } else { @@ -4775,9 +4776,9 @@ duplicate: i.reg_operands++; i.tm.operands++; - i.op[dup] = i.op[dest]; - i.types[dup] = i.types[dest]; - i.tm.operand_types[dup] = i.tm.operand_types[dest]; + i.op[dupl] = i.op[dest]; + i.types[dupl] = i.types[dest]; + i.tm.operand_types[dupl] = i.tm.operand_types[dest]; } if (i.tm.opcode_modifier.immext) @@ -4929,7 +4930,7 @@ build_modrm_byte (void) vex_2_sources = i.tm.opcode_modifier.vex2sources; if (vex_3_sources) { - unsigned int nds, reg; + unsigned int nds, reg_slot; expressionS *exp; if (i.tm.opcode_modifier.veximmext @@ -4939,7 +4940,7 @@ build_modrm_byte (void) gas_assert (dest == 3); } else - dest = i.operands - 1; + dest = i.operands - 1; nds = dest - 1; /* This instruction must have 4 register operands @@ -4963,23 +4964,23 @@ build_modrm_byte (void) if (i.tm.opcode_modifier.vexw1) { source = 0; - reg = 1; + reg_slot = 1; } else { source = 1; - reg = 0; + reg_slot = 0; } - gas_assert ((operand_type_equal (&i.tm.operand_types[reg], ®xmm) - || operand_type_equal (&i.tm.operand_types[reg], + gas_assert ((operand_type_equal (&i.tm.operand_types[reg_slot], ®xmm) + || operand_type_equal (&i.tm.operand_types[reg_slot], ®ymm)) && (operand_type_equal (&i.tm.operand_types[nds], ®xmm) || operand_type_equal (&i.tm.operand_types[nds], ®ymm))); exp->X_op = O_constant; exp->X_add_number - = ((i.op[reg].regs->reg_num - + ((i.op[reg].regs->reg_flags & RegRex) ? 8 : 0)) << 4); + = ((i.op[reg_slot].regs->reg_num + + ((i.op[reg_slot].regs->reg_flags & RegRex) ? 8 : 0)) << 4); i.vex.register_specifier = i.op[nds].regs; } else @@ -6110,7 +6111,7 @@ x86_cons_fix_new (fragS *frag, unsigned int off, unsigned int len, is non-null set it to the length of the string we removed from the input line. Otherwise return NULL. */ static char * -lex_got (enum bfd_reloc_code_real *reloc, +lex_got (enum bfd_reloc_code_real *rel, int *adjust, i386_operand_type *types) { @@ -6199,7 +6200,7 @@ lex_got (enum bfd_reloc_code_real *reloc, int first, second; char *tmpbuf, *past_reloc; - *reloc = gotrel[j].rel[object_64bit]; + *rel = gotrel[j].rel[object_64bit]; if (adjust) *adjust = len; @@ -7877,7 +7878,7 @@ size_t md_longopts_size = sizeof (md_longopts); int md_parse_option (int c, char *arg) { - unsigned int i; + unsigned int j; char *arch, *next; switch (c) @@ -7963,16 +7964,16 @@ md_parse_option (int c, char *arg) next = strchr (arch, '+'); if (next) *next++ = '\0'; - for (i = 0; i < ARRAY_SIZE (cpu_arch); i++) + for (j = 0; j < ARRAY_SIZE (cpu_arch); j++) { - if (strcmp (arch, cpu_arch [i].name) == 0) + if (strcmp (arch, cpu_arch [j].name) == 0) { /* Processor. */ - cpu_arch_name = cpu_arch[i].name; + cpu_arch_name = cpu_arch[j].name; cpu_sub_arch_name = NULL; - cpu_arch_flags = cpu_arch[i].flags; - cpu_arch_isa = cpu_arch[i].type; - cpu_arch_isa_flags = cpu_arch[i].flags; + cpu_arch_flags = cpu_arch[j].flags; + cpu_arch_isa = cpu_arch[j].type; + cpu_arch_isa_flags = cpu_arch[j].flags; if (!cpu_arch_tune_set) { cpu_arch_tune = cpu_arch_isa; @@ -7980,37 +7981,37 @@ md_parse_option (int c, char *arg) } break; } - else if (*cpu_arch [i].name == '.' - && strcmp (arch, cpu_arch [i].name + 1) == 0) + else if (*cpu_arch [j].name == '.' + && strcmp (arch, cpu_arch [j].name + 1) == 0) { /* ISA entension. */ i386_cpu_flags flags; if (strncmp (arch, "no", 2)) flags = cpu_flags_or (cpu_arch_flags, - cpu_arch[i].flags); + cpu_arch[j].flags); else flags = cpu_flags_and_not (cpu_arch_flags, - cpu_arch[i].flags); + cpu_arch[j].flags); if (!cpu_flags_equal (&flags, &cpu_arch_flags)) { if (cpu_sub_arch_name) { char *name = cpu_sub_arch_name; cpu_sub_arch_name = concat (name, - cpu_arch[i].name, + cpu_arch[j].name, (const char *) NULL); free (name); } else - cpu_sub_arch_name = xstrdup (cpu_arch[i].name); + cpu_sub_arch_name = xstrdup (cpu_arch[j].name); cpu_arch_flags = flags; } break; } } - if (i >= ARRAY_SIZE (cpu_arch)) + if (j >= ARRAY_SIZE (cpu_arch)) as_fatal (_("Invalid -march= option: `%s'"), arg); arch = next; @@ -8021,17 +8022,17 @@ md_parse_option (int c, char *arg) case OPTION_MTUNE: if (*arg == '.') as_fatal (_("Invalid -mtune= option: `%s'"), arg); - for (i = 0; i < ARRAY_SIZE (cpu_arch); i++) + for (j = 0; j < ARRAY_SIZE (cpu_arch); j++) { - if (strcmp (arg, cpu_arch [i].name) == 0) + if (strcmp (arg, cpu_arch [j].name) == 0) { cpu_arch_tune_set = 1; - cpu_arch_tune = cpu_arch [i].type; - cpu_arch_tune_flags = cpu_arch[i].flags; + cpu_arch_tune = cpu_arch [j].type; + cpu_arch_tune_flags = cpu_arch[j].flags; break; } } - if (i >= ARRAY_SIZE (cpu_arch)) + if (j >= ARRAY_SIZE (cpu_arch)) as_fatal (_("Invalid -mtune= option: `%s'"), arg); break; @@ -8713,12 +8714,12 @@ i386_solaris_fix_up_eh_frame (segT sec) void tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size) { - expressionS expr; + expressionS exp; - expr.X_op = O_secrel; - expr.X_add_symbol = symbol; - expr.X_add_number = 0; - emit_expr (&expr, size); + exp.X_op = O_secrel; + exp.X_add_symbol = symbol; + exp.X_add_number = 0; + emit_expr (&exp, size); } #endif diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index e3369df0a..dcaa41617 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -2547,7 +2547,7 @@ slot_index (unsigned long slot_addr, fragS *first_frag, int before_relax) { - unsigned long index = 0; + unsigned long s_index = 0; /* First time we are called, the initial address and frag are invalid. */ if (first_addr == 0) @@ -2565,7 +2565,7 @@ slot_index (unsigned long slot_addr, /* We can get the final addresses only during and after relaxation. */ if (first_frag->fr_next && first_frag->fr_next->fr_address) - index += 3 * ((first_frag->fr_next->fr_address + s_index += 3 * ((first_frag->fr_next->fr_address - first_frag->fr_address - first_frag->fr_fix) >> 4); } @@ -2586,7 +2586,7 @@ slot_index (unsigned long slot_addr, case rs_align_test: /* Take alignment into account. Assume the worst case before relaxation. */ - index += 3 * ((1 << first_frag->fr_offset) >> 4); + s_index += 3 * ((1 << first_frag->fr_offset) >> 4); break; case rs_org: @@ -2596,14 +2596,14 @@ slot_index (unsigned long slot_addr, break; } case rs_fill: - index += 3 * (first_frag->fr_offset >> 4); + s_index += 3 * (first_frag->fr_offset >> 4); break; } /* Add in the full size of the frag converted to instruction slots. */ - index += 3 * (first_frag->fr_fix >> 4); + s_index += 3 * (first_frag->fr_fix >> 4); /* Subtract away the initial part before first_addr. */ - index -= (3 * ((first_addr >> 4) - (start_addr >> 4)) + s_index -= (3 * ((first_addr >> 4) - (start_addr >> 4)) + ((first_addr & 0x3) - (start_addr & 0x3))); /* Move to the beginning of the next frag. */ @@ -2619,9 +2619,9 @@ slot_index (unsigned long slot_addr, } /* Add in the used part of the last frag. */ - index += (3 * ((slot_addr >> 4) - (first_addr >> 4)) + s_index += (3 * ((slot_addr >> 4) - (first_addr >> 4)) + ((slot_addr & 0x3) - (first_addr & 0x3))); - return index; + return s_index; } /* Optimize unwind record directives. */ @@ -4646,7 +4646,7 @@ dot_ln (int dummy ATTRIBUTE_UNUSED) } static void -cross_section (int ref, void (*cons) (int), int ua) +cross_section (int ref, void (*builder) (int), int ua) { char *start, *end; int saved_auto_align; @@ -4691,15 +4691,15 @@ cross_section (int ref, void (*cons) (int), int ua) end = input_line_pointer + 1; /* skip comma */ input_line_pointer = start; md.keep_pending_output = 1; - section_count = bfd_count_sections(stdoutput); + section_count = bfd_count_sections (stdoutput); obj_elf_section (0); - if (section_count != bfd_count_sections(stdoutput)) + if (section_count != bfd_count_sections (stdoutput)) as_warn (_("Creating sections with .xdataN/.xrealN/.xstringZ is deprecated.")); input_line_pointer = end; saved_auto_align = md.auto_align; if (ua) md.auto_align = 0; - (*cons) (ref); + (*builder) (ref); if (ua) md.auto_align = saved_auto_align; obj_elf_previous (0); @@ -5305,9 +5305,9 @@ operand_width (enum ia64_opnd opnd) } static enum operand_match_result -operand_match (const struct ia64_opcode *idesc, int index, expressionS *e) +operand_match (const struct ia64_opcode *idesc, int res_index, expressionS *e) { - enum ia64_opnd opnd = idesc->operands[index]; + enum ia64_opnd opnd = idesc->operands[res_index]; int bits, relocatable = 0; struct insn_fix *fix; bfd_signed_vma val; @@ -5477,7 +5477,7 @@ operand_match (const struct ia64_opcode *idesc, int index, expressionS *e) case IA64_OPND_CNT2a: case IA64_OPND_LEN4: case IA64_OPND_LEN6: - bits = operand_width (idesc->operands[index]); + bits = operand_width (idesc->operands[res_index]); if (e->X_op == O_constant) { if ((bfd_vma) (e->X_add_number - 1) < ((bfd_vma) 1 << bits)) @@ -5551,7 +5551,7 @@ operand_match (const struct ia64_opcode *idesc, int index, expressionS *e) e->X_op = O_symbol; } - fix->opnd = idesc->operands[index]; + fix->opnd = idesc->operands[res_index]; fix->expr = *e; fix->is_pcrel = 0; ++CURR_SLOT.num_fixups; @@ -5586,7 +5586,7 @@ operand_match (const struct ia64_opcode *idesc, int index, expressionS *e) case IA64_OPND_MBTYPE4: case IA64_OPND_MHTYPE8: case IA64_OPND_POS6: - bits = operand_width (idesc->operands[index]); + bits = operand_width (idesc->operands[res_index]); if (e->X_op == O_constant) { if ((bfd_vma) e->X_add_number < ((bfd_vma) 1 << bits)) @@ -5597,7 +5597,7 @@ operand_match (const struct ia64_opcode *idesc, int index, expressionS *e) break; case IA64_OPND_IMMU9: - bits = operand_width (idesc->operands[index]); + bits = operand_width (idesc->operands[res_index]); if (e->X_op == O_constant) { if ((bfd_vma) e->X_add_number < ((bfd_vma) 1 << bits)) @@ -5673,14 +5673,14 @@ operand_match (const struct ia64_opcode *idesc, int index, expressionS *e) case IA64_OPND_IMM8M1U8: case IA64_OPND_IMM9a: case IA64_OPND_IMM9b: - bits = operand_width (idesc->operands[index]); + bits = operand_width (idesc->operands[res_index]); if (relocatable && (e->X_op == O_symbol || e->X_op == O_subtract || e->X_op == O_pseudo_fixup)) { fix = CURR_SLOT.fixup + CURR_SLOT.num_fixups; - if (idesc->operands[index] == IA64_OPND_IMM14) + if (idesc->operands[res_index] == IA64_OPND_IMM14) fix->code = BFD_RELOC_IA64_IMM14; else fix->code = BFD_RELOC_IA64_IMM22; @@ -5692,7 +5692,7 @@ operand_match (const struct ia64_opcode *idesc, int index, expressionS *e) e->X_op = O_symbol; } - fix->opnd = idesc->operands[index]; + fix->opnd = idesc->operands[res_index]; fix->expr = *e; fix->is_pcrel = 0; ++CURR_SLOT.num_fixups; @@ -5798,7 +5798,7 @@ operand_match (const struct ia64_opcode *idesc, int index, expressionS *e) abort (); fix->code = ia64_gen_real_reloc_type (e->X_op_symbol, fix->code); - fix->opnd = idesc->operands[index]; + fix->opnd = idesc->operands[res_index]; fix->expr = *e; fix->is_pcrel = 1; ++CURR_SLOT.num_fixups; @@ -5817,7 +5817,7 @@ operand_match (const struct ia64_opcode *idesc, int index, expressionS *e) create a dummy reloc. This will not live past md_apply_fix. */ fix->code = BFD_RELOC_UNUSED; fix->code = ia64_gen_real_reloc_type (e->X_op_symbol, fix->code); - fix->opnd = idesc->operands[index]; + fix->opnd = idesc->operands[res_index]; fix->expr = *e; fix->is_pcrel = 1; ++CURR_SLOT.num_fixups; @@ -5831,7 +5831,7 @@ operand_match (const struct ia64_opcode *idesc, int index, expressionS *e) case IA64_OPND_LDXMOV: fix = CURR_SLOT.fixup + CURR_SLOT.num_fixups; fix->code = BFD_RELOC_IA64_LDXMOV; - fix->opnd = idesc->operands[index]; + fix->opnd = idesc->operands[res_index]; fix->expr = *e; fix->is_pcrel = 0; ++CURR_SLOT.num_fixups; @@ -8361,9 +8361,9 @@ dep->name, idesc->name, (rsrc_write?"write":"read"), note) || (!rsrc_write && idesc->operands[1] == IA64_OPND_PMD_R3)) { - int index = ((idesc->operands[1] == IA64_OPND_R3 && !rsrc_write) - ? 1 : !rsrc_write); - int regno = CURR_SLOT.opnd[index].X_add_number - REG_GR; + int reg_index = ((idesc->operands[1] == IA64_OPND_R3 && !rsrc_write) + ? 1 : !rsrc_write); + int regno = CURR_SLOT.opnd[reg_index].X_add_number - REG_GR; if (regno >= 0 && regno < NELEMS (gr_values) && KNOWN (regno)) { @@ -8901,11 +8901,11 @@ dep->name, idesc->name, (rsrc_write?"write":"read"), note) if (idesc->operands[0] == IA64_OPND_CR3 || idesc->operands[1] == IA64_OPND_CR3) { - int index = + int reg_index = ((idesc->operands[0] == IA64_OPND_CR3) ? 0 : 1); int regno = - CURR_SLOT.opnd[index].X_add_number - REG_CR; + CURR_SLOT.opnd[reg_index].X_add_number - REG_CR; switch (regno) { @@ -8939,15 +8939,15 @@ dep->name, idesc->name, (rsrc_write?"write":"read"), note) if (idesc->operands[0] == IA64_OPND_AR3 || idesc->operands[1] == IA64_OPND_AR3) { - int index = + int reg_index = ((idesc->operands[0] == IA64_OPND_AR3) ? 0 : 1); int regno = - CURR_SLOT.opnd[index].X_add_number - REG_AR; + CURR_SLOT.opnd[reg_index].X_add_number - REG_AR; if (regno == AR_ITC || regno == AR_RUC - || (index == 0 + || (reg_index == 0 && (regno == AR_RSC || (regno >= AR_K0 && regno <= AR_K7)))) @@ -10799,13 +10799,13 @@ ia64_pcrel_from_section (fixS *fix, segT sec) void ia64_dwarf2_emit_offset (symbolS *symbol, unsigned int size) { - expressionS expr; + expressionS exp; - expr.X_op = O_pseudo_fixup; - expr.X_op_symbol = pseudo_func[FUNC_SEC_RELATIVE].u.sym; - expr.X_add_number = 0; - expr.X_add_symbol = symbol; - emit_expr (&expr, size); + exp.X_op = O_pseudo_fixup; + exp.X_op_symbol = pseudo_func[FUNC_SEC_RELATIVE].u.sym; + exp.X_add_number = 0; + exp.X_add_symbol = symbol; + emit_expr (&exp, size); } /* This is called whenever some data item (not an instruction) needs a @@ -11403,13 +11403,13 @@ ia64_handle_align (fragS *fragp) { int bytes; char *p; - const unsigned char *nop; + const unsigned char *nop_type; if (fragp->fr_type != rs_align_code) return; /* Check if this frag has to end with a stop bit. */ - nop = fragp->tc_frag_data ? le_nop_stop : le_nop; + nop_type = fragp->tc_frag_data ? le_nop_stop : le_nop; bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix; p = fragp->fr_literal + fragp->fr_fix; @@ -11446,7 +11446,7 @@ ia64_handle_align (fragS *fragp) } /* Instruction bundles are always little-endian. */ - memcpy (p, nop, 16); + memcpy (p, nop_type, 16); fragp->fr_var = 16; } diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c index 044044876..dcde23126 100644 --- a/gas/config/tc-m32r.c +++ b/gas/config/tc-m32r.c @@ -570,7 +570,7 @@ debug_sym (int ignore ATTRIBUTE_UNUSED) char delim; char *end_name; symbolS *symbolP; - sym_linkS *link; + sym_linkS *lnk; name = input_line_pointer; delim = get_symbol_end (); @@ -589,10 +589,10 @@ debug_sym (int ignore ATTRIBUTE_UNUSED) else { - link = (sym_linkS *) xmalloc (sizeof (sym_linkS)); - link->symbol = symbolP; - link->next = debug_sym_link; - debug_sym_link = link; + lnk = (sym_linkS *) xmalloc (sizeof (sym_linkS)); + lnk->symbol = symbolP; + lnk->next = debug_sym_link; + debug_sym_link = lnk; symbol_get_obj (symbolP)->local = 1; } diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c index 81913ead8..5cae36ff3 100644 --- a/gas/config/tc-m68hc11.c +++ b/gas/config/tc-m68hc11.c @@ -1612,7 +1612,7 @@ build_jump_insn (struct m68hc11_opcode *opcode, operand operands[], } else { - char *opcode; + char *op; frag = frag_now; where = frag_now_fix (); @@ -1623,8 +1623,8 @@ build_jump_insn (struct m68hc11_opcode *opcode, operand operands[], /* Branch offset must fit in 8-bits, don't do some relax. */ if (jmp_mode == 0 && flag_fixed_branches) { - opcode = m68hc11_new_insn (1); - number_to_chars_bigendian (opcode, code, 1); + op = m68hc11_new_insn (1); + number_to_chars_bigendian (op, code, 1); fixup8 (&operands[0].exp, M6811_OP_JUMP_REL, M6811_OP_JUMP_REL); } @@ -1632,31 +1632,31 @@ build_jump_insn (struct m68hc11_opcode *opcode, operand operands[], else if (code == M6811_BSR || code == M6811_BRA || code == M6812_BSR) { /* Allocate worst case storage. */ - opcode = m68hc11_new_insn (3); - number_to_chars_bigendian (opcode, code, 1); - number_to_chars_bigendian (opcode + 1, 0, 1); + op = m68hc11_new_insn (3); + number_to_chars_bigendian (op, code, 1); + number_to_chars_bigendian (op + 1, 0, 1); frag_variant (rs_machine_dependent, 1, 1, ENCODE_RELAX (STATE_PC_RELATIVE, STATE_UNDF), operands[0].exp.X_add_symbol, (offsetT) n, - opcode); + op); } else if (current_architecture & cpu6812) { - opcode = m68hc11_new_insn (2); - number_to_chars_bigendian (opcode, code, 1); - number_to_chars_bigendian (opcode + 1, 0, 1); + op = m68hc11_new_insn (2); + number_to_chars_bigendian (op, code, 1); + number_to_chars_bigendian (op + 1, 0, 1); frag_var (rs_machine_dependent, 2, 2, ENCODE_RELAX (STATE_CONDITIONAL_BRANCH_6812, STATE_UNDF), - operands[0].exp.X_add_symbol, (offsetT) n, opcode); + operands[0].exp.X_add_symbol, (offsetT) n, op); } else { - opcode = m68hc11_new_insn (2); - number_to_chars_bigendian (opcode, code, 1); - number_to_chars_bigendian (opcode + 1, 0, 1); + op = m68hc11_new_insn (2); + number_to_chars_bigendian (op, code, 1); + number_to_chars_bigendian (op + 1, 0, 1); frag_var (rs_machine_dependent, 3, 3, ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_UNDF), - operands[0].exp.X_add_symbol, (offsetT) n, opcode); + operands[0].exp.X_add_symbol, (offsetT) n, op); } } } diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 1c9648022..ff2ffc6f9 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -2612,10 +2612,10 @@ insns_between (const struct mips_cl_insn *insn1, /* Return the number of nops that would be needed to work around the VR4130 mflo/mfhi errata if instruction INSN immediately followed - the MAX_VR4130_NOPS instructions described by HISTORY. */ + the MAX_VR4130_NOPS instructions described by HIST. */ static int -nops_for_vr4130 (const struct mips_cl_insn *history, +nops_for_vr4130 (const struct mips_cl_insn *hist, const struct mips_cl_insn *insn) { int i, j, reg; @@ -2630,13 +2630,13 @@ nops_for_vr4130 (const struct mips_cl_insn *history, /* Search for the first MFLO or MFHI. */ for (i = 0; i < MAX_VR4130_NOPS; i++) - if (MF_HILO_INSN (history[i].insn_mo->pinfo)) + if (MF_HILO_INSN (hist[i].insn_mo->pinfo)) { /* Extract the destination register. */ if (mips_opts.mips16) - reg = mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RX, history[i])]; + reg = mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RX, hist[i])]; else - reg = EXTRACT_OPERAND (RD, history[i]); + reg = EXTRACT_OPERAND (RD, hist[i]); /* No nops are needed if INSN reads that register. */ if (insn != NULL && insn_uses_reg (insn, reg, MIPS_GR_REG)) @@ -2644,7 +2644,7 @@ nops_for_vr4130 (const struct mips_cl_insn *history, /* ...or if any of the intervening instructions do. */ for (j = 0; j < i; j++) - if (insn_uses_reg (&history[j], reg, MIPS_GR_REG)) + if (insn_uses_reg (&hist[j], reg, MIPS_GR_REG)) return 0; return MAX_VR4130_NOPS - i; @@ -2653,12 +2653,12 @@ nops_for_vr4130 (const struct mips_cl_insn *history, } /* Return the number of nops that would be needed if instruction INSN - immediately followed the MAX_NOPS instructions given by HISTORY, - where HISTORY[0] is the most recent instruction. If INSN is null, + immediately followed the MAX_NOPS instructions given by HIST, + where HIST[0] is the most recent instruction. If INSN is null, return the worse-case number of nops for any instruction. */ static int -nops_for_insn (const struct mips_cl_insn *history, +nops_for_insn (const struct mips_cl_insn *hist, const struct mips_cl_insn *insn) { int i, nops, tmp_nops; @@ -2666,14 +2666,14 @@ nops_for_insn (const struct mips_cl_insn *history, nops = 0; for (i = 0; i < MAX_DELAY_NOPS; i++) { - tmp_nops = insns_between (history + i, insn) - i; + tmp_nops = insns_between (hist + i, insn) - i; if (tmp_nops > nops) nops = tmp_nops; } if (mips_fix_vr4130) { - tmp_nops = nops_for_vr4130 (history, insn); + tmp_nops = nops_for_vr4130 (hist, insn); if (tmp_nops > nops) nops = tmp_nops; } @@ -2682,20 +2682,20 @@ nops_for_insn (const struct mips_cl_insn *history, } /* The variable arguments provide NUM_INSNS extra instructions that - might be added to HISTORY. Return the largest number of nops that + might be added to HIST. Return the largest number of nops that would be needed after the extended sequence. */ static int -nops_for_sequence (int num_insns, const struct mips_cl_insn *history, ...) +nops_for_sequence (int num_insns, const struct mips_cl_insn *hist, ...) { va_list args; struct mips_cl_insn buffer[MAX_NOPS]; struct mips_cl_insn *cursor; int nops; - va_start (args, history); + va_start (args, hist); cursor = buffer + num_insns; - memcpy (cursor, history, (MAX_NOPS - num_insns) * sizeof (*cursor)); + memcpy (cursor, hist, (MAX_NOPS - num_insns) * sizeof (*cursor)); while (cursor > buffer) *--cursor = *va_arg (args, const struct mips_cl_insn *); @@ -2708,23 +2708,23 @@ nops_for_sequence (int num_insns, const struct mips_cl_insn *history, ...) worst-case delay for the branch target. */ static int -nops_for_insn_or_target (const struct mips_cl_insn *history, +nops_for_insn_or_target (const struct mips_cl_insn *hist, const struct mips_cl_insn *insn) { int nops, tmp_nops; - nops = nops_for_insn (history, insn); + nops = nops_for_insn (hist, insn); if (insn->insn_mo->pinfo & (INSN_UNCOND_BRANCH_DELAY | INSN_COND_BRANCH_DELAY | INSN_COND_BRANCH_LIKELY)) { - tmp_nops = nops_for_sequence (2, history, insn, NOP_INSN); + tmp_nops = nops_for_sequence (2, hist, insn, NOP_INSN); if (tmp_nops > nops) nops = tmp_nops; } else if (mips_opts.mips16 && (insn->insn_mo->pinfo & MIPS16_INSN_BRANCH)) { - tmp_nops = nops_for_sequence (1, history, insn); + tmp_nops = nops_for_sequence (1, hist, insn); if (tmp_nops > nops) nops = tmp_nops; } @@ -5754,8 +5754,6 @@ macro (struct mips_cl_insn *ip) } else if (IS_SEXT_32BIT_NUM (expr1.X_add_number + 0x8000)) { - int dreg; - /* If we are going to add in a base register, and the target register and the base register are the same, then we are using AT as a temporary register. Since @@ -5895,8 +5893,6 @@ macro (struct mips_cl_insn *ip) } else { - int dreg; - /* If we are going to add in a base register, and the target register and the base register are the same, then we are using AT as a temporary register. Since @@ -6034,8 +6030,6 @@ macro (struct mips_cl_insn *ip) } else if (IS_SEXT_32BIT_NUM (expr1.X_add_number + 0x8000)) { - int dreg; - /* If we are going to add in a base register, and the target register and the base register are the same, then we are using AT as a temporary register. Since @@ -7550,7 +7544,8 @@ macro2 (struct mips_cl_insn *ip) case M_DROL_I: { unsigned int rot; - char *l, *r; + char *l; + char *rr; if (imm_expr.X_op != O_constant) as_bad (_("Improper rotate count")); @@ -7570,11 +7565,11 @@ macro2 (struct mips_cl_insn *ip) break; } l = (rot < 0x20) ? "dsll" : "dsll32"; - r = ((0x40 - rot) < 0x20) ? "dsrl" : "dsrl32"; + rr = ((0x40 - rot) < 0x20) ? "dsrl" : "dsrl32"; rot &= 0x1f; used_at = 1; macro_build (NULL, l, "d,w,<", AT, sreg, rot); - macro_build (NULL, r, "d,w,<", dreg, sreg, (0x20 - rot) & 0x1f); + macro_build (NULL, rr, "d,w,<", dreg, sreg, (0x20 - rot) & 0x1f); macro_build (NULL, "or", "d,v,t", dreg, dreg, AT); } break; @@ -7632,7 +7627,8 @@ macro2 (struct mips_cl_insn *ip) case M_DROR_I: { unsigned int rot; - char *l, *r; + char *l; + char *rr; if (imm_expr.X_op != O_constant) as_bad (_("Improper rotate count")); @@ -7650,11 +7646,11 @@ macro2 (struct mips_cl_insn *ip) macro_build (NULL, "dsrl", "d,w,<", dreg, sreg, 0); break; } - r = (rot < 0x20) ? "dsrl" : "dsrl32"; + rr = (rot < 0x20) ? "dsrl" : "dsrl32"; l = ((0x40 - rot) < 0x20) ? "dsll" : "dsll32"; rot &= 0x1f; used_at = 1; - macro_build (NULL, r, "d,w,<", AT, sreg, rot); + macro_build (NULL, rr, "d,w,<", AT, sreg, rot); macro_build (NULL, l, "d,w,<", dreg, sreg, (0x20 - rot) & 0x1f); macro_build (NULL, "or", "d,v,t", dreg, dreg, AT); } @@ -10601,7 +10597,7 @@ mips16_ip (char *str, struct mips_cl_insn *ip) { int opcode = 0; int framesz = 0, seen_framesz = 0; - int args = 0, statics = 0, sregs = 0; + int nargs = 0, statics = 0, sregs = 0; while (*s != '\0') { @@ -10656,7 +10652,7 @@ mips16_ip (char *str, struct mips_cl_insn *ip) { if (!seen_framesz) /* args $a0-$a3 */ - args |= 1 << (reg1 - 4); + nargs |= 1 << (reg1 - 4); else /* statics $a0-$a3 */ statics |= 1 << (reg1 - 4); @@ -10682,9 +10678,9 @@ mips16_ip (char *str, struct mips_cl_insn *ip) } /* Encode args/statics combination. */ - if (args & statics) + if (nargs & statics) as_bad (_("arg/static registers overlap")); - else if (args == 0xf) + else if (nargs == 0xf) /* All $a0-$a3 are args. */ opcode |= MIPS16_ALL_ARGS << 16; else if (statics == 0xf) @@ -10695,12 +10691,12 @@ mips16_ip (char *str, struct mips_cl_insn *ip) int narg = 0, nstat = 0; /* Count arg registers. */ - while (args & 0x1) + while (nargs & 0x1) { - args >>= 1; + nargs >>= 1; narg++; } - if (args != 0) + if (nargs != 0) as_bad (_("invalid arg register list")); /* Count static registers. */ diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index 4f7cccb51..f9bf78b84 100644 --- a/gas/config/tc-mn10200.c +++ b/gas/config/tc-mn10200.c @@ -1241,12 +1241,12 @@ keep_going: for (i = 0; i < fc; i++) { const struct mn10200_operand *operand; + int reloc_size; operand = &mn10200_operands[fixups[i].opindex]; if (fixups[i].reloc != BFD_RELOC_UNUSED) { reloc_howto_type *reloc_howto; - int size; int offset; fixS *fixP; @@ -1256,14 +1256,14 @@ keep_going: if (!reloc_howto) abort (); - size = bfd_get_reloc_size (reloc_howto); + reloc_size = bfd_get_reloc_size (reloc_howto); - if (size < 1 || size > 4) + if (reloc_size < 1 || reloc_size > 4) abort (); - offset = 4 - size; + offset = 4 - reloc_size; fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, - size, + reloc_size, &fixups[i].exp, reloc_howto->pc_relative, fixups[i].reloc); @@ -1272,11 +1272,11 @@ keep_going: next instruction, not from the start of the current instruction. */ if (reloc_howto->pc_relative) - fixP->fx_offset += size; + fixP->fx_offset += reloc_size; } else { - int reloc, pcrel, reloc_size, offset; + int reloc, pcrel, offset; fixS *fixP; reloc = BFD_RELOC_NONE; diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index 9ac44ad5a..1ddb110b3 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -1772,8 +1772,6 @@ keep_going: that they do indeed not match. */ if (opcode->no_match_operands) { - int i; - /* Look at each operand to see if it's marked. */ for (i = 0; i < MN10300_MAX_OPERANDS; i++) { @@ -2056,6 +2054,7 @@ keep_going: for (i = 0; i < fc; i++) { const struct mn10300_operand *operand; + int reloc_size; operand = &mn10300_operands[fixups[i].opindex]; if (fixups[i].reloc != BFD_RELOC_UNUSED @@ -2065,7 +2064,6 @@ keep_going: && fixups[i].reloc != BFD_RELOC_MN10300_GOT32) { reloc_howto_type *reloc_howto; - int size; int offset; fixS *fixP; @@ -2075,20 +2073,20 @@ keep_going: if (!reloc_howto) abort (); - size = bfd_get_reloc_size (reloc_howto); + reloc_size = bfd_get_reloc_size (reloc_howto); - if (size < 1 || size > 4) + if (reloc_size < 1 || reloc_size > 4) abort (); offset = 4 - size; fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, - size, &fixups[i].exp, + reloc_size, &fixups[i].exp, reloc_howto->pc_relative, fixups[i].reloc); } else { - int reloc, pcrel, reloc_size, offset; + int reloc, pcrel, offset; fixS *fixP; reloc = BFD_RELOC_NONE; diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c index 20f6cd034..aaebde434 100644 --- a/gas/config/tc-ns32k.c +++ b/gas/config/tc-ns32k.c @@ -375,7 +375,7 @@ char disp_size[] = static int addr_mode (char *operand, - addr_modeS *addr_modeP, + addr_modeS *addrmodeP, int recursive_level) { char *str; @@ -385,16 +385,16 @@ addr_mode (char *operand, int j; mode = DEFAULT; /* Default. */ - addr_modeP->scaled_mode = 0; /* Why not. */ - addr_modeP->scaled_reg = 0; /* If 0, not scaled index. */ - addr_modeP->float_flag = 0; - addr_modeP->am_size = 0; - addr_modeP->im_disp = 0; - addr_modeP->pcrel = 0; /* Not set in this function. */ - addr_modeP->disp_suffix[0] = 0; - addr_modeP->disp_suffix[1] = 0; - addr_modeP->disp[0] = NULL; - addr_modeP->disp[1] = NULL; + addrmodeP->scaled_mode = 0; /* Why not. */ + addrmodeP->scaled_reg = 0; /* If 0, not scaled index. */ + addrmodeP->float_flag = 0; + addrmodeP->am_size = 0; + addrmodeP->im_disp = 0; + addrmodeP->pcrel = 0; /* Not set in this function. */ + addrmodeP->disp_suffix[0] = 0; + addrmodeP->disp_suffix[1] = 0; + addrmodeP->disp[0] = NULL; + addrmodeP->disp[1] = NULL; str = operand; if (str[0] == 0) @@ -410,16 +410,16 @@ addr_mode (char *operand, case ABSOLUTE_PREFIX: if (str[strl - 1] == ']') break; - addr_modeP->mode = 21; /* absolute */ - addr_modeP->disp[0] = str + 1; + addrmodeP->mode = 21; /* absolute */ + addrmodeP->disp[0] = str + 1; return -1; #endif #ifdef IMMEDIATE_PREFIX case IMMEDIATE_PREFIX: if (str[strl - 1] == ']') break; - addr_modeP->mode = 20; /* immediate */ - addr_modeP->disp[0] = str + 1; + addrmodeP->mode = 20; /* immediate */ + addrmodeP->disp[0] = str + 1; return -1; #endif case '.': @@ -431,8 +431,8 @@ addr_mode (char *operand, case '+': if (str[2] != '\000') { - addr_modeP->mode = 27; /* pc-relative */ - addr_modeP->disp[0] = str + 2; + addrmodeP->mode = 27; /* pc-relative */ + addrmodeP->disp[0] = str + 2; return -1; } default: @@ -446,7 +446,7 @@ addr_mode (char *operand, { if ((!strncmp (str, "ext(", 4)) && strl > 7) { /* external */ - addr_modeP->disp[0] = str + 4; + addrmodeP->disp[0] = str + 4; i = 0; j = 2; do @@ -464,8 +464,8 @@ addr_mode (char *operand, return (0); } str[j] = '\000'; /* null terminate disp[0] */ - addr_modeP->disp[1] = str + j + 2; - addr_modeP->mode = 22; + addrmodeP->disp[1] = str + j + 2; + addrmodeP->mode = 22; return -1; } } @@ -483,12 +483,12 @@ addr_mode (char *operand, switch (str[0]) { case 'f': - addr_modeP->float_flag = 1; + addrmodeP->float_flag = 1; /* Drop through. */ case 'r': if (str[1] >= '0' && str[1] < '8') { - addr_modeP->mode = str[1] - '0'; + addrmodeP->mode = str[1] - '0'; return -1; } break; @@ -500,7 +500,7 @@ addr_mode (char *operand, case 3: if (!strncmp (str, "tos", 3)) { - addr_modeP->mode = 23; /* TopOfStack */ + addrmodeP->mode = 23; /* TopOfStack */ return -1; } break; @@ -525,7 +525,7 @@ addr_mode (char *operand, if (mode != DEFAULT) { /* Memory relative. */ - addr_modeP->mode = mode; + addrmodeP->mode = mode; j = strl - 5; /* Temp for end of disp[0]. */ i = 0; @@ -545,8 +545,8 @@ addr_mode (char *operand, return (0); } - addr_modeP->disp[1] = str; - addr_modeP->disp[0] = str + strl + 1; + addrmodeP->disp[1] = str; + addrmodeP->disp[0] = str + strl + 1; str[j] = '\000'; /* Null terminate disp[0] . */ str[strl] = '\000'; /* Null terminate disp[1]. */ @@ -562,8 +562,8 @@ addr_mode (char *operand, && str[strl - 2] < '8' && str[strl - 4] == '(') { - addr_modeP->mode = str[strl - 2] - '0' + 8; - addr_modeP->disp[0] = str; + addrmodeP->mode = str[strl - 2] - '0' + 8; + addrmodeP->disp[0] = str; str[strl - 4] = 0; return -1; /* reg rel */ } @@ -581,8 +581,8 @@ addr_mode (char *operand, if (mode != DEFAULT) { - addr_modeP->mode = mode; - addr_modeP->disp[0] = str; + addrmodeP->mode = mode; + addrmodeP->disp[0] = str; str[strl - 4] = '\0'; return -1; /* Memory space. */ @@ -622,27 +622,27 @@ addr_mode (char *operand, return 0; } - addr_modeP->am_size += 1; /* scaled index byte. */ + addrmodeP->am_size += 1; /* scaled index byte. */ j = str[strl - 4] - '0'; /* store temporary. */ str[strl - 6] = '\000'; /* nullterminate for recursive call. */ - i = addr_mode (str, addr_modeP, 1); + i = addr_mode (str, addrmodeP, 1); - if (!i || addr_modeP->mode == 20) + if (!i || addrmodeP->mode == 20) { as_bad (_("Invalid or illegal addressing mode combined with scaled-index")); return 0; } - addr_modeP->scaled_mode = addr_modeP->mode; /* Store the inferior mode. */ - addr_modeP->mode = mode; - addr_modeP->scaled_reg = j + 1; + addrmodeP->scaled_mode = addrmodeP->mode; /* Store the inferior mode. */ + addrmodeP->mode = mode; + addrmodeP->scaled_reg = j + 1; return -1; } } - addr_modeP->mode = DEFAULT; /* Default to whatever. */ - addr_modeP->disp[0] = str; + addrmodeP->mode = DEFAULT; /* Default to whatever. */ + addrmodeP->disp[0] = str; return -1; } @@ -665,13 +665,13 @@ evaluate_expr (expressionS *resultP, char *ptr) ns32k-opcode. Also builds index bytes if needed. */ static int -get_addr_mode (char *ptr, addr_modeS *addr_modeP) +get_addr_mode (char *ptr, addr_modeS *addrmodeP) { int tmp; - addr_mode (ptr, addr_modeP, 0); + addr_mode (ptr, addrmodeP, 0); - if (addr_modeP->mode == DEFAULT || addr_modeP->scaled_mode == -1) + if (addrmodeP->mode == DEFAULT || addrmodeP->scaled_mode == -1) { /* Resolve ambiguous operands, this shouldn't be necessary if one uses standard NSC operand syntax. But the sequent @@ -679,19 +679,19 @@ get_addr_mode (char *ptr, addr_modeS *addr_modeP) if it is implicitly stated. See ns32k-opcode.h. */ (void) evaluate_expr (&exprP, ptr); /* This call takes time Sigh! */ - if (addr_modeP->mode == DEFAULT) + if (addrmodeP->mode == DEFAULT) { if (exprP.X_add_symbol || exprP.X_op_symbol) - addr_modeP->mode = desc->default_model; /* We have a label. */ + addrmodeP->mode = desc->default_model; /* We have a label. */ else - addr_modeP->mode = desc->default_modec; /* We have a constant. */ + addrmodeP->mode = desc->default_modec; /* We have a constant. */ } else { if (exprP.X_add_symbol || exprP.X_op_symbol) - addr_modeP->scaled_mode = desc->default_model; + addrmodeP->scaled_mode = desc->default_model; else - addr_modeP->scaled_mode = desc->default_modec; + addrmodeP->scaled_mode = desc->default_modec; } /* Must put this mess down in addr_mode to handle the scaled @@ -703,17 +703,17 @@ get_addr_mode (char *ptr, addr_modeS *addr_modeP) case. Think it does so with local labels too, not optimum, pcrel is better. When I have time I will make gas check this and select pcrel when possible Actually that is trivial. */ - if ((tmp = addr_modeP->scaled_reg)) + if ((tmp = addrmodeP->scaled_reg)) { /* Build indexbyte. */ tmp--; /* Remember regnumber comes incremented for flagpurpose. */ - tmp |= addr_modeP->scaled_mode << 3; - addr_modeP->index_byte = (char) tmp; - addr_modeP->am_size += 1; + tmp |= addrmodeP->scaled_mode << 3; + addrmodeP->index_byte = (char) tmp; + addrmodeP->am_size += 1; } - gas_assert (addr_modeP->mode >= 0); - if (disp_test[(unsigned int) addr_modeP->mode]) + gas_assert (addrmodeP->mode >= 0); + if (disp_test[(unsigned int) addrmodeP->mode]) { char c; char suffix; @@ -723,23 +723,23 @@ get_addr_mode (char *ptr, addr_modeS *addr_modeP) char *fromP; /* There was a displacement, probe for length specifying suffix. */ - addr_modeP->pcrel = 0; + addrmodeP->pcrel = 0; - gas_assert (addr_modeP->mode >= 0); - if (disp_test[(unsigned int) addr_modeP->mode]) + gas_assert (addrmodeP->mode >= 0); + if (disp_test[(unsigned int) addrmodeP->mode]) { /* There is a displacement. */ - if (addr_modeP->mode == 27 || addr_modeP->scaled_mode == 27) + if (addrmodeP->mode == 27 || addrmodeP->scaled_mode == 27) /* Do we have pcrel. mode. */ - addr_modeP->pcrel = 1; + addrmodeP->pcrel = 1; - addr_modeP->im_disp = 1; + addrmodeP->im_disp = 1; for (i = 0; i < 2; i++) { suffix_sub = suffix = 0; - if ((toP = addr_modeP->disp[i])) + if ((toP = addrmodeP->disp[i])) { /* Suffix of expression, the largest size rules. */ fromP = toP; @@ -778,23 +778,23 @@ get_addr_mode (char *ptr, addr_modeS *addr_modeP) } *toP = '\0'; /* Terminate properly. */ - addr_modeP->disp_suffix[i] = suffix; - addr_modeP->am_size += suffix ? suffix : 4; + addrmodeP->disp_suffix[i] = suffix; + addrmodeP->am_size += suffix ? suffix : 4; } } } } else { - if (addr_modeP->mode == 20) + if (addrmodeP->mode == 20) { /* Look in ns32k_opcode for size. */ - addr_modeP->disp_suffix[0] = addr_modeP->am_size = desc->im_size; - addr_modeP->im_disp = 0; + addrmodeP->disp_suffix[0] = addrmodeP->am_size = desc->im_size; + addrmodeP->im_disp = 0; } } - return addr_modeP->mode; + return addrmodeP->mode; } /* Read an optionlist. */ @@ -1246,7 +1246,7 @@ parse (const char *line, int recursive_level) static bfd_reloc_code_real_type reloc (int size, int pcrel, int type) { - int length, index; + int length, rel_index; bfd_reloc_code_real_type relocs[] = { BFD_RELOC_NS32K_IMM_8, @@ -1289,10 +1289,10 @@ reloc (int size, int pcrel, int type) break; } - index = length + 3 * pcrel + 6 * type; + rel_index = length + 3 * pcrel + 6 * type; - if (index >= 0 && (unsigned int) index < sizeof (relocs) / sizeof (relocs[0])) - return relocs[index]; + if (rel_index >= 0 && (unsigned int) rel_index < sizeof (relocs) / sizeof (relocs[0])) + return relocs[rel_index]; if (pcrel) as_bad (_("Can not do %d byte pc-relative relocation for storage type %d"), diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 1d615e950..e6776022d 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -877,7 +877,7 @@ static const struct pd_reg cr_names[] = expression. */ int -ppc_parse_name (const char *name, expressionS *expr) +ppc_parse_name (const char *name, expressionS *exp) { int val; @@ -891,8 +891,8 @@ ppc_parse_name (const char *name, expressionS *expr) if (val < 0) return 0; - expr->X_op = O_constant; - expr->X_add_number = val; + exp->X_op = O_constant; + exp->X_add_number = val; return 1; } @@ -1624,7 +1624,7 @@ static unsigned long ppc_insert_operand (unsigned long insn, const struct powerpc_operand *operand, offsetT val, - ppc_cpu_t ppc_cpu, + ppc_cpu_t cpu, char *file, unsigned int line) { @@ -1683,7 +1683,7 @@ ppc_insert_operand (unsigned long insn, const char *errmsg; errmsg = NULL; - insn = (*operand->insert) (insn, (long) val, ppc_cpu, &errmsg); + insn = (*operand->insert) (insn, (long) val, cpu, &errmsg); if (errmsg != (const char *) NULL) as_bad_where (file, line, "%s", errmsg); } @@ -2381,7 +2381,6 @@ md_assemble (char *str) { unsigned int opcount; unsigned int num_operands_expected; - unsigned int i; /* There is an optional operand. Count the number of commas in the input line. */ @@ -3779,16 +3778,16 @@ ppc_function (int ignore ATTRIBUTE_UNUSED) if (*input_line_pointer == ',') { - expressionS ignore; + expressionS exp; /* Ignore the third argument. */ ++input_line_pointer; - expression (&ignore); + expression (& exp); if (*input_line_pointer == ',') { /* Ignore the fourth argument. */ ++input_line_pointer; - expression (&ignore); + expression (& exp); if (*input_line_pointer == ',') { /* The fifth argument is the function size. */ diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c index 22da682f6..61220de3e 100644 --- a/gas/config/tc-score.c +++ b/gas/config/tc-score.c @@ -58,7 +58,7 @@ static void s_score_lcomm (int bytes_p); static void s3_md_number_to_chars (char *buf, valueT val, int n); static valueT s3_md_chars_to_number (char *buf, int n); static void s3_assemble (char *str); -static void s3_operand (expressionS * expr); +static void s3_operand (expressionS *); static void s3_begin (void); static void s3_number_to_chars (char *buf, valueT val, int n); static char *s3_atof (int type, char *litP, int *sizeP); @@ -3138,7 +3138,6 @@ s3_do_ldst_insn (char *str) if (s3_inst.reloc.exp.X_op == O_constant) { - int value; unsigned int data_type; if (pre_inc == 1) @@ -6510,11 +6509,11 @@ s3_assemble (char *str) } static void -s3_operand (expressionS * expr) +s3_operand (expressionS * exp) { if (s3_in_my_get_expression) { - expr->X_op = O_illegal; + exp->X_op = O_illegal; if (s3_inst.error == NULL) { s3_inst.error = _("bad expression"); @@ -7522,12 +7521,12 @@ md_assemble (char *str) /* We handle all bad expressions here, so that we can report the faulty instruction in the error message. */ void -md_operand (expressionS * expr) +md_operand (expressionS * exp) { if (score3) - s3_operand (expr); + s3_operand (exp); else - s7_operand (expr); + s7_operand (exp); } /* Turn an integer of n bytes (in val) into a stream of bytes appropriate diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c index c931102ce..9edd699d4 100644 --- a/gas/config/tc-score7.c +++ b/gas/config/tc-score7.c @@ -3306,7 +3306,6 @@ s7_do_ldst_insn (char *str) if (s7_inst.reloc.exp.X_op == O_constant) { - int value; unsigned int data_type; if (pre_inc == 1) @@ -6194,11 +6193,11 @@ s7_assemble (char *str) instruction in the error message. */ static void -s7_operand (expressionS * expr) +s7_operand (expressionS * exp) { if (s7_in_my_get_expression) { - expr->X_op = O_illegal; + exp->X_op = O_illegal; if (s7_inst.error == NULL) { s7_inst.error = _("bad expression"); diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 702b0b4d7..42f01e9ba 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -2320,7 +2320,7 @@ insert_loop_bounds (char *output, sh_operand_info *operand) static unsigned int build_Mytes (sh_opcode_info *opcode, sh_operand_info *operand) { - int index; + int indx; char nbuf[8]; char *output; unsigned int size = 2; @@ -2345,12 +2345,12 @@ build_Mytes (sh_opcode_info *opcode, sh_operand_info *operand) else output = frag_more (2); - for (index = 0; index < max_index; index++) + for (indx = 0; indx < max_index; indx++) { - sh_nibble_type i = opcode->nibbles[index]; + sh_nibble_type i = opcode->nibbles[indx]; if (i < 16) { - nbuf[index] = i; + nbuf[indx] = i; } else { @@ -2358,32 +2358,32 @@ build_Mytes (sh_opcode_info *opcode, sh_operand_info *operand) { case REG_N: case REG_N_D: - nbuf[index] = reg_n; + nbuf[indx] = reg_n; break; case REG_M: - nbuf[index] = reg_m; + nbuf[indx] = reg_m; break; case SDT_REG_N: if (reg_n < 2 || reg_n > 5) as_bad (_("Invalid register: 'r%d'"), reg_n); - nbuf[index] = (reg_n & 3) | 4; + nbuf[indx] = (reg_n & 3) | 4; break; case REG_NM: - nbuf[index] = reg_n | (reg_m >> 2); + nbuf[indx] = reg_n | (reg_m >> 2); break; case REG_B: - nbuf[index] = reg_b | 0x08; + nbuf[indx] = reg_b | 0x08; break; case REG_N_B01: - nbuf[index] = reg_n | 0x01; + nbuf[indx] = reg_n | 0x01; break; case IMM0_3s: - nbuf[index] |= 0x08; + nbuf[indx] |= 0x08; case IMM0_3c: insert (output + low_byte, BFD_RELOC_SH_IMM3, 0, operand); break; case IMM0_3Us: - nbuf[index] |= 0x80; + nbuf[indx] |= 0x80; case IMM0_3Uc: insert (output + low_byte, BFD_RELOC_SH_IMM3U, 0, operand); break; @@ -2465,7 +2465,7 @@ build_Mytes (sh_opcode_info *opcode, sh_operand_info *operand) break; case REPEAT: output = insert_loop_bounds (output, operand); - nbuf[index] = opcode->nibbles[3]; + nbuf[indx] = opcode->nibbles[3]; operand += 2; break; default: diff --git a/gas/config/tc-sh64.c b/gas/config/tc-sh64.c index 7610a4942..db6984604 100644 --- a/gas/config/tc-sh64.c +++ b/gas/config/tc-sh64.c @@ -3273,9 +3273,9 @@ sh64_consume_datalabel (const char *name, expressionS *exp, else { symbolS *dl_symp; - const char *name = S_GET_NAME (symp); + const char * sname = S_GET_NAME (symp); char *dl_name - = xmalloc (strlen (name) + sizeof (DATALABEL_SUFFIX)); + = xmalloc (strlen (sname) + sizeof (DATALABEL_SUFFIX)); /* Now we copy the datalabel-qualified symbol into a symbol with the same name, but with " DL" appended. We mark the @@ -3283,13 +3283,13 @@ sh64_consume_datalabel (const char *name, expressionS *exp, the main symbol, so we don't have to inspect all symbol names. Note that use of "datalabel" is not expected to be a common case. */ - strcpy (dl_name, name); + strcpy (dl_name, sname); strcat (dl_name, DATALABEL_SUFFIX); /* A FAKE_LABEL_NAME marks "$" or ".". There can be any number of them and all have the same (faked) name; we must make a new one each time. */ - if (strcmp (name, FAKE_LABEL_NAME) == 0) + if (strcmp (sname, FAKE_LABEL_NAME) == 0) dl_symp = symbol_make (dl_name); else dl_symp = symbol_find_or_make (dl_name); diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index 1be7760c7..26ecc8600 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -1446,15 +1446,15 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn) { while (*s == '#') { - int mask; + int jmask; if (! parse_keyword_arg (sparc_encode_membar, &s, - &mask)) + &jmask)) { error_message = _(": invalid membar mask name"); goto error; } - kmask |= mask; + kmask |= jmask; while (*s == ' ') ++s; if (*s == '|' || *s == '+') @@ -2890,36 +2890,36 @@ get_expression (char *str) /* Subroutine of md_assemble to output one insn. */ static void -output_insn (const struct sparc_opcode *insn, struct sparc_it *the_insn) +output_insn (const struct sparc_opcode *insn, struct sparc_it *theinsn) { char *toP = frag_more (4); /* Put out the opcode. */ if (INSN_BIG_ENDIAN) - number_to_chars_bigendian (toP, (valueT) the_insn->opcode, 4); + number_to_chars_bigendian (toP, (valueT) theinsn->opcode, 4); else - number_to_chars_littleendian (toP, (valueT) the_insn->opcode, 4); + number_to_chars_littleendian (toP, (valueT) theinsn->opcode, 4); /* Put out the symbol-dependent stuff. */ - if (the_insn->reloc != BFD_RELOC_NONE) + if (theinsn->reloc != BFD_RELOC_NONE) { fixS *fixP = fix_new_exp (frag_now, /* Which frag. */ (toP - frag_now->fr_literal), /* Where. */ 4, /* Size. */ - &the_insn->exp, - the_insn->pcrel, - the_insn->reloc); + &theinsn->exp, + theinsn->pcrel, + theinsn->reloc); /* Turn off overflow checking in fixup_segment. We'll do our own overflow checking in md_apply_fix. This is necessary because the insn size is 4 and fixup_segment will signal an overflow for large 8 byte quantities. */ fixP->fx_no_overflow = 1; - if (the_insn->reloc == BFD_RELOC_SPARC_OLO10) - fixP->tc_fix_data = the_insn->exp2.X_add_number; + if (theinsn->reloc == BFD_RELOC_SPARC_OLO10) + fixP->tc_fix_data = theinsn->exp2.X_add_number; } last_insn = insn; - last_opcode = the_insn->opcode; + last_opcode = theinsn->opcode; #ifdef OBJ_ELF dwarf2_emit_insn (4); @@ -3869,7 +3869,6 @@ s_common (int ignore ATTRIBUTE_UNUSED) { segT old_sec; int old_subsec; - char *p; int align; old_sec = now_seg; diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c index d4d98d5ec..7dea5d7f9 100644 --- a/gas/config/tc-tic30.c +++ b/gas/config/tc-tic30.c @@ -327,19 +327,19 @@ tic30_find_parallel_insn (char *current_line, char *next_line) { int i; - char *opcode, *operands, *line; + char *op, *operands, *line; for (i = 0; i < 2; i++) { if (i == 0) { - opcode = &first_opcode[0]; + op = &first_opcode[0]; operands = &first_operands[0]; line = current_line; } else { - opcode = &second_opcode[0]; + op = &second_opcode[0]; operands = &second_operands[0]; line = next_line; } @@ -353,14 +353,14 @@ tic30_find_parallel_insn (char *current_line, char *next_line) { if (is_opcode_char (c) && search_status == NONE) { - opcode[char_ptr++] = TOLOWER (c); + op[char_ptr++] = TOLOWER (c); search_status = START_OPCODE; } else if (is_opcode_char (c) && search_status == START_OPCODE) - opcode[char_ptr++] = TOLOWER (c); + op[char_ptr++] = TOLOWER (c); else if (!is_opcode_char (c) && search_status == START_OPCODE) { - opcode[char_ptr] = '\0'; + op[char_ptr] = '\0'; char_ptr = 0; search_status = END_OPCODE; } @@ -620,8 +620,6 @@ tic30_operand (char *token) } else { - unsigned count; - debug ("Found a number or displacement\n"); for (count = 0; count < strlen (token); count++) if (*(token + count) == '.') @@ -1307,42 +1305,42 @@ md_atof (int what_statement_type, } if (prec == 2) { - long exp, mant; + long expon, mantis; if (tmsfloat == 0x80000000) value = 0x8000; else { value = 0; - exp = (tmsfloat & 0xFF000000); - exp >>= 24; - mant = tmsfloat & 0x007FFFFF; + expon = (tmsfloat & 0xFF000000); + expon >>= 24; + mantis = tmsfloat & 0x007FFFFF; if (tmsfloat & 0x00800000) { - mant |= 0xFF000000; - mant += 0x00000800; - mant >>= 12; - mant |= 0x00000800; - mant &= 0x0FFF; - if (exp > 7) + mantis |= 0xFF000000; + mantis += 0x00000800; + mantis >>= 12; + mantis |= 0x00000800; + mantis &= 0x0FFF; + if (expon > 7) value = 0x7800; } else { - mant |= 0x00800000; - mant += 0x00000800; - exp += (mant >> 24); - mant >>= 12; - mant &= 0x07FF; - if (exp > 7) + mantis |= 0x00800000; + mantis += 0x00000800; + expon += (mantis >> 24); + mantis >>= 12; + mantis &= 0x07FF; + if (expon > 7) value = 0x77FF; } - if (exp < -8) + if (expon < -8) value = 0x8000; if (value == 0) { - mant = (exp << 12) | mant; - value = mant & 0xFFFF; + mantis = (expon << 12) | mantis; + value = mantis & 0xFFFF; } } } @@ -1416,7 +1414,7 @@ md_operand (expressionS *expressionP ATTRIBUTE_UNUSED) void md_assemble (char *line) { - insn_template *opcode; + insn_template *op; char *current_posn; char *token_start; char save_char; @@ -1464,11 +1462,11 @@ md_assemble (char *line) /* Find instruction. */ save_char = *current_posn; *current_posn = '\0'; - opcode = (insn_template *) hash_find (op_hash, token_start); - if (opcode) + op = (insn_template *) hash_find (op_hash, token_start); + if (op) { - debug ("Found instruction %s\n", opcode->name); - insn.tm = opcode; + debug ("Found instruction %s\n", op->name); + insn.tm = op; } else { diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c index 3ff6cbc04..fd98c2c45 100644 --- a/gas/config/tc-tic4x.c +++ b/gas/config/tc-tic4x.c @@ -1248,7 +1248,7 @@ tic4x_inst_make (char *name, unsigned long opcode, char *args) { static tic4x_inst_t *insts = NULL; static char *names = NULL; - static int index = 0; + static int iindex = 0; if (insts == NULL) { @@ -1258,18 +1258,18 @@ tic4x_inst_make (char *name, unsigned long opcode, char *args) insts = (tic4x_inst_t *) xmalloc (sizeof (tic4x_inst_t) * 1024); } - insts[index].name = names; - insts[index].opcode = opcode; - insts[index].opmask = 0xffffffff; - insts[index].args = args; - index++; + insts[iindex].name = names; + insts[iindex].opcode = opcode; + insts[iindex].opmask = 0xffffffff; + insts[iindex].args = args; + iindex++; do *names++ = *name++; while (*name); *names++ = '\0'; - return &insts[index - 1]; + return &insts[iindex - 1]; } /* Add instruction template, creating dynamic templates as required. */ @@ -1672,12 +1672,12 @@ tic4x_operand_parse (char *s, tic4x_operand_t *operand) } static int -tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) +tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *tinsn, int check) { const char *args = inst->args; unsigned long opcode = inst->opcode; - int num_operands = insn->num_operands; - tic4x_operand_t *operand = insn->operands; + int num_operands = tinsn->num_operands; + tic4x_operand_t *operand = tinsn->operands; expressionS *exp = &operand->expr; int ret = 1; int reg; @@ -1688,13 +1688,13 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) If an operand matches, we modify insn or opcode appropriately, and do a "continue". If an operand fails to match, we "break". */ - insn->nchars = 4; /* Instructions always 4 bytes. */ - insn->reloc = NO_RELOC; - insn->pcrel = 0; + tinsn->nchars = 4; /* Instructions always 4 bytes. */ + tinsn->reloc = NO_RELOC; + tinsn->pcrel = 0; if (*args == '\0') { - insn->opcode = opcode; + tinsn->opcode = opcode; return num_operands == 0; } @@ -1706,7 +1706,7 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) case '\0': /* End of args. */ if (num_operands == 1) { - insn->opcode = opcode; + tinsn->opcode = opcode; return ret; } break; /* Too many operands. */ @@ -1735,8 +1735,8 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) } else if (exp->X_op == O_symbol) { - insn->reloc = BFD_RELOC_HI16; - insn->exp = *exp; + tinsn->reloc = BFD_RELOC_HI16; + tinsn->exp = *exp; continue; } break; /* Not direct (dp) addressing. */ @@ -1752,8 +1752,8 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) } else if (exp->X_op == O_symbol) { - insn->reloc = BFD_RELOC_LO16; - insn->exp = *exp; + tinsn->reloc = BFD_RELOC_LO16; + tinsn->exp = *exp; continue; } break; /* Not direct addressing. */ @@ -1794,15 +1794,15 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) } if (IS_CPU_TIC4X (tic4x_cpu)) { - insn->reloc = BFD_RELOC_24_PCREL; - insn->pcrel = 1; + tinsn->reloc = BFD_RELOC_24_PCREL; + tinsn->pcrel = 1; } else { - insn->reloc = BFD_RELOC_24; - insn->pcrel = 0; + tinsn->reloc = BFD_RELOC_24; + tinsn->pcrel = 0; } - insn->exp = *exp; + tinsn->exp = *exp; continue; case 'C': @@ -2048,9 +2048,9 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) continue; } } - insn->reloc = BFD_RELOC_16_PCREL; - insn->pcrel = 1; - insn->exp = *exp; + tinsn->reloc = BFD_RELOC_16_PCREL; + tinsn->pcrel = 1; + tinsn->exp = *exp; continue; case 'Q': @@ -2127,21 +2127,21 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) { if (operand->mode == M_HI) { - insn->reloc = BFD_RELOC_HI16; + tinsn->reloc = BFD_RELOC_HI16; } else { - insn->reloc = BFD_RELOC_LO16; + tinsn->reloc = BFD_RELOC_LO16; } - insn->exp = *exp; + tinsn->exp = *exp; continue; } /* Handle cases like ldi foo - $, ar0 where foo is a forward reference. Perhaps we should check for X_op == O_symbol and disallow things like ldi foo, ar0. */ - insn->reloc = BFD_RELOC_16; - insn->exp = *exp; + tinsn->reloc = BFD_RELOC_16; + tinsn->exp = *exp; continue; case 'T': /* 5-bit immediate value for tic4x stik. */ @@ -2189,15 +2189,15 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) else if (exp->X_op == O_symbol) { if (operand->mode == M_HI) - insn->reloc = BFD_RELOC_HI16; + tinsn->reloc = BFD_RELOC_HI16; else - insn->reloc = BFD_RELOC_LO16; + tinsn->reloc = BFD_RELOC_LO16; - insn->exp = *exp; + tinsn->exp = *exp; continue; } - insn->reloc = BFD_RELOC_16; - insn->exp = *exp; + tinsn->reloc = BFD_RELOC_16; + tinsn->exp = *exp; continue; case 'V': /* Trap numbers (immediate field). */ @@ -2254,8 +2254,8 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) continue; } } - insn->reloc = BFD_RELOC_16; - insn->exp = *exp; + tinsn->reloc = BFD_RELOC_16; + tinsn->exp = *exp; continue; case 'X': /* Expansion register for tic4x. */ @@ -2309,7 +2309,7 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) continue; case '|': /* treat as `,' if have ldi_ldi form. */ - if (insn->parallel) + if (tinsn->parallel) { if (--num_operands < 0) break; /* Too few operands. */ @@ -2343,57 +2343,57 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check) } static void -tic4x_insn_check (tic4x_insn_t *insn) +tic4x_insn_check (tic4x_insn_t *tinsn) { - if (!strcmp(insn->name, "lda")) + if (!strcmp (tinsn->name, "lda")) { - if (insn->num_operands < 2 || insn->num_operands > 2) + if (tinsn->num_operands < 2 || tinsn->num_operands > 2) as_fatal ("Illegal internal LDA insn definition"); - if ( insn->operands[0].mode == M_REGISTER - && insn->operands[1].mode == M_REGISTER - && insn->operands[0].expr.X_add_number == insn->operands[1].expr.X_add_number ) + if (tinsn->operands[0].mode == M_REGISTER + && tinsn->operands[1].mode == M_REGISTER + && tinsn->operands[0].expr.X_add_number == tinsn->operands[1].expr.X_add_number ) as_bad (_("Source and destination register should not be equal")); } - else if( !strcmp(insn->name, "ldi_ldi") - || !strcmp(insn->name, "ldi1_ldi2") - || !strcmp(insn->name, "ldi2_ldi1") - || !strcmp(insn->name, "ldf_ldf") - || !strcmp(insn->name, "ldf1_ldf2") - || !strcmp(insn->name, "ldf2_ldf1") ) + else if (!strcmp (tinsn->name, "ldi_ldi") + || !strcmp (tinsn->name, "ldi1_ldi2") + || !strcmp (tinsn->name, "ldi2_ldi1") + || !strcmp (tinsn->name, "ldf_ldf") + || !strcmp (tinsn->name, "ldf1_ldf2") + || !strcmp (tinsn->name, "ldf2_ldf1") ) { - if ( insn->num_operands < 4 && insn->num_operands > 5 ) - as_fatal ("Illegal internal %s insn definition", insn->name); + if (tinsn->num_operands < 4 && tinsn->num_operands > 5 ) + as_fatal ("Illegal internal %s insn definition", tinsn->name); - if ( insn->operands[1].mode == M_REGISTER - && insn->operands[insn->num_operands-1].mode == M_REGISTER - && insn->operands[1].expr.X_add_number == insn->operands[insn->num_operands-1].expr.X_add_number ) + if (tinsn->operands[1].mode == M_REGISTER + && tinsn->operands[tinsn->num_operands-1].mode == M_REGISTER + && tinsn->operands[1].expr.X_add_number == tinsn->operands[tinsn->num_operands-1].expr.X_add_number ) as_warn (_("Equal parallell destination registers, one result will be discarded")); } } static void -tic4x_insn_output (tic4x_insn_t *insn) +tic4x_insn_output (tic4x_insn_t *tinsn) { char *dst; /* Grab another fragment for opcode. */ - dst = frag_more (insn->nchars); + dst = frag_more (tinsn->nchars); /* Put out opcode word as a series of bytes in little endian order. */ - md_number_to_chars (dst, insn->opcode, insn->nchars); + md_number_to_chars (dst, tinsn->opcode, tinsn->nchars); /* Put out the symbol-dependent stuff. */ - if (insn->reloc != NO_RELOC) + if (tinsn->reloc != NO_RELOC) { /* Where is the offset into the fragment for this instruction. */ fix_new_exp (frag_now, dst - frag_now->fr_literal, /* where */ - insn->nchars, /* size */ - &insn->exp, - insn->pcrel, - insn->reloc); + tinsn->nchars, /* size */ + &tinsn->exp, + tinsn->pcrel, + tinsn->reloc); } } diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c index eb1815c2b..1a00bb495 100644 --- a/gas/config/tc-tic54x.c +++ b/gas/config/tc-tic54x.c @@ -243,11 +243,11 @@ md_show_usage (FILE *stream) static void tic54x_emit_char (char c) { - expressionS exp; + expressionS expn; - exp.X_op = O_constant; - exp.X_add_number = c; - emit_expr (&exp, 2); + expn.X_op = O_constant; + expn.X_add_number = c; + emit_expr (&expn, 2); } /* Walk backwards in the frag chain. */ @@ -298,14 +298,14 @@ frag_bit_offset (fragS *frag, segT seg) expression. */ static char * -parse_expression (char *str, expressionS *exp) +parse_expression (char *str, expressionS *expn) { char *s; char *tmp; tmp = input_line_pointer; /* Save line pointer. */ input_line_pointer = str; - expression (exp); + expression (expn); s = input_line_pointer; input_line_pointer = tmp; /* Restore line pointer. */ return s; /* Return pointer to where parsing stopped. */ @@ -1018,12 +1018,12 @@ tic54x_cons (int type) } else { - expressionS exp; + expressionS expn; - input_line_pointer = parse_expression (input_line_pointer, &exp); - if (exp.X_op == O_constant) + input_line_pointer = parse_expression (input_line_pointer, &expn); + if (expn.X_op == O_constant) { - offsetT value = exp.X_add_number; + offsetT value = expn.X_add_number; /* Truncate overflows. */ switch (octets) { @@ -1039,7 +1039,7 @@ tic54x_cons (int type) break; } } - if (exp.X_op != O_constant && octets < 2) + if (expn.X_op != O_constant && octets < 2) { /* Disallow .byte with a non constant expression that will require relocation. */ @@ -1048,7 +1048,7 @@ tic54x_cons (int type) return; } - if (exp.X_op != O_constant + if (expn.X_op != O_constant && amode == c_mode && octets == 4) { @@ -1059,14 +1059,14 @@ tic54x_cons (int type) totally ignored in the latest tools). */ amode = far_mode; emitting_long = 1; - emit_expr (&exp, 4); + emit_expr (&expn, 4); emitting_long = 0; amode = c_mode; } else { emitting_long = octets == 4; - emit_expr (&exp, (octets == 1) ? 2 : octets); + emit_expr (&expn, (octets == 1) ? 2 : octets); emitting_long = 0; } } @@ -1222,7 +1222,7 @@ tic54x_sect (int arg) static void tic54x_space (int arg) { - expressionS exp; + expressionS expn; char *p = 0; int octets = 0; long words; @@ -1238,22 +1238,21 @@ tic54x_space (int arg) #endif /* Read the bit count. */ - expression (&exp); + expression (&expn); /* Some expressions are unresolvable until later in the assembly pass; postpone until relaxation/fixup. we also have to postpone if a previous partial allocation has not been completed yet. */ - if (exp.X_op != O_constant || frag_bit_offset (frag_now, now_seg) == -1) + if (expn.X_op != O_constant || frag_bit_offset (frag_now, now_seg) == -1) { struct bit_info *bi = xmalloc (sizeof (struct bit_info)); - char *p; bi->seg = now_seg; bi->type = bes; bi->sym = label; p = frag_var (rs_machine_dependent, 65536 * 2, 1, (relax_substateT) 0, - make_expr_symbol (&exp), (offsetT) 0, + make_expr_symbol (&expn), (offsetT) 0, (char *) bi); if (p) *p = 0; @@ -1268,7 +1267,7 @@ tic54x_space (int arg) { int spare_bits = bits_per_byte - bit_offset; - if (spare_bits >= exp.X_add_number) + if (spare_bits >= expn.X_add_number) { /* Don't have to do anything; sufficient bits have already been allocated; just point the label to the right place. */ @@ -1278,10 +1277,10 @@ tic54x_space (int arg) S_SET_VALUE (label, frag_now_fix () - 1); label = NULL; } - frag_now->tc_frag_data += exp.X_add_number; + frag_now->tc_frag_data += expn.X_add_number; goto getout; } - exp.X_add_number -= spare_bits; + expn.X_add_number -= spare_bits; /* Set the label to point to the first word allocated, which in this case is the previous word, which was only partially filled. */ if (!bes && label != NULL) @@ -1292,9 +1291,9 @@ tic54x_space (int arg) } } /* Convert bits to bytes/words and octets, rounding up. */ - words = ((exp.X_add_number + bits_per_byte - 1) / bits_per_byte); + words = ((expn.X_add_number + bits_per_byte - 1) / bits_per_byte); /* How many do we have left over? */ - bit_offset = exp.X_add_number % bits_per_byte; + bit_offset = expn.X_add_number % bits_per_byte; octets = words * OCTETS_PER_BYTE; if (octets < 0) { @@ -1695,7 +1694,7 @@ tic54x_align_words (int arg) static void tic54x_field (int ignore ATTRIBUTE_UNUSED) { - expressionS exp; + expressionS expn; int size = 16; char *p; valueT value; @@ -1707,7 +1706,7 @@ tic54x_field (int ignore ATTRIBUTE_UNUSED) return; } - input_line_pointer = parse_expression (input_line_pointer, &exp); + input_line_pointer = parse_expression (input_line_pointer, &expn); if (*input_line_pointer == ',') { @@ -1722,7 +1721,7 @@ tic54x_field (int ignore ATTRIBUTE_UNUSED) } /* Truncate values to the field width. */ - if (exp.X_op != O_constant) + if (expn.X_op != O_constant) { /* If the expression value is relocatable, the field size *must* be 16. */ @@ -1734,17 +1733,17 @@ tic54x_field (int ignore ATTRIBUTE_UNUSED) } frag_now->tc_frag_data = 0; - emit_expr (&exp, 2); + emit_expr (&expn, 2); } else { unsigned long fmask = (size == 32) ? 0xFFFFFFFF : (1ul << size) - 1; - value = exp.X_add_number; - exp.X_add_number &= fmask; - if (value != (valueT) exp.X_add_number) + value = expn.X_add_number; + expn.X_add_number &= fmask; + if (value != (valueT) expn.X_add_number) as_warn (_("field value truncated")); - value = exp.X_add_number; + value = expn.X_add_number; /* Bits are stored MS first. */ while (size >= 16) { @@ -2656,11 +2655,11 @@ subsym_ismember (char *sym, char *list) static int subsym_iscons (char *a, char *ignore ATTRIBUTE_UNUSED) { - expressionS exp; + expressionS expn; - parse_expression (a, &exp); + parse_expression (a, &expn); - if (exp.X_op == O_constant) + if (expn.X_op == O_constant) { int len = strlen (a); @@ -4570,10 +4569,10 @@ subsym_substitute (char *line, int forced) ++ptr; if (math_entry != NULL) { - float arg1, arg2 = 0; + float farg1, farg2 = 0; volatile float fresult; - arg1 = (float) strtod (ptr, &ptr); + farg1 = (float) strtod (ptr, &ptr); if (math_entry->nargs == 2) { if (*ptr++ != ',') @@ -4581,9 +4580,9 @@ subsym_substitute (char *line, int forced) as_bad (_("Expecting second argument")); break; } - arg2 = (float) strtod (ptr, &ptr); + farg2 = (float) strtod (ptr, &ptr); } - fresult = (*math_entry->proc) (arg1, arg2); + fresult = (*math_entry->proc) (farg1, farg2); value = xmalloc (128); if (math_entry->int_return) sprintf (value, "%d", (int) fresult); @@ -5080,7 +5079,7 @@ tic54x_undefined_symbol (char *name) int tic54x_parse_name (char *name ATTRIBUTE_UNUSED, - expressionS *exp ATTRIBUTE_UNUSED) + expressionS *expn ATTRIBUTE_UNUSED) { return 0; } @@ -5125,7 +5124,7 @@ tc_gen_reloc (asection *section, fixS *fixP) /* Handle cons expressions. */ void -tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *exp) +tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *expn) { bfd_reloc_code_real_type r; @@ -5148,7 +5147,7 @@ tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *exp) r = BFD_RELOC_32; break; } - fix_new_exp (frag, where, octets, exp, 0, r); + fix_new_exp (frag, where, octets, expn, 0, r); } /* Attempt to simplify or even eliminate a fixup. diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 2ed8adafd..efb527b03 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -1826,6 +1826,7 @@ expression_maybe_register (xtensa_opcode opc, int opnd, expressionS *tok) { bfd_reloc_code_real_type reloc; segT t = expression (tok); + if (t == absolute_section && xtensa_operand_is_PCrelative (isa, opc, opnd) == 1) { @@ -3235,15 +3236,16 @@ xg_immeds_fit (const TInsn *insn) gas_assert (insn->insn_type == ITYPE_INSN); for (i = 0; i < n; ++i) { - const expressionS *expr = &insn->tok[i]; + const expressionS *exp = &insn->tok[i]; + if (xtensa_operand_is_register (isa, insn->opcode, i) == 1) continue; - switch (expr->X_op) + switch (exp->X_op) { case O_register: case O_constant: - if (xg_check_operand (expr->X_add_number, insn->opcode, i)) + if (xg_check_operand (exp->X_add_number, insn->opcode, i)) return FALSE; break; @@ -3279,15 +3281,16 @@ xg_symbolic_immeds_fit (const TInsn *insn, for (i = 0; i < n; ++i) { - const expressionS *expr = &insn->tok[i]; + const expressionS *exp = &insn->tok[i]; + if (xtensa_operand_is_register (isa, insn->opcode, i) == 1) continue; - switch (expr->X_op) + switch (exp->X_op) { case O_register: case O_constant: - if (xg_check_operand (expr->X_add_number, insn->opcode, i)) + if (xg_check_operand (exp->X_add_number, insn->opcode, i)) return FALSE; break; @@ -3307,8 +3310,8 @@ xg_symbolic_immeds_fit (const TInsn *insn, /* If it is a weak symbol or a symbol in a different section, it cannot be known to fit at assembly time. */ - if (S_IS_WEAK (expr->X_add_symbol) - || S_GET_SEGMENT (expr->X_add_symbol) != pc_seg) + if (S_IS_WEAK (exp->X_add_symbol) + || S_GET_SEGMENT (exp->X_add_symbol) != pc_seg) { /* For a direct call with --no-longcalls, be optimistic and assume it will be in range. If the symbol is weak and @@ -3318,16 +3321,16 @@ xg_symbolic_immeds_fit (const TInsn *insn, symbols even if longcalls is not enabled. */ if (is_direct_call_opcode (insn->opcode) && ! pc_frag->tc_frag_data.use_longcalls - && (! S_IS_WEAK (expr->X_add_symbol) - || S_IS_DEFINED (expr->X_add_symbol))) + && (! S_IS_WEAK (exp->X_add_symbol) + || S_IS_DEFINED (exp->X_add_symbol))) return TRUE; return FALSE; } - symbolP = expr->X_add_symbol; + symbolP = exp->X_add_symbol; sym_frag = symbol_get_frag (symbolP); - target = S_GET_VALUE (symbolP) + expr->X_add_number; + target = S_GET_VALUE (symbolP) + exp->X_add_number; pc = pc_frag->fr_address + pc_offset; /* If frag has yet to be reached on this pass, assume it @@ -3568,11 +3571,11 @@ xg_expand_to_stack (IStack *istack, TInsn *insn, int lateral_steps) /* Check to see if it fits. */ for (i = stack_size; i < istack->ninsn; i++) { - TInsn *insn = &istack->insn[i]; + TInsn *tinsn = &istack->insn[i]; - if (insn->insn_type == ITYPE_INSN - && !tinsn_has_symbolic_operands (insn) - && !xg_immeds_fit (insn)) + if (tinsn->insn_type == ITYPE_INSN + && !tinsn_has_symbolic_operands (tinsn) + && !xg_immeds_fit (tinsn)) { istack->ninsn = stack_size; return FALSE; @@ -4192,7 +4195,7 @@ xg_add_opcode_fix (TInsn *tinsn, int opnum, xtensa_format fmt, int slot, - expressionS *expr, + expressionS *exp, fragS *fragP, offsetT offset) { @@ -4212,15 +4215,15 @@ xg_add_opcode_fix (TInsn *tinsn, } else if (opcode == xtensa_const16_opcode) { - if (expr->X_op == O_lo16) + if (exp->X_op == O_lo16) { reloc = encode_reloc (slot); - expr->X_op = O_symbol; + exp->X_op = O_symbol; } - else if (expr->X_op == O_hi16) + else if (exp->X_op == O_hi16) { reloc = encode_alt_reloc (slot); - expr->X_op = O_symbol; + exp->X_op = O_symbol; } } @@ -4234,7 +4237,7 @@ xg_add_opcode_fix (TInsn *tinsn, /* Handle erroneous "@h" and "@l" expressions here before they propagate into the symbol table where the generic portions of the assembler won't know what to do with them. */ - if (expr->X_op == O_lo16 || expr->X_op == O_hi16) + if (exp->X_op == O_lo16 || exp->X_op == O_hi16) { as_bad (_("invalid expression for operand %i of '%s'"), opnum + 1, xtensa_opcode_name (xtensa_default_isa, opcode)); @@ -4259,11 +4262,11 @@ xg_add_opcode_fix (TInsn *tinsn, } fmt_length = xtensa_format_length (xtensa_default_isa, fmt); - the_fix = fix_new_exp (fragP, offset, fmt_length, expr, + the_fix = fix_new_exp (fragP, offset, fmt_length, exp, howto->pc_relative, reloc); the_fix->fx_no_overflow = 1; - the_fix->tc_fix_data.X_add_symbol = expr->X_add_symbol; - the_fix->tc_fix_data.X_add_number = expr->X_add_number; + the_fix->tc_fix_data.X_add_symbol = exp->X_add_symbol; + the_fix->tc_fix_data.X_add_number = exp->X_add_number; the_fix->tc_fix_data.slot = slot; return TRUE; @@ -7349,12 +7352,12 @@ static offsetT unrelaxed_frag_max_size (fragS *); static bfd_boolean is_narrow_branch_guaranteed_in_range (fragS *fragP, TInsn *tinsn) { - const expressionS *expr = &tinsn->tok[1]; - symbolS *symbolP = expr->X_add_symbol; - offsetT max_distance = expr->X_add_number; + const expressionS *exp = &tinsn->tok[1]; + symbolS *symbolP = exp->X_add_symbol; + offsetT max_distance = exp->X_add_number; fragS *target_frag; - if (expr->X_op != O_symbol) + if (exp->X_op != O_symbol) return FALSE; target_frag = symbol_get_frag (symbolP); @@ -7441,12 +7444,12 @@ xtensa_mark_difference_of_two_symbols (void) for (expr_sym = expr_symbols; expr_sym; expr_sym = symbol_get_tc (expr_sym)->next_expr_symbol) { - expressionS *expr = symbol_get_value_expression (expr_sym); + expressionS *exp = symbol_get_value_expression (expr_sym); - if (expr->X_op == O_subtract) + if (exp->X_op == O_subtract) { - symbolS *left = expr->X_add_symbol; - symbolS *right = expr->X_op_symbol; + symbolS *left = exp->X_add_symbol; + symbolS *right = exp->X_op_symbol; /* Difference of two symbols not in the same section are handled with relocations in the linker. */ @@ -8083,7 +8086,7 @@ xtensa_sanity_check (void) static bfd_boolean is_empty_loop (const TInsn *insn, fragS *fragP) { - const expressionS *expr; + const expressionS *exp; symbolS *symbolP; fragS *next_fragP; @@ -8096,12 +8099,12 @@ is_empty_loop (const TInsn *insn, fragS *fragP) if (insn->ntok <= LOOP_IMMED_OPN) return FALSE; - expr = &insn->tok[LOOP_IMMED_OPN]; + exp = &insn->tok[LOOP_IMMED_OPN]; - if (expr->X_op != O_symbol) + if (exp->X_op != O_symbol) return FALSE; - symbolP = expr->X_add_symbol; + symbolP = exp->X_add_symbol; if (!symbolP) return FALSE; @@ -8130,7 +8133,7 @@ is_empty_loop (const TInsn *insn, fragS *fragP) static bfd_boolean is_local_forward_loop (const TInsn *insn, fragS *fragP) { - const expressionS *expr; + const expressionS *exp; symbolS *symbolP; fragS *next_fragP; @@ -8143,12 +8146,12 @@ is_local_forward_loop (const TInsn *insn, fragS *fragP) if (insn->ntok <= LOOP_IMMED_OPN) return FALSE; - expr = &insn->tok[LOOP_IMMED_OPN]; + exp = &insn->tok[LOOP_IMMED_OPN]; - if (expr->X_op != O_symbol) + if (exp->X_op != O_symbol) return FALSE; - symbolP = expr->X_add_symbol; + symbolP = exp->X_add_symbol; if (!symbolP) return FALSE; @@ -10167,9 +10170,9 @@ xtensa_move_literals (void) for (lit = literal_syms; lit; lit = lit->next) { symbolS *lit_sym = lit->sym; - segT dest_seg = symbol_get_frag (lit_sym)->tc_frag_data.lit_seg; - if (dest_seg) - S_SET_SEGMENT (lit_sym, dest_seg); + segT dseg = symbol_get_frag (lit_sym)->tc_frag_data.lit_seg; + if (dseg) + S_SET_SEGMENT (lit_sym, dseg); } } @@ -11401,20 +11404,20 @@ tinsn_to_slotbuf (xtensa_format fmt, for (i = 0; i < noperands; i++) { - expressionS *expr = &tinsn->tok[i]; + expressionS *exp = &tinsn->tok[i]; int rc; unsigned line; char *file_name; uint32 opnd_value; - switch (expr->X_op) + switch (exp->X_op) { case O_register: if (xtensa_operand_is_visible (isa, opcode, i) == 0) break; /* The register number has already been checked in expression_maybe_register, so we don't need to check here. */ - opnd_value = expr->X_add_number; + opnd_value = exp->X_add_number; (void) xtensa_operand_encode (isa, opcode, i, &opnd_value); rc = xtensa_operand_set_field (isa, opcode, i, fmt, slot, slotbuf, opnd_value); @@ -11429,7 +11432,7 @@ tinsn_to_slotbuf (xtensa_format fmt, /* It is a constant and we called this function then we have to try to fit it. */ xtensa_insnbuf_set_operand (slotbuf, fmt, slot, opcode, i, - expr->X_add_number, file_name, line); + exp->X_add_number, file_name, line); break; default: @@ -11783,8 +11786,8 @@ vinsn_to_insnbuf (vliw_insn *vinsn, for (i = 0; i < noperands; i++) { - expressionS* expr = &tinsn->tok[i]; - switch (expr->X_op) + expressionS* exp = &tinsn->tok[i]; + switch (exp->X_op) { case O_symbol: case O_lo16: @@ -11799,15 +11802,15 @@ vinsn_to_insnbuf (vliw_insn *vinsn, || tinsn->is_specific_opcode || !xg_is_relaxable_insn (tinsn, 0)) { - xg_add_opcode_fix (tinsn, i, fmt, slot, expr, fragP, + xg_add_opcode_fix (tinsn, i, fmt, slot, exp, fragP, frag_offset - fragP->fr_literal); } else { - if (expr->X_op != O_symbol) + if (exp->X_op != O_symbol) as_bad (_("invalid operand")); - tinsn->symbol = expr->X_add_symbol; - tinsn->offset = expr->X_add_number; + tinsn->symbol = exp->X_add_symbol; + tinsn->offset = exp->X_add_number; } } else diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c index a66ae9053..7cc061ab4 100644 --- a/gas/config/tc-z8k.c +++ b/gas/config/tc-z8k.c @@ -203,7 +203,7 @@ static int the_interrupt; number. */ static char * -whatreg (unsigned int *reg, char *src) +whatreg (unsigned int *preg, char *src) { unsigned int new_reg; @@ -222,7 +222,7 @@ whatreg (unsigned int *reg, char *src) if (src[0] != 0 && src[0] != ',' && src[0] != '(' && src[0] != ')') return NULL; - *reg = new_reg; + *preg = new_reg; return src; } @@ -244,7 +244,7 @@ whatreg (unsigned int *reg, char *src) in SRC after the reg name. */ static char * -parse_reg (char *src, int *mode, unsigned int *reg) +parse_reg (char *src, int *mode, unsigned int *preg) { char *res = NULL; char regno; @@ -257,12 +257,12 @@ parse_reg (char *src, int *mode, unsigned int *reg) if (segmented_mode) { *mode = CLASS_REG_LONG; - *reg = 14; + *preg = 14; } else { *mode = CLASS_REG_WORD; - *reg = 15; + *preg = 15; } return src + 2; } @@ -274,10 +274,10 @@ parse_reg (char *src, int *mode, unsigned int *reg) if (src[2] < '0' || src[2] > '9') return NULL; /* Assume no register name but a label starting with 'rr'. */ *mode = CLASS_REG_LONG; - res = whatreg (reg, src + 2); + res = whatreg (preg, src + 2); if (res == NULL) return NULL; /* Not a valid register name. */ - regno = *reg; + regno = *preg; if (regno > 14) as_bad (_("register rr%d out of range"), regno); if (regno & 1) @@ -288,10 +288,10 @@ parse_reg (char *src, int *mode, unsigned int *reg) if (src[2] < '0' || src[2] > '9') return NULL; /* Assume no register name but a label starting with 'rh'. */ *mode = CLASS_REG_BYTE; - res = whatreg (reg, src + 2); + res = whatreg (preg, src + 2); if (res == NULL) return NULL; /* Not a valid register name. */ - regno = *reg; + regno = *preg; if (regno > 7) as_bad (_("register rh%d out of range"), regno); } @@ -300,23 +300,23 @@ parse_reg (char *src, int *mode, unsigned int *reg) if (src[2] < '0' || src[2] > '9') return NULL; /* Assume no register name but a label starting with 'rl'. */ *mode = CLASS_REG_BYTE; - res = whatreg (reg, src + 2); + res = whatreg (preg, src + 2); if (res == NULL) return NULL; /* Not a valid register name. */ - regno = *reg; + regno = *preg; if (regno > 7) as_bad (_("register rl%d out of range"), regno); - *reg += 8; + *preg += 8; } else if (src[1] == 'q' || src[1] == 'Q') { if (src[2] < '0' || src[2] > '9') return NULL; /* Assume no register name but a label starting with 'rq'. */ *mode = CLASS_REG_QUAD; - res = whatreg (reg, src + 2); + res = whatreg (preg, src + 2); if (res == NULL) return NULL; /* Not a valid register name. */ - regno = *reg; + regno = *preg; if (regno > 12) as_bad (_("register rq%d out of range"), regno); if (regno & 3) @@ -327,10 +327,10 @@ parse_reg (char *src, int *mode, unsigned int *reg) if (src[1] < '0' || src[1] > '9') return NULL; /* Assume no register name but a label starting with 'r'. */ *mode = CLASS_REG_WORD; - res = whatreg (reg, src + 1); + res = whatreg (preg, src + 1); if (res == NULL) return NULL; /* Not a valid register name. */ - regno = *reg; + regno = *preg; if (regno > 15) as_bad (_("register r%d out of range"), regno); } diff --git a/gas/configure b/gas/configure index f6bbc9797..cbcffc7dc 100755 --- a/gas/configure +++ b/gas/configure @@ -11446,7 +11446,7 @@ fi using_cgen=no -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/gas/doc/Makefile.in b/gas/doc/Makefile.in index 74bdb7eac..c148176cb 100644 --- a/gas/doc/Makefile.in +++ b/gas/doc/Makefile.in @@ -39,12 +39,15 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(as_TEXINFOS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/zlib.m4 \ $(top_srcdir)/../bfd/warning.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 \ + $(top_srcdir)/../config/plugins.m4 \ $(top_srcdir)/../config/po.m4 \ $(top_srcdir)/../config/progtest.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index dfe24af77..93e011f45 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -1716,7 +1716,6 @@ cfi_finish (void) for (fde = all_fde_data; fde ; fde = fde->next) { struct cfi_insn_data *first; - struct cie_entry *cie; if (fde->end_address == NULL) { diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 42d7267ff..4061c7289 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -216,12 +216,12 @@ static unsigned int get_filenum (const char *, unsigned int); static void generic_dwarf2_emit_offset (symbolS *symbol, unsigned int size) { - expressionS expr; + expressionS exp; - expr.X_op = O_symbol; - expr.X_add_symbol = symbol; - expr.X_add_number = 0; - emit_expr (&expr, size); + exp.X_op = O_symbol; + exp.X_add_symbol = symbol; + exp.X_add_number = 0; + emit_expr (&exp, size); } #endif @@ -235,7 +235,7 @@ get_line_subseg (segT seg, subsegT subseg) static struct line_subseg *last_line_subseg; struct line_seg *s; - struct line_subseg **pss, *ss; + struct line_subseg **pss, *lss; if (seg == last_seg && subseg == last_subseg) return last_line_subseg; @@ -253,27 +253,27 @@ get_line_subseg (segT seg, subsegT subseg) } gas_assert (seg == s->seg); - for (pss = &s->head; (ss = *pss) != NULL ; pss = &ss->next) + for (pss = &s->head; (lss = *pss) != NULL ; pss = &lss->next) { - if (ss->subseg == subseg) + if (lss->subseg == subseg) goto found_subseg; - if (ss->subseg > subseg) + if (lss->subseg > subseg) break; } - ss = (struct line_subseg *) xmalloc (sizeof (*ss)); - ss->next = *pss; - ss->subseg = subseg; - ss->head = NULL; - ss->ptail = &ss->head; - *pss = ss; + lss = (struct line_subseg *) xmalloc (sizeof (*lss)); + lss->next = *pss; + lss->subseg = subseg; + lss->head = NULL; + lss->ptail = &lss->head; + *pss = lss; found_subseg: last_seg = seg; last_subseg = subseg; - last_line_subseg = ss; + last_line_subseg = lss; - return ss; + return lss; } /* Record an entry for LOC occurring at LABEL. */ @@ -281,7 +281,7 @@ get_line_subseg (segT seg, subsegT subseg) static void dwarf2_gen_line_info_1 (symbolS *label, struct dwarf2_line_info *loc) { - struct line_subseg *ss; + struct line_subseg *lss; struct line_entry *e; e = (struct line_entry *) xmalloc (sizeof (*e)); @@ -289,9 +289,9 @@ dwarf2_gen_line_info_1 (symbolS *label, struct dwarf2_line_info *loc) e->label = label; e->loc = *loc; - ss = get_line_subseg (now_seg, now_subseg); - *ss->ptail = e; - ss->ptail = &e->next; + lss = get_line_subseg (now_seg, now_subseg); + *lss->ptail = e; + lss->ptail = &e->next; } /* Record an entry for LOC occurring at OFS within the current fragment. */ @@ -813,16 +813,16 @@ get_frag_fix (fragS *frag, segT seg) static void out_set_addr (symbolS *sym) { - expressionS expr; + expressionS exp; out_opcode (DW_LNS_extended_op); out_uleb128 (sizeof_address + 1); out_opcode (DW_LNE_set_address); - expr.X_op = O_symbol; - expr.X_add_symbol = sym; - expr.X_add_number = 0; - emit_expr (&expr, sizeof_address); + exp.X_op = O_symbol; + exp.X_add_symbol = sym; + exp.X_add_number = 0; + emit_expr (&exp, sizeof_address); } #if DWARF2_LINE_MIN_INSN_LENGTH > 1 @@ -1052,7 +1052,7 @@ static void emit_fixed_inc_line_addr (int line_delta, addressT addr_delta, fragS *frag, char *p, int len) { - expressionS *exp; + expressionS *pexp; segT line_seg; char *end = p + len; @@ -1067,7 +1067,7 @@ emit_fixed_inc_line_addr (int line_delta, addressT addr_delta, fragS *frag, p += output_leb128 (p, line_delta, 1); } - exp = symbol_get_value_expression (frag->fr_symbol); + pexp = symbol_get_value_expression (frag->fr_symbol); line_seg = subseg_get (".debug_line", 0); /* The DW_LNS_fixed_advance_pc opcode has a 2-byte operand so it can @@ -1078,26 +1078,26 @@ emit_fixed_inc_line_addr (int line_delta, addressT addr_delta, fragS *frag, if (addr_delta > 50000) { symbolS *to_sym; - expressionS expr; + expressionS exp; - gas_assert (exp->X_op = O_subtract); - to_sym = exp->X_add_symbol; + gas_assert (pexp->X_op = O_subtract); + to_sym = pexp->X_add_symbol; *p++ = DW_LNS_extended_op; p += output_leb128 (p, sizeof_address + 1, 0); *p++ = DW_LNE_set_address; - expr.X_op = O_symbol; - expr.X_add_symbol = to_sym; - expr.X_add_number = 0; + exp.X_op = O_symbol; + exp.X_add_symbol = to_sym; + exp.X_add_number = 0; subseg_change (line_seg, 0); - emit_expr_fix (&expr, sizeof_address, frag, p); + emit_expr_fix (&exp, sizeof_address, frag, p); p += sizeof_address; } else { *p++ = DW_LNS_fixed_advance_pc; subseg_change (line_seg, 0); - emit_expr_fix (exp, 2, frag, p); + emit_expr_fix (pexp, 2, frag, p); p += 2; } @@ -1119,13 +1119,13 @@ emit_fixed_inc_line_addr (int line_delta, addressT addr_delta, fragS *frag, static void relax_inc_line_addr (int line_delta, symbolS *to_sym, symbolS *from_sym) { - expressionS expr; + expressionS exp; int max_chars; - expr.X_op = O_subtract; - expr.X_add_symbol = to_sym; - expr.X_op_symbol = from_sym; - expr.X_add_number = 0; + exp.X_op = O_subtract; + exp.X_add_symbol = to_sym; + exp.X_op_symbol = from_sym; + exp.X_add_number = 0; /* The maximum size of the frag is the line delta with a maximum sized address delta. */ @@ -1136,7 +1136,7 @@ relax_inc_line_addr (int line_delta, symbolS *to_sym, symbolS *from_sym) max_chars = size_inc_line_addr (line_delta, -DWARF2_LINE_MIN_INSN_LENGTH); frag_var (rs_dwarf2dbg, max_chars, max_chars, 1, - make_expr_symbol (&expr), line_delta, NULL); + make_expr_symbol (&exp), line_delta, NULL); } /* The function estimates the size of a rs_dwarf2dbg variant frag @@ -1368,7 +1368,7 @@ out_file_list (void) to the end of the section. */ static int -out_header (asection *sec, expressionS *expr) +out_header (asection *sec, expressionS *exp) { symbolS *start_sym; symbolS *end_sym; @@ -1378,26 +1378,26 @@ out_header (asection *sec, expressionS *expr) end_sym = symbol_temp_make (); /* Total length of the information. */ - expr->X_op = O_subtract; - expr->X_add_symbol = end_sym; - expr->X_op_symbol = start_sym; + exp->X_op = O_subtract; + exp->X_add_symbol = end_sym; + exp->X_op_symbol = start_sym; switch (DWARF2_FORMAT (sec)) { case dwarf2_format_32bit: - expr->X_add_number = -4; - emit_expr (expr, 4); + exp->X_add_number = -4; + emit_expr (exp, 4); return 4; case dwarf2_format_64bit: - expr->X_add_number = -12; + exp->X_add_number = -12; out_four (-1); - emit_expr (expr, 8); + emit_expr (exp, 8); return 8; case dwarf2_format_64bit_irix: - expr->X_add_number = -8; - emit_expr (expr, 8); + exp->X_add_number = -8; + emit_expr (exp, 8); return 8; } @@ -1410,23 +1410,23 @@ out_header (asection *sec, expressionS *expr) static void out_debug_line (segT line_seg) { - expressionS expr; + expressionS exp; symbolS *prologue_end; symbolS *line_end; struct line_seg *s; int sizeof_offset; - sizeof_offset = out_header (line_seg, &expr); - line_end = expr.X_add_symbol; + sizeof_offset = out_header (line_seg, &exp); + line_end = exp.X_add_symbol; /* Version. */ out_two (2); /* Length of the prologue following this length. */ prologue_end = symbol_temp_make (); - expr.X_add_symbol = prologue_end; - expr.X_add_number = - (4 + 2 + 4); - emit_expr (&expr, sizeof_offset); + exp.X_add_symbol = prologue_end; + exp.X_add_number = - (4 + 2 + 4); + emit_expr (&exp, sizeof_offset); /* Parameters of the state machine. */ out_byte (DWARF2_LINE_MIN_INSN_LENGTH); @@ -1465,7 +1465,7 @@ out_debug_ranges (segT ranges_seg) { unsigned int addr_size = sizeof_address; struct line_seg *s; - expressionS expr; + expressionS exp; unsigned int i; subseg_set (ranges_seg, 0); @@ -1490,15 +1490,15 @@ out_debug_ranges (segT ranges_seg) end = symbol_temp_new (s->seg, get_frag_fix (frag, s->seg), frag); s->text_end = end; - expr.X_op = O_symbol; - expr.X_add_symbol = beg; - expr.X_add_number = 0; - emit_expr (&expr, addr_size); + exp.X_op = O_symbol; + exp.X_add_symbol = beg; + exp.X_add_number = 0; + emit_expr (&exp, addr_size); - expr.X_op = O_symbol; - expr.X_add_symbol = end; - expr.X_add_number = 0; - emit_expr (&expr, addr_size); + exp.X_op = O_symbol; + exp.X_add_symbol = end; + exp.X_add_number = 0; + emit_expr (&exp, addr_size); } /* End of Range Entry. */ @@ -1515,13 +1515,13 @@ out_debug_aranges (segT aranges_seg, segT info_seg) { unsigned int addr_size = sizeof_address; struct line_seg *s; - expressionS expr; + expressionS exp; symbolS *aranges_end; char *p; int sizeof_offset; - sizeof_offset = out_header (aranges_seg, &expr); - aranges_end = expr.X_add_symbol; + sizeof_offset = out_header (aranges_seg, &exp); + aranges_end = exp.X_add_symbol; /* Version. */ out_two (2); @@ -1551,16 +1551,16 @@ out_debug_aranges (segT aranges_seg, segT info_seg) end = symbol_temp_new (s->seg, get_frag_fix (frag, s->seg), frag); s->text_end = end; - expr.X_op = O_symbol; - expr.X_add_symbol = beg; - expr.X_add_number = 0; - emit_expr (&expr, addr_size); + exp.X_op = O_symbol; + exp.X_add_symbol = beg; + exp.X_add_number = 0; + emit_expr (&exp, addr_size); - expr.X_op = O_subtract; - expr.X_add_symbol = end; - expr.X_op_symbol = beg; - expr.X_add_number = 0; - emit_expr (&expr, addr_size); + exp.X_op = O_subtract; + exp.X_add_symbol = end; + exp.X_op_symbol = beg; + exp.X_add_number = 0; + emit_expr (&exp, addr_size); } p = frag_more (2 * addr_size); @@ -1617,14 +1617,14 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT ranges_seg) char producer[128]; const char *comp_dir; const char *dirname; - expressionS expr; + expressionS exp; symbolS *info_end; char *p; int len; int sizeof_offset; - sizeof_offset = out_header (info_seg, &expr); - info_end = expr.X_add_symbol; + sizeof_offset = out_header (info_seg, &exp); + info_end = exp.X_add_symbol; /* DWARF version. */ out_two (2); @@ -1647,16 +1647,16 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT ranges_seg) if (all_segs->next == NULL) { /* DW_AT_low_pc */ - expr.X_op = O_symbol; - expr.X_add_symbol = all_segs->text_start; - expr.X_add_number = 0; - emit_expr (&expr, sizeof_address); + exp.X_op = O_symbol; + exp.X_add_symbol = all_segs->text_start; + exp.X_add_number = 0; + emit_expr (&exp, sizeof_address); /* DW_AT_high_pc */ - expr.X_op = O_symbol; - expr.X_add_symbol = all_segs->text_end; - expr.X_add_number = 0; - emit_expr (&expr, sizeof_address); + exp.X_op = O_symbol; + exp.X_add_symbol = all_segs->text_end; + exp.X_add_number = 0; + emit_expr (&exp, sizeof_address); } else { @@ -1750,13 +1750,13 @@ dwarf2_finish (void) /* For each subsection, chain the debug entries together. */ for (s = all_segs; s; s = s->next) { - struct line_subseg *ss = s->head; - struct line_entry **ptail = ss->ptail; + struct line_subseg *lss = s->head; + struct line_entry **ptail = lss->ptail; - while ((ss = ss->next) != NULL) + while ((lss = lss->next) != NULL) { - *ptail = ss->head; - ptail = ss->ptail; + *ptail = lss->head; + ptail = lss->ptail; } } diff --git a/gas/expr.c b/gas/expr.c index fbfdffc67..fe2b81b0d 100644 --- a/gas/expr.c +++ b/gas/expr.c @@ -1587,13 +1587,13 @@ operatorf (int *num_chars) if (is_name_beginner (c)) { char *name = input_line_pointer; - char c = get_symbol_end (); + char ec = get_symbol_end (); - ret = md_operator (name, 2, &c); + ret = md_operator (name, 2, &ec); switch (ret) { case O_absent: - *input_line_pointer = c; + *input_line_pointer = ec; input_line_pointer = name; break; case O_uminus: @@ -1603,7 +1603,7 @@ operatorf (int *num_chars) ret = O_illegal; /* FALLTHROUGH */ default: - *input_line_pointer = c; + *input_line_pointer = ec; *num_chars = input_line_pointer - name; input_line_pointer = name; return ret; diff --git a/gas/hash.c b/gas/hash.c index 9d71ba8d4..6fc8543a9 100644 --- a/gas/hash.c +++ b/gas/hash.c @@ -1,6 +1,6 @@ /* hash.c -- gas hash table code Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, - 2000, 2001, 2002, 2003, 2005, 2007, 2008 + 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -90,16 +90,16 @@ get_gas_hash_table_size (void) { 1021, 4051, 8599, 16699, 65537 }; - unsigned int index; + unsigned int hindex; /* Work out the best prime number near the hash_size. FIXME: This could be a more sophisticated algorithm, but is it really worth implementing it ? */ - for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index) - if (gas_hash_table_size <= hash_size_primes[index]) + for (hindex = 0; hindex < ARRAY_SIZE (hash_size_primes) - 1; ++ hindex) + if (gas_hash_table_size <= hash_size_primes[hindex]) break; - return hash_size_primes[index]; + return hash_size_primes[hindex]; } /* Create a hash table. This return a control block. */ @@ -157,7 +157,7 @@ hash_lookup (struct hash_control *table, const char *key, size_t len, unsigned long hash; size_t n; unsigned int c; - unsigned int index; + unsigned int hindex; struct hash_entry **list; struct hash_entry *p; struct hash_entry *prev; @@ -179,8 +179,8 @@ hash_lookup (struct hash_control *table, const char *key, size_t len, if (phash != NULL) *phash = hash; - index = hash % table->size; - list = table->table + index; + hindex = hash % table->size; + list = table->table + hindex; if (plist != NULL) *plist = list; @@ -223,7 +223,7 @@ hash_lookup (struct hash_control *table, const char *key, size_t len, hash table. */ const char * -hash_insert (struct hash_control *table, const char *key, void *value) +hash_insert (struct hash_control *table, const char *key, void *val) { struct hash_entry *p; struct hash_entry **list; @@ -240,7 +240,7 @@ hash_insert (struct hash_control *table, const char *key, void *value) p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p)); p->string = key; p->hash = hash; - p->data = value; + p->data = val; p->next = *list; *list = p; @@ -253,7 +253,7 @@ hash_insert (struct hash_control *table, const char *key, void *value) error. If an entry already exists, its value is replaced. */ const char * -hash_jam (struct hash_control *table, const char *key, void *value) +hash_jam (struct hash_control *table, const char *key, void *val) { struct hash_entry *p; struct hash_entry **list; @@ -266,7 +266,7 @@ hash_jam (struct hash_control *table, const char *key, void *value) ++table->replacements; #endif - p->data = value; + p->data = val; } else { @@ -277,7 +277,7 @@ hash_jam (struct hash_control *table, const char *key, void *value) p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p)); p->string = key; p->hash = hash; - p->data = value; + p->data = val; p->next = *list; *list = p; diff --git a/gas/listing.c b/gas/listing.c index 25178b363..93f2b3705 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -1043,9 +1043,9 @@ print_source (file_info_type * current_file, while (current_file->linenum < list->hll_line && !current_file->at_end) { - cached_line * cache = cached_lines + next_free_line; char *p; + cache = cached_lines + next_free_line; cache->file = current_file; cache->line = current_file->linenum; cache->buffer[0] = 0; diff --git a/gas/macro.c b/gas/macro.c index f77be59ad..b5c1824d2 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -75,14 +75,14 @@ static int macro_number; void macro_init (int alternate, int mri, int strip_at, - int (*expr) (const char *, int, sb *, int *)) + int (*exp) (const char *, int, sb *, int *)) { macro_hash = hash_new (); macro_defined = 0; macro_alternate = alternate; macro_mri = mri; macro_strip_at = strip_at; - macro_expr = expr; + macro_expr = exp; } /* Switch in and out of alternate mode on the fly. */ @@ -1204,7 +1204,7 @@ check_macro (const char *line, sb *expand, const char **error, macro_entry **info) { const char *s; - char *copy, *cs; + char *copy, *cls; macro_entry *macro; sb line_sb; @@ -1221,8 +1221,8 @@ check_macro (const char *line, sb *expand, copy = (char *) alloca (s - line + 1); memcpy (copy, line, s - line); copy[s - line] = '\0'; - for (cs = copy; *cs != '\0'; cs++) - *cs = TOLOWER (*cs); + for (cls = copy; *cls != '\0'; cls ++) + *cls = TOLOWER (*cls); macro = (macro_entry *) hash_find (macro_hash, copy); diff --git a/gas/read.c b/gas/read.c index fb9fd290f..9f75fee61 100644 --- a/gas/read.c +++ b/gas/read.c @@ -589,9 +589,9 @@ try_macro (char term, const char *line) void read_a_source_file (char *name) { - register char c; - register char *s; /* String of symbol, '\0' appended. */ - register int temp; + char c; + char *s; /* String of symbol, '\0' appended. */ + int temp; pseudo_typeS *pop; #ifdef WARN_COMMENTS @@ -680,7 +680,6 @@ read_a_source_file (char *name) if (is_name_beginner (*input_line_pointer)) { char *line_start = input_line_pointer; - char c; int mri_line_macro; HANDLE_CONDITIONAL_ASSEMBLY (); @@ -3198,12 +3197,12 @@ s_space (int mult) } else if (mri_common_symbol != NULL) { - valueT val; + valueT mri_val; - val = S_GET_VALUE (mri_common_symbol); - if ((val & 1) != 0) + mri_val = S_GET_VALUE (mri_common_symbol); + if ((mri_val & 1) != 0) { - S_SET_VALUE (mri_common_symbol, val + 1); + S_SET_VALUE (mri_common_symbol, mri_val + 1); if (line_label != NULL) { expressionS *symexp; diff --git a/gas/stabs.c b/gas/stabs.c index da399ad59..d19bf2b9c 100644 --- a/gas/stabs.c +++ b/gas/stabs.c @@ -1,6 +1,6 @@ /* Generic stabs parsing for gas. Copyright 1989, 1990, 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2001 - 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -517,7 +517,7 @@ generate_asm_file (int type, char *file) char sym[30]; char *buf; char *tmp = file; - char *endp = file + strlen (file); + char *file_endp = file + strlen (file); char *bufp; if (last_file != NULL @@ -540,7 +540,7 @@ generate_asm_file (int type, char *file) *bufp++ = '"'; - while (tmp < endp) + while (tmp < file_endp) { char *bslash = strchr (tmp, '\\'); size_t len = (bslash) ? (size_t) (bslash - tmp + 1) : strlen (tmp); diff --git a/gas/symbols.c b/gas/symbols.c index 5eda2cbbd..9202a9b31 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -188,7 +188,7 @@ static unsigned long local_symbol_conversion_count; /* Create a local symbol and insert it into the local hash table. */ static struct local_symbol * -local_symbol_make (const char *name, segT section, valueT value, fragS *frag) +local_symbol_make (const char *name, segT section, valueT val, fragS *frag) { char *name_copy; struct local_symbol *ret; @@ -202,7 +202,7 @@ local_symbol_make (const char *name, segT section, valueT value, fragS *frag) ret->lsy_name = name_copy; ret->lsy_section = section; local_symbol_set_frag (ret, frag); - ret->lsy_value = value; + ret->lsy_value = val; hash_jam (local_hash, name_copy, (void *) ret); @@ -1484,21 +1484,21 @@ snapshot_symbol (symbolS **symbolPP, valueT *valueP, segT *segP, fragS **fragPP) } else { - expressionS expr = symbolP->sy_value; + expressionS exp = symbolP->sy_value; - if (!symbolP->sy_resolved && expr.X_op != O_illegal) + if (!symbolP->sy_resolved && exp.X_op != O_illegal) { int resolved; if (symbolP->sy_resolving) return 0; symbolP->sy_resolving = 1; - resolved = resolve_expression (&expr); + resolved = resolve_expression (&exp); symbolP->sy_resolving = 0; if (!resolved) return 0; - switch (expr.X_op) + switch (exp.X_op) { case O_constant: case O_register: @@ -1507,7 +1507,7 @@ snapshot_symbol (symbolS **symbolPP, valueT *valueP, segT *segP, fragS **fragPP) /* Fall thru. */ case O_symbol: case O_symbol_rva: - symbolP = expr.X_add_symbol; + symbolP = exp.X_add_symbol; break; default: return 0; @@ -1515,12 +1515,12 @@ snapshot_symbol (symbolS **symbolPP, valueT *valueP, segT *segP, fragS **fragPP) } *symbolPP = symbolP; - *valueP = expr.X_add_number; + *valueP = exp.X_add_number; *segP = symbolP->bsym->section; *fragPP = symbolP->sy_frag; if (*segP == expr_section) - switch (expr.X_op) + switch (exp.X_op) { case O_constant: *segP = absolute_section; break; case O_register: *segP = reg_section; break; @@ -1862,17 +1862,17 @@ decode_local_label_name (char *s) int instance_number; char *type; const char *message_format; - int index = 0; + int lindex = 0; #ifdef LOCAL_LABEL_PREFIX - if (s[index] == LOCAL_LABEL_PREFIX) - ++index; + if (s[lindex] == LOCAL_LABEL_PREFIX) + ++lindex; #endif - if (s[index] != 'L') + if (s[lindex] != 'L') return s; - for (label_number = 0, p = s + index + 1; ISDIGIT (*p); ++p) + for (label_number = 0, p = s + lindex + 1; ISDIGIT (*p); ++p) label_number = (10 * label_number) + *p - '0'; if (*p == DOLLAR_LABEL_CHAR) diff --git a/gas/write.c b/gas/write.c index 8adb87b94..1ded21f94 100644 --- a/gas/write.c +++ b/gas/write.c @@ -1787,22 +1787,24 @@ write_object_file (void) if (symbol_equated_reloc_p (symp) || S_IS_WEAKREFR (symp)) { - const char *name = S_GET_NAME (symp); + const char *sname = S_GET_NAME (symp); + if (S_IS_COMMON (symp) - && !TC_FAKE_LABEL (name) + && !TC_FAKE_LABEL (sname) && !S_IS_WEAKREFR (symp) && (!S_IS_EXTERNAL (symp) || S_IS_LOCAL (symp))) { expressionS *e = symbol_get_value_expression (symp); + as_bad (_("Local symbol `%s' can't be equated to common symbol `%s'"), - name, S_GET_NAME (e->X_add_symbol)); + sname, S_GET_NAME (e->X_add_symbol)); } if (S_GET_SEGMENT (symp) == reg_section) { /* Report error only if we know the symbol name. */ if (S_GET_NAME (symp) != reg_section->name) as_bad (_("can't make global register symbol `%s'"), - name); + sname); } symbol_remove (symp, &symbol_rootP, &symbol_lastP); continue; diff --git a/gold/ChangeLog b/gold/ChangeLog index 5801a5c64..139dca5ab 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,54 @@ +2009-12-11 Nick Clifton + + * archive.cc: Fix shadowed variable warnings. + * arm.cc: Likewise. + * compressed_output.cc: Likewise. + * compressed_output.h: Likewise. + * configure: Likewise. + * dwarf_reader.cc: Likewise. + * dynobj.cc: Likewise. + * dynobj.h: Likewise. + * ehframe.cc: Likewise. + * ehframe.h: Likewise. + * errors.cc: Likewise. + * expression.cc: Likewise. + * fileread.cc: Likewise. + * fileread.h: Likewise. + * freebsd.h: Likewise. + * i386.cc: Likewise. + * icf.cc: Likewise. + * incremental.h: Likewise. + * layout.cc: Likewise. + * layout.h: Likewise. + * mapfile.cc: Likewise. + * merge.cc: Likewise. + * merge.h: Likewise. + * object.cc: Likewise. + * object.h: Likewise. + * options.h: Likewise. + * output.cc: Likewise. + * output.h: Likewise. + * parameters.cc: Likewise. + * plugin.cc: Likewise. + * powerpc.cc: Likewise. + * reduced_debug_output.cc: Likewise. + * reduced_debug_output.h: Likewise. + * reloc.cc: Likewise. + * reloc.h: Likewise. + * resolve.cc: Likewise. + * script-sections.cc: Likewise. + * script.cc: Likewise. + * script.h: Likewise. + * sparc.cc: Likewise. + * symtab.cc: Likewise. + * symtab.h: Likewise. + * target-select.cc: Likewise. + * target-select.h: Likewise. + * token.h: Likewise. + * workqueue.cc: Likewise. + * workqueue.h: Likewise. + * x86_64.cc: Likewise. + 2009-12-10 Doug Kwan * arm.cc (attributes.h): New include. diff --git a/gold/archive.cc b/gold/archive.cc index 569a491ae..7c82ca0aa 100644 --- a/gold/archive.cc +++ b/gold/archive.cc @@ -83,15 +83,15 @@ const char Archive::armagt[sarmag] = const char Archive::arfmag[2] = { '`', '\n' }; -Archive::Archive(const std::string& name, Input_file* input_file, - bool is_thin_archive, Dirsearch* dirpath, Task* task) - : name_(name), input_file_(input_file), armap_(), armap_names_(), +Archive::Archive(const std::string& aname, Input_file* ainput_file, + bool is_a_thin_archive, Dirsearch* dirpath, Task* task) + : name_(aname), input_file_(ainput_file), armap_(), armap_names_(), extended_names_(), armap_checked_(), seen_offsets_(), members_(), - is_thin_archive_(is_thin_archive), included_member_(false), + is_thin_archive_(is_a_thin_archive), included_member_(false), nested_archives_(), dirpath_(dirpath), task_(task), num_members_(0) { this->no_export_ = - parameters->options().check_excluded_libs(input_file->found_name()); + parameters->options().check_excluded_libs(ainput_file->found_name()); } // Set up the archive: read the symbol map and the extended name @@ -247,9 +247,9 @@ Archive::interpret_header(const Archive_header* hdr, off_t off, *ps = '\0'; errno = 0; - char* end; - off_t member_size = strtol(size_string, &end, 10); - if (*end != '\0' + char* hend; + off_t member_size = strtol(size_string, &hend, 10); + if (*hend != '\0' || member_size < 0 || (member_size == LONG_MAX && errno == ERANGE)) { @@ -285,11 +285,11 @@ Archive::interpret_header(const Archive_header* hdr, off_t off, else { errno = 0; - long x = strtol(hdr->ar_name + 1, &end, 10); + long x = strtol(hdr->ar_name + 1, &hend, 10); long y = 0; - if (*end == ':') - y = strtol(end + 1, &end, 10); - if (*end != ' ' + if (*hend == ':') + y = strtol(hend + 1, &hend, 10); + if (*hend != ' ' || x < 0 || (x == LONG_MAX && errno == ERANGE) || static_cast(x) >= this->extended_names_.size()) @@ -299,16 +299,16 @@ Archive::interpret_header(const Archive_header* hdr, off_t off, return this->input_file_->file().filesize() - off; } - const char* name = this->extended_names_.data() + x; - const char* name_end = strchr(name, '\n'); - if (static_cast(name_end - name) > this->extended_names_.size() + const char* name_start = this->extended_names_.data() + x; + const char* name_end = strchr(name_start, '\n'); + if (static_cast(name_end - name_start) > this->extended_names_.size() || name_end[-1] != '/') { gold_error(_("%s: bad extended name entry at header %zu"), this->name().c_str(), static_cast(off)); return this->input_file_->file().filesize() - off; } - pname->assign(name, name_end - 1 - name); + pname->assign(name_start, name_end - 1 - name_start); if (nested_off != NULL) *nested_off = y; } @@ -452,14 +452,14 @@ Archive::end() // to the name of the archive member. Return TRUE on success. bool -Archive::get_file_and_offset(off_t off, Input_file** input_file, off_t* memoff, +Archive::get_file_and_offset(off_t off, Input_file** in_file, off_t* memoff, off_t* memsize, std::string* member_name) { off_t nested_off; *memsize = this->read_header(off, false, member_name, &nested_off); - *input_file = this->input_file_; + *in_file = this->input_file_; *memoff = off + static_cast(sizeof(Archive_header)); if (!this->is_thin_archive_) @@ -492,18 +492,18 @@ Archive::get_file_and_offset(off_t off, Input_file** input_file, off_t* memoff, new Input_file_argument(member_name->c_str(), Input_file_argument::INPUT_FILE_TYPE_FILE, "", false, parameters->options()); - *input_file = new Input_file(input_file_arg); + *in_file = new Input_file(input_file_arg); int dummy = 0; - if (!(*input_file)->open(*this->dirpath_, this->task_, &dummy)) + if (!(*in_file)->open(*this->dirpath_, this->task_, &dummy)) return false; - arch = new Archive(*member_name, *input_file, false, this->dirpath_, + arch = new Archive(*member_name, *in_file, false, this->dirpath_, this->task_); arch->setup(); std::pair ins = this->nested_archives_.insert(std::make_pair(*member_name, arch)); gold_assert(ins.second); } - return arch->get_file_and_offset(nested_off, input_file, memoff, + return arch->get_file_and_offset(nested_off, in_file, memoff, memsize, member_name); } @@ -513,13 +513,13 @@ Archive::get_file_and_offset(off_t off, Input_file** input_file, off_t* memoff, new Input_file_argument(member_name->c_str(), Input_file_argument::INPUT_FILE_TYPE_FILE, "", false, this->input_file_->options()); - *input_file = new Input_file(input_file_arg); + *in_file = new Input_file(input_file_arg); int dummy = 0; - if (!(*input_file)->open(*this->dirpath_, this->task_, &dummy)) + if (!(*in_file)->open(*this->dirpath_, this->task_, &dummy)) return false; *memoff = 0; - *memsize = (*input_file)->file().filesize(); + *memsize = (*in_file)->file().filesize(); return true; } @@ -532,17 +532,17 @@ Archive::get_elf_object_for_member(off_t off, bool* punconfigured) { *punconfigured = false; - Input_file* input_file; + Input_file* in_file; off_t memoff; off_t memsize; std::string member_name; - if (!this->get_file_and_offset(off, &input_file, &memoff, &memsize, + if (!this->get_file_and_offset(off, &in_file, &memoff, &memsize, &member_name)) return NULL; if (parameters->options().has_plugins()) { - Object* obj = parameters->options().plugins()->claim_file(input_file, + Object* obj = parameters->options().plugins()->claim_file(in_file, memoff, memsize); if (obj != NULL) @@ -555,7 +555,7 @@ Archive::get_elf_object_for_member(off_t off, bool* punconfigured) const unsigned char* ehdr; int read_size; - if (!is_elf_object(input_file, memoff, &ehdr, &read_size)) + if (!is_elf_object(in_file, memoff, &ehdr, &read_size)) { gold_error(_("%s: member at %zu is not an ELF object"), this->name().c_str(), static_cast(off)); @@ -564,7 +564,7 @@ Archive::get_elf_object_for_member(off_t off, bool* punconfigured) Object *obj = make_elf_object((std::string(this->input_file_->filename()) + "(" + member_name + ")"), - input_file, memoff, ehdr, read_size, + in_file, memoff, ehdr, read_size, punconfigured); if (obj == NULL) return NULL; diff --git a/gold/arm.cc b/gold/arm.cc index 03cc69798..f69593e6c 100644 --- a/gold/arm.cc +++ b/gold/arm.cc @@ -210,8 +210,8 @@ class Insn_template // We make the constructor private to ensure that only the factory // methods are used. inline - Insn_template(unsigned data, Type type, unsigned int r_type, int reloc_addend) - : data_(data), type_(type), r_type_(r_type), reloc_addend_(reloc_addend) + Insn_template(unsigned adata, Type atype, unsigned int rtype, int relocaddend) + : data_(adata), type_(atype), r_type_(rtype), reloc_addend_(relocaddend) { } // Instruction specific data. This is used to store information like @@ -373,8 +373,8 @@ class Stub static_cast(-1); public: - Stub(const Stub_template* stub_template) - : stub_template_(stub_template), offset_(invalid_offset) + Stub(const Stub_template* stubtemplate) + : stub_template_(stubtemplate), offset_(invalid_offset) { } virtual @@ -396,8 +396,8 @@ class Stub // Set offset of code stub from beginning of its containing stub table. void - set_offset(section_offset_type offset) - { this->offset_ = offset; } + set_offset(section_offset_type off) + { this->offset_ = off; } // Return the relocation target address of the i-th relocation in the // stub. This must be defined in a child class. @@ -475,20 +475,20 @@ class Reloc_stub : public Stub // If SYMBOL is not null, this is a global symbol, we ignore RELOBJ and // R_SYM. Otherwise, this is a local symbol and RELOBJ must non-NULL // and R_SYM must not be invalid_index. - Key(Stub_type stub_type, const Symbol* symbol, const Relobj* relobj, - unsigned int r_sym, int32_t addend) - : stub_type_(stub_type), addend_(addend) + Key(Stub_type stubtype, const Symbol* sym, const Relobj* rel_obj, + unsigned int rsym, int32_t addend) + : stub_type_(stubtype), addend_(addend) { - if (symbol != NULL) + if (sym != NULL) { this->r_sym_ = Reloc_stub::invalid_index; - this->u_.symbol = symbol; + this->u_.symbol = sym; } else { - gold_assert(relobj != NULL && r_sym != invalid_index); - this->r_sym_ = r_sym; - this->u_.relobj = relobj; + gold_assert(rel_obj != NULL && rsym != invalid_index); + this->r_sym_ = rsym; + this->u_.relobj = rel_obj; } } @@ -585,8 +585,8 @@ class Reloc_stub : public Stub protected: // Reloc_stubs are created via a stub factory. So these are protected. - Reloc_stub(const Stub_template* stub_template) - : Stub(stub_template), destination_address_(invalid_address) + Reloc_stub(const Stub_template* stubtemplate) + : Stub(stubtemplate), destination_address_(invalid_address) { } ~Reloc_stub() @@ -660,8 +660,8 @@ template class Stub_table : public Output_data { public: - Stub_table(Arm_input_section* owner) - : Output_data(), addralign_(1), owner_(owner), has_been_changed_(false), + Stub_table(Arm_input_section* own) + : Output_data(), addralign_(1), owner_(own), has_been_changed_(false), reloc_stubs_() { } @@ -755,8 +755,8 @@ template class Arm_input_section : public Output_relaxed_input_section { public: - Arm_input_section(Relobj* relobj, unsigned int shndx) - : Output_relaxed_input_section(relobj, shndx, 1), + Arm_input_section(Relobj* rel_obj, unsigned int sec_shndx) + : Output_relaxed_input_section(rel_obj, sec_shndx, 1), original_addralign_(1), original_size_(0), stub_table_(NULL) { } @@ -779,8 +779,8 @@ class Arm_input_section : public Output_relaxed_input_section // Set the stub_table. void - set_stub_table(Stub_table* stub_table) - { this->stub_table_ = stub_table; } + set_stub_table(Stub_table* stubtable) + { this->stub_table_ = stubtable; } // Downcast a base pointer to an Arm_input_section pointer. This is // not type-safe but we only use Arm_input_section not the base class. @@ -814,17 +814,17 @@ class Arm_input_section : public Output_relaxed_input_section // Output offset. bool - do_output_offset(const Relobj* object, unsigned int shndx, - section_offset_type offset, + do_output_offset(const Relobj* object, unsigned int sec_shndx, + section_offset_type off, section_offset_type* poutput) const { if ((object == this->relobj()) - && (shndx == this->shndx()) - && (offset >= 0) - && (convert_types(offset) + && (sec_shndx == this->shndx()) + && (off >= 0) + && (convert_types(off) <= this->original_size_)) { - *poutput = offset; + *poutput = off; return true; } else @@ -851,9 +851,9 @@ template class Arm_output_section : public Output_section { public: - Arm_output_section(const char* name, elfcpp::Elf_Word type, - elfcpp::Elf_Xword flags) - : Output_section(name, type, flags) + Arm_output_section(const char* aname, elfcpp::Elf_Word atype, + elfcpp::Elf_Xword xflags) + : Output_section(aname, atype, xflags) { } ~Arm_output_section() @@ -890,9 +890,9 @@ class Arm_relobj : public Sized_relobj<32, big_endian> public: static const Arm_address invalid_address = static_cast(-1); - Arm_relobj(const std::string& name, Input_file* input_file, off_t offset, + Arm_relobj(const std::string& aname, Input_file* inputfile, off_t off, const typename elfcpp::Ehdr<32, big_endian>& ehdr) - : Sized_relobj<32, big_endian>(name, input_file, offset, ehdr), + : Sized_relobj<32, big_endian>(aname, inputfile, off, ehdr), stub_tables_(), local_symbol_is_thumb_function_(), attributes_section_data_(NULL) { } @@ -902,18 +902,18 @@ class Arm_relobj : public Sized_relobj<32, big_endian> // Return the stub table of the SHNDX-th section if there is one. Stub_table* - stub_table(unsigned int shndx) const + stub_table(unsigned int sec_shndx) const { - gold_assert(shndx < this->stub_tables_.size()); - return this->stub_tables_[shndx]; + gold_assert(sec_shndx < this->stub_tables_.size()); + return this->stub_tables_[sec_shndx]; } // Set STUB_TABLE to be the stub_table of the SHNDX-th section. void - set_stub_table(unsigned int shndx, Stub_table* stub_table) + set_stub_table(unsigned int sec_shndx, Stub_table* stubtable) { - gold_assert(shndx < this->stub_tables_.size()); - this->stub_tables_[shndx] = stub_table; + gold_assert(sec_shndx < this->stub_tables_.size()); + this->stub_tables_[sec_shndx] = stubtable; } // Whether a local symbol is a THUMB function. R_SYM is the symbol table @@ -932,19 +932,19 @@ class Arm_relobj : public Sized_relobj<32, big_endian> // Convert regular input section with index SHNDX to a relaxed section. void - convert_input_section_to_relaxed_section(unsigned shndx) + convert_input_section_to_relaxed_section(unsigned sec_shndx) { // The stubs have relocations and we need to process them after writing // out the stubs. So relocation now must follow section write. - this->invalidate_section_offset(shndx); + this->invalidate_section_offset(sec_shndx); this->set_relocs_must_follow_section_writes(); } // Downcast a base pointer to an Arm_relobj pointer. This is // not type-safe but we only use Arm_relobj not the base class. static Arm_relobj* - as_arm_relobj(Relobj* relobj) - { return static_cast*>(relobj); } + as_arm_relobj(Relobj* rel_obj) + { return static_cast*>(rel_obj); } // Processor-specific flags in ELF file header. This is valid only after // reading symbols. @@ -1004,10 +1004,10 @@ template class Arm_dynobj : public Sized_dynobj<32, big_endian> { public: - Arm_dynobj(const std::string& name, Input_file* input_file, off_t offset, + Arm_dynobj(const std::string& aname, Input_file* inputfile, off_t off, const elfcpp::Ehdr<32, big_endian>& ehdr) - : Sized_dynobj<32, big_endian>(name, input_file, offset, ehdr), - processor_specific_flags_(0), attributes_section_data_(NULL) + : Sized_dynobj<32, big_endian>(aname, inputfile, off, ehdr), + processor_specific_flags_(0) { } ~Arm_dynobj() @@ -1347,7 +1347,7 @@ class Target_arm : public Sized_target<32, big_endian> // Find the Arm_input_section object corresponding to the SHNDX-th input // section of RELOBJ. Arm_input_section* - find_arm_input_section(Relobj* relobj, unsigned int shndx) const; + find_arm_input_section(Relobj* rel_obj, unsigned int sec_shndx) const; // Make a new Stub_table Stub_table* @@ -1600,12 +1600,12 @@ class Target_arm : public Sized_target<32, big_endian> void copy_reloc(Symbol_table* symtab, Layout* layout, Sized_relobj<32, big_endian>* object, - unsigned int shndx, Output_section* output_section, + unsigned int sec_shndx, Output_section* output_section, Symbol* sym, const elfcpp::Rel<32, big_endian>& reloc) { this->copy_relocs_.copy_reloc(symtab, layout, symtab->get_sized_symbol<32>(sym), - object, shndx, output_section, reloc, + object, sec_shndx, output_section, reloc, this->rel_dyn_section(layout)); } @@ -2369,15 +2369,15 @@ Arm_relocate_functions::arm_branch_common( (thumb_bit != 0)); if (stub_type != arm_stub_none) { - Stub_table* stub_table = + Stub_table* stubtable = object->stub_table(relinfo->data_shndx); - gold_assert(stub_table != NULL); + gold_assert(stubtable != NULL); Reloc_stub::Key stub_key(stub_type, gsym, object, r_sym, addend); - stub = stub_table->find_reloc_stub(stub_key); + stub = stubtable->find_reloc_stub(stub_key); gold_assert(stub != NULL); thumb_bit = stub->stub_template()->entry_in_thumb_mode() ? 1 : 0; - branch_target = stub_table->address() + stub->offset() + addend; + branch_target = stubtable->address() + stub->offset() + addend; branch_offset = branch_target - address; gold_assert((branch_offset <= ARM_MAX_FWD_BRANCH_OFFSET) && (branch_offset >= ARM_MAX_BWD_BRANCH_OFFSET)); @@ -2516,15 +2516,15 @@ Arm_relocate_functions::thumb_branch_common( (thumb_bit != 0)); if (stub_type != arm_stub_none) { - Stub_table* stub_table = + Stub_table* stubtable = object->stub_table(relinfo->data_shndx); - gold_assert(stub_table != NULL); + gold_assert(stubtable != NULL); Reloc_stub::Key stub_key(stub_type, gsym, object, r_sym, addend); - Reloc_stub* stub = stub_table->find_reloc_stub(stub_key); + Reloc_stub* stub = stubtable->find_reloc_stub(stub_key); gold_assert(stub != NULL); thumb_bit = stub->stub_template()->entry_in_thumb_mode() ? 1 : 0; - branch_target = stub_table->address() + stub->offset() + addend; + branch_target = stubtable->address() + stub->offset() + addend; branch_offset = branch_target - address; } } @@ -2677,21 +2677,21 @@ Insn_template::alignment() const // Stub_template methods. Stub_template::Stub_template( - Stub_type type, const Insn_template* insns, - size_t insn_count) - : type_(type), insns_(insns), insn_count_(insn_count), alignment_(1), + Stub_type atype, const Insn_template* iinsns, + size_t insncount) + : type_(atype), insns_(iinsns), insn_count_(insncount), alignment_(1), entry_in_thumb_mode_(false), relocs_() { - off_t offset = 0; + off_t off = 0; // Compute byte size and alignment of stub template. - for (size_t i = 0; i < insn_count; i++) + for (size_t i = 0; i < insncount; i++) { - unsigned insn_alignment = insns[i].alignment(); - size_t insn_size = insns[i].size(); - gold_assert((offset & (insn_alignment - 1)) == 0); + unsigned insn_alignment = iinsns[i].alignment(); + size_t insn_size = iinsns[i].size(); + gold_assert((off & (insn_alignment - 1)) == 0); this->alignment_ = std::max(this->alignment_, insn_alignment); - switch (insns[i].type()) + switch (iinsns[i].type()) { case Insn_template::THUMB16_TYPE: if (i == 0) @@ -2699,8 +2699,8 @@ Stub_template::Stub_template( break; case Insn_template::THUMB32_TYPE: - if (insns[i].r_type() != elfcpp::R_ARM_NONE) - this->relocs_.push_back(Reloc(i, offset)); + if (iinsns[i].r_type() != elfcpp::R_ARM_NONE) + this->relocs_.push_back(Reloc(i, off)); if (i == 0) this->entry_in_thumb_mode_ = true; break; @@ -2708,22 +2708,22 @@ Stub_template::Stub_template( case Insn_template::ARM_TYPE: // Handle cases where the target is encoded within the // instruction. - if (insns[i].r_type() == elfcpp::R_ARM_JUMP24) - this->relocs_.push_back(Reloc(i, offset)); + if (iinsns[i].r_type() == elfcpp::R_ARM_JUMP24) + this->relocs_.push_back(Reloc(i, off)); break; case Insn_template::DATA_TYPE: // Entry point cannot be data. gold_assert(i != 0); - this->relocs_.push_back(Reloc(i, offset)); + this->relocs_.push_back(Reloc(i, off)); break; default: gold_unreachable(); } - offset += insn_size; + off += insn_size; } - this->size_ = offset; + this->size_ = off; } // Reloc_stub::Key methods. @@ -2939,12 +2939,12 @@ void inline Reloc_stub::do_fixed_endian_write(unsigned char* view, section_size_type view_size) { - const Stub_template* stub_template = this->stub_template(); - const Insn_template* insns = stub_template->insns(); + const Stub_template* stubtemplate = this->stub_template(); + const Insn_template* insns = stubtemplate->insns(); // FIXME: We do not handle BE8 encoding yet. unsigned char* pov = view; - for (size_t i = 0; i < stub_template->insn_count(); i++) + for (size_t i = 0; i < stubtemplate->insn_count(); i++) { switch (insns[i].type()) { @@ -3198,11 +3198,11 @@ Stub_table::add_reloc_stub( Reloc_stub* stub, const Reloc_stub::Key& key) { - const Stub_template* stub_template = stub->stub_template(); - gold_assert(stub_template->type() == key.stub_type()); + const Stub_template* stubtemplate = stub->stub_template(); + gold_assert(stubtemplate->type() == key.stub_type()); this->reloc_stubs_[key] = stub; - if (this->addralign_ < stub_template->alignment()) - this->addralign_ = stub_template->alignment(); + if (this->addralign_ < stubtemplate->alignment()) + this->addralign_ = stubtemplate->alignment(); this->has_been_changed_ = true; } @@ -3211,14 +3211,14 @@ void Stub_table::relocate_stubs( const Relocate_info<32, big_endian>* relinfo, Target_arm* arm_target, - Output_section* output_section, + Output_section* out_section, unsigned char* view, - Arm_address address, + Arm_address addr, section_size_type view_size) { // If we are passed a view bigger than the stub table's. we need to // adjust the view. - gold_assert(address == this->address() + gold_assert(addr == this->address() && (view_size == static_cast(this->data_size()))); @@ -3227,16 +3227,16 @@ Stub_table::relocate_stubs( ++p) { Reloc_stub* stub = p->second; - const Stub_template* stub_template = stub->stub_template(); - if (stub_template->reloc_count() != 0) + const Stub_template* stubtemplate = stub->stub_template(); + if (stubtemplate->reloc_count() != 0) { // Adjust view to cover the stub only. - section_size_type offset = stub->offset(); - section_size_type stub_size = stub_template->size(); - gold_assert(offset + stub_size <= view_size); + section_size_type off = stub->offset(); + section_size_type stub_size = stubtemplate->size(); + gold_assert(off + stub_size <= view_size); - arm_target->relocate_stub(stub, relinfo, output_section, - view + offset, address + offset, + arm_target->relocate_stub(stub, relinfo, out_section, + view + off, addr + off, stub_size); } } @@ -3255,13 +3255,13 @@ Stub_table::do_reset_address_and_file_offset() ++p) { Reloc_stub* stub = p->second; - const Stub_template* stub_template = stub->stub_template(); - uint64_t stub_addralign = stub_template->alignment(); + const Stub_template* stubtemplate = stub->stub_template(); + uint64_t stub_addralign = stubtemplate->alignment(); max_addralign = std::max(max_addralign, stub_addralign); off = align_address(off, stub_addralign); stub->set_offset(off); stub->reset_destination_address(); - off += stub_template->size(); + off += stubtemplate->size(); } this->addralign_ = max_addralign; @@ -3274,19 +3274,19 @@ template void Stub_table::do_write(Output_file* of) { - off_t offset = this->offset(); + off_t off = this->offset(); const section_size_type oview_size = convert_to_section_size_type(this->data_size()); - unsigned char* const oview = of->get_output_view(offset, oview_size); + unsigned char* const oview = of->get_output_view(off, oview_size); for (typename Reloc_stub_map::const_iterator p = this->reloc_stubs_.begin(); p != this->reloc_stubs_.end(); ++p) { Reloc_stub* stub = p->second; - Arm_address address = this->address() + stub->offset(); - gold_assert(address - == align_address(address, + Arm_address addr = this->address() + stub->offset(); + gold_assert(addr + == align_address(addr, stub->stub_template()->alignment())); stub->write(oview + stub->offset(), stub->stub_template()->size(), big_endian); @@ -3302,21 +3302,21 @@ template void Arm_input_section::init() { - Relobj* relobj = this->relobj(); - unsigned int shndx = this->shndx(); + Relobj* rel_obj = this->relobj(); + unsigned int sec_shndx = this->shndx(); // Cache these to speed up size and alignment queries. It is too slow // to call section_addraglin and section_size every time. - this->original_addralign_ = relobj->section_addralign(shndx); - this->original_size_ = relobj->section_size(shndx); + this->original_addralign_ = rel_obj->section_addralign(sec_shndx); + this->original_size_ = rel_obj->section_size(sec_shndx); // We want to make this look like the original input section after // output sections are finalized. - Output_section* os = relobj->output_section(shndx); - off_t offset = relobj->output_section_offset(shndx); - gold_assert(os != NULL && !relobj->is_output_section_offset_invalid(shndx)); - this->set_address(os->address() + offset); - this->set_file_offset(os->offset() + offset); + Output_section* os = rel_obj->output_section(sec_shndx); + off_t off = rel_obj->output_section_offset(sec_shndx); + gold_assert(os != NULL && !rel_obj->is_output_section_offset_invalid(sec_shndx)); + this->set_address(os->address() + off); + this->set_file_offset(os->offset() + off); this->set_current_data_size(this->original_size_); this->finalize_data_size(); @@ -3346,15 +3346,15 @@ Arm_input_section::set_final_data_size() // If this owns a stub table, finalize its data size as well. if (this->is_stub_table_owner()) { - uint64_t address = this->address(); + uint64_t addr = this->address(); // The stub table comes after the original section contents. - address += this->original_size_; - address = align_address(address, this->stub_table_->addralign()); - off_t offset = this->offset() + (address - this->address()); - this->stub_table_->set_address_and_file_offset(address, offset); - address += this->stub_table_->data_size(); - gold_assert(address == this->address() + this->current_data_size()); + addr += this->original_size_; + addr = align_address(addr, this->stub_table_->addralign()); + off_t off = this->offset() + (addr - this->address()); + this->stub_table_->set_address_and_file_offset(addr, off); + addr += this->stub_table_->data_size(); + gold_assert(addr == this->address() + this->current_data_size()); } this->set_data_size(this->current_data_size()); @@ -3372,13 +3372,13 @@ Arm_input_section::do_reset_address_and_file_offset() // If this is a stub table owner, account for the stub table size. if (this->is_stub_table_owner()) { - Stub_table* stub_table = this->stub_table_; + Stub_table* stubtable = this->stub_table_; // Reset the stub table's address and file offset. The // current data size for child will be updated after that. stub_table_->reset_address_and_file_offset(); off = align_address(off, stub_table_->addralign()); - off += stub_table->current_data_size(); + off += stubtable->current_data_size(); } this->set_current_data_size(off); @@ -3420,10 +3420,10 @@ Arm_output_section::create_stub_group( } // Create a stub table. - Stub_table* stub_table = + Stub_table* stubtable = target->new_stub_table(arm_input_section); - arm_input_section->set_stub_table(stub_table); + arm_input_section->set_stub_table(stubtable); Input_section_list::const_iterator p = begin; Input_section_list::const_iterator prev_p; @@ -3437,7 +3437,7 @@ Arm_output_section::create_stub_group( // in their objects. Arm_relobj* arm_relobj = Arm_relobj::as_arm_relobj(p->relobj()); - arm_relobj->set_stub_table(p->shndx(), stub_table); + arm_relobj->set_stub_table(p->shndx(), stubtable); } prev_p = p++; } @@ -3489,7 +3489,7 @@ Arm_output_section::group_sections( section_size_type stub_table_end_offset = 0; Input_section_list::const_iterator group_begin = this->input_sections().end(); - Input_section_list::const_iterator stub_table = + Input_section_list::const_iterator stubtable = this->input_sections().end(); Input_section_list::const_iterator group_end = this->input_sections().end(); for (Input_section_list::const_iterator p = this->input_sections().begin(); @@ -3524,7 +3524,7 @@ Arm_output_section::group_sections( // stub_group_size bytes after the stub table can be // handled by it too. state = HAS_STUB_SECTION; - stub_table = group_end; + stubtable = group_end; stub_table_end_offset = group_end_offset; } } @@ -3536,7 +3536,7 @@ Arm_output_section::group_sections( if (section_end_offset - stub_table_end_offset >= group_size) { gold_assert(group_end != this->input_sections().end()); - this->create_stub_group(group_begin, group_end, stub_table, + this->create_stub_group(group_begin, group_end, stubtable, target, &new_relaxed_sections); state = NO_GROUP; } @@ -3573,7 +3573,7 @@ Arm_output_section::group_sections( this->create_stub_group(group_begin, group_end, (state == FINDING_STUB_SECTION ? group_end - : stub_table), + : stubtable), target, &new_relaxed_sections); } @@ -3587,9 +3587,9 @@ Arm_output_section::group_sections( Arm_relobj* arm_relobj = Arm_relobj::as_arm_relobj( new_relaxed_sections[i]->relobj()); - unsigned int shndx = new_relaxed_sections[i]->shndx(); + unsigned int sec_shndx = new_relaxed_sections[i]->shndx(); // Tell Arm_relobj that this input section is converted. - arm_relobj->convert_input_section_to_relaxed_section(shndx); + arm_relobj->convert_input_section_to_relaxed_section(sec_shndx); } } @@ -3602,14 +3602,14 @@ void Arm_relobj::scan_sections_for_stubs( Target_arm* arm_target, const Symbol_table* symtab, - const Layout* layout) + const Layout* alayout) { - unsigned int shnum = this->shnum(); - const unsigned int shdr_size = elfcpp::Elf_sizes<32>::shdr_size; + unsigned int sec_shnum = this->shnum(); + const unsigned int shdrsize = elfcpp::Elf_sizes<32>::shdr_size; // Read the section headers. const unsigned char* pshdrs = this->get_view(this->elf_file()->shoff(), - shnum * shdr_size, + sec_shnum * shdrsize, true, true); // To speed up processing, we set up hash tables for fast lookup of @@ -3620,11 +3620,11 @@ Arm_relobj::scan_sections_for_stubs( Relocate_info<32, big_endian> relinfo; relinfo.symtab = symtab; - relinfo.layout = layout; + relinfo.layout = alayout; relinfo.object = this; - const unsigned char* p = pshdrs + shdr_size; - for (unsigned int i = 1; i < shnum; ++i, p += shdr_size) + const unsigned char* p = pshdrs + shdrsize; + for (unsigned int i = 1; i < sec_shnum; ++i, p += shdrsize) { typename elfcpp::Shdr<32, big_endian> shdr(p); @@ -3738,15 +3738,15 @@ Arm_relobj::do_count_local_symbols( this->local_symbol_is_thumb_function_.swap(empty_vector); // Read the symbol table section header. - const unsigned int symtab_shndx = this->symtab_shndx(); + const unsigned int sym_tab_shndx = this->symtab_shndx(); elfcpp::Shdr<32, big_endian> - symtabshdr(this, this->elf_file()->section_header(symtab_shndx)); + symtabshdr(this, this->elf_file()->section_header(sym_tab_shndx)); gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB); // Read the local symbols. - const int sym_size =elfcpp::Elf_sizes<32>::sym_size; + const int symsize =elfcpp::Elf_sizes<32>::sym_size; gold_assert(loccount == symtabshdr.get_sh_info()); - off_t locsize = loccount * sym_size; + off_t locsize = loccount * symsize; const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(), locsize, true, true); @@ -3754,10 +3754,10 @@ Arm_relobj::do_count_local_symbols( // to THUMB functions. // Skip the first dummy symbol. - psyms += sym_size; + psyms += symsize; typename Sized_relobj<32, big_endian>::Local_values* plocal_values = this->local_values(); - for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size) + for (unsigned int i = 1; i < loccount; ++i, psyms += symsize) { elfcpp::Sym<32, big_endian> sym(psyms); elfcpp::STT st_type = sym.get_st_type(); @@ -3781,12 +3781,12 @@ template void Arm_relobj::do_relocate_sections( const Symbol_table* symtab, - const Layout* layout, + const Layout* alayout, const unsigned char* pshdrs, typename Sized_relobj<32, big_endian>::Views* pviews) { // Call parent to relocate sections. - Sized_relobj<32, big_endian>::do_relocate_sections(symtab, layout, pshdrs, + Sized_relobj<32, big_endian>::do_relocate_sections(symtab, alayout, pshdrs, pviews); // We do not generate stubs if doing a relocatable link. @@ -3794,17 +3794,17 @@ Arm_relobj::do_relocate_sections( return; // Relocate stub tables. - unsigned int shnum = this->shnum(); + unsigned int sec_shnum = this->shnum(); Target_arm* arm_target = Target_arm::default_target(); Relocate_info<32, big_endian> relinfo; relinfo.symtab = symtab; - relinfo.layout = layout; + relinfo.layout = alayout; relinfo.object = this; - for (unsigned int i = 1; i < shnum; ++i) + for (unsigned int i = 1; i < sec_shnum; ++i) { Arm_input_section* arm_input_section = arm_target->find_arm_input_section(this, i); @@ -3827,18 +3827,18 @@ Arm_relobj::do_relocate_sections( // We are passed the output section view. Adjust it to cover the // stub table only. - Stub_table* stub_table = arm_input_section->stub_table(); - gold_assert((stub_table->address() >= (*pviews)[i].address) - && ((stub_table->address() + stub_table->data_size()) + Stub_table* stubtable = arm_input_section->stub_table(); + gold_assert((stubtable->address() >= (*pviews)[i].address) + && ((stubtable->address() + stubtable->data_size()) <= (*pviews)[i].address + (*pviews)[i].view_size)); - off_t offset = stub_table->address() - (*pviews)[i].address; - unsigned char* view = (*pviews)[i].view + offset; - Arm_address address = stub_table->address(); - section_size_type view_size = stub_table->data_size(); + off_t off = stubtable->address() - (*pviews)[i].address; + unsigned char* pview = (*pviews)[i].view + off; + Arm_address address = stubtable->address(); + section_size_type view_size = stubtable->data_size(); - stub_table->relocate_stubs(&relinfo, arm_target, os, view, address, - view_size); + stubtable->relocate_stubs(&relinfo, arm_target, os, pview, address, + view_size); } } @@ -4043,13 +4043,13 @@ class Output_data_plt_arm : public Output_section_data // section just for PLT entries. template -Output_data_plt_arm::Output_data_plt_arm(Layout* layout, +Output_data_plt_arm::Output_data_plt_arm(Layout* alayout, Output_data_space* got_plt) : Output_section_data(4), got_plt_(got_plt), count_(0) { this->rel_ = new Reloc_section(false); - layout->add_output_section_data(".rel.plt", elfcpp::SHT_REL, - elfcpp::SHF_ALLOC, this->rel_, true); + alayout->add_output_section_data(".rel.plt", elfcpp::SHT_REL, + elfcpp::SHF_ALLOC, this->rel_, true); } template @@ -4125,10 +4125,10 @@ template void Output_data_plt_arm::do_write(Output_file* of) { - const off_t offset = this->offset(); + const off_t off = this->offset(); const section_size_type oview_size = convert_to_section_size_type(this->data_size()); - unsigned char* const oview = of->get_output_view(offset, oview_size); + unsigned char* const oview = of->get_output_view(off, oview_size); const off_t got_file_offset = this->got_plt_->offset(); const section_size_type got_size = @@ -4170,15 +4170,15 @@ Output_data_plt_arm::do_write(Output_file* of) got_offset += 4) { // Set and adjust the PLT entry itself. - int32_t offset = ((got_address + got_offset) - - (plt_address + plt_offset + 8)); + int32_t offst = ((got_address + got_offset) + - (plt_address + plt_offset + 8)); - gold_assert(offset >= 0 && offset < 0x0fffffff); - uint32_t plt_insn0 = plt_entry[0] | ((offset >> 20) & 0xff); + gold_assert(offst >= 0 && offst < 0x0fffffff); + uint32_t plt_insn0 = plt_entry[0] | ((offst >> 20) & 0xff); elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0); - uint32_t plt_insn1 = plt_entry[1] | ((offset >> 12) & 0xff); + uint32_t plt_insn1 = plt_entry[1] | ((offst >> 12) & 0xff); elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1); - uint32_t plt_insn2 = plt_entry[2] | (offset & 0xfff); + uint32_t plt_insn2 = plt_entry[2] | (offst & 0xfff); elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2); // Set the entry in the GOT. @@ -4188,7 +4188,7 @@ Output_data_plt_arm::do_write(Output_file* of) gold_assert(static_cast(pov - oview) == oview_size); gold_assert(static_cast(got_pov - got_view) == got_size); - of->write_output_view(offset, oview_size, oview); + of->write_output_view(off, oview_size, oview); of->write_output_view(got_file_offset, got_size, got_view); } @@ -4196,7 +4196,7 @@ Output_data_plt_arm::do_write(Output_file* of) template void -Target_arm::make_plt_entry(Symbol_table* symtab, Layout* layout, +Target_arm::make_plt_entry(Symbol_table* symtab, Layout* alayout, Symbol* gsym) { if (gsym->has_plt_offset()) @@ -4205,13 +4205,13 @@ Target_arm::make_plt_entry(Symbol_table* symtab, Layout* layout, if (this->plt_ == NULL) { // Create the GOT sections first. - this->got_section(symtab, layout); + this->got_section(symtab, alayout); - this->plt_ = new Output_data_plt_arm(layout, this->got_plt_); - layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS, - (elfcpp::SHF_ALLOC - | elfcpp::SHF_EXECINSTR), - this->plt_, false); + this->plt_ = new Output_data_plt_arm(alayout, this->got_plt_); + alayout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS, + (elfcpp::SHF_ALLOC + | elfcpp::SHF_EXECINSTR), + this->plt_, false); } this->plt_->add_entry(gsym); } @@ -4281,7 +4281,7 @@ Target_arm::Scan::check_non_pic(Relobj* object, template inline void Target_arm::Scan::local(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Target_arm* target, Sized_relobj<32, big_endian>* object, unsigned int data_shndx, @@ -4306,7 +4306,7 @@ Target_arm::Scan::local(Symbol_table* symtab, // relocate it easily. if (parameters->options().output_is_position_independent()) { - Reloc_section* rel_dyn = target->rel_dyn_section(layout); + Reloc_section* rel_dyn = target->rel_dyn_section(alayout); unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info()); // If we are to add more other reloc types than R_ARM_ABS32, // we need to add check_non_pic(object, r_type) here. @@ -4339,7 +4339,7 @@ Target_arm::Scan::local(Symbol_table* symtab, case elfcpp::R_ARM_GOTOFF32: // We need a GOT section: - target->got_section(symtab, layout); + target->got_section(symtab, alayout); break; case elfcpp::R_ARM_BASE_PREL: @@ -4351,7 +4351,7 @@ Target_arm::Scan::local(Symbol_table* symtab, { // The symbol requires a GOT entry. Output_data_got<32, big_endian>* got = - target->got_section(symtab, layout); + target->got_section(symtab, alayout); unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info()); if (got->add_local(object, r_sym, GOT_TYPE_STANDARD)) { @@ -4359,11 +4359,11 @@ Target_arm::Scan::local(Symbol_table* symtab, // dynamic RELATIVE relocation for this symbol's GOT entry. if (parameters->options().output_is_position_independent()) { - Reloc_section* rel_dyn = target->rel_dyn_section(layout); - unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info()); + Reloc_section* rel_dyn = target->rel_dyn_section(alayout); + unsigned int rsym = elfcpp::elf_r_sym<32>(reloc.get_r_info()); rel_dyn->add_local_relative( - object, r_sym, elfcpp::R_ARM_RELATIVE, got, - object->local_got_offset(r_sym, GOT_TYPE_STANDARD)); + object, rsym, elfcpp::R_ARM_RELATIVE, got, + object->local_got_offset(rsym, GOT_TYPE_STANDARD)); } } } @@ -4408,7 +4408,7 @@ Target_arm::Scan::unsupported_reloc_global( template inline void Target_arm::Scan::global(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Target_arm* target, Sized_relobj<32, big_endian>* object, unsigned int data_shndx, @@ -4431,14 +4431,14 @@ Target_arm::Scan::global(Symbol_table* symtab, { if (target->may_need_copy_reloc(gsym)) { - target->copy_reloc(symtab, layout, object, + target->copy_reloc(symtab, alayout, object, data_shndx, output_section, gsym, reloc); } else if (gsym->can_use_relative_reloc(false)) { // If we are to add more other reloc types than R_ARM_ABS32, // we need to add check_non_pic(object, r_type) here. - Reloc_section* rel_dyn = target->rel_dyn_section(layout); + Reloc_section* rel_dyn = target->rel_dyn_section(alayout); rel_dyn->add_global_relative(gsym, elfcpp::R_ARM_RELATIVE, output_section, object, data_shndx, reloc.get_r_offset()); @@ -4447,7 +4447,7 @@ Target_arm::Scan::global(Symbol_table* symtab, { // If we are to add more other reloc types than R_ARM_ABS32, // we need to add check_non_pic(object, r_type) here. - Reloc_section* rel_dyn = target->rel_dyn_section(layout); + Reloc_section* rel_dyn = target->rel_dyn_section(alayout); rel_dyn->add_global(gsym, r_type, output_section, object, data_shndx, reloc.get_r_offset()); } @@ -4491,13 +4491,13 @@ Target_arm::Scan::global(Symbol_table* symtab, { if (target->may_need_copy_reloc(gsym)) { - target->copy_reloc(symtab, layout, object, + target->copy_reloc(symtab, alayout, object, data_shndx, output_section, gsym, reloc); } else { check_non_pic(object, r_type); - Reloc_section* rel_dyn = target->rel_dyn_section(layout); + Reloc_section* rel_dyn = target->rel_dyn_section(alayout); rel_dyn->add_global(gsym, r_type, output_section, object, data_shndx, reloc.get_r_offset()); } @@ -4511,7 +4511,7 @@ Target_arm::Scan::global(Symbol_table* symtab, case elfcpp::R_ARM_THM_CALL: if (Target_arm::Scan::symbol_needs_plt_entry(gsym)) - target->make_plt_entry(symtab, layout, gsym); + target->make_plt_entry(symtab, alayout, gsym); else { // Check to see if this is a function that would need a PLT @@ -4540,12 +4540,12 @@ Target_arm::Scan::global(Symbol_table* symtab, && !gsym->is_from_dynobj() && !gsym->is_preemptible()) break; - target->make_plt_entry(symtab, layout, gsym); + target->make_plt_entry(symtab, alayout, gsym); break; case elfcpp::R_ARM_GOTOFF32: // We need a GOT section. - target->got_section(symtab, layout); + target->got_section(symtab, alayout); break; case elfcpp::R_ARM_BASE_PREL: @@ -4557,14 +4557,14 @@ Target_arm::Scan::global(Symbol_table* symtab, { // The symbol requires a GOT entry. Output_data_got<32, big_endian>* got = - target->got_section(symtab, layout); + target->got_section(symtab, alayout); if (gsym->final_value_is_known()) got->add_global(gsym, GOT_TYPE_STANDARD); else { // If this symbol is not fully resolved, we need to add a // GOT entry with a dynamic relocation. - Reloc_section* rel_dyn = target->rel_dyn_section(layout); + Reloc_section* rel_dyn = target->rel_dyn_section(alayout); if (gsym->is_from_dynobj() || gsym->is_undefined() || gsym->is_preemptible()) @@ -4605,7 +4605,7 @@ Target_arm::Scan::global(Symbol_table* symtab, template void Target_arm::gc_process_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Sized_relobj<32, big_endian>* object, unsigned int data_shndx, unsigned int, @@ -4617,11 +4617,11 @@ Target_arm::gc_process_relocs(Symbol_table* symtab, const unsigned char* plocal_symbols) { typedef Target_arm Arm; - typedef typename Target_arm::Scan Scan; + typedef typename Target_arm::Scan scan; - gold::gc_process_relocs<32, big_endian, Arm, elfcpp::SHT_REL, Scan>( + gold::gc_process_relocs<32, big_endian, Arm, elfcpp::SHT_REL, scan>( symtab, - layout, + alayout, this, object, data_shndx, @@ -4638,7 +4638,7 @@ Target_arm::gc_process_relocs(Symbol_table* symtab, template void Target_arm::scan_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Sized_relobj<32, big_endian>* object, unsigned int data_shndx, unsigned int sh_type, @@ -4649,7 +4649,7 @@ Target_arm::scan_relocs(Symbol_table* symtab, size_t local_symbol_count, const unsigned char* plocal_symbols) { - typedef typename Target_arm::Scan Scan; + typedef typename Target_arm::Scan scan; if (sh_type == elfcpp::SHT_RELA) { gold_error(_("%s: unsupported RELA reloc section"), @@ -4657,9 +4657,9 @@ Target_arm::scan_relocs(Symbol_table* symtab, return; } - gold::scan_relocs<32, big_endian, Target_arm, elfcpp::SHT_REL, Scan>( + gold::scan_relocs<32, big_endian, Target_arm, elfcpp::SHT_REL, scan>( symtab, - layout, + alayout, this, object, data_shndx, @@ -4676,7 +4676,7 @@ Target_arm::scan_relocs(Symbol_table* symtab, template void Target_arm::do_finalize_sections( - Layout* layout, + Layout* alayout, const Input_objects* input_objects, Symbol_table* symtab) { @@ -4715,7 +4715,7 @@ Target_arm::do_finalize_sections( this->set_may_use_blx(true); // Fill in some more dynamic tags. - Output_data_dynamic* const odyn = layout->dynamic_data(); + Output_data_dynamic* const odyn = alayout->dynamic_data(); if (odyn != NULL) { if (this->got_plt_ != NULL @@ -4752,10 +4752,10 @@ Target_arm::do_finalize_sections( // Emit any relocs we saved in an attempt to avoid generating COPY // relocs. if (this->copy_relocs_.any_saved_relocs()) - this->copy_relocs_.emit(this->rel_dyn_section(layout)); + this->copy_relocs_.emit(this->rel_dyn_section(alayout)); // Handle the .ARM.exidx section. - Output_section* exidx_section = layout->find_output_section(".ARM.exidx"); + Output_section* exidx_section = alayout->find_output_section(".ARM.exidx"); if (exidx_section != NULL && exidx_section->type() == elfcpp::SHT_ARM_EXIDX && !parameters->options().relocatable()) @@ -4772,12 +4772,12 @@ Target_arm::do_finalize_sections( // For the ARM target, we need to add a PT_ARM_EXIDX segment for // the .ARM.exidx section. - if (!layout->script_options()->saw_phdrs_clause()) + if (!alayout->script_options()->saw_phdrs_clause()) { - gold_assert(layout->find_output_segment(elfcpp::PT_ARM_EXIDX, 0, 0) + gold_assert(alayout->find_output_segment(elfcpp::PT_ARM_EXIDX, 0, 0) == NULL); Output_segment* exidx_segment = - layout->make_output_segment(elfcpp::PT_ARM_EXIDX, elfcpp::PF_R); + alayout->make_output_segment(elfcpp::PT_ARM_EXIDX, elfcpp::PF_R); exidx_segment->add_output_section(exidx_section, elfcpp::PF_R, false); } @@ -5286,9 +5286,9 @@ Target_arm::relocate_section( + arm_input_section->data_size()) <= (address + view_size))); - off_t offset = section_address - address; - view += offset; - address += offset; + off_t off = section_address - address; + view += off; + address += off; view_size = section_size; } @@ -5377,7 +5377,7 @@ template void Target_arm::scan_relocatable_relocs( Symbol_table* symtab, - Layout* layout, + Layout* alayout, Sized_relobj<32, big_endian>* object, unsigned int data_shndx, unsigned int sh_type, @@ -5397,7 +5397,7 @@ Target_arm::scan_relocatable_relocs( gold::scan_relocatable_relocs<32, big_endian, elfcpp::SHT_REL, Scan_relocatable_relocs>( symtab, - layout, + alayout, object, data_shndx, prelocs, @@ -5576,20 +5576,20 @@ Object* Target_arm::do_make_elf_object( const std::string& name, Input_file* input_file, - off_t offset, const elfcpp::Ehdr<32, big_endian>& ehdr) + off_t off, const elfcpp::Ehdr<32, big_endian>& ehdr) { int et = ehdr.get_e_type(); if (et == elfcpp::ET_REL) { Arm_relobj* obj = - new Arm_relobj(name, input_file, offset, ehdr); + new Arm_relobj(name, input_file, off, ehdr); obj->setup(); return obj; } else if (et == elfcpp::ET_DYN) { Sized_dynobj<32, big_endian>* obj = - new Arm_dynobj(name, input_file, offset, ehdr); + new Arm_dynobj(name, input_file, off, ehdr); obj->setup(); return obj; } @@ -6424,13 +6424,13 @@ Target_arm::reloc_uses_thumb_bit(unsigned int r_type) template Arm_input_section* Target_arm::new_arm_input_section( - Relobj* relobj, - unsigned int shndx) + Relobj* rel_obj, + unsigned int sec_shndx) { - Input_section_specifier iss(relobj, shndx); + Input_section_specifier iss(rel_obj, sec_shndx); Arm_input_section* arm_input_section = - new Arm_input_section(relobj, shndx); + new Arm_input_section(rel_obj, sec_shndx); arm_input_section->init(); // Register new Arm_input_section in map for look-up. @@ -6450,10 +6450,10 @@ Target_arm::new_arm_input_section( template Arm_input_section* Target_arm::find_arm_input_section( - Relobj* relobj, - unsigned int shndx) const + Relobj* rel_obj, + unsigned int sec_shndx) const { - Input_section_specifier iss(relobj, shndx); + Input_section_specifier iss(rel_obj, sec_shndx); typename Arm_input_section_map::const_iterator p = this->arm_input_section_map_.find(iss); return (p != this->arm_input_section_map_.end()) ? p->second : NULL; @@ -6465,15 +6465,15 @@ template Stub_table* Target_arm::new_stub_table(Arm_input_section* owner) { - Stub_table* stub_table = + Stub_table* stubtable = new Stub_table(owner); - this->stub_tables_.push_back(stub_table); + this->stub_tables_.push_back(stubtable); - stub_table->set_address(owner->address() + owner->data_size()); - stub_table->set_file_offset(owner->offset() + owner->data_size()); - stub_table->finalize_data_size(); + stubtable->set_address(owner->address() + owner->data_size()); + stubtable->set_file_offset(owner->offset() + owner->data_size()); + stubtable->finalize_data_size(); - return stub_table; + return stubtable; } // Scan a relocation for stub generation. @@ -6489,7 +6489,7 @@ Target_arm::scan_reloc_for_stub( elfcpp::Elf_types<32>::Elf_Swxword addend, Arm_address address) { - typedef typename Target_arm::Relocate Relocate; + typedef typename Target_arm::Relocate relocate; const Arm_relobj* arm_relobj = Arm_relobj::as_arm_relobj(relinfo->object); @@ -6500,7 +6500,7 @@ Target_arm::scan_reloc_for_stub( { // This is a global symbol. Determine if we use PLT and if the // final target is THUMB. - if (gsym->use_plt_offset(Relocate::reloc_is_non_pic(r_type))) + if (gsym->use_plt_offset(relocate::reloc_is_non_pic(r_type))) { // This uses a PLT, change the symbol value. symval.set_output_value(this->plt_section()->address() @@ -6571,20 +6571,20 @@ Target_arm::scan_reloc_for_stub( return; // Try looking up an existing stub from a stub table. - Stub_table* stub_table = + Stub_table* stubtable = arm_relobj->stub_table(relinfo->data_shndx); - gold_assert(stub_table != NULL); + gold_assert(stubtable != NULL); // Locate stub by destination. Reloc_stub::Key stub_key(stub_type, gsym, arm_relobj, r_sym, addend); // Create a stub if there is not one already - Reloc_stub* stub = stub_table->find_reloc_stub(stub_key); + Reloc_stub* stub = stubtable->find_reloc_stub(stub_key); if (stub == NULL) { // create a new stub and add it to stub table. stub = this->stub_factory().make_reloc_stub(stub_type); - stub_table->add_reloc_stub(stub, stub_key); + stubtable->add_reloc_stub(stub, stub_key); } // Record the destination address. @@ -6653,22 +6653,22 @@ Target_arm::scan_reloc_section_for_stubs( && (r_type != elfcpp::R_ARM_THM_JUMP19)) continue; - section_offset_type offset = + section_offset_type off = convert_to_section_size_type(reloc.get_r_offset()); if (needs_special_offset_handling) { - offset = output_section->output_offset(relinfo->object, - relinfo->data_shndx, - offset); - if (offset == -1) + off = output_section->output_offset(relinfo->object, + relinfo->data_shndx, + off); + if (off == -1) continue; } // Get the addend. Stub_addend_reader stub_addend_reader; elfcpp::Elf_types<32>::Elf_Swxword addend = - stub_addend_reader(r_type, view + offset, reloc); + stub_addend_reader(r_type, view + off, reloc); const Sized_symbol<32>* sym; @@ -6685,11 +6685,11 @@ Target_arm::scan_reloc_section_for_stubs( // counterpart in the kept section. The symbol must not // correspond to a section we are folding. bool is_ordinary; - unsigned int shndx = psymval->input_shndx(&is_ordinary); + unsigned int sec_shndx = psymval->input_shndx(&is_ordinary); if (is_ordinary - && shndx != elfcpp::SHN_UNDEF - && !arm_object->is_section_included(shndx) - && !(relinfo->symtab->is_section_folded(arm_object, shndx))) + && sec_shndx != elfcpp::SHN_UNDEF + && !arm_object->is_section_included(sec_shndx) + && !(relinfo->symtab->is_section_folded(arm_object, sec_shndx))) { if (comdat_behavior == CB_UNDETERMINED) { @@ -6701,7 +6701,7 @@ Target_arm::scan_reloc_section_for_stubs( { bool found; typename elfcpp::Elf_types<32>::Elf_Addr value = - arm_object->map_to_kept_section(shndx, &found); + arm_object->map_to_kept_section(sec_shndx, &found); if (found) symval.set_output_value(value + psymval->input_value()); else @@ -6751,7 +6751,7 @@ Target_arm::scan_reloc_section_for_stubs( continue; this->scan_reloc_for_stub(relinfo, r_type, sym, r_sym, psymval, - addend, view_address + offset); + addend, view_address + off); } } @@ -6809,13 +6809,13 @@ Target_arm::scan_section_for_stubs( template void Target_arm::group_sections( - Layout* layout, + Layout* alayout, section_size_type group_size, bool stubs_always_after_branch) { // Group input sections and insert stub table Layout::Section_list section_list; - layout->get_allocated_sections(§ion_list); + alayout->get_allocated_sections(§ion_list); for (Layout::Section_list::const_iterator p = section_list.begin(); p != section_list.end(); ++p) @@ -6835,7 +6835,7 @@ Target_arm::do_relax( int pass, const Input_objects* input_objects, Symbol_table* symtab, - Layout* layout) + Layout* alayout) { // No need to generate stubs if this is a relocatable link. gold_assert(!parameters->options().relocatable()); @@ -6867,7 +6867,7 @@ Target_arm::do_relax( stub_group_size = 4170000; } - group_sections(layout, stub_group_size, stubs_always_after_branch); + group_sections(alayout, stub_group_size, stubs_always_after_branch); } // clear changed flags for all stub_tables @@ -6884,7 +6884,7 @@ Target_arm::do_relax( { Arm_relobj* arm_relobj = Arm_relobj::as_arm_relobj(*op); - arm_relobj->scan_sections_for_stubs(this, symtab, layout); + arm_relobj->scan_sections_for_stubs(this, symtab, alayout); } bool any_stub_table_changed = false; @@ -6912,14 +6912,14 @@ Target_arm::relocate_stub( section_size_type view_size) { Relocate relocate; - const Stub_template* stub_template = stub->stub_template(); - for (size_t i = 0; i < stub_template->reloc_count(); i++) + const Stub_template* stubtemplate = stub->stub_template(); + for (size_t i = 0; i < stubtemplate->reloc_count(); i++) { - size_t reloc_insn_index = stub_template->reloc_insn_index(i); - const Insn_template* insn = &stub_template->insns()[reloc_insn_index]; + size_t reloc_insn_index = stubtemplate->reloc_insn_index(i); + const Insn_template* insn = &stubtemplate->insns()[reloc_insn_index]; unsigned int r_type = insn->r_type(); - section_size_type reloc_offset = stub_template->reloc_offset(i); + section_size_type reloc_offset = stubtemplate->reloc_offset(i); section_size_type reloc_size = insn->size(); gold_assert(reloc_offset + reloc_size <= view_size); diff --git a/gold/compressed_output.cc b/gold/compressed_output.cc index a0f8ed181..814bd250a 100644 --- a/gold/compressed_output.cc +++ b/gold/compressed_output.cc @@ -1,6 +1,6 @@ // compressed_output.cc -- manage compressed output sections for gold -// Copyright 2007, 2008 Free Software Foundation, Inc. +// Copyright 2007, 2008, 2009 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -137,14 +137,14 @@ Output_compressed_section::set_final_data_size() void Output_compressed_section::do_write(Output_file* of) { - off_t offset = this->offset(); - off_t data_size = this->data_size(); - unsigned char* view = of->get_output_view(offset, data_size); + off_t off = this->offset(); + off_t datasize = this->data_size(); + unsigned char* view = of->get_output_view(off, datasize); if (this->data_ == NULL) - memcpy(view, this->postprocessing_buffer(), data_size); + memcpy(view, this->postprocessing_buffer(), datasize); else - memcpy(view, this->data_, data_size); - of->write_output_view(offset, data_size, view); + memcpy(view, this->data_, datasize); + of->write_output_view(off, datasize, view); } } // End namespace gold. diff --git a/gold/compressed_output.h b/gold/compressed_output.h index 11b276228..86e3c013c 100644 --- a/gold/compressed_output.h +++ b/gold/compressed_output.h @@ -1,6 +1,6 @@ // compressed_output.h -- compressed output sections for gold -*- C++ -*- -// Copyright 2007, 2008 Free Software Foundation, Inc. +// Copyright 2007, 2008, 2009 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -45,9 +45,9 @@ class Output_compressed_section : public Output_section { public: Output_compressed_section(const General_options* options, - const char* name, elfcpp::Elf_Word flags, - elfcpp::Elf_Xword type) - : Output_section(name, flags, type), + const char* cname, elfcpp::Elf_Word cflags, + elfcpp::Elf_Xword ctype) + : Output_section(cname, cflags, ctype), options_(options) { this->set_requires_postprocessing(); } diff --git a/gold/configure b/gold/configure index 793af0dc8..3f67d29f5 100755 --- a/gold/configure +++ b/gold/configure @@ -6270,7 +6270,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/gold/dwarf_reader.cc b/gold/dwarf_reader.cc index 4062fe67c..c8d29cddf 100644 --- a/gold/dwarf_reader.cc +++ b/gold/dwarf_reader.cc @@ -294,7 +294,7 @@ Sized_dwarf_line_info::process_one_opcode( case elfcpp::DW_LNS_advance_pc: { const uint64_t advance_address - = read_unsigned_LEB_128(start, &templen); + = read_unsigned_LEB_128(start, &templen); oplen += templen; lsm->address += header_.min_insn_length * advance_address; } @@ -353,7 +353,7 @@ Sized_dwarf_line_info::process_one_opcode( case elfcpp::DW_LNS_extended_op: { const uint64_t extended_op_len - = read_unsigned_LEB_128(start, &templen); + = read_unsigned_LEB_128(start, &templen); start += templen; oplen += templen + extended_op_len; @@ -375,7 +375,7 @@ Sized_dwarf_line_info::process_one_opcode( { lsm->address = elfcpp::Swap_unaligned::readval(start); typename Reloc_map::const_iterator it - = reloc_map_.find(start - this->buffer_); + = reloc_map_.find(start - this->buffer_); if (it != reloc_map_.end()) { // value + addend. @@ -420,17 +420,16 @@ Sized_dwarf_line_info::process_one_opcode( default: { - // Ignore unknown opcode silently + // Ignore unknown opcode silently. for (int i = 0; i < header_.std_opcode_lengths[opcode]; i++) { - size_t templen; read_unsigned_LEB_128(start, &templen); start += templen; oplen += templen; } } break; - } + } *len = oplen; return false; } diff --git a/gold/dynobj.cc b/gold/dynobj.cc index 1b0dad93d..80d4a4353 100644 --- a/gold/dynobj.cc +++ b/gold/dynobj.cc @@ -39,8 +39,8 @@ namespace gold // Sets up the default soname_ to use, in the (rare) cases we never // see a DT_SONAME entry. -Dynobj::Dynobj(const std::string& name, Input_file* input_file, off_t offset) - : Object(name, input_file, true, offset), +Dynobj::Dynobj(const std::string& aname, Input_file* ainput_file, off_t aoffset) + : Object(aname, ainput_file, true, aoffset), needed_(), unknown_needed_(UNKNOWN_NEEDED_UNSET) { @@ -67,11 +67,11 @@ Dynobj::Dynobj(const std::string& name, Input_file* input_file, off_t offset) template Sized_dynobj::Sized_dynobj( - const std::string& name, - Input_file* input_file, - off_t offset, + const std::string& aname, + Input_file* ainput_file, + off_t aoffset, const elfcpp::Ehdr& ehdr) - : Dynobj(name, input_file, offset), + : Dynobj(aname, ainput_file, aoffset), elf_file_(this, ehdr), dynsym_shndx_(-1U), symbols_(NULL), @@ -85,8 +85,8 @@ template void Sized_dynobj::setup() { - const unsigned int shnum = this->elf_file_.shnum(); - this->set_shnum(shnum); + const unsigned int sec_shnum = this->elf_file_.shnum(); + this->set_shnum(sec_shnum); } // Find the SHT_DYNSYM section and the various version sections, and @@ -108,9 +108,9 @@ Sized_dynobj::find_dynsym_sections( unsigned int xindex_shndx = 0; unsigned int xindex_link = 0; - const unsigned int shnum = this->shnum(); + const unsigned int sec_shnum = this->shnum(); const unsigned char* p = pshdrs; - for (unsigned int i = 0; i < shnum; ++i, p += This::shdr_size) + for (unsigned int i = 0; i < sec_shnum; ++i, p += This::shdr_size) { typename This::Shdr shdr(p); @@ -180,13 +180,13 @@ Sized_dynobj::read_dynsym_section( unsigned int shndx, elfcpp::SHT type, unsigned int link, - File_view** view, + File_view** aview, section_size_type* view_size, unsigned int* view_info) { if (shndx == -1U) { - *view = NULL; + *aview = NULL; *view_size = 0; *view_info = 0; return; @@ -200,8 +200,8 @@ Sized_dynobj::read_dynsym_section( this->error(_("unexpected link in section %u header: %u != %u"), shndx, this->adjust_shndx(shdr.get_sh_link()), link); - *view = this->get_lasting_view(shdr.get_sh_offset(), shdr.get_sh_size(), - true, false); + *aview = this->get_lasting_view(shdr.get_sh_offset(), shdr.get_sh_size(), + true, false); *view_size = convert_to_section_size_type(shdr.get_sh_size()); *view_info = shdr.get_sh_info(); } @@ -424,8 +424,8 @@ Sized_dynobj::do_layout(Symbol_table* symtab, Layout*, Read_symbols_data* sd) { - const unsigned int shnum = this->shnum(); - if (shnum == 0) + const unsigned int sec_shnum = this->shnum(); + if (sec_shnum == 0) return; // Get the section headers. @@ -437,7 +437,7 @@ Sized_dynobj::do_layout(Symbol_table* symtab, // Skip the first, dummy, section. pshdrs += This::shdr_size; - for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size) + for (unsigned int i = 1; i < sec_shnum; ++i, pshdrs += This::shdr_size) { typename This::Shdr shdr(pshdrs); @@ -448,10 +448,10 @@ Sized_dynobj::do_layout(Symbol_table* symtab, return; } - const char* name = pnames + shdr.get_sh_name(); + const char* aname = pnames + shdr.get_sh_name(); - this->handle_gnu_warning_section(name, i, symtab); - this->handle_split_stack_section(name); + this->handle_gnu_warning_section(aname, i, symtab); + this->handle_split_stack_section(aname); } delete sd->section_headers; @@ -468,13 +468,13 @@ void Sized_dynobj::set_version_map( Version_map* version_map, unsigned int ndx, - const char* name) const + const char* aname) const { if (ndx >= version_map->size()) version_map->resize(ndx + 1); if ((*version_map)[ndx] != NULL) this->error(_("duplicate definition for version %u"), ndx); - (*version_map)[ndx] = name; + (*version_map)[ndx] = aname; } // Add mappings for the version definitions to VERSION_MAP. @@ -670,10 +670,10 @@ Sized_dynobj::do_add_symbols(Symbol_table* symtab, return; } - const int sym_size = This::sym_size; - const size_t symcount = sd->symbols_size / sym_size; + const int symsize = This::sym_size; + const size_t symcount = sd->symbols_size / symsize; gold_assert(sd->external_symbols_offset == 0); - if (symcount * sym_size != sd->symbols_size) + if (symcount * symsize != sd->symbols_size) { this->error(_("size of dynamic symbols is not multiple of symbol size")); return; @@ -1217,9 +1217,9 @@ Verdef::write(const Stringpool* dynpool, bool is_last, unsigned char* pb) const p != this->deps_.end(); ++p, ++i) { - elfcpp::Verdaux_write vda(pb); - vda.set_vda_name(dynpool->get_offset(*p)); - vda.set_vda_next(i + 1 >= this->deps_.size() ? 0 : verdaux_size); + elfcpp::Verdaux_write avda(pb); + avda.set_vda_name(dynpool->get_offset(*p)); + avda.set_vda_next(i + 1 >= this->deps_.size() ? 0 : verdaux_size); pb += verdaux_size; } @@ -1305,10 +1305,10 @@ Verneed::write(const Stringpool* dynpool, bool is_last, // Versions methods. -Versions::Versions(const Version_script_info& version_script, +Versions::Versions(const Version_script_info& vscript, Stringpool* dynpool) : defs_(), needs_(), version_table_(), - is_finalized_(false), version_script_(version_script), + is_finalized_(false), version_script_(vscript), needs_base_version_(parameters->options().shared()) { if (!this->version_script_.empty()) @@ -1620,18 +1620,18 @@ Versions::symbol_section_contents(const Symbol_table* symtab, p != syms.end(); ++p) { - unsigned int version_index; + unsigned int vindex; const char* version = (*p)->version(); if (version == NULL) - version_index = elfcpp::VER_NDX_GLOBAL; + vindex = elfcpp::VER_NDX_GLOBAL; else - version_index = this->version_index(symtab, dynpool, *p); + vindex = this->version_index(symtab, dynpool, *p); // If the symbol was defined as foo@V1 instead of foo@@V1, add // the hidden bit. if ((*p)->version() != NULL && !(*p)->is_default()) - version_index |= elfcpp::VERSYM_HIDDEN; + vindex |= elfcpp::VERSYM_HIDDEN; elfcpp::Swap<16, big_endian>::writeval(pbuf + (*p)->dynsym_index() * 2, - version_index); + vindex); } *pp = pbuf; diff --git a/gold/dynobj.h b/gold/dynobj.h index 66d2bff3a..be0d975b2 100644 --- a/gold/dynobj.h +++ b/gold/dynobj.h @@ -330,10 +330,10 @@ class Version_base // Set the version index. void - set_index(unsigned int index) + set_index(unsigned int vindex) { gold_assert(this->index_ == -1U); - this->index_ = index; + this->index_ = vindex; } // Clear the weak flag in a version definition. @@ -354,10 +354,10 @@ class Version_base class Verdef : public Version_base { public: - Verdef(const char* name, const std::vector& deps, - bool is_base, bool is_weak, bool is_symbol_created) - : name_(name), deps_(deps), is_base_(is_base), is_weak_(is_weak), - is_symbol_created_(is_symbol_created) + Verdef(const char* vname, const std::vector& deps, + bool is_base, bool vis_weak, bool vis_symbol_created) + : name_(vname), deps_(deps), is_base_(is_base), is_weak_(vis_weak), + is_symbol_created_(vis_symbol_created) { } // Return the version name. @@ -373,8 +373,8 @@ class Verdef : public Version_base // Add a dependency to this version. The NAME should be // canonicalized in the dynamic Stringpool. void - add_dependency(const char* name) - { this->deps_.push_back(name); } + add_dependency(const char* dname) + { this->deps_.push_back(dname); } // Return whether this definition is weak. bool @@ -424,8 +424,8 @@ class Verdef : public Version_base class Verneed_version : public Version_base { public: - Verneed_version(const char* version) - : version_(version) + Verneed_version(const char* ver) + : version_(ver) { } // Return the version name. @@ -450,8 +450,8 @@ class Verneed_version : public Version_base class Verneed { public: - Verneed(const char* filename) - : filename_(filename), need_versions_() + Verneed(const char* fname) + : filename_(fname), need_versions_() { } ~Verneed(); diff --git a/gold/ehframe.cc b/gold/ehframe.cc index 333e665c1..a9afa1dac 100644 --- a/gold/ehframe.cc +++ b/gold/ehframe.cc @@ -93,15 +93,15 @@ Eh_frame_hdr::Eh_frame_hdr(Output_section* eh_frame_section, void Eh_frame_hdr::set_final_data_size() { - unsigned int data_size = eh_frame_hdr_size + 4; + unsigned int datasize = eh_frame_hdr_size + 4; if (!this->any_unrecognized_eh_frame_sections_) { unsigned int fde_count = this->eh_frame_data_->fde_count(); if (fde_count != 0) - data_size += 4 + 8 * fde_count; + datasize += 4 + 8 * fde_count; this->fde_offsets_.reserve(fde_count); } - this->set_data_size(data_size); + this->set_data_size(datasize); } // Write the data to the flie. @@ -332,11 +332,11 @@ Fde::write(unsigned char* oview, section_offset_type offset, { gold_assert((offset & (addralign - 1)) == 0); - size_t length = this->contents_.length(); + size_t len = this->contents_.length(); // We add 8 when getting the aligned length to account for the // length word and the CIE offset. - size_t aligned_full_length = align_address(length + 8, addralign); + size_t aligned_full_length = align_address(len + 8, addralign); // Write the length of the FDE as a 32-bit word. The length word // does not include the four bytes of the length word itself, but it @@ -353,10 +353,10 @@ Fde::write(unsigned char* oview, section_offset_type offset, // Copy the rest of the FDE. Note that this is run before // relocation processing is done on this section, so the relocations // will later be applied to the FDE data. - memcpy(oview + offset + 8, this->contents_.data(), length); + memcpy(oview + offset + 8, this->contents_.data(), len); - if (aligned_full_length > length + 8) - memset(oview + offset + length + 8, 0, aligned_full_length - (length + 8)); + if (aligned_full_length > len + 8) + memset(oview + offset + len + 8, 0, aligned_full_length - (len + 8)); // Tell the exception frame header about this FDE. if (eh_frame_hdr != NULL) @@ -934,16 +934,16 @@ Eh_frame::read_fde(Sized_relobj* object, const unsigned char* symbols, section_size_type symbols_size, const unsigned char* pcontents, - unsigned int offset, + unsigned int fde_offset, const unsigned char* pfde, const unsigned char *pfdeend, Track_relocs* relocs, Offsets_to_cie* cies) { - // OFFSET is the distance between the 4 bytes before PFDE to the + // FDE_OFFSET is the distance between the 4 bytes before PFDE to the // start of the CIE. The offset we recorded for the CIE is 8 bytes // after the start of the CIE--after the length and the zero tag. - unsigned int cie_offset = (pfde - 4 - pcontents) - offset + 8; + unsigned int cie_offset = (pfde - 4 - pcontents) - fde_offset + 8; Offsets_to_cie::const_iterator pcie = cies->find(cie_offset); if (pcie == cies->end()) return false; @@ -1026,38 +1026,38 @@ Eh_frame::set_final_data_size() return; } - section_offset_type output_offset = 0; + section_offset_type out_offset = 0; for (Unmergeable_cie_offsets::iterator p = this->unmergeable_cie_offsets_.begin(); p != this->unmergeable_cie_offsets_.end(); ++p) - output_offset = (*p)->set_output_offset(output_offset, - this->addralign(), - &this->merge_map_); + out_offset = (*p)->set_output_offset(out_offset, + this->addralign(), + &this->merge_map_); for (Cie_offsets::iterator p = this->cie_offsets_.begin(); p != this->cie_offsets_.end(); ++p) - output_offset = (*p)->set_output_offset(output_offset, - this->addralign(), - &this->merge_map_); + out_offset = (*p)->set_output_offset(out_offset, + this->addralign(), + &this->merge_map_); this->mappings_are_done_ = true; - this->final_data_size_ = output_offset; + this->final_data_size_ = out_offset; - gold_assert((output_offset & (this->addralign() - 1)) == 0); - this->set_data_size(output_offset); + gold_assert((out_offset & (this->addralign() - 1)) == 0); + this->set_data_size(out_offset); } // Return an output offset for an input offset. bool Eh_frame::do_output_offset(const Relobj* object, unsigned int shndx, - section_offset_type offset, + section_offset_type foffset, section_offset_type* poutput) const { - return this->merge_map_.get_output_offset(object, shndx, offset, poutput); + return this->merge_map_.get_output_offset(object, shndx, foffset, poutput); } // Return whether this is the merge section for an input section. @@ -1074,9 +1074,9 @@ Eh_frame::do_is_merge_section_for(const Relobj* object, void Eh_frame::do_write(Output_file* of) { - const off_t offset = this->offset(); + const off_t foffset = this->offset(); const off_t oview_size = this->data_size(); - unsigned char* const oview = of->get_output_view(offset, oview_size); + unsigned char* const oview = of->get_output_view(foffset, oview_size); switch (parameters->size_and_endianness()) { @@ -1104,7 +1104,7 @@ Eh_frame::do_write(Output_file* of) gold_unreachable(); } - of->write_output_view(offset, oview_size, oview); + of->write_output_view(foffset, oview_size, oview); } // Write the data to the output file--template version. @@ -1113,18 +1113,18 @@ template void Eh_frame::do_sized_write(unsigned char* oview) { - unsigned int addralign = this->addralign(); + unsigned int addr_align = this->addralign(); section_offset_type o = 0; for (Unmergeable_cie_offsets::iterator p = this->unmergeable_cie_offsets_.begin(); p != this->unmergeable_cie_offsets_.end(); ++p) - o = (*p)->write(oview, o, addralign, + o = (*p)->write(oview, o, addr_align, this->eh_frame_hdr_); for (Cie_offsets::iterator p = this->cie_offsets_.begin(); p != this->cie_offsets_.end(); ++p) - o = (*p)->write(oview, o, addralign, + o = (*p)->write(oview, o, addr_align, this->eh_frame_hdr_); } diff --git a/gold/ehframe.h b/gold/ehframe.h index 4726ffc43..06d0fdc4b 100644 --- a/gold/ehframe.h +++ b/gold/ehframe.h @@ -1,6 +1,6 @@ // ehframe.h -- handle exception frame sections for gold -*- C++ -*- -// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -169,9 +169,9 @@ class Fde { public: Fde(Relobj* object, unsigned int shndx, section_offset_type input_offset, - const unsigned char* contents, size_t length) + const unsigned char* contents, size_t len) : object_(object), shndx_(shndx), input_offset_(input_offset), - contents_(reinterpret_cast(contents), length) + contents_(reinterpret_cast(contents), len) { } // Return the length of this FDE. Add 4 for the length and 4 for diff --git a/gold/errors.cc b/gold/errors.cc index 618f9cd64..a7c3ad20e 100644 --- a/gold/errors.cc +++ b/gold/errors.cc @@ -1,6 +1,6 @@ // errors.cc -- handle errors for gold -// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -38,8 +38,8 @@ namespace gold const int Errors::max_undefined_error_report; -Errors::Errors(const char* program_name) - : program_name_(program_name), lock_(NULL), initialize_lock_(&this->lock_), +Errors::Errors(const char* prog_name) + : program_name_(prog_name), lock_(NULL), initialize_lock_(&this->lock_), error_count_(0), warning_count_(0), undefined_symbols_() { } diff --git a/gold/expression.cc b/gold/expression.cc index 853a698d1..8bbcfaace 100644 --- a/gold/expression.cc +++ b/gold/expression.cc @@ -1,6 +1,6 @@ // expression.cc -- expressions in linker scripts for gold -// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -739,10 +739,10 @@ class Align_expression : public Binary_expression && parameters->options().relocatable()) gold_warning(_("aligning to section relative value")); - uint64_t value = this->left_value(eei, eei->result_section_pointer); + uint64_t val = this->left_value(eei, eei->result_section_pointer); if (align <= 1) - return value; - return ((value + align - 1) / align) * align; + return val; + return ((val + align - 1) / align) * align; } void @@ -768,10 +768,10 @@ class Assert_expression : public Unary_expression uint64_t value(const Expression_eval_info* eei) { - uint64_t value = this->arg_value(eei, eei->result_section_pointer); - if (!value && eei->check_assertions) + uint64_t val = this->arg_value(eei, eei->result_section_pointer); + if (!val && eei->check_assertions) gold_error("%s", this->message_.c_str()); - return value; + return val; } void diff --git a/gold/fileread.cc b/gold/fileread.cc index ac3076921..ebc6e2360 100644 --- a/gold/fileread.cc +++ b/gold/fileread.cc @@ -754,14 +754,14 @@ File_view::~File_view() // Create a file for testing. -Input_file::Input_file(const Task* task, const char* name, +Input_file::Input_file(const Task* task, const char* iname, const unsigned char* contents, off_t size) : file_() { this->input_argument_ = - new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE, + new Input_file_argument(iname, Input_file_argument::INPUT_FILE_TYPE_FILE, "", false, Position_dependent_options()); - bool ok = this->file_.open(task, name, contents, size); + bool ok = this->file_.open(task, iname, contents, size); gold_assert(ok); } @@ -843,7 +843,7 @@ File_read::get_mtime() bool Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) { - std::string name; + std::string iname; // Case 1: name is an absolute file, just try to open it // Case 2: name is relative but is_lib is false, is_searched_file is false, @@ -853,8 +853,8 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) && !this->input_argument_->is_searched_file() && this->input_argument_->extra_search_path() == NULL)) { - name = this->input_argument_->name(); - this->found_name_ = name; + iname = this->input_argument_->name(); + this->found_name_ = iname; } // Case 3: is_lib is true or is_searched_file is true else if (this->input_argument_->is_lib() @@ -878,15 +878,15 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) } else n1 = this->input_argument_->name(); - name = dirpath.find(n1, n2, &this->is_in_sysroot_, pindex); - if (name.empty()) + iname = dirpath.find(n1, n2, &this->is_in_sysroot_, pindex); + if (iname.empty()) { gold_error(_("cannot find %s%s"), this->input_argument_->is_lib() ? "-l" : "", this->input_argument_->name()); return false; } - if (n2.empty() || name[name.length() - 1] == 'o') + if (n2.empty() || iname[iname.length() - 1] == 'o') this->found_name_ = n1; else this->found_name_ = n2; @@ -897,20 +897,20 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) gold_assert(this->input_argument_->extra_search_path() != NULL); // First, check extra_search_path. - name = this->input_argument_->extra_search_path(); - if (!IS_DIR_SEPARATOR (name[name.length() - 1])) - name += '/'; - name += this->input_argument_->name(); + iname = this->input_argument_->extra_search_path(); + if (!IS_DIR_SEPARATOR (iname[iname.length() - 1])) + iname += '/'; + iname += this->input_argument_->name(); struct stat dummy_stat; - if (*pindex > 0 || ::stat(name.c_str(), &dummy_stat) < 0) + if (*pindex > 0 || ::stat(iname.c_str(), &dummy_stat) < 0) { // extra_search_path failed, so check the normal search-path. int index = *pindex; if (index > 0) --index; - name = dirpath.find(this->input_argument_->name(), "", - &this->is_in_sysroot_, &index); - if (name.empty()) + iname = dirpath.find(this->input_argument_->name(), "", + &this->is_in_sysroot_, &index); + if (iname.empty()) { gold_error(_("cannot find %s"), this->input_argument_->name()); @@ -927,17 +927,17 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) this->input_argument_->options().format_enum(); bool ok; if (format == General_options::OBJECT_FORMAT_ELF) - ok = this->file_.open(task, name); + ok = this->file_.open(task, iname); else { gold_assert(format == General_options::OBJECT_FORMAT_BINARY); - ok = this->open_binary(task, name); + ok = this->open_binary(task, iname); } if (!ok) { gold_error(_("cannot open %s: %s"), - name.c_str(), strerror(errno)); + iname.c_str(), strerror(errno)); return false; } @@ -947,7 +947,7 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) // Open a file for --format binary. bool -Input_file::open_binary(const Task* task, const std::string& name) +Input_file::open_binary(const Task* task, const std::string& iname) { // In order to open a binary file, we need machine code, size, and // endianness. We may not have a valid target at this point, in @@ -958,10 +958,10 @@ Input_file::open_binary(const Task* task, const std::string& name) Binary_to_elf binary_to_elf(target.machine_code(), target.get_size(), target.is_big_endian(), - name); + iname); if (!binary_to_elf.convert(task)) return false; - return this->file_.open(task, name, binary_to_elf.converted_data_leak(), + return this->file_.open(task, iname, binary_to_elf.converted_data_leak(), binary_to_elf.converted_size()); } diff --git a/gold/fileread.h b/gold/fileread.h index 47c8e0ff2..2e27d2f82 100644 --- a/gold/fileread.h +++ b/gold/fileread.h @@ -246,10 +246,10 @@ class File_read DATA_MMAPPED }; - View(off_t start, section_size_type size, const unsigned char* data, - unsigned int byteshift, bool cache, Data_ownership data_ownership) - : start_(start), size_(size), data_(data), lock_count_(0), - byteshift_(byteshift), cache_(cache), data_ownership_(data_ownership), + View(off_t vstart, section_size_type vsize, const unsigned char* vdata, + unsigned int vbyteshift, bool cache, Data_ownership data_ownership) + : start_(vstart), size_(vsize), data_(vdata), lock_count_(0), + byteshift_(vbyteshift), cache_(cache), data_ownership_(data_ownership), accessed_(true) { } @@ -450,8 +450,8 @@ class File_view friend class File_read; // Callers have to get these via File_read::get_lasting_view. - File_view(File_read& file, File_read::View* view, const unsigned char* data) - : file_(file), view_(view), data_(data) + File_view(File_read& file, File_read::View* view, const unsigned char* vdata) + : file_(file), view_(view), data_(vdata) { } File_read& file_; diff --git a/gold/freebsd.h b/gold/freebsd.h index de697357f..9dbebe783 100644 --- a/gold/freebsd.h +++ b/gold/freebsd.h @@ -87,11 +87,11 @@ Target_freebsd::do_adjust_elf_header(unsigned char* view, class Target_selector_freebsd : public Target_selector { public: - Target_selector_freebsd(int machine, int size, bool is_big_endian, - const char* bfd_name, + Target_selector_freebsd(int amachine, int size, bool is_big_end, + const char* bfdname, const char* freebsd_bfd_name) - : Target_selector(machine, size, is_big_endian, NULL), - bfd_name_(bfd_name), freebsd_bfd_name_(freebsd_bfd_name) + : Target_selector(amachine, size, is_big_end, NULL), + bfd_name_(bfdname), freebsd_bfd_name_(freebsd_bfd_name) { } protected: diff --git a/gold/i386.cc b/gold/i386.cc index 4820f15aa..cadffbadb 100644 --- a/gold/i386.cc +++ b/gold/i386.cc @@ -667,10 +667,10 @@ unsigned char Output_data_plt_i386::dyn_plt_entry[plt_entry_size] = void Output_data_plt_i386::do_write(Output_file* of) { - const off_t offset = this->offset(); + const off_t off = this->offset(); const section_size_type oview_size = convert_to_section_size_type(this->data_size()); - unsigned char* const oview = of->get_output_view(offset, oview_size); + unsigned char* const oview = of->get_output_view(off, oview_size); const off_t got_file_offset = this->got_plt_->offset(); const section_size_type got_size = @@ -739,7 +739,7 @@ Output_data_plt_i386::do_write(Output_file* of) gold_assert(static_cast(pov - oview) == oview_size); gold_assert(static_cast(got_pov - got_view) == got_size); - of->write_output_view(offset, oview_size, oview); + of->write_output_view(off, oview_size, oview); of->write_output_view(got_file_offset, got_size, got_view); } @@ -975,7 +975,7 @@ Target_i386::Scan::local(Symbol_table* symtab, if (parameters->options().output_is_position_independent()) { Reloc_section* rel_dyn = target->rel_dyn_section(layout); - unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info()); + r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info()); rel_dyn->add_local_relative( object, r_sym, elfcpp::R_386_RELATIVE, got, object->local_got_offset(r_sym, GOT_TYPE_STANDARD)); diff --git a/gold/icf.cc b/gold/icf.cc index 03b927adc..39334a579 100644 --- a/gold/icf.cc +++ b/gold/icf.cc @@ -557,7 +557,7 @@ Icf::find_identical_sections(const Input_objects* input_objects, Symbol_table* symtab) { unsigned int section_num = 0; - std::vector num_tracked_relocs; + std::vector num_tracked_rels; std::vector is_secn_or_group_unique; std::vector section_contents; @@ -585,7 +585,7 @@ Icf::find_identical_sections(const Input_objects* input_objects, this->id_section_.push_back(Section_id(*p, i)); this->section_id_[Section_id(*p, i)] = section_num; this->kept_section_id_.push_back(section_num); - num_tracked_relocs.push_back(0); + num_tracked_rels.push_back(0); is_secn_or_group_unique.push_back(false); section_contents.push_back(""); section_num++; @@ -605,7 +605,7 @@ Icf::find_identical_sections(const Input_objects* input_objects, { num_iterations++; converged = match_sections(num_iterations, symtab, - &num_tracked_relocs, &this->kept_section_id_, + &num_tracked_rels, &this->kept_section_id_, this->id_section_, &is_secn_or_group_unique, §ion_contents); } diff --git a/gold/incremental.h b/gold/incremental.h index a94f39719..58b589564 100644 --- a/gold/incremental.h +++ b/gold/incremental.h @@ -432,8 +432,8 @@ class Incremental_inputs // Record the input arguments obtained from parsing the command line. void - report_inputs(const Input_arguments& inputs) - { this->inputs_ = &inputs; } + report_inputs(const Input_arguments& ins) + { this->inputs_ = &ins; } // Record that the input argument INPUT is an archive ARCHIVE. void diff --git a/gold/layout.cc b/gold/layout.cc index a7f8185d4..8655e7c51 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -160,9 +160,9 @@ Layout_task_runner::run(Workqueue* workqueue, const Task* task) // Layout methods. -Layout::Layout(int number_of_input_files, Script_options* script_options) +Layout::Layout(int number_of_input_files, Script_options* script_opts) : number_of_input_files_(number_of_input_files), - script_options_(script_options), + script_options_(script_opts), namepool_(), sympool_(), dynpool_(), @@ -2831,7 +2831,7 @@ Layout::create_dynamic_symtab(const Input_objects* input_objects, // inconvenient to check. if (this->allocated_output_section_count() >= elfcpp::SHN_LORESERVE) { - Output_section* dynsym_xindex = + Output_section* dyn_sym_xindex = this->choose_output_section(NULL, ".dynsym_shndx", elfcpp::SHT_SYMTAB_SHNDX, elfcpp::SHF_ALLOC, @@ -2839,13 +2839,13 @@ Layout::create_dynamic_symtab(const Input_objects* input_objects, this->dynsym_xindex_ = new Output_symtab_xindex(index); - dynsym_xindex->add_output_section_data(this->dynsym_xindex_); + dyn_sym_xindex->add_output_section_data(this->dynsym_xindex_); - dynsym_xindex->set_link_section(dynsym); - dynsym_xindex->set_addralign(4); - dynsym_xindex->set_entsize(4); + dyn_sym_xindex->set_link_section(dynsym); + dyn_sym_xindex->set_addralign(4); + dyn_sym_xindex->set_entsize(4); - dynsym_xindex->set_after_input_sections(); + dyn_sym_xindex->set_after_input_sections(); // This tells the driver code to wait until the symbol table has // written out before writing out the postprocessing sections, @@ -3489,13 +3489,13 @@ Layout::find_or_add_kept_section(const std::string& name, // Store the allocated sections into the section list. void -Layout::get_allocated_sections(Section_list* section_list) const +Layout::get_allocated_sections(Section_list* sec_list) const { for (Section_list::const_iterator p = this->section_list_.begin(); p != this->section_list_.end(); ++p) if (((*p)->flags() & elfcpp::SHF_ALLOC) != 0) - section_list->push_back(*p); + sec_list->push_back(*p); } // Create an output segment. @@ -3538,35 +3538,35 @@ Layout::write_data(const Symbol_table* symtab, Output_file* of) const { if (!parameters->options().strip_all()) { - const Output_section* symtab_section = this->symtab_section_; + const Output_section* sym_tab_section = this->symtab_section_; for (Section_list::const_iterator p = this->section_list_.begin(); p != this->section_list_.end(); ++p) { if ((*p)->needs_symtab_index()) { - gold_assert(symtab_section != NULL); + gold_assert(sym_tab_section != NULL); unsigned int index = (*p)->symtab_index(); gold_assert(index > 0 && index != -1U); - off_t off = (symtab_section->offset() - + index * symtab_section->entsize()); + off_t off = (sym_tab_section->offset() + + index * sym_tab_section->entsize()); symtab->write_section_symbol(*p, this->symtab_xindex_, of, off); } } } - const Output_section* dynsym_section = this->dynsym_section_; + const Output_section* dyn_sym_section = this->dynsym_section_; for (Section_list::const_iterator p = this->section_list_.begin(); p != this->section_list_.end(); ++p) { if ((*p)->needs_dynsym_index()) { - gold_assert(dynsym_section != NULL); + gold_assert(dyn_sym_section != NULL); unsigned int index = (*p)->dynsym_index(); gold_assert(index > 0 && index != -1U); - off_t off = (dynsym_section->offset() - + index * dynsym_section->entsize()); + off_t off = (dyn_sym_section->offset() + + index * dyn_sym_section->entsize()); symtab->write_section_symbol(*p, this->dynsym_xindex_, of, off); } } diff --git a/gold/layout.h b/gold/layout.h index 71afa966f..79785bfd0 100644 --- a/gold/layout.h +++ b/gold/layout.h @@ -151,10 +151,10 @@ class Kept_section // Set the object. void - set_object(Relobj* object) + set_object(Relobj* obj) { gold_assert(this->object_ == NULL); - this->object_ = object; + this->object_ = obj; } // The section index. @@ -164,10 +164,10 @@ class Kept_section // Set the section index. void - set_shndx(unsigned int shndx) + set_shndx(unsigned int sec_shndx) { gold_assert(this->shndx_ == 0); - this->shndx_ = shndx; + this->shndx_ = sec_shndx; } // Whether this is a comdat group. @@ -198,11 +198,11 @@ class Kept_section // Add a section to the group list. void - add_comdat_section(const std::string& name, unsigned int shndx, + add_comdat_section(const std::string& name, unsigned int sec_shndx, uint64_t size) { gold_assert(this->is_comdat_); - Comdat_section_info sinfo(shndx, size); + Comdat_section_info sinfo(sec_shndx, size); this->u_.group_sections->insert(std::make_pair(name, sinfo)); } diff --git a/gold/mapfile.cc b/gold/mapfile.cc index a3ba52ba6..a9b4e728e 100644 --- a/gold/mapfile.cc +++ b/gold/mapfile.cc @@ -217,7 +217,7 @@ Mapfile::print_input_section_symbols( && is_ordinary && sym->is_defined()) { - for (size_t i = 0; i < Mapfile::section_name_map_length; ++i) + for (size_t j = 0; j < Mapfile::section_name_map_length; ++j) putc(' ', this->map_file_); const Sized_symbol* ssym = static_cast*>(sym); diff --git a/gold/merge.cc b/gold/merge.cc index 3d9692124..654f3495f 100644 --- a/gold/merge.cc +++ b/gold/merge.cc @@ -289,10 +289,10 @@ Merge_map::is_merge_section_for(const Relobj* object, unsigned int shndx) const bool Output_merge_base::do_output_offset(const Relobj* object, unsigned int shndx, - section_offset_type offset, + section_offset_type off, section_offset_type* poutput) const { - return this->merge_map_.get_output_offset(object, shndx, offset, poutput); + return this->merge_map_.get_output_offset(object, shndx, off, poutput); } // Return whether this is the merge section for SHNDX in OBJECT. @@ -354,10 +354,10 @@ Output_merge_data::Merge_data_eq::operator()(Merge_data_key k1, void Output_merge_data::add_constant(const unsigned char* p) { - section_size_type entsize = convert_to_section_size_type(this->entsize()); - section_size_type addralign = + section_size_type ent_size = convert_to_section_size_type(this->entsize()); + section_size_type addr_align = convert_to_section_size_type(this->addralign()); - section_size_type addsize = std::max(entsize, addralign); + section_size_type addsize = std::max(ent_size, addr_align); if (this->len_ + addsize > this->alc_) { if (this->alc_ == 0) @@ -369,9 +369,9 @@ Output_merge_data::add_constant(const unsigned char* p) gold_nomem(); } - memcpy(this->p_ + this->len_, p, entsize); - if (addsize > entsize) - memset(this->p_ + this->len_ + entsize, 0, addsize - entsize); + memcpy(this->p_ + this->len_, p, ent_size); + if (addsize > ent_size) + memset(this->p_ + this->len_ + ent_size, 0, addsize - ent_size); this->len_ += addsize; } @@ -386,14 +386,14 @@ Output_merge_data::do_add_input_section(Relobj* object, unsigned int shndx) section_size_type len; const unsigned char* p = object->section_contents(shndx, &len, false); - section_size_type entsize = convert_to_section_size_type(this->entsize()); + section_size_type ent_size = convert_to_section_size_type(this->entsize()); - if (len % entsize != 0) + if (len % ent_size != 0) return false; - this->input_count_ += len / entsize; + this->input_count_ += len / ent_size; - for (section_size_type i = 0; i < len; i += entsize, p += entsize) + for (section_size_type i = 0; i < len; i += ent_size, p += ent_size) { // Add the constant to the section contents. If we find that it // is already in the hash table, we will remove it again. @@ -406,12 +406,12 @@ Output_merge_data::do_add_input_section(Relobj* object, unsigned int shndx) if (!ins.second) { // Key was already present. Remove the copy we just added. - this->len_ -= entsize; + this->len_ -= ent_size; k = *ins.first; } // Record the offset of this constant in the output section. - this->add_mapping(object, shndx, i, entsize, k); + this->add_mapping(object, shndx, i, ent_size, k); } return true; @@ -531,9 +531,9 @@ Output_merge_string::finalize_merged_data() p != this->merged_strings_.end(); ++p) { - section_offset_type offset = + section_offset_type soffset = this->stringpool_.get_offset_from_key(p->stringpool_key); - this->add_mapping(p->object, p->shndx, p->offset, p->length, offset); + this->add_mapping(p->object, p->shndx, p->offset, p->length, soffset); } // Save some memory. This also ensures that this function will work diff --git a/gold/merge.h b/gold/merge.h index 345b1154e..62c0ecaf6 100644 --- a/gold/merge.h +++ b/gold/merge.h @@ -1,6 +1,6 @@ // merge.h -- handle section merging for gold -*- C++ -*- -// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -215,8 +215,8 @@ class Merge_map class Output_merge_base : public Output_section_data { public: - Output_merge_base(uint64_t entsize, uint64_t addralign) - : Output_section_data(addralign), merge_map_(), entsize_(entsize) + Output_merge_base(uint64_t ent_size, uint64_t addr_align) + : Output_section_data(addr_align), merge_map_(), entsize_(ent_size) { } // Return the entry size. @@ -241,15 +241,15 @@ class Output_merge_base : public Output_section_data bool do_is_merge_section_for(const Relobj*, unsigned int shndx) const; - // Add a mapping from an OFFSET in input section SHNDX in object - // OBJECT to an OUTPUT_OFFSET in the output section. OUTPUT_OFFSET + // Add a mapping from an IN_OFFSET in input section SHNDX in object + // OBJECT to an OUT_OFFSET in the output section. OUT_OFFSET // is the offset from the start of the merged data in the output // section. void - add_mapping(Relobj* object, unsigned int shndx, section_offset_type offset, - section_size_type length, section_offset_type output_offset) + add_mapping(Relobj* object, unsigned int shndx, section_offset_type in_offset, + section_size_type length, section_offset_type out_offset) { - this->merge_map_.add_mapping(object, shndx, offset, length, output_offset); + this->merge_map_.add_mapping(object, shndx, in_offset, length, out_offset); } // This may be overriden by the child class. @@ -271,8 +271,8 @@ class Output_merge_base : public Output_section_data class Output_merge_data : public Output_merge_base { public: - Output_merge_data(uint64_t entsize, uint64_t addralign) - : Output_merge_base(entsize, addralign), p_(NULL), len_(0), alc_(0), + Output_merge_data(uint64_t ent_size, uint64_t addr_align) + : Output_merge_base(ent_size, addr_align), p_(NULL), len_(0), alc_(0), input_count_(0), hashtable_(128, Merge_data_hash(this), Merge_data_eq(this)) { } @@ -386,11 +386,11 @@ template class Output_merge_string : public Output_merge_base { public: - Output_merge_string(uint64_t addralign) - : Output_merge_base(sizeof(Char_type), addralign), stringpool_(), + Output_merge_string(uint64_t addr_align) + : Output_merge_base(sizeof(Char_type), addr_align), stringpool_(), merged_strings_(), input_count_(0) { - gold_assert(addralign <= sizeof(Char_type)); + gold_assert(addr_align <= sizeof(Char_type)); this->stringpool_.set_no_zero_null(); } diff --git a/gold/object.cc b/gold/object.cc index 798e42d80..465e99c7c 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -51,12 +51,12 @@ namespace gold template void -Xindex::initialize_symtab_xindex(Object* object, unsigned int symtab_shndx) +Xindex::initialize_symtab_xindex(Object* object, unsigned int sym_tab_shndx) { if (!this->symtab_xindex_.empty()) return; - gold_assert(symtab_shndx != 0); + gold_assert(sym_tab_shndx != 0); // Look through the sections in reverse order, on the theory that it // is more likely to be near the end than the beginning. @@ -65,7 +65,7 @@ Xindex::initialize_symtab_xindex(Object* object, unsigned int symtab_shndx) { --i; if (object->section_type(i) == elfcpp::SHT_SYMTAB_SHNDX - && this->adjust_shndx(object->section_link(i)) == symtab_shndx) + && this->adjust_shndx(object->section_link(i)) == sym_tab_shndx) { this->read_symtab_xindex(object, i, NULL); return; @@ -177,8 +177,8 @@ Object::read_section_data(elfcpp::Elf_file* elf_file, // Read the section headers. const off_t shoff = elf_file->shoff(); - const unsigned int shnum = this->shnum(); - sd->section_headers = this->get_lasting_view(shoff, shnum * shdr_size, + const unsigned int sec_shnum = this->shnum(); + sd->section_headers = this->get_lasting_view(shoff, sec_shnum * shdr_size, true, true); // Read the section names. @@ -197,17 +197,17 @@ Object::read_section_data(elfcpp::Elf_file* elf_file, false); } -// If NAME is the name of a special .gnu.warning section, arrange for +// If SNAME is the name of a special .gnu.warning section, arrange for // the warning to be issued. SHNDX is the section index. Return // whether it is a warning section. bool -Object::handle_gnu_warning_section(const char* name, unsigned int shndx, +Object::handle_gnu_warning_section(const char* sname, unsigned int shndx, Symbol_table* symtab) { const char warn_prefix[] = ".gnu.warning."; const int warn_prefix_len = sizeof warn_prefix - 1; - if (strncmp(name, warn_prefix, warn_prefix_len) == 0) + if (strncmp(sname, warn_prefix, warn_prefix_len) == 0) { // Read the section contents to get the warning text. It would // be nicer if we only did this if we have to actually issue a @@ -220,29 +220,29 @@ Object::handle_gnu_warning_section(const char* name, unsigned int shndx, false); if (len == 0) { - const char* warning = name + warn_prefix_len; + const char* warning = sname + warn_prefix_len; contents = reinterpret_cast(warning); len = strlen(warning); } std::string warning(reinterpret_cast(contents), len); - symtab->add_warning(name + warn_prefix_len, this, warning); + symtab->add_warning(sname + warn_prefix_len, this, warning); return true; } return false; } -// If NAME is the name of the special section which indicates that +// If SNAME is the name of the special section which indicates that // this object was compiled with -fstack-split, mark it accordingly. bool -Object::handle_split_stack_section(const char* name) +Object::handle_split_stack_section(const char* sname) { - if (strcmp(name, ".note.GNU-split-stack") == 0) + if (strcmp(sname, ".note.GNU-split-stack") == 0) { this->uses_split_stack_ = true; return true; } - if (strcmp(name, ".note.GNU-no-split-stack") == 0) + if (strcmp(sname, ".note.GNU-no-split-stack") == 0) { this->has_no_split_stack_ = true; return true; @@ -301,22 +301,22 @@ Relobj::copy_symbols_data(Symbols_data* gc_sd, Read_symbols_data* sd, // roots of the worklist. bool -Relobj::is_section_name_included(const char* name) +Relobj::is_section_name_included(const char* sname) { - if (is_prefix_of(".ctors", name) - || is_prefix_of(".dtors", name) - || is_prefix_of(".note", name) - || is_prefix_of(".init", name) - || is_prefix_of(".fini", name) - || is_prefix_of(".gcc_except_table", name) - || is_prefix_of(".jcr", name) - || is_prefix_of(".preinit_array", name) - || (is_prefix_of(".text", name) - && strstr(name, "personality")) - || (is_prefix_of(".data", name) - && strstr(name, "personality")) - || (is_prefix_of(".gnu.linkonce.d", name) && - strstr(name, "personality"))) + if (is_prefix_of(".ctors", sname) + || is_prefix_of(".dtors", sname) + || is_prefix_of(".note", sname) + || is_prefix_of(".init", sname) + || is_prefix_of(".fini", sname) + || is_prefix_of(".gcc_except_table", sname) + || is_prefix_of(".jcr", sname) + || is_prefix_of(".preinit_array", sname) + || (is_prefix_of(".text", sname) + && strstr(sname, "personality")) + || (is_prefix_of(".data", sname) + && strstr(sname, "personality")) + || (is_prefix_of(".gnu.linkonce.d", sname) + && strstr(sname, "personality"))) { return true; } @@ -327,11 +327,11 @@ Relobj::is_section_name_included(const char* name) template Sized_relobj::Sized_relobj( - const std::string& name, - Input_file* input_file, - off_t offset, + const std::string& aname, + Input_file* ainput_file, + off_t aoffset, const elfcpp::Ehdr& ehdr) - : Relobj(name, input_file, offset), + : Relobj(aname, ainput_file, aoffset), elf_file_(this, ehdr), symtab_shndx_(-1U), local_symbol_count_(0), @@ -361,8 +361,8 @@ template void Sized_relobj::do_setup() { - const unsigned int shnum = this->elf_file_.shnum(); - this->set_shnum(shnum); + const unsigned int sec_shnum = this->elf_file_.shnum(); + this->set_shnum(sec_shnum); } // Find the SHT_SYMTAB section, given the section headers. The ELF @@ -374,14 +374,14 @@ template void Sized_relobj::find_symtab(const unsigned char* pshdrs) { - const unsigned int shnum = this->shnum(); + const unsigned int sec_shnum = this->shnum(); this->symtab_shndx_ = 0; - if (shnum > 0) + if (sec_shnum > 0) { // Look through the sections in reverse order, since gas tends // to put the symbol table at the end. - const unsigned char* p = pshdrs + shnum * This::shdr_size; - unsigned int i = shnum; + const unsigned char* p = pshdrs + sec_shnum * This::shdr_size; + unsigned int i = sec_shnum; unsigned int xindex_shndx = 0; unsigned int xindex_link = 0; while (i > 0) @@ -451,9 +451,9 @@ Sized_relobj::find_eh_frame( const char* names, section_size_type names_size) const { - const unsigned int shnum = this->shnum(); + const unsigned int sec_shnum = this->shnum(); const unsigned char* p = pshdrs + This::shdr_size; - for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size) + for (unsigned int i = 1; i < sec_shnum; ++i, p += This::shdr_size) { typename This::Shdr shdr(p); if (this->check_eh_frame_flags(&shdr)) @@ -465,8 +465,8 @@ Sized_relobj::find_eh_frame( continue; } - const char* name = names + shdr.get_sh_name(); - if (strcmp(name, ".eh_frame") == 0) + const char* aname = names + shdr.get_sh_name(); + if (strcmp(aname, ".eh_frame") == 0) return true; } } @@ -517,11 +517,11 @@ Sized_relobj::do_read_symbols(Read_symbols_data* sd) // object file format is over 5 pages that we don't need to read // now. - const int sym_size = This::sym_size; + const int symsize = This::sym_size; const unsigned int loccount = symtabshdr.get_sh_info(); this->local_symbol_count_ = loccount; this->local_values_.resize(loccount); - section_offset_type locsize = loccount * sym_size; + section_offset_type locsize = loccount * symsize; off_t dataoff = symtabshdr.get_sh_offset(); section_size_type datasize = convert_to_section_size_type(symtabshdr.get_sh_size()); @@ -604,9 +604,9 @@ template bool Sized_relobj::include_section_group( Symbol_table* symtab, - Layout* layout, + Layout* alayout, unsigned int index, - const char* name, + const char* aname, const unsigned char* shdrs, const char* section_names, section_size_type section_names_size, @@ -697,9 +697,9 @@ Sized_relobj::include_section_group( } else { - include_group = layout->find_or_add_kept_section(signature, - this, index, true, - true, &kept_section); + include_group = alayout->find_or_add_kept_section(signature, + this, index, true, + true, &kept_section); is_comdat = true; } @@ -792,8 +792,8 @@ Sized_relobj::include_section_group( } if (relocate_group) - layout->layout_group(symtab, this, index, name, signature.c_str(), - shdr, flags, &shndxes); + alayout->layout_group(symtab, this, index, aname, signature.c_str(), + shdr, flags, &shndxes); return include_group; } @@ -816,9 +816,9 @@ Sized_relobj::include_section_group( template bool Sized_relobj::include_linkonce_section( - Layout* layout, + Layout* alayout, unsigned int index, - const char* name, + const char* aname, const elfcpp::Shdr& shdr) { typename elfcpp::Elf_types::Elf_WXword sh_size = shdr.get_sh_size(); @@ -832,18 +832,18 @@ Sized_relobj::include_linkonce_section( // ".gnu.linkonce.d.rel.ro.local". const char* const linkonce_t = ".gnu.linkonce.t."; const char* symname; - if (strncmp(name, linkonce_t, strlen(linkonce_t)) == 0) - symname = name + strlen(linkonce_t); + if (strncmp(aname, linkonce_t, strlen(linkonce_t)) == 0) + symname = aname + strlen(linkonce_t); else - symname = strrchr(name, '.') + 1; + symname = strrchr(aname, '.') + 1; std::string sig1(symname); - std::string sig2(name); + std::string sig2(aname); Kept_section* kept1; Kept_section* kept2; - bool include1 = layout->find_or_add_kept_section(sig1, this, index, false, - false, &kept1); - bool include2 = layout->find_or_add_kept_section(sig2, this, index, false, - true, &kept2); + bool include1 = alayout->find_or_add_kept_section(sig1, this, index, false, + false, &kept1); + bool include2 = alayout->find_or_add_kept_section(sig2, this, index, false, + true, &kept2); if (!include2) { @@ -887,27 +887,27 @@ Sized_relobj::include_linkonce_section( template inline void -Sized_relobj::layout_section(Layout* layout, +Sized_relobj::layout_section(Layout* alayout, unsigned int shndx, - const char* name, + const char* aname, typename This::Shdr& shdr, unsigned int reloc_shndx, unsigned int reloc_type) { - off_t offset; - Output_section* os = layout->layout(this, shndx, name, shdr, - reloc_shndx, reloc_type, &offset); + off_t aoffset; + Output_section* os = alayout->layout(this, shndx, aname, shdr, + reloc_shndx, reloc_type, &aoffset); this->output_sections()[shndx] = os; - if (offset == -1) + if (aoffset == -1) this->section_offsets_[shndx] = invalid_address; else - this->section_offsets_[shndx] = convert_types(offset); + this->section_offsets_[shndx] = convert_types(aoffset); // If this section requires special handling, and if there are // relocs that apply to it, then we must do the special handling // before we apply the relocs. - if (offset == -1 && reloc_shndx != 0) + if (aoffset == -1 && reloc_shndx != 0) this->set_relocs_must_follow_section_writes(); } @@ -928,10 +928,10 @@ Sized_relobj::layout_section(Layout* layout, template void Sized_relobj::do_layout(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_symbols_data* sd) { - const unsigned int shnum = this->shnum(); + const unsigned int sec_shnum = this->shnum(); bool is_gc_pass_one = ((parameters->options().gc_sections() && !symtab->gc()->is_worklist_ready()) || (parameters->options().icf_enabled() @@ -948,7 +948,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // Both is_gc_pass_one and is_gc_pass_two should not be true. gold_assert(!(is_gc_pass_one && is_gc_pass_two)); - if (shnum == 0) + if (sec_shnum == 0) return; Symbols_data* gc_sd = NULL; if (is_gc_pass_one) @@ -956,7 +956,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // During garbage collection save the symbols data to use it when // re-entering this function. gc_sd = new Symbols_data; - this->copy_symbols_data(gc_sd, sd, This::shdr_size * shnum); + this->copy_symbols_data(gc_sd, sd, This::shdr_size * sec_shnum); this->set_symbols_data(gc_sd); } else if (is_gc_pass_two) @@ -1016,11 +1016,11 @@ Sized_relobj::do_layout(Symbol_table* symtab, // For each section, record the index of the reloc section if any. // Use 0 to mean that there is no reloc section, -1U to mean that // there is more than one. - std::vector reloc_shndx(shnum, 0); - std::vector reloc_type(shnum, elfcpp::SHT_NULL); + std::vector reloc_shndx(sec_shnum, 0); + std::vector reloc_type(sec_shnum, elfcpp::SHT_NULL); // Skip the first, dummy, section. pshdrs = shdrs + This::shdr_size; - for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size) + for (unsigned int i = 1; i < sec_shnum; ++i, pshdrs += This::shdr_size) { typename This::Shdr shdr(pshdrs); @@ -1032,7 +1032,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, if (sh_type == elfcpp::SHT_REL || sh_type == elfcpp::SHT_RELA) { unsigned int target_shndx = this->adjust_shndx(shdr.get_sh_info()); - if (target_shndx == 0 || target_shndx >= shnum) + if (target_shndx == 0 || target_shndx >= sec_shnum) { this->error(_("relocation section %u has bad info %u"), i, target_shndx); @@ -1054,8 +1054,8 @@ Sized_relobj::do_layout(Symbol_table* symtab, if (!is_gc_pass_two) { - out_sections.resize(shnum); - out_section_offsets.resize(shnum); + out_sections.resize(sec_shnum); + out_section_offsets.resize(sec_shnum); } // If we are only linking for symbols, then there is nothing else to @@ -1084,12 +1084,12 @@ Sized_relobj::do_layout(Symbol_table* symtab, uint64_t gnu_stack_flags = 0; // Keep track of which sections to omit. - std::vector omit(shnum, false); + std::vector omit(sec_shnum, false); // Keep track of reloc sections when emitting relocations. const bool relocatable = parameters->options().relocatable(); - const bool emit_relocs = (relocatable - || parameters->options().emit_relocs()); + const bool emit_rels = (relocatable + || parameters->options().emit_relocs()); std::vector reloc_sections; // Keep track of .eh_frame sections. @@ -1097,7 +1097,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // Skip the first, dummy, section. pshdrs = shdrs + This::shdr_size; - for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size) + for (unsigned int i = 1; i < sec_shnum; ++i, pshdrs += This::shdr_size) { typename This::Shdr shdr(pshdrs); @@ -1108,11 +1108,11 @@ Sized_relobj::do_layout(Symbol_table* symtab, return; } - const char* name = pnames + shdr.get_sh_name(); + const char* sname = pnames + shdr.get_sh_name(); if (!is_gc_pass_two) { - if (this->handle_gnu_warning_section(name, i, symtab)) + if (this->handle_gnu_warning_section(sname, i, symtab)) { if (!relocatable) omit[i] = true; @@ -1121,7 +1121,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // The .note.GNU-stack section is special. It gives the // protection flags that this object file requires for the stack // in memory. - if (strcmp(name, ".note.GNU-stack") == 0) + if (strcmp(sname, ".note.GNU-stack") == 0) { seen_gnu_stack = true; gnu_stack_flags |= shdr.get_sh_flags(); @@ -1131,7 +1131,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // The .note.GNU-split-stack section is also special. It // indicates that the object was compiled with // -fsplit-stack. - if (this->handle_split_stack_section(name)) + if (this->handle_split_stack_section(sname)) { if (!parameters->options().relocatable() && !parameters->options().shared()) @@ -1139,7 +1139,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, } // Skip attributes section. - if (parameters->target().is_attributes_section(name)) + if (parameters->target().is_attributes_section(sname)) { omit[i] = true; } @@ -1149,16 +1149,16 @@ Sized_relobj::do_layout(Symbol_table* symtab, { if (shdr.get_sh_type() == elfcpp::SHT_GROUP) { - if (!this->include_section_group(symtab, layout, i, name, + if (!this->include_section_group(symtab, alayout, i, sname, shdrs, pnames, section_names_size, &omit)) discard = true; } else if ((shdr.get_sh_flags() & elfcpp::SHF_GROUP) == 0 - && Layout::is_linkonce(name)) + && Layout::is_linkonce(sname)) { - if (!this->include_linkonce_section(layout, i, name, shdr)) + if (!this->include_linkonce_section(alayout, i, sname, shdr)) discard = true; } } @@ -1174,7 +1174,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, if (is_gc_pass_one && parameters->options().gc_sections()) { - if (is_section_name_included(name) + if (is_section_name_included(sname) || shdr.get_sh_type() == elfcpp::SHT_INIT_ARRAY || shdr.get_sh_type() == elfcpp::SHT_FINI_ARRAY) { @@ -1188,7 +1188,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // However, we don't know that yet for all sections. So save // reloc sections and process them later. Garbage collection is // not triggered when relocatable code is desired. - if (emit_relocs + if (emit_rels && (shdr.get_sh_type() == elfcpp::SHT_REL || shdr.get_sh_type() == elfcpp::SHT_RELA)) { @@ -1206,7 +1206,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // determine which sections are being discarded, and discard the // corresponding information. if (!relocatable - && strcmp(name, ".eh_frame") == 0 + && strcmp(sname, ".eh_frame") == 0 && this->check_eh_frame_flags(&shdr)) { if (is_gc_pass_one) @@ -1279,7 +1279,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, if (should_defer_layout && (shdr.get_sh_flags() & elfcpp::SHF_ALLOC)) { gold_assert(!is_gc_pass_two); - this->deferred_layout_.push_back(Deferred_layout(i, name, + this->deferred_layout_.push_back(Deferred_layout(i, sname, pshdrs, reloc_shndx[i], reloc_type[i])); @@ -1308,18 +1308,18 @@ Sized_relobj::do_layout(Symbol_table* symtab, { // When garbage collection is switched on the actual layout // only happens in the second call. - this->layout_section(layout, i, name, shdr, reloc_shndx[i], + this->layout_section(alayout, i, sname, shdr, reloc_shndx[i], reloc_type[i]); } } if (!is_gc_pass_one) - layout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags); + alayout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags); // When doing a relocatable link handle the reloc sections at the // end. Garbage collection and Identical Code Folding is not // turned on for relocatable code. - if (emit_relocs) + if (emit_rels) this->size_relocatable_relocs(); gold_assert(!(is_gc_or_icf) || reloc_sections.empty()); @@ -1334,7 +1334,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, typename This::Shdr shdr(pshdr); unsigned int data_shndx = this->adjust_shndx(shdr.get_sh_info()); - if (data_shndx >= shnum) + if (data_shndx >= sec_shnum) { // We already warned about this above. continue; @@ -1351,8 +1351,8 @@ Sized_relobj::do_layout(Symbol_table* symtab, Relocatable_relocs* rr = new Relocatable_relocs(); this->set_relocatable_relocs(i, rr); - Output_section* os = layout->layout_reloc(this, i, shdr, data_section, - rr); + Output_section* os = alayout->layout_reloc(this, i, shdr, data_section, + rr); out_sections[i] = os; out_section_offsets[i] = invalid_address; } @@ -1371,18 +1371,18 @@ Sized_relobj::do_layout(Symbol_table* symtab, pshdr = section_headers_data + i * This::shdr_size; typename This::Shdr shdr(pshdr); - off_t offset; - Output_section* os = layout->layout_eh_frame(this, - symbols_data, - symbols_size, - symbol_names_data, - symbol_names_size, - i, shdr, - reloc_shndx[i], - reloc_type[i], - &offset); + off_t off; + Output_section* os = alayout->layout_eh_frame(this, + symbols_data, + symbols_size, + symbol_names_data, + symbol_names_size, + i, shdr, + reloc_shndx[i], + reloc_type[i], + &off); out_sections[i] = os; - if (offset == -1) + if (off == -1) { // An object can contain at most one section holding exception // frame information. @@ -1391,12 +1391,12 @@ Sized_relobj::do_layout(Symbol_table* symtab, out_section_offsets[i] = invalid_address; } else - out_section_offsets[i] = convert_types(offset); + out_section_offsets[i] = convert_types(off); // If this section requires special handling, and if there are // relocs that apply to it, then we must do the special handling // before we apply the relocs. - if (offset == -1 && reloc_shndx[i] != 0) + if (off == -1 && reloc_shndx[i] != 0) this->set_relocs_must_follow_section_writes(); } @@ -1422,7 +1422,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, template void -Sized_relobj::do_layout_deferred_sections(Layout* layout) +Sized_relobj::do_layout_deferred_sections(Layout* alayout) { typename std::vector::iterator deferred; @@ -1431,7 +1431,7 @@ Sized_relobj::do_layout_deferred_sections(Layout* layout) ++deferred) { typename This::Shdr shdr(deferred->shdr_data_); - this->layout_section(layout, deferred->shndx_, deferred->name_.c_str(), + this->layout_section(alayout, deferred->shndx_, deferred->name_.c_str(), shdr, deferred->reloc_shndx_, deferred->reloc_type_); } @@ -1452,10 +1452,10 @@ Sized_relobj::do_add_symbols(Symbol_table* symtab, return; } - const int sym_size = This::sym_size; + const int symsize = This::sym_size; size_t symcount = ((sd->symbols_size - sd->external_symbols_offset) - / sym_size); - if (symcount * sym_size != sd->symbols_size - sd->external_symbols_offset) + / symsize); + if (symcount * symsize != sd->symbols_size - sd->external_symbols_offset) { this->error(_("size of symbols is not multiple of symbol size")); return; @@ -1497,16 +1497,16 @@ Sized_relobj::do_count_local_symbols(Stringpool* pool, } // Read the symbol table section header. - const unsigned int symtab_shndx = this->symtab_shndx_; + const unsigned int sym_tab_shndx = this->symtab_shndx_; typename This::Shdr symtabshdr(this, - this->elf_file_.section_header(symtab_shndx)); + this->elf_file_.section_header(sym_tab_shndx)); gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB); // Read the local symbols. - const int sym_size = This::sym_size; + const int symsize = This::sym_size; const unsigned int loccount = this->local_symbol_count_; gold_assert(loccount == symtabshdr.get_sh_info()); - off_t locsize = loccount * sym_size; + off_t locsize = loccount * symsize; const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(), locsize, true, true); @@ -1522,13 +1522,13 @@ Sized_relobj::do_count_local_symbols(Stringpool* pool, // Loop over the local symbols. const Output_sections& out_sections(this->output_sections()); - unsigned int shnum = this->shnum(); + unsigned int sec_shnum = this->shnum(); unsigned int count = 0; unsigned int dyncount = 0; // Skip the first, dummy, symbol. - psyms += sym_size; + psyms += symsize; bool discard_locals = parameters->options().discard_locals(); - for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size) + for (unsigned int i = 1; i < loccount; ++i, psyms += symsize) { elfcpp::Sym sym(psyms); @@ -1549,7 +1549,7 @@ Sized_relobj::do_count_local_symbols(Stringpool* pool, // Decide whether this symbol should go into the output file. - if ((shndx < shnum && out_sections[shndx] == NULL) + if ((shndx < sec_shnum && out_sections[shndx] == NULL) || (shndx == this->discarded_eh_frame_shndx_)) { lv.set_no_output_symtab_entry(); @@ -1585,11 +1585,11 @@ Sized_relobj::do_count_local_symbols(Stringpool* pool, // - the symbol has a name. // // We do not discard a symbol if it needs a dynamic symbol entry. - const char* name = pnames + sym.get_st_name(); + const char* sname = pnames + sym.get_st_name(); if (discard_locals && sym.get_st_type() != elfcpp::STT_FILE && !lv.needs_output_dynsym_entry() - && parameters->target().is_local_label_name(name)) + && parameters->target().is_local_label_name(sname)) { lv.set_no_output_symtab_entry(); continue; @@ -1597,20 +1597,20 @@ Sized_relobj::do_count_local_symbols(Stringpool* pool, // Discard the local symbol if -retain_symbols_file is specified // and the local symbol is not in that file. - if (!parameters->options().should_retain_symbol(name)) + if (!parameters->options().should_retain_symbol(sname)) { lv.set_no_output_symtab_entry(); continue; } // Add the symbol to the symbol table string pool. - pool->add(name, true, NULL); + pool->add(sname, true, NULL); ++count; // If needed, add the symbol to the dynamic symbol table string pool. if (lv.needs_output_dynsym_entry()) { - dynpool->add(name, true, NULL); + dynpool->add(sname, true, NULL); ++dyncount; } } @@ -1638,7 +1638,7 @@ Sized_relobj::do_finalize_local_symbols(unsigned int index, const bool relocatable = parameters->options().relocatable(); const Output_sections& out_sections(this->output_sections()); const std::vector
& out_offsets(this->section_offsets_); - unsigned int shnum = this->shnum(); + unsigned int sec_shnum = this->shnum(); for (unsigned int i = 1; i < loccount; ++i) { @@ -1662,7 +1662,7 @@ Sized_relobj::do_finalize_local_symbols(unsigned int index, } else { - if (shndx >= shnum) + if (shndx >= sec_shnum) { this->error(_("local symbol %u section index %u out of range"), i, shndx); @@ -1854,16 +1854,16 @@ Sized_relobj::write_local_symbols( } // Read the symbol table section header. - const unsigned int symtab_shndx = this->symtab_shndx_; + const unsigned int sym_tab_shndx = this->symtab_shndx_; typename This::Shdr symtabshdr(this, - this->elf_file_.section_header(symtab_shndx)); + this->elf_file_.section_header(sym_tab_shndx)); gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB); const unsigned int loccount = this->local_symbol_count_; gold_assert(loccount == symtabshdr.get_sh_info()); // Read the local symbols. - const int sym_size = This::sym_size; - off_t locsize = loccount * sym_size; + const int symsize = This::sym_size; + off_t locsize = loccount * symsize; const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(), locsize, true, false); @@ -1878,12 +1878,12 @@ Sized_relobj::write_local_symbols( // Get views into the output file for the portions of the symbol table // and the dynamic symbol table that we will be writing. - off_t output_size = this->output_local_symbol_count_ * sym_size; + off_t output_size = this->output_local_symbol_count_ * symsize; unsigned char* oview = NULL; if (output_size > 0) oview = of->get_output_view(this->local_symbol_offset_, output_size); - off_t dyn_output_size = this->output_local_dynsym_count_ * sym_size; + off_t dyn_output_size = this->output_local_dynsym_count_ * symsize; unsigned char* dyn_oview = NULL; if (dyn_output_size > 0) dyn_oview = of->get_output_view(this->local_dynsym_offset_, @@ -1895,8 +1895,8 @@ Sized_relobj::write_local_symbols( unsigned char* ov = oview; unsigned char* dyn_ov = dyn_oview; - psyms += sym_size; - for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size) + psyms += symsize; + for (unsigned int i = 1; i < loccount; ++i, psyms += symsize) { elfcpp::Sym isym(psyms); @@ -1927,15 +1927,15 @@ Sized_relobj::write_local_symbols( elfcpp::Sym_write osym(ov); gold_assert(isym.get_st_name() < strtab_size); - const char* name = pnames + isym.get_st_name(); - osym.put_st_name(sympool->get_offset(name)); + const char* sname = pnames + isym.get_st_name(); + osym.put_st_name(sympool->get_offset(sname)); osym.put_st_value(this->local_values_[i].value(this, 0)); osym.put_st_size(isym.get_st_size()); osym.put_st_info(isym.get_st_info()); osym.put_st_other(isym.get_st_other()); osym.put_st_shndx(st_shndx); - ov += sym_size; + ov += symsize; } // Write the symbol to the output dynamic symbol table. @@ -1945,15 +1945,15 @@ Sized_relobj::write_local_symbols( elfcpp::Sym_write osym(dyn_ov); gold_assert(isym.get_st_name() < strtab_size); - const char* name = pnames + isym.get_st_name(); - osym.put_st_name(dynpool->get_offset(name)); + const char* sname = pnames + isym.get_st_name(); + osym.put_st_name(dynpool->get_offset(sname)); osym.put_st_value(this->local_values_[i].value(this, 0)); osym.put_st_size(isym.get_st_size()); osym.put_st_info(isym.get_st_info()); osym.put_st_other(isym.get_st_other()); osym.put_st_shndx(st_shndx); - dyn_ov += sym_size; + dyn_ov += symsize; } } @@ -1980,7 +1980,7 @@ template bool Sized_relobj::get_symbol_location_info( unsigned int shndx, - off_t offset, + off_t sym_offset, Symbol_location_info* info) { if (this->symtab_shndx_ == 0) @@ -1998,11 +1998,11 @@ Sized_relobj::get_symbol_location_info( this->section_contents(symbol_names_shndx, &names_size, false); const char* symbol_names = reinterpret_cast(symbol_names_u); - const int sym_size = This::sym_size; - const size_t count = symbols_size / sym_size; + const int symsize = This::sym_size; + const size_t count = symbols_size / symsize; const unsigned char* p = symbols; - for (size_t i = 0; i < count; ++i, p += sym_size) + for (size_t i = 0; i < count; ++i, p += symsize) { elfcpp::Sym sym(p); @@ -2020,9 +2020,9 @@ Sized_relobj::get_symbol_location_info( &is_ordinary); if (is_ordinary && st_shndx == shndx - && static_cast(sym.get_st_value()) <= offset + && static_cast(sym.get_st_value()) <= sym_offset && (static_cast(sym.get_st_value() + sym.get_st_size()) - > offset)) + > sym_offset)) { if (sym.get_st_name() > names_size) info->enclosing_symbol_name = "(invalid)"; @@ -2065,11 +2065,11 @@ Sized_relobj::map_to_kept_section( Sized_relobj* kept_relobj = static_cast*>(kept_object); Output_section* os = kept_relobj->output_section(kept_shndx); - Address offset = kept_relobj->get_output_section_offset(kept_shndx); - if (os != NULL && offset != invalid_address) + Address addr_offset = kept_relobj->get_output_section_offset(kept_shndx); + if (os != NULL && addr_offset != invalid_address) { *found = true; - return os->address() + offset; + return os->address() + addr_offset; } } *found = false; diff --git a/gold/object.h b/gold/object.h index 187a10179..c2359bead 100644 --- a/gold/object.h +++ b/gold/object.h @@ -192,12 +192,12 @@ class Object // (e.g., libfoo.a(bar.o) if this is in an archive. INPUT_FILE is // used to read the file. OFFSET is the offset within the input // file--0 for a .o or .so file, something else for a .a file. - Object(const std::string& name, Input_file* input_file, bool is_dynamic, - off_t offset = 0) - : name_(name), input_file_(input_file), offset_(offset), shnum_(-1U), - is_dynamic_(is_dynamic), is_needed_(false), uses_split_stack_(false), + Object(const std::string& oname, Input_file* oinput_file, bool ois_dynamic, + off_t ooffset = 0) + : name_(oname), input_file_(oinput_file), offset_(ooffset), shnum_(-1U), + is_dynamic_(ois_dynamic), is_needed_(false), uses_split_stack_(false), has_no_split_stack_(false), no_export_(false), xindex_(NULL) - { input_file->file().add_object(); } + { oinput_file->file().add_object(); } virtual ~Object() { this->input_file_->file().remove_object(); } @@ -372,13 +372,13 @@ class Object // Pass sections which should be included in the link to the Layout // object, and record where the sections go in the output file. void - layout(Symbol_table* symtab, Layout* layout, Read_symbols_data* sd) - { this->do_layout(symtab, layout, sd); } + layout(Symbol_table* symtab, Layout* olayout, Read_symbols_data* sd) + { this->do_layout(symtab, olayout, sd); } // Add symbol information to the global symbol table. void - add_symbols(Symbol_table* symtab, Read_symbols_data* sd, Layout *layout) - { this->do_add_symbols(symtab, sd, layout); } + add_symbols(Symbol_table* symtab, Read_symbols_data* sd, Layout *olayout) + { this->do_add_symbols(symtab, sd, olayout); } // Functions and types for the elfcpp::Elf_file interface. This // permit us to use Object as the File template parameter for @@ -555,8 +555,8 @@ class Object // Set the number of sections. void - set_shnum(int shnum) - { this->shnum_ = shnum; } + set_shnum(int sec_shnum) + { this->shnum_ = sec_shnum; } // Functions used by both Sized_relobj and Sized_dynobj. @@ -625,8 +625,8 @@ class Object class Relobj : public Object { public: - Relobj(const std::string& name, Input_file* input_file, off_t offset = 0) - : Object(name, input_file, false, offset), + Relobj(const std::string& rname, Input_file* rinput_file, off_t roffset = 0) + : Object(rname, rinput_file, false, roffset), output_sections_(), map_to_relocatable_relocs_(NULL), object_merge_map_(NULL), @@ -676,13 +676,13 @@ class Relobj : public Object // Process the relocs, during garbage collection only. void - gc_process_relocs(Symbol_table* symtab, Layout* layout, Read_relocs_data* rd) - { return this->do_gc_process_relocs(symtab, layout, rd); } + gc_process_relocs(Symbol_table* symtab, Layout* olayout, Read_relocs_data* rd) + { return this->do_gc_process_relocs(symtab, olayout, rd); } // Scan the relocs and adjust the symbol table. void - scan_relocs(Symbol_table* symtab, Layout* layout, Read_relocs_data* rd) - { return this->do_scan_relocs(symtab, layout, rd); } + scan_relocs(Symbol_table* symtab, Layout* olayout, Read_relocs_data* rd) + { return this->do_scan_relocs(symtab, olayout, rd); } // The number of local symbols in the input symbol table. virtual unsigned int @@ -716,8 +716,8 @@ class Relobj : public Object // Relocate the input sections and write out the local symbols. void - relocate(const Symbol_table* symtab, const Layout* layout, Output_file* of) - { return this->do_relocate(symtab, layout, of); } + relocate(const Symbol_table* symtab, const Layout* olayout, Output_file* of) + { return this->do_relocate(symtab, olayout, of); } // Return whether an input section is being included in the link. bool @@ -789,8 +789,8 @@ class Relobj : public Object // Layout sections whose layout was deferred while waiting for // input files from a plugin. void - layout_deferred_sections(Layout* layout) - { this->do_layout_deferred_sections(layout); } + layout_deferred_sections(Layout* olayout) + { this->do_layout_deferred_sections(olayout); } protected: // The output section to be used for each input section, indexed by @@ -1018,8 +1018,8 @@ class Symbol_value // Set the value of this symbol in the output symbol table. void - set_output_value(Value value) - { this->u_.value = value; } + set_output_value(Value val) + { this->u_.value = val; } // For a section symbol in a merged section, we need more // information. @@ -1058,8 +1058,8 @@ class Symbol_value // called by count_local_symbols, to communicate the value to // finalize_local_symbols. void - set_input_value(Value value) - { this->u_.value = value; } + set_input_value(Value val) + { this->u_.value = val; } // Return the input value. This is only called by // finalize_local_symbols and (in special cases) relocate_section. @@ -1735,9 +1735,9 @@ class Sized_relobj : public Relobj // Relocate the sections in the output file. void - relocate_sections(const Symbol_table* symtab, const Layout* layout, + relocate_sections(const Symbol_table* symtab, const Layout* olayout, const unsigned char* pshdrs, Views* pviews) - { this->do_relocate_sections(symtab, layout, pshdrs, pviews); } + { this->do_relocate_sections(symtab, olayout, pshdrs, pviews); } // Scan the input relocations for --emit-relocs. void diff --git a/gold/options.h b/gold/options.h index 399c3015c..db10ee66e 100644 --- a/gold/options.h +++ b/gold/options.h @@ -227,9 +227,9 @@ struct Struct_special : public Struct_var parse(parse_function) { } - void parse_to_value(const char* option, const char* arg, + void parse_to_value(const char* opt, const char* arg, Command_line* cmdline, General_options* options) - { (options->*(this->parse))(option, arg, cmdline); } + { (options->*(this->parse))(opt, arg, cmdline); } One_option option; Parse_function parse; @@ -517,8 +517,8 @@ class Search_directory { } // This is the usual constructor. - Search_directory(const char* name, bool put_in_sysroot) - : name_(name), put_in_sysroot_(put_in_sysroot), is_in_sysroot_(false) + Search_directory(const char* cname, bool put_in_sysroot) + : name_(cname), put_in_sysroot_(put_in_sysroot), is_in_sysroot_(false) { if (this->name_.empty()) this->name_ = "."; @@ -1298,24 +1298,24 @@ class Input_file_argument just_symbols_(false), options_() { } - Input_file_argument(const char* name, Input_file_type type, - const char* extra_search_path, - bool just_symbols, - const Position_dependent_options& options) - : name_(name), type_(type), extra_search_path_(extra_search_path), - just_symbols_(just_symbols), options_(options) + Input_file_argument(const char* aname, Input_file_type type, + const char* aextra_search_path, + bool ajust_symbols, + const Position_dependent_options& aoptions) + : name_(aname), type_(type), extra_search_path_(aextra_search_path), + just_symbols_(ajust_symbols), options_(aoptions) { } // You can also pass in a General_options instance instead of a // Position_dependent_options. In that case, we extract the // position-independent vars from the General_options and only store // those. - Input_file_argument(const char* name, Input_file_type type, - const char* extra_search_path, - bool just_symbols, - const General_options& options) - : name_(name), type_(type), extra_search_path_(extra_search_path), - just_symbols_(just_symbols), options_(options) + Input_file_argument(const char* aname, Input_file_type type, + const char* aextra_search_path, + bool ajust_symbols, + const General_options& aoptions) + : name_(aname), type_(type), extra_search_path_(aextra_search_path), + just_symbols_(ajust_symbols), options_(aoptions) { } const char* @@ -1374,13 +1374,13 @@ class Input_argument { public: // Create a file or library argument. - explicit Input_argument(Input_file_argument file) - : is_file_(true), file_(file), group_(NULL) + explicit Input_argument(Input_file_argument afile) + : is_file_(true), file_(afile), group_(NULL) { } // Create a group argument. - explicit Input_argument(Input_file_group* group) - : is_file_(false), group_(group) + explicit Input_argument(Input_file_group* agroup) + : is_file_(false), group_(agroup) { } // Return whether this is a file. diff --git a/gold/output.cc b/gold/output.cc index 61c2ba6f4..2f9ed2330 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -354,13 +354,13 @@ Output_segment_headers::do_size() const Output_file_header::Output_file_header(const Target* target, const Symbol_table* symtab, const Output_segment_headers* osh, - const char* entry) + const char* aentry) : target_(target), symtab_(symtab), segment_header_(osh), section_header_(NULL), shstrtab_(NULL), - entry_(entry) + entry_(aentry) { this->set_data_size(this->do_size()); } @@ -509,11 +509,11 @@ Output_file_header::entry() && !parameters->options().shared()); // FIXME: Need to support target specific entry symbol. - const char* entry = this->entry_; - if (entry == NULL) - entry = "_start"; + const char* entry_sym = this->entry_; + if (entry_sym == NULL) + entry_sym = "_start"; - Symbol* sym = this->symtab_->lookup(entry); + Symbol* sym = this->symtab_->lookup(entry_sym); typename Sized_symbol::Value_type v; if (sym != NULL) @@ -521,7 +521,7 @@ Output_file_header::entry() Sized_symbol* ssym; ssym = this->symtab_->get_sized_symbol(sym); if (!ssym->is_defined() && should_issue_warning) - gold_warning("entry symbol '%s' exists but is not defined", entry); + gold_warning("entry symbol '%s' exists but is not defined", entry_sym); v = ssym->value(); } else @@ -529,11 +529,11 @@ Output_file_header::entry() // We couldn't find the entry symbol. See if we can parse it as // a number. This supports, e.g., -e 0x1000. char* endptr; - v = strtoull(entry, &endptr, 0); + v = strtoull(entry_sym, &endptr, 0); if (*endptr != '\0') { if (should_issue_warning) - gold_warning("cannot find entry symbol '%s'", entry); + gold_warning("cannot find entry symbol '%s'", entry_sym); v = 0; } } @@ -596,12 +596,12 @@ Output_section_data::do_out_shndx() const // of the output section. void -Output_section_data::set_addralign(uint64_t addralign) +Output_section_data::set_addralign(uint64_t addr_align) { - this->addralign_ = addralign; + this->addralign_ = addr_align; if (this->output_section_ != NULL - && this->output_section_->addralign() < addralign) - this->output_section_->set_addralign(addralign); + && this->output_section_->addralign() < addr_align) + this->output_section_->set_addralign(addr_align); } // Output_data_strtab methods. @@ -633,9 +633,9 @@ Output_reloc::Output_reloc( unsigned int type, Output_data* od, Address address, - bool is_relative) + bool is_rel) : address_(address), local_sym_index_(GSYM_CODE), type_(type), - is_relative_(is_relative), is_section_symbol_(false), shndx_(INVALID_CODE) + is_relative_(is_rel), is_section_symbol_(false), shndx_(INVALID_CODE) { // this->type_ is a bitfield; make sure TYPE fits. gold_assert(this->type_ == type); @@ -652,9 +652,9 @@ Output_reloc::Output_reloc( Sized_relobj* relobj, unsigned int shndx, Address address, - bool is_relative) + bool is_rel) : address_(address), local_sym_index_(GSYM_CODE), type_(type), - is_relative_(is_relative), is_section_symbol_(false), shndx_(shndx) + is_relative_(is_rel), is_section_symbol_(false), shndx_(shndx) { gold_assert(shndx != INVALID_CODE); // this->type_ is a bitfield; make sure TYPE fits. @@ -674,10 +674,10 @@ Output_reloc::Output_reloc( unsigned int type, Output_data* od, Address address, - bool is_relative, + bool is_rel, bool is_section_symbol) : address_(address), local_sym_index_(local_sym_index), type_(type), - is_relative_(is_relative), is_section_symbol_(is_section_symbol), + is_relative_(is_rel), is_section_symbol_(is_section_symbol), shndx_(INVALID_CODE) { gold_assert(local_sym_index != GSYM_CODE @@ -697,10 +697,10 @@ Output_reloc::Output_reloc( unsigned int type, unsigned int shndx, Address address, - bool is_relative, + bool is_rel, bool is_section_symbol) : address_(address), local_sym_index_(local_sym_index), type_(type), - is_relative_(is_relative), is_section_symbol_(is_section_symbol), + is_relative_(is_rel), is_section_symbol_(is_section_symbol), shndx_(shndx) { gold_assert(local_sym_index != GSYM_CODE @@ -1222,9 +1222,9 @@ Output_data_got::add_global_with_rel( this->entries_.push_back(Got_entry()); this->set_got_size(); - unsigned int got_offset = this->last_got_offset(); - gsym->set_got_offset(got_type, got_offset); - rel_dyn->add_global(gsym, r_type, this, got_offset); + unsigned int g_offset = this->last_got_offset(); + gsym->set_got_offset(got_type, g_offset); + rel_dyn->add_global(gsym, r_type, this, g_offset); } template @@ -1240,9 +1240,9 @@ Output_data_got::add_global_with_rela( this->entries_.push_back(Got_entry()); this->set_got_size(); - unsigned int got_offset = this->last_got_offset(); - gsym->set_got_offset(got_type, got_offset); - rela_dyn->add_global(gsym, r_type, this, got_offset, 0); + unsigned int g_offset = this->last_got_offset(); + gsym->set_got_offset(got_type, g_offset); + rela_dyn->add_global(gsym, r_type, this, g_offset, 0); } // Add a pair of entries for a global symbol to the GOT, and add @@ -1261,15 +1261,15 @@ Output_data_got::add_global_pair_with_rel( return; this->entries_.push_back(Got_entry()); - unsigned int got_offset = this->last_got_offset(); - gsym->set_got_offset(got_type, got_offset); - rel_dyn->add_global(gsym, r_type_1, this, got_offset); + unsigned int g_offset = this->last_got_offset(); + gsym->set_got_offset(got_type, g_offset); + rel_dyn->add_global(gsym, r_type_1, this, g_offset); this->entries_.push_back(Got_entry()); if (r_type_2 != 0) { - got_offset = this->last_got_offset(); - rel_dyn->add_global(gsym, r_type_2, this, got_offset); + g_offset = this->last_got_offset(); + rel_dyn->add_global(gsym, r_type_2, this, g_offset); } this->set_got_size(); @@ -1288,15 +1288,15 @@ Output_data_got::add_global_pair_with_rela( return; this->entries_.push_back(Got_entry()); - unsigned int got_offset = this->last_got_offset(); - gsym->set_got_offset(got_type, got_offset); - rela_dyn->add_global(gsym, r_type_1, this, got_offset, 0); + unsigned int g_offset = this->last_got_offset(); + gsym->set_got_offset(got_type, g_offset); + rela_dyn->add_global(gsym, r_type_1, this, g_offset, 0); this->entries_.push_back(Got_entry()); if (r_type_2 != 0) { - got_offset = this->last_got_offset(); - rela_dyn->add_global(gsym, r_type_2, this, got_offset, 0); + g_offset = this->last_got_offset(); + rela_dyn->add_global(gsym, r_type_2, this, g_offset, 0); } this->set_got_size(); @@ -1338,9 +1338,9 @@ Output_data_got::add_local_with_rel( this->entries_.push_back(Got_entry()); this->set_got_size(); - unsigned int got_offset = this->last_got_offset(); - object->set_local_got_offset(symndx, got_type, got_offset); - rel_dyn->add_local(object, symndx, r_type, this, got_offset); + unsigned int g_offset = this->last_got_offset(); + object->set_local_got_offset(symndx, got_type, g_offset); + rel_dyn->add_local(object, symndx, r_type, this, g_offset); } template @@ -1357,9 +1357,9 @@ Output_data_got::add_local_with_rela( this->entries_.push_back(Got_entry()); this->set_got_size(); - unsigned int got_offset = this->last_got_offset(); - object->set_local_got_offset(symndx, got_type, got_offset); - rela_dyn->add_local(object, symndx, r_type, this, got_offset, 0); + unsigned int g_offset = this->last_got_offset(); + object->set_local_got_offset(symndx, got_type, g_offset); + rela_dyn->add_local(object, symndx, r_type, this, g_offset, 0); } // Add a pair of entries for a local symbol to the GOT, and add @@ -1380,16 +1380,16 @@ Output_data_got::add_local_pair_with_rel( return; this->entries_.push_back(Got_entry()); - unsigned int got_offset = this->last_got_offset(); - object->set_local_got_offset(symndx, got_type, got_offset); + unsigned int g_offset = this->last_got_offset(); + object->set_local_got_offset(symndx, got_type, g_offset); Output_section* os = object->output_section(shndx); - rel_dyn->add_output_section(os, r_type_1, this, got_offset); + rel_dyn->add_output_section(os, r_type_1, this, g_offset); this->entries_.push_back(Got_entry(object, symndx)); if (r_type_2 != 0) { - got_offset = this->last_got_offset(); - rel_dyn->add_output_section(os, r_type_2, this, got_offset); + g_offset = this->last_got_offset(); + rel_dyn->add_output_section(os, r_type_2, this, g_offset); } this->set_got_size(); @@ -1410,16 +1410,16 @@ Output_data_got::add_local_pair_with_rela( return; this->entries_.push_back(Got_entry()); - unsigned int got_offset = this->last_got_offset(); - object->set_local_got_offset(symndx, got_type, got_offset); + unsigned int g_offset = this->last_got_offset(); + object->set_local_got_offset(symndx, got_type, g_offset); Output_section* os = object->output_section(shndx); - rela_dyn->add_output_section(os, r_type_1, this, got_offset, 0); + rela_dyn->add_output_section(os, r_type_1, this, g_offset, 0); this->entries_.push_back(Got_entry(object, symndx)); if (r_type_2 != 0) { - got_offset = this->last_got_offset(); - rela_dyn->add_output_section(os, r_type_2, this, got_offset, 0); + g_offset = this->last_got_offset(); + rela_dyn->add_output_section(os, r_type_2, this, g_offset, 0); } this->set_got_size(); @@ -1571,9 +1571,9 @@ Output_data_dynamic::sized_write(Output_file* of) { const int dyn_size = elfcpp::Elf_sizes::dyn_size; - const off_t offset = this->offset(); + const off_t off = this->offset(); const off_t oview_size = this->data_size(); - unsigned char* const oview = of->get_output_view(offset, oview_size); + unsigned char* const oview = of->get_output_view(off, oview_size); unsigned char* pov = oview; for (typename Dynamic_entries::const_iterator p = this->entries_.begin(); @@ -1586,7 +1586,7 @@ Output_data_dynamic::sized_write(Output_file* of) gold_assert(pov - oview == oview_size); - of->write_output_view(offset, oview_size, oview); + of->write_output_view(off, oview_size, oview); // We no longer need the dynamic entries. this->entries_.clear(); @@ -1597,9 +1597,9 @@ Output_data_dynamic::sized_write(Output_file* of) void Output_symtab_xindex::do_write(Output_file* of) { - const off_t offset = this->offset(); + const off_t off = this->offset(); const off_t oview_size = this->data_size(); - unsigned char* const oview = of->get_output_view(offset, oview_size); + unsigned char* const oview = of->get_output_view(off, oview_size); memset(oview, 0, oview_size); @@ -1608,7 +1608,7 @@ Output_symtab_xindex::do_write(Output_file* of) else this->endian_do_write(oview); - of->write_output_view(offset, oview_size, oview); + of->write_output_view(off, oview_size, oview); // We no longer need the data. this->entries_.clear(); @@ -1682,17 +1682,17 @@ Output_section::Input_section::finalize_data_size() inline bool Output_section::Input_section::output_offset( const Relobj* object, - unsigned int shndx, - section_offset_type offset, + unsigned int sec_shndx, + section_offset_type off, section_offset_type *poutput) const { if (!this->is_input_section()) - return this->u2_.posd->output_offset(object, shndx, offset, poutput); + return this->u2_.posd->output_offset(object, sec_shndx, off, poutput); else { - if (this->shndx_ != shndx || this->u2_.object != object) + if (this->shndx_ != sec_shndx || this->u2_.object != object) return false; - *poutput = offset; + *poutput = off; return true; } } @@ -1702,11 +1702,11 @@ Output_section::Input_section::output_offset( inline bool Output_section::Input_section::is_merge_section_for(const Relobj* object, - unsigned int shndx) const + unsigned int sec_shndx) const { if (this->is_input_section()) return false; - return this->u2_.posd->is_merge_section_for(object, shndx); + return this->u2_.posd->is_merge_section_for(object, sec_shndx); } // Write out the data. We don't have to do anything for an input @@ -1761,9 +1761,9 @@ Output_section::Input_section::print_to_mapfile(Mapfile* mapfile) const // Construct an Output_section. NAME will point into a Stringpool. -Output_section::Output_section(const char* name, elfcpp::Elf_Word type, - elfcpp::Elf_Xword flags) - : name_(name), +Output_section::Output_section(const char* aname, elfcpp::Elf_Word atype, + elfcpp::Elf_Xword aflags) + : name_(aname), addralign_(0), entsize_(0), load_address_(0), @@ -1772,8 +1772,8 @@ Output_section::Output_section(const char* name, elfcpp::Elf_Word type, info_section_(NULL), info_symndx_(NULL), info_(0), - type_(type), - flags_(flags), + type_(atype), + flags_(aflags), out_shndx_(-1U), symtab_index_(0), dynsym_index_(0), @@ -1810,7 +1810,7 @@ Output_section::Output_section(const char* name, elfcpp::Elf_Word type, // An unallocated section has no address. Forcing this means that // we don't need special treatment for symbols defined in debug // sections. - if ((flags & elfcpp::SHF_ALLOC) == 0) + if ((aflags & elfcpp::SHF_ALLOC) == 0) this->set_address(0); } @@ -1845,34 +1845,34 @@ Output_section::set_entsize(uint64_t v) template off_t Output_section::add_input_section(Sized_relobj* object, - unsigned int shndx, + unsigned int sec_shndx, const char* secname, const elfcpp::Shdr& shdr, unsigned int reloc_shndx, bool have_sections_script) { - elfcpp::Elf_Xword addralign = shdr.get_sh_addralign(); - if ((addralign & (addralign - 1)) != 0) + elfcpp::Elf_Xword addr_align = shdr.get_sh_addralign(); + if ((addr_align & (addr_align - 1)) != 0) { object->error(_("invalid alignment %lu for section \"%s\""), - static_cast(addralign), secname); - addralign = 1; + static_cast(addr_align), secname); + addr_align = 1; } - if (addralign > this->addralign_) - this->addralign_ = addralign; + if (addr_align > this->addralign_) + this->addralign_ = addr_align; typename elfcpp::Elf_types::Elf_WXword sh_flags = shdr.get_sh_flags(); this->update_flags_for_input_section(sh_flags); - uint64_t entsize = shdr.get_sh_entsize(); + uint64_t ent_size = shdr.get_sh_entsize(); // .debug_str is a mergeable string section, but is not always so // marked by compilers. Mark manually here so we can optimize. if (strcmp(secname, ".debug_str") == 0) { sh_flags |= (elfcpp::SHF_MERGE | elfcpp::SHF_STRINGS); - entsize = 1; + ent_size = 1; } // If this is a SHF_MERGE section, we pass all the input sections to @@ -1883,8 +1883,8 @@ Output_section::add_input_section(Sized_relobj* object, && reloc_shndx == 0 && shdr.get_sh_size() > 0) { - if (this->add_merge_input_section(object, shndx, sh_flags, - entsize, addralign)) + if (this->add_merge_input_section(object, sec_shndx, sh_flags, + ent_size, addr_align)) { // Tell the relocation routines that they need to call the // output_offset method to determine the final address. @@ -1894,7 +1894,7 @@ Output_section::add_input_section(Sized_relobj* object, off_t offset_in_section = this->current_data_size_for_child(); off_t aligned_offset_in_section = align_address(offset_in_section, - addralign); + addr_align); // Determine if we want to delay code-fill generation until the output // section is written. When the target is relaxing, we want to delay fill @@ -1942,9 +1942,9 @@ Output_section::add_input_section(Sized_relobj* object, || this->must_sort_attached_input_sections() || parameters->options().user_set_Map() || parameters->target().may_relax()) - this->input_sections_.push_back(Input_section(object, shndx, + this->input_sections_.push_back(Input_section(object, sec_shndx, shdr.get_sh_size(), - addralign)); + addr_align)); return aligned_offset_in_section; } @@ -2002,9 +2002,9 @@ Output_section::add_output_section_data(Input_section* inp) this->input_sections_.push_back(*inp); - uint64_t addralign = inp->addralign(); - if (addralign > this->addralign_) - this->addralign_ = addralign; + uint64_t addr_align = inp->addralign(); + if (addr_align > this->addralign_) + this->addralign_ = addr_align; inp->set_output_section(this); } @@ -2013,43 +2013,43 @@ Output_section::add_output_section_data(Input_section* inp) void Output_section::add_output_merge_section(Output_section_data* posd, - bool is_string, uint64_t entsize) + bool is_string, uint64_t ent_size) { - Input_section inp(posd, is_string, entsize); + Input_section inp(posd, is_string, ent_size); this->add_output_section_data(&inp); } // Add an input section to a SHF_MERGE section. bool -Output_section::add_merge_input_section(Relobj* object, unsigned int shndx, - uint64_t flags, uint64_t entsize, - uint64_t addralign) +Output_section::add_merge_input_section(Relobj* object, unsigned int sec_shndx, + uint64_t aflags, uint64_t ent_size, + uint64_t addr_align) { - bool is_string = (flags & elfcpp::SHF_STRINGS) != 0; + bool is_string = (aflags & elfcpp::SHF_STRINGS) != 0; // We only merge strings if the alignment is not more than the // character size. This could be handled, but it's unusual. - if (is_string && addralign > entsize) + if (is_string && addr_align > ent_size) return false; // We cannot restore merged input section states. gold_assert(this->checkpoint_ == NULL); // Look up merge sections by required properties. - Merge_section_properties msp(is_string, entsize, addralign); + Merge_section_properties msp(is_string, ent_size, addr_align); Merge_section_by_properties_map::const_iterator p = this->merge_section_by_properties_map_.find(msp); if (p != this->merge_section_by_properties_map_.end()) { Output_merge_base* merge_section = p->second; - merge_section->add_input_section(object, shndx); + merge_section->add_input_section(object, sec_shndx); gold_assert(merge_section->is_string() == is_string - && merge_section->entsize() == entsize - && merge_section->addralign() == addralign); + && merge_section->entsize() == ent_size + && merge_section->addralign() == addr_align); // Link input section to found merge section. - Input_section_specifier iss(object, shndx); + Input_section_specifier iss(object, sec_shndx); this->merge_section_map_[iss] = merge_section; return true; } @@ -2058,19 +2058,19 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int shndx, // Output_merge_string_data. Output_merge_base* pomb; if (!is_string) - pomb = new Output_merge_data(entsize, addralign); + pomb = new Output_merge_data(ent_size, addr_align); else { - switch (entsize) + switch (ent_size) { case 1: - pomb = new Output_merge_string(addralign); + pomb = new Output_merge_string(addr_align); break; case 2: - pomb = new Output_merge_string(addralign); + pomb = new Output_merge_string(addr_align); break; case 4: - pomb = new Output_merge_string(addralign); + pomb = new Output_merge_string(addr_align); break; default: return false; @@ -2079,30 +2079,30 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int shndx, // Add new merge section to this output section and link merge section // properties to new merge section in map. - this->add_output_merge_section(pomb, is_string, entsize); + this->add_output_merge_section(pomb, is_string, ent_size); this->merge_section_by_properties_map_[msp] = pomb; // Add input section to new merge section and link input section to new // merge section in map. - pomb->add_input_section(object, shndx); - Input_section_specifier iss(object, shndx); + pomb->add_input_section(object, sec_shndx); + Input_section_specifier iss(object, sec_shndx); this->merge_section_map_[iss] = pomb; return true; } // Build a relaxation map to speed up relaxation of existing input sections. -// Look up to the first LIMIT elements in INPUT_SECTIONS. +// Look up to the first LIMIT elements in INPUTSECTIONS. void Output_section::build_relaxation_map( - const Input_section_list& input_sections, + const Input_section_list& inputsections, size_t limit, Relaxation_map* relaxation_map) const { for (size_t i = 0; i < limit; ++i) { - const Input_section& is(input_sections[i]); + const Input_section& is(inputsections[i]); if (is.is_input_section() || is.is_relaxed_input_section()) { Input_section_specifier iss(is.relobj(), is.shndx()); @@ -2113,13 +2113,13 @@ Output_section::build_relaxation_map( // Convert regular input sections in INPUT_SECTIONS into relaxed input // sections in RELAXED_SECTIONS. MAP is a prebuilt map from input section -// specifier to indices of INPUT_SECTIONS. +// specifier to indices of INPUTSECTIONS. void Output_section::convert_input_sections_in_list_to_relaxed_sections( const std::vector& relaxed_sections, const Relaxation_map& map, - Input_section_list* input_sections) + Input_section_list* inputsections) { for (size_t i = 0; i < relaxed_sections.size(); ++i) { @@ -2127,8 +2127,8 @@ Output_section::convert_input_sections_in_list_to_relaxed_sections( Input_section_specifier iss(poris->relobj(), poris->shndx()); Relaxation_map::const_iterator p = map.find(iss); gold_assert(p != map.end()); - gold_assert((*input_sections)[p->second].is_input_section()); - (*input_sections)[p->second] = Input_section(poris); + gold_assert((*inputsections)[p->second].is_input_section()); + (*inputsections)[p->second] = Input_section(poris); } } @@ -2186,35 +2186,35 @@ Output_section::convert_input_sections_to_relaxed_sections( // Update the output section flags based on input section flags. void -Output_section::update_flags_for_input_section(elfcpp::Elf_Xword flags) +Output_section::update_flags_for_input_section(elfcpp::Elf_Xword aflags) { // If we created the section with SHF_ALLOC clear, we set the // address. If we are now setting the SHF_ALLOC flag, we need to // undo that. if ((this->flags_ & elfcpp::SHF_ALLOC) == 0 - && (flags & elfcpp::SHF_ALLOC) != 0) + && (aflags & elfcpp::SHF_ALLOC) != 0) this->mark_address_invalid(); - this->flags_ |= (flags + this->flags_ |= (aflags & (elfcpp::SHF_WRITE | elfcpp::SHF_ALLOC | elfcpp::SHF_EXECINSTR)); } -// Find the merge section into which an input section with index SHNDX in +// Find the merge section into which an input section with index SEC_SHNDX in // OBJECT has been added. Return NULL if none found. Output_section_data* Output_section::find_merge_section(const Relobj* object, - unsigned int shndx) const + unsigned int sec_shndx) const { - Input_section_specifier iss(object, shndx); + Input_section_specifier iss(object, sec_shndx); Output_section_data_by_input_section_map::const_iterator p = this->merge_section_map_.find(iss); if (p != this->merge_section_map_.end()) { Output_section_data* posd = p->second; - gold_assert(posd->is_merge_section_for(object, shndx)); + gold_assert(posd->is_merge_section_for(object, sec_shndx)); return posd; } else @@ -2222,11 +2222,11 @@ Output_section::find_merge_section(const Relobj* object, } // Find an relaxed input section corresponding to an input section -// in OBJECT with index SHNDX. +// in OBJECT with index SEC_SHNDX. const Output_section_data* Output_section::find_relaxed_input_section(const Relobj* object, - unsigned int shndx) const + unsigned int sec_shndx) const { // Be careful that the map may not be valid due to input section export // to scripts or a check-point restore. @@ -2246,7 +2246,7 @@ Output_section::find_relaxed_input_section(const Relobj* object, this->is_relaxed_input_section_map_valid_ = true; } - Input_section_specifier iss(object, shndx); + Input_section_specifier iss(object, sec_shndx); Output_section_data_by_input_section_map::const_iterator p = this->relaxed_input_section_map_.find(iss); if (p != this->relaxed_input_section_map_.end()) @@ -2255,27 +2255,27 @@ Output_section::find_relaxed_input_section(const Relobj* object, return NULL; } -// Given an address OFFSET relative to the start of input section -// SHNDX in OBJECT, return whether this address is being included in -// the final link. This should only be called if SHNDX in OBJECT has +// Given an address OFF relative to the start of input section +// SEC_SHNDX in OBJECT, return whether this address is being included in +// the final link. This should only be called if SEC_SHNDX in OBJECT has // a special mapping. bool Output_section::is_input_address_mapped(const Relobj* object, - unsigned int shndx, - off_t offset) const + unsigned int sec_shndx, + off_t off) const { // Look at the Output_section_data_maps first. - const Output_section_data* posd = this->find_merge_section(object, shndx); + const Output_section_data* posd = this->find_merge_section(object, sec_shndx); if (posd == NULL) - posd = this->find_relaxed_input_section(object, shndx); + posd = this->find_relaxed_input_section(object, sec_shndx); if (posd != NULL) { - section_offset_type output_offset; - bool found = posd->output_offset(object, shndx, offset, &output_offset); + section_offset_type outputoffset; + bool found = posd->output_offset(object, sec_shndx, off, &outputoffset); gold_assert(found); - return output_offset != -1; + return outputoffset != -1; } // Fall back to the slow look-up. @@ -2283,9 +2283,9 @@ Output_section::is_input_address_mapped(const Relobj* object, p != this->input_sections_.end(); ++p) { - section_offset_type output_offset; - if (p->output_offset(object, shndx, offset, &output_offset)) - return output_offset != -1; + section_offset_type outputoffset; + if (p->output_offset(object, sec_shndx, off, &outputoffset)) + return outputoffset != -1; } // By default we assume that the address is mapped. This should @@ -2294,29 +2294,29 @@ Output_section::is_input_address_mapped(const Relobj* object, return true; } -// Given an address OFFSET relative to the start of input section -// SHNDX in object OBJECT, return the output offset relative to the +// Given an address OFF relative to the start of input section +// SEC_SHNDX in object OBJECT, return the output offset relative to the // start of the input section in the output section. This should only -// be called if SHNDX in OBJECT has a special mapping. +// be called if SEC_SHNDX in OBJECT has a special mapping. section_offset_type -Output_section::output_offset(const Relobj* object, unsigned int shndx, - section_offset_type offset) const +Output_section::output_offset(const Relobj* object, unsigned int sec_shndx, + section_offset_type off) const { // This can only be called meaningfully when we know the data size // of this. gold_assert(this->is_data_size_valid()); // Look at the Output_section_data_maps first. - const Output_section_data* posd = this->find_merge_section(object, shndx); + const Output_section_data* posd = this->find_merge_section(object, sec_shndx); if (posd == NULL) - posd = this->find_relaxed_input_section(object, shndx); + posd = this->find_relaxed_input_section(object, sec_shndx); if (posd != NULL) { - section_offset_type output_offset; - bool found = posd->output_offset(object, shndx, offset, &output_offset); + section_offset_type outputoffset; + bool found = posd->output_offset(object, sec_shndx, off, &outputoffset); gold_assert(found); - return output_offset; + return outputoffset; } // Fall back to the slow look-up. @@ -2324,32 +2324,32 @@ Output_section::output_offset(const Relobj* object, unsigned int shndx, p != this->input_sections_.end(); ++p) { - section_offset_type output_offset; - if (p->output_offset(object, shndx, offset, &output_offset)) - return output_offset; + section_offset_type outputoffset; + if (p->output_offset(object, sec_shndx, off, &outputoffset)) + return outputoffset; } gold_unreachable(); } -// Return the output virtual address of OFFSET relative to the start -// of input section SHNDX in object OBJECT. +// Return the output virtual address of OFF relative to the start +// of input section SEC_SHNDX in object OBJECT. uint64_t -Output_section::output_address(const Relobj* object, unsigned int shndx, - off_t offset) const +Output_section::output_address(const Relobj* object, unsigned int sec_shndx, + off_t off) const { uint64_t addr = this->address() + this->first_input_offset_; // Look at the Output_section_data_maps first. - const Output_section_data* posd = this->find_merge_section(object, shndx); + const Output_section_data* posd = this->find_merge_section(object, sec_shndx); if (posd == NULL) - posd = this->find_relaxed_input_section(object, shndx); + posd = this->find_relaxed_input_section(object, sec_shndx); if (posd != NULL && posd->is_address_valid()) { - section_offset_type output_offset; - bool found = posd->output_offset(object, shndx, offset, &output_offset); + section_offset_type outputoffset; + bool found = posd->output_offset(object, sec_shndx, off, &outputoffset); gold_assert(found); - return posd->address() + output_offset; + return posd->address() + outputoffset; } // Fall back to the slow look-up. @@ -2358,12 +2358,12 @@ Output_section::output_address(const Relobj* object, unsigned int shndx, ++p) { addr = align_address(addr, p->addralign()); - section_offset_type output_offset; - if (p->output_offset(object, shndx, offset, &output_offset)) + section_offset_type outputoffset; + if (p->output_offset(object, sec_shndx, off, &outputoffset)) { - if (output_offset == -1) + if (outputoffset == -1) return -1ULL; - return addr + output_offset; + return addr + outputoffset; } addr += p->data_size(); } @@ -2377,11 +2377,11 @@ Output_section::output_address(const Relobj* object, unsigned int shndx, } // Find the output address of the start of the merged section for -// input section SHNDX in object OBJECT. +// input section SEC_SHNDX in object OBJECT. bool Output_section::find_starting_output_address(const Relobj* object, - unsigned int shndx, + unsigned int sec_shndx, uint64_t* paddr) const { // FIXME: This becomes a bottle-neck if we have many relaxed sections. @@ -2398,7 +2398,7 @@ Output_section::find_starting_output_address(const Relobj* object, // method to get the output offset of input offset 0. // Unfortunately we don't know for sure that input offset 0 is // mapped at all. - if (p->is_merge_section_for(object, shndx)) + if (p->is_merge_section_for(object, sec_shndx)) { *paddr = addr; return true; @@ -2426,7 +2426,7 @@ Output_section::set_final_data_size() if (this->must_sort_attached_input_sections()) this->sort_attached_input_sections(); - uint64_t address = this->address(); + uint64_t addr = this->address(); off_t startoff = this->offset(); off_t off = startoff + this->first_input_offset_; for (Input_section_list::iterator p = this->input_sections_.begin(); @@ -2434,7 +2434,7 @@ Output_section::set_final_data_size() ++p) { off = align_address(off, p->addralign()); - p->set_address_and_file_offset(address + (off - startoff), off, + p->set_address_and_file_offset(addr + (off - startoff), off, startoff); off += p->data_size(); } @@ -2498,11 +2498,11 @@ class Output_section::Input_section_sort_entry section_name_() { } - Input_section_sort_entry(const Input_section& input_section, - unsigned int index) - : input_section_(input_section), index_(index), - section_has_name_(input_section.is_input_section() - || input_section.is_relaxed_input_section()) + Input_section_sort_entry(const Input_section& inputsection, + unsigned int indx) + : input_section_(inputsection), index_(indx), + section_has_name_(inputsection.is_input_section() + || inputsection.is_relaxed_input_section()) { if (this->section_has_name_) { @@ -2510,14 +2510,14 @@ class Output_section::Input_section_sort_entry // so it is OK to lock. Unfortunately we have no way to pass // in a Task token. const Task* dummy_task = reinterpret_cast(-1); - Object* obj = (input_section.is_input_section() - ? input_section.relobj() - : input_section.relaxed_input_section()->relobj()); + Object* obj = (inputsection.is_input_section() + ? inputsection.relobj() + : inputsection.relaxed_input_section()->relobj()); Task_lock_obj tl(dummy_task, obj); // This is a slow operation, which should be cached in // Layout::layout if this becomes a speed problem. - this->section_name_ = obj->section_name(input_section.shndx()); + this->section_name_ = obj->section_name(inputsection.shndx()); } } @@ -2568,12 +2568,12 @@ class Output_section::Input_section_sort_entry // file name this way is a dreadful hack, but the GNU linker does it // in order to better support gcc, and we need to be compatible. bool - match_file_name(const char* match_file_name) const + match_file_name(const char* match_filename) const { const std::string& file_name(this->input_section_.relobj()->name()); const char* base_name = lbasename(file_name.c_str()); - size_t match_len = strlen(match_file_name); - if (strncmp(base_name, match_file_name, match_len) != 0) + size_t match_len = strlen(match_filename); + if (strncmp(base_name, match_filename, match_len) != 0) return false; size_t base_len = strlen(base_name); if (base_len != match_len + 2 && base_len != match_len + 3) @@ -2706,10 +2706,10 @@ Output_section::write_header(const Layout* layout, oshdr->put_sh_name(secnamepool->get_offset(this->name_)); oshdr->put_sh_type(this->type_); - elfcpp::Elf_Xword flags = this->flags_; + elfcpp::Elf_Xword xflags = this->flags_; if (this->info_section_ != NULL && this->info_uses_section_index_) - flags |= elfcpp::SHF_INFO_LINK; - oshdr->put_sh_flags(flags); + xflags |= elfcpp::SHF_INFO_LINK; + oshdr->put_sh_flags(xflags); oshdr->put_sh_addr(this->address()); oshdr->put_sh_offset(this->offset()); @@ -2723,19 +2723,19 @@ Output_section::write_header(const Layout* layout, else oshdr->put_sh_link(this->link_); - elfcpp::Elf_Word info; + elfcpp::Elf_Word inf; if (this->info_section_ != NULL) { if (this->info_uses_section_index_) - info = this->info_section_->out_shndx(); + inf = this->info_section_->out_shndx(); else - info = this->info_section_->symtab_index(); + inf = this->info_section_->symtab_index(); } else if (this->info_symndx_ != NULL) - info = this->info_symndx_->symtab_index(); + inf = this->info_symndx_->symtab_index(); else - info = this->info_; - oshdr->put_sh_info(info); + inf = this->info_; + oshdr->put_sh_info(inf); oshdr->put_sh_addralign(this->addralign_); oshdr->put_sh_entsize(this->entsize_); @@ -2862,9 +2862,9 @@ Output_section::write_to_postprocessing_buffer() uint64_t Output_section::get_input_sections( - uint64_t address, + uint64_t addr, const std::string& fill, - std::list* input_sections) + std::list* inputsections) { if (this->checkpoint_ != NULL && !this->checkpoint_->input_sections_saved()) @@ -2873,9 +2873,9 @@ Output_section::get_input_sections( // Invalidate the relaxed input section map. this->is_relaxed_input_section_map_valid_ = false; - uint64_t orig_address = address; + uint64_t orig_address = addr; - address = align_address(address, this->addralign()); + addr = align_address(addr, this->addralign()); Input_section_list remaining; for (Input_section_list::iterator p = this->input_sections_.begin(); @@ -2883,18 +2883,18 @@ Output_section::get_input_sections( ++p) { if (p->is_input_section()) - input_sections->push_back(Simple_input_section(p->relobj(), + inputsections->push_back(Simple_input_section(p->relobj(), p->shndx())); else if (p->is_relaxed_input_section()) - input_sections->push_back( + inputsections->push_back( Simple_input_section(p->relaxed_input_section())); else { - uint64_t aligned_address = align_address(address, p->addralign()); - if (aligned_address != address && !fill.empty()) + uint64_t aligned_address = align_address(addr, p->addralign()); + if (aligned_address != addr && !fill.empty()) { section_size_type length = - convert_to_section_size_type(aligned_address - address); + convert_to_section_size_type(aligned_address - addr); std::string this_fill; this_fill.reserve(length); while (this_fill.length() + fill.length() <= length) @@ -2905,44 +2905,44 @@ Output_section::get_input_sections( Output_section_data* posd = new Output_data_const(this_fill, 0); remaining.push_back(Input_section(posd)); } - address = aligned_address; + addr = aligned_address; remaining.push_back(*p); p->finalize_data_size(); - address += p->data_size(); + addr += p->data_size(); } } this->input_sections_.swap(remaining); this->first_input_offset_ = 0; - uint64_t data_size = address - orig_address; - this->set_current_data_size_for_child(data_size); - return data_size; + uint64_t datasize = addr - orig_address; + this->set_current_data_size_for_child(datasize); + return datasize; } // Add an input section from a script. void Output_section::add_input_section_for_script(const Simple_input_section& sis, - off_t data_size, - uint64_t addralign) + off_t datasize, + uint64_t addr_align) { - if (addralign > this->addralign_) - this->addralign_ = addralign; + if (addr_align > this->addralign_) + this->addralign_ = addr_align; off_t offset_in_section = this->current_data_size_for_child(); off_t aligned_offset_in_section = align_address(offset_in_section, - addralign); + addr_align); this->set_current_data_size_for_child(aligned_offset_in_section - + data_size); + + datasize); Input_section is = (sis.is_relaxed_input_section() ? Input_section(sis.relaxed_input_section()) - : Input_section(sis.relobj(), sis.shndx(), data_size, addralign)); + : Input_section(sis.relobj(), sis.shndx(), datasize, addr_align)); this->input_sections_.push_back(is); } @@ -3022,7 +3022,7 @@ Output_section::print_merge_stats() // Output segment methods. -Output_segment::Output_segment(elfcpp::Elf_Word type, elfcpp::Elf_Word flags) +Output_segment::Output_segment(elfcpp::Elf_Word atype, elfcpp::Elf_Word aflags) : output_data_(), output_bss_(), vaddr_(0), @@ -3032,8 +3032,8 @@ Output_segment::Output_segment(elfcpp::Elf_Word type, elfcpp::Elf_Word flags) min_p_align_(0), offset_(0), filesz_(0), - type_(type), - flags_(flags), + type_(atype), + flags_(aflags), is_max_align_known_(false), are_addresses_set_(false), is_large_data_segment_(false) @@ -3332,15 +3332,15 @@ Output_segment::maximum_alignment() { if (!this->is_max_align_known_) { - uint64_t addralign; + uint64_t addr_align; - addralign = Output_segment::maximum_alignment_list(&this->output_data_); - if (addralign > this->max_align_) - this->max_align_ = addralign; + addr_align = Output_segment::maximum_alignment_list(&this->output_data_); + if (addr_align > this->max_align_) + this->max_align_ = addr_align; - addralign = Output_segment::maximum_alignment_list(&this->output_bss_); - if (addralign > this->max_align_) - this->max_align_ = addralign; + addr_align = Output_segment::maximum_alignment_list(&this->output_bss_); + if (addr_align > this->max_align_) + this->max_align_ = addr_align; // If -z relro is in effect, and the first section in this // segment is a relro section, then the segment must be aligned @@ -3350,9 +3350,9 @@ Output_segment::maximum_alignment() && parameters->options().relro() && this->is_first_section_relro()) { - addralign = parameters->target().common_pagesize(); - if (addralign > this->max_align_) - this->max_align_ = addralign; + addr_align = parameters->target().common_pagesize(); + if (addr_align > this->max_align_) + this->max_align_ = addr_align; } this->is_max_align_known_ = true; @@ -3371,9 +3371,9 @@ Output_segment::maximum_alignment_list(const Output_data_list* pdl) p != pdl->end(); ++p) { - uint64_t addralign = (*p)->addralign(); - if (addralign > ret) - ret = addralign; + uint64_t addr_align = (*p)->addralign(); + if (addr_align > ret) + ret = addr_align; } return ret; } @@ -4138,7 +4138,7 @@ template off_t Output_section::add_input_section<32, false>( Sized_relobj<32, false>* object, - unsigned int shndx, + unsigned int sec_shndx, const char* secname, const elfcpp::Shdr<32, false>& shdr, unsigned int reloc_shndx, @@ -4150,7 +4150,7 @@ template off_t Output_section::add_input_section<32, true>( Sized_relobj<32, true>* object, - unsigned int shndx, + unsigned int sec_shndx, const char* secname, const elfcpp::Shdr<32, true>& shdr, unsigned int reloc_shndx, @@ -4162,7 +4162,7 @@ template off_t Output_section::add_input_section<64, false>( Sized_relobj<64, false>* object, - unsigned int shndx, + unsigned int sec_shndx, const char* secname, const elfcpp::Shdr<64, false>& shdr, unsigned int reloc_shndx, @@ -4174,7 +4174,7 @@ template off_t Output_section::add_input_section<64, true>( Sized_relobj<64, true>* object, - unsigned int shndx, + unsigned int sec_shndx, const char* secname, const elfcpp::Shdr<64, true>& shdr, unsigned int reloc_shndx, diff --git a/gold/output.h b/gold/output.h index 6631aa1e8..21d80fb6a 100644 --- a/gold/output.h +++ b/gold/output.h @@ -53,8 +53,8 @@ class Sized_relobj; class Input_section_specifier { public: - Input_section_specifier(const Relobj* relobj, unsigned int shndx) - : relobj_(relobj), shndx_(shndx) + Input_section_specifier(const Relobj* robj, unsigned int sec_shndx) + : relobj_(robj), shndx_(sec_shndx) { } // Return Relobj of this. @@ -416,11 +416,11 @@ class Output_data // Set the size of the data. void - set_data_size(off_t data_size) + set_data_size(off_t datasize) { gold_assert(!this->is_data_size_valid_ && !this->is_data_size_fixed_); - this->data_size_ = data_size; + this->data_size_ = datasize; this->is_data_size_valid_ = true; } @@ -442,10 +442,10 @@ class Output_data // Set the current data size--this is for the convenience of // sections which build up their size over time. void - set_current_data_size_for_child(off_t data_size) + set_current_data_size_for_child(off_t datasize) { gold_assert(!this->is_data_size_valid_); - this->data_size_ = data_size; + this->data_size_ = datasize; } // Return default alignment for the target size. @@ -639,17 +639,17 @@ class Output_file_header : public Output_data class Output_section_data : public Output_data { public: - Output_section_data(off_t data_size, uint64_t addralign, - bool is_data_size_fixed) - : Output_data(), output_section_(NULL), addralign_(addralign) + Output_section_data(off_t datasize, uint64_t addr_align, + bool is_datasize_fixed) + : Output_data(), output_section_(NULL), addralign_(addr_align) { - this->set_data_size(data_size); - if (is_data_size_fixed) + this->set_data_size(datasize); + if (is_datasize_fixed) this->fix_data_size(); } - Output_section_data(uint64_t addralign) - : Output_data(), output_section_(NULL), addralign_(addralign) + Output_section_data(uint64_t addr_align) + : Output_data(), output_section_(NULL), addralign_(addr_align) { } // Return the output section. @@ -675,9 +675,9 @@ class Output_section_data : public Output_data // this input offset is being discarded. bool output_offset(const Relobj* object, unsigned int shndx, - section_offset_type offset, + section_offset_type sec_offset, section_offset_type *poutput) const - { return this->do_output_offset(object, shndx, offset, poutput); } + { return this->do_output_offset(object, shndx, sec_offset, poutput); } // Return whether this is the merge section for the input section // SHNDX in OBJECT. This should return true when output_offset @@ -768,8 +768,8 @@ class Output_section_data : public Output_data class Output_section_data_build : public Output_section_data { public: - Output_section_data_build(uint64_t addralign) - : Output_section_data(addralign) + Output_section_data_build(uint64_t addr_align) + : Output_section_data(addr_align) { } // Get the current data size. @@ -779,8 +779,8 @@ class Output_section_data_build : public Output_section_data // Set the current data size. void - set_current_data_size(off_t data_size) - { this->set_current_data_size_for_child(data_size); } + set_current_data_size(off_t datasize) + { this->set_current_data_size_for_child(datasize); } protected: // Set the final data size. @@ -795,16 +795,16 @@ class Output_section_data_build : public Output_section_data class Output_data_const : public Output_section_data { public: - Output_data_const(const std::string& data, uint64_t addralign) - : Output_section_data(data.size(), addralign, true), data_(data) + Output_data_const(const std::string& data, uint64_t addr_align) + : Output_section_data(data.size(), addr_align, true), data_(data) { } - Output_data_const(const char* p, off_t len, uint64_t addralign) - : Output_section_data(len, addralign, true), data_(p, len) + Output_data_const(const char* p, off_t len, uint64_t addr_align) + : Output_section_data(len, addr_align, true), data_(p, len) { } - Output_data_const(const unsigned char* p, off_t len, uint64_t addralign) - : Output_section_data(len, addralign, true), + Output_data_const(const unsigned char* p, off_t len, uint64_t addr_align) + : Output_section_data(len, addr_align, true), data_(reinterpret_cast(p), len) { } @@ -834,8 +834,8 @@ class Output_data_const_buffer : public Output_section_data { public: Output_data_const_buffer(const unsigned char* p, off_t len, - uint64_t addralign, const char* map_name) - : Output_section_data(len, addralign, true), + uint64_t addr_align, const char* map_name) + : Output_section_data(len, addr_align, true), p_(p), map_name_(map_name) { } @@ -868,9 +868,9 @@ class Output_data_const_buffer : public Output_section_data class Output_data_fixed_space : public Output_section_data { public: - Output_data_fixed_space(off_t data_size, uint64_t addralign, + Output_data_fixed_space(off_t datasize, uint64_t addr_align, const char* map_name) - : Output_section_data(data_size, addralign, true), + : Output_section_data(datasize, addr_align, true), map_name_(map_name) { } @@ -898,8 +898,8 @@ class Output_data_fixed_space : public Output_section_data class Output_data_space : public Output_section_data_build { public: - explicit Output_data_space(uint64_t addralign, const char* map_name) - : Output_section_data_build(addralign), + explicit Output_data_space(uint64_t addr_align, const char* map_name) + : Output_section_data_build(addr_align), map_name_(map_name) { } @@ -932,8 +932,8 @@ class Output_data_space : public Output_section_data_build class Output_data_zero_fill : public Output_section_data { public: - Output_data_zero_fill(off_t data_size, uint64_t addralign) - : Output_section_data(data_size, addralign, true) + Output_data_zero_fill(off_t datasize, uint64_t addr_align) + : Output_section_data(datasize, addr_align, true) { } protected: @@ -1181,33 +1181,33 @@ class Output_reloc // A reloc against a global symbol. Output_reloc(Symbol* gsym, unsigned int type, Output_data* od, - Address address, Addend addend, bool is_relative) - : rel_(gsym, type, od, address, is_relative), addend_(addend) + Address addr, Addend addend, bool is_relative) + : rel_(gsym, type, od, addr, is_relative), addend_(addend) { } Output_reloc(Symbol* gsym, unsigned int type, Sized_relobj* relobj, - unsigned int shndx, Address address, Addend addend, + unsigned int shndx, Address addr, Addend addend, bool is_relative) - : rel_(gsym, type, relobj, shndx, address, is_relative), addend_(addend) + : rel_(gsym, type, relobj, shndx, addr, is_relative), addend_(addend) { } // A reloc against a local symbol. Output_reloc(Sized_relobj* relobj, unsigned int local_sym_index, unsigned int type, - Output_data* od, Address address, + Output_data* od, Address addr, Addend addend, bool is_relative, bool is_section_symbol) - : rel_(relobj, local_sym_index, type, od, address, is_relative, + : rel_(relobj, local_sym_index, type, od, addr, is_relative, is_section_symbol), addend_(addend) { } Output_reloc(Sized_relobj* relobj, unsigned int local_sym_index, unsigned int type, - unsigned int shndx, Address address, + unsigned int shndx, Address addr, Addend addend, bool is_relative, bool is_section_symbol) - : rel_(relobj, local_sym_index, type, shndx, address, is_relative, + : rel_(relobj, local_sym_index, type, shndx, addr, is_relative, is_section_symbol), addend_(addend) { } @@ -1215,14 +1215,14 @@ class Output_reloc // A reloc against the STT_SECTION symbol of an output section. Output_reloc(Output_section* os, unsigned int type, Output_data* od, - Address address, Addend addend) - : rel_(os, type, od, address), addend_(addend) + Address addr, Addend addend) + : rel_(os, type, od, addr), addend_(addend) { } Output_reloc(Output_section* os, unsigned int type, Sized_relobj* relobj, - unsigned int shndx, Address address, Addend addend) - : rel_(os, type, relobj, shndx, address), addend_(addend) + unsigned int shndx, Address addr, Addend addend) + : rel_(os, type, relobj, shndx, addr), addend_(addend) { } // Write the reloc entry to an output view. @@ -1345,33 +1345,33 @@ class Output_data_reloc // Add a reloc against a global symbol. void - add_global(Symbol* gsym, unsigned int type, Output_data* od, Address address) - { this->add(od, Output_reloc_type(gsym, type, od, address, false)); } + add_global(Symbol* gsym, unsigned int type, Output_data* od, Address addr) + { this->add(od, Output_reloc_type(gsym, type, od, addr, false)); } void add_global(Symbol* gsym, unsigned int type, Output_data* od, Sized_relobj* relobj, - unsigned int shndx, Address address) - { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address, + unsigned int shndx, Address addr) + { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr, false)); } // These are to simplify the Copy_relocs class. void - add_global(Symbol* gsym, unsigned int type, Output_data* od, Address address, + add_global(Symbol* gsym, unsigned int type, Output_data* od, Address addr, Address addend) { gold_assert(addend == 0); - this->add_global(gsym, type, od, address); + this->add_global(gsym, type, od, addr); } void add_global(Symbol* gsym, unsigned int type, Output_data* od, Sized_relobj* relobj, - unsigned int shndx, Address address, Address addend) + unsigned int shndx, Address addr, Address addend) { gold_assert(addend == 0); - this->add_global(gsym, type, od, relobj, shndx, address); + this->add_global(gsym, type, od, relobj, shndx, addr); } // Add a RELATIVE reloc against a global symbol. The final relocation @@ -1379,15 +1379,15 @@ class Output_data_reloc void add_global_relative(Symbol* gsym, unsigned int type, Output_data* od, - Address address) - { this->add(od, Output_reloc_type(gsym, type, od, address, true)); } + Address addr) + { this->add(od, Output_reloc_type(gsym, type, od, addr, true)); } void add_global_relative(Symbol* gsym, unsigned int type, Output_data* od, Sized_relobj* relobj, - unsigned int shndx, Address address) + unsigned int shndx, Address addr) { - this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address, + this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr, true)); } @@ -1396,19 +1396,19 @@ class Output_data_reloc void add_local(Sized_relobj* relobj, unsigned int local_sym_index, unsigned int type, - Output_data* od, Address address) + Output_data* od, Address addr) { this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, - address, false, false)); + addr, false, false)); } void add_local(Sized_relobj* relobj, unsigned int local_sym_index, unsigned int type, - Output_data* od, unsigned int shndx, Address address) + Output_data* od, unsigned int shndx, Address addr) { this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx, - address, false, false)); + addr, false, false)); } // Add a RELATIVE reloc against a local symbol. @@ -1416,19 +1416,19 @@ class Output_data_reloc void add_local_relative(Sized_relobj* relobj, unsigned int local_sym_index, unsigned int type, - Output_data* od, Address address) + Output_data* od, Address addr) { this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, - address, true, false)); + addr, true, false)); } void add_local_relative(Sized_relobj* relobj, unsigned int local_sym_index, unsigned int type, - Output_data* od, unsigned int shndx, Address address) + Output_data* od, unsigned int shndx, Address addr) { this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx, - address, true, false)); + addr, true, false)); } // Add a reloc against a local section symbol. This will be @@ -1438,19 +1438,19 @@ class Output_data_reloc void add_local_section(Sized_relobj* relobj, unsigned int input_shndx, unsigned int type, - Output_data* od, Address address) + Output_data* od, Address addr) { this->add(od, Output_reloc_type(relobj, input_shndx, type, od, - address, false, true)); + addr, false, true)); } void add_local_section(Sized_relobj* relobj, unsigned int input_shndx, unsigned int type, - Output_data* od, unsigned int shndx, Address address) + Output_data* od, unsigned int shndx, Address addr) { this->add(od, Output_reloc_type(relobj, input_shndx, type, shndx, - address, false, true)); + addr, false, true)); } // A reloc against the STT_SECTION symbol of an output section. @@ -1459,14 +1459,14 @@ class Output_data_reloc void add_output_section(Output_section* os, unsigned int type, - Output_data* od, Address address) - { this->add(od, Output_reloc_type(os, type, od, address)); } + Output_data* od, Address addr) + { this->add(od, Output_reloc_type(os, type, od, addr)); } void add_output_section(Output_section* os, unsigned int type, Output_data* od, Sized_relobj* relobj, - unsigned int shndx, Address address) - { this->add(od, Output_reloc_type(os, type, relobj, shndx, address)); } + unsigned int shndx, Address addr) + { this->add(od, Output_reloc_type(os, type, relobj, shndx, addr)); } }; // The SHT_RELA version of Output_data_reloc. @@ -1492,16 +1492,16 @@ class Output_data_reloc void add_global(Symbol* gsym, unsigned int type, Output_data* od, - Address address, Addend addend) - { this->add(od, Output_reloc_type(gsym, type, od, address, addend, + Address addr, Addend addend) + { this->add(od, Output_reloc_type(gsym, type, od, addr, addend, false)); } void add_global(Symbol* gsym, unsigned int type, Output_data* od, Sized_relobj* relobj, - unsigned int shndx, Address address, + unsigned int shndx, Address addr, Addend addend) - { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address, + { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr, addend, false)); } // Add a RELATIVE reloc against a global symbol. The final output @@ -1511,14 +1511,14 @@ class Output_data_reloc void add_global_relative(Symbol* gsym, unsigned int type, Output_data* od, - Address address, Addend addend) - { this->add(od, Output_reloc_type(gsym, type, od, address, addend, true)); } + Address addr, Addend addend) + { this->add(od, Output_reloc_type(gsym, type, od, addr, addend, true)); } void add_global_relative(Symbol* gsym, unsigned int type, Output_data* od, Sized_relobj* relobj, - unsigned int shndx, Address address, Addend addend) - { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address, + unsigned int shndx, Address addr, Addend addend) + { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr, addend, true)); } // Add a reloc against a local symbol. @@ -1526,20 +1526,20 @@ class Output_data_reloc void add_local(Sized_relobj* relobj, unsigned int local_sym_index, unsigned int type, - Output_data* od, Address address, Addend addend) + Output_data* od, Address addr, Addend addend) { - this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, address, + this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, addr, addend, false, false)); } void add_local(Sized_relobj* relobj, unsigned int local_sym_index, unsigned int type, - Output_data* od, unsigned int shndx, Address address, + Output_data* od, unsigned int shndx, Address addr, Addend addend) { this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx, - address, addend, false, false)); + addr, addend, false, false)); } // Add a RELATIVE reloc against a local symbol. @@ -1547,20 +1547,20 @@ class Output_data_reloc void add_local_relative(Sized_relobj* relobj, unsigned int local_sym_index, unsigned int type, - Output_data* od, Address address, Addend addend) + Output_data* od, Address addr, Addend addend) { - this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, address, + this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, addr, addend, true, false)); } void add_local_relative(Sized_relobj* relobj, unsigned int local_sym_index, unsigned int type, - Output_data* od, unsigned int shndx, Address address, + Output_data* od, unsigned int shndx, Address addr, Addend addend) { this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx, - address, addend, true, false)); + addr, addend, true, false)); } // Add a reloc against a local section symbol. This will be @@ -1570,34 +1570,34 @@ class Output_data_reloc void add_local_section(Sized_relobj* relobj, unsigned int input_shndx, unsigned int type, - Output_data* od, Address address, Addend addend) + Output_data* od, Address addr, Addend addend) { - this->add(od, Output_reloc_type(relobj, input_shndx, type, od, address, + this->add(od, Output_reloc_type(relobj, input_shndx, type, od, addr, addend, false, true)); } void add_local_section(Sized_relobj* relobj, unsigned int input_shndx, unsigned int type, - Output_data* od, unsigned int shndx, Address address, + Output_data* od, unsigned int shndx, Address addr, Addend addend) { this->add(od, Output_reloc_type(relobj, input_shndx, type, shndx, - address, addend, false, true)); + addr, addend, false, true)); } // A reloc against the STT_SECTION symbol of an output section. void add_output_section(Output_section* os, unsigned int type, Output_data* od, - Address address, Addend addend) - { this->add(os, Output_reloc_type(os, type, od, address, addend)); } + Address addr, Addend addend) + { this->add(os, Output_reloc_type(os, type, od, addr, addend)); } void add_output_section(Output_section* os, unsigned int type, Sized_relobj* relobj, - unsigned int shndx, Address address, Addend addend) - { this->add(os, Output_reloc_type(os, type, relobj, shndx, address, + unsigned int shndx, Address addr, Addend addend) + { this->add(os, Output_reloc_type(os, type, relobj, shndx, addr, addend)); } }; @@ -1866,8 +1866,8 @@ class Output_data_dynamic : public Output_section_data // plus a constant offset. void add_section_plus_offset(elfcpp::DT tag, const Output_data* od, - unsigned int offset) - { this->add_entry(Dynamic_entry(tag, od, offset)); } + unsigned int sec_offset) + { this->add_entry(Dynamic_entry(tag, od, sec_offset)); } // Add a new dynamic entry with the size of output data. void @@ -1912,32 +1912,32 @@ class Output_data_dynamic : public Output_section_data { public: // Create an entry with a fixed numeric value. - Dynamic_entry(elfcpp::DT tag, unsigned int val) - : tag_(tag), offset_(DYNAMIC_NUMBER) + Dynamic_entry(elfcpp::DT etag, unsigned int val) + : tag_(etag), offset_(DYNAMIC_NUMBER) { this->u_.val = val; } // Create an entry with the size or address of a section. - Dynamic_entry(elfcpp::DT tag, const Output_data* od, bool section_size) - : tag_(tag), + Dynamic_entry(elfcpp::DT etag, const Output_data* od, bool section_size) + : tag_(etag), offset_(section_size ? DYNAMIC_SECTION_SIZE : DYNAMIC_SECTION_ADDRESS) { this->u_.od = od; } // Create an entry with the address of a section plus a constant offset. - Dynamic_entry(elfcpp::DT tag, const Output_data* od, unsigned int offset) - : tag_(tag), + Dynamic_entry(elfcpp::DT etag, const Output_data* od, unsigned int offset) + : tag_(etag), offset_(offset) { this->u_.od = od; } // Create an entry with the address of a symbol. - Dynamic_entry(elfcpp::DT tag, const Symbol* sym) - : tag_(tag), offset_(DYNAMIC_SYMBOL) + Dynamic_entry(elfcpp::DT etag, const Symbol* sym) + : tag_(etag), offset_(DYNAMIC_SYMBOL) { this->u_.sym = sym; } // Create an entry with a string. - Dynamic_entry(elfcpp::DT tag, const char* str) - : tag_(tag), offset_(DYNAMIC_STRING) + Dynamic_entry(elfcpp::DT etag, const char* str) + : tag_(etag), offset_(DYNAMIC_STRING) { this->u_.str = str; } // Return the tag of this entry. @@ -2050,9 +2050,9 @@ class Output_relaxed_input_section : public Output_section_data_build // We would like to call relobj->section_addralign(shndx) to get the // alignment but we do not want the constructor to fail. So callers // are repsonsible for ensuring that. - Output_relaxed_input_section(Relobj* relobj, unsigned int shndx, - uint64_t addralign) - : Output_section_data_build(addralign), relobj_(relobj), shndx_(shndx) + Output_relaxed_input_section(Relobj* rel_obj, unsigned int sec_shndx, + uint64_t addr_align) + : Output_section_data_build(addr_align), relobj_(rel_obj), shndx_(sec_shndx) { } // Return the Relobj of this relaxed input section. @@ -2132,9 +2132,9 @@ class Output_section : public Output_data // Set the load address. void - set_load_address(uint64_t load_address) + set_load_address(uint64_t load_addr) { - this->load_address_ = load_address; + this->load_address_ = load_addr; this->has_load_address_ = true; } @@ -2502,11 +2502,11 @@ class Output_section : public Output_data static const unsigned int invalid_shndx = static_cast(-1); public: - Simple_input_section(Relobj *relobj, unsigned int shndx) - : shndx_(shndx) + Simple_input_section(Relobj *rel_obj, unsigned int sec_shndx) + : shndx_(sec_shndx) { - gold_assert(shndx != invalid_shndx); - this->u_.relobj = relobj; + gold_assert(sec_shndx != invalid_shndx); + this->u_.relobj = rel_obj; } Simple_input_section(Output_relaxed_input_section* section) @@ -2676,8 +2676,8 @@ class Output_section : public Output_data // Return whether this is a section of the specified type. bool - do_is_section_type(elfcpp::Elf_Word type) const - { return this->type_ == type; } + do_is_section_type(elfcpp::Elf_Word sec_type) const + { return this->type_ == sec_type; } // Return whether the specified section flag is set. bool @@ -2738,16 +2738,16 @@ class Output_section : public Output_data } // For an ordinary input section. - Input_section(Relobj* object, unsigned int shndx, off_t data_size, - uint64_t addralign) - : shndx_(shndx), - p2align_(ffsll(static_cast(addralign))) + Input_section(Relobj* object, unsigned int sec_shndx, off_t datasize, + uint64_t addr_align) + : shndx_(sec_shndx), + p2align_(ffsll(static_cast(addr_align))) { - gold_assert(shndx != OUTPUT_SECTION_CODE - && shndx != MERGE_DATA_SECTION_CODE - && shndx != MERGE_STRING_SECTION_CODE - && shndx != RELAXED_INPUT_SECTION_CODE); - this->u1_.data_size = data_size; + gold_assert(sec_shndx != OUTPUT_SECTION_CODE + && sec_shndx != MERGE_DATA_SECTION_CODE + && sec_shndx != MERGE_STRING_SECTION_CODE + && sec_shndx != RELAXED_INPUT_SECTION_CODE); + this->u1_.data_size = datasize; this->u2_.object = object; } @@ -2807,13 +2807,13 @@ class Output_section : public Output_data // parameters. bool is_merge_section(bool is_string, uint64_t entsize, - uint64_t addralign) const + uint64_t addr_align) const { return (this->shndx_ == (is_string ? MERGE_STRING_SECTION_CODE : MERGE_DATA_SECTION_CODE) && this->u1_.entsize == entsize - && this->addralign() == addralign); + && this->addralign() == addr_align); } // Return whether this is a relaxed input section. @@ -2896,11 +2896,11 @@ class Output_section : public Output_data // Add an input section, for SHF_MERGE sections. bool - add_input_section(Relobj* object, unsigned int shndx) + add_input_section(Relobj* object, unsigned int sec_shndx) { gold_assert(this->shndx_ == MERGE_DATA_SECTION_CODE || this->shndx_ == MERGE_STRING_SECTION_CODE); - return this->u2_.posd->add_input_section(object, shndx); + return this->u2_.posd->add_input_section(object, sec_shndx); } // Given an input OBJECT, an input section index SHNDX within that @@ -3000,15 +3000,15 @@ class Output_section : public Output_data class Checkpoint_output_section { public: - Checkpoint_output_section(uint64_t addralign, elfcpp::Elf_Xword flags, - const Input_section_list& input_sections, - off_t first_input_offset, - bool attached_input_sections_are_sorted) - : addralign_(addralign), flags_(flags), - input_sections_(input_sections), + Checkpoint_output_section(uint64_t addr_align, elfcpp::Elf_Xword sflags, + const Input_section_list& sinput_sections, + off_t first_input_off, + bool attached_input_sections_sorted) + : addralign_(addr_align), flags_(sflags), + input_sections_(sinput_sections), input_sections_size_(input_sections_.size()), - input_sections_copy_(), first_input_offset_(first_input_offset), - attached_input_sections_are_sorted_(attached_input_sections_are_sorted) + input_sections_copy_(), first_input_offset_(first_input_off), + attached_input_sections_are_sorted_(attached_input_sections_sorted) { } virtual @@ -3098,9 +3098,9 @@ class Output_section : public Output_data class Fill { public: - Fill(off_t section_offset, off_t length) - : section_offset_(section_offset), - length_(convert_to_section_size_type(length)) + Fill(off_t section_off, off_t len) + : section_offset_(section_off), + length_(convert_to_section_size_type(len)) { } // Return section offset. @@ -3467,18 +3467,18 @@ class Output_segment // Set the addresses. void - set_addresses(uint64_t vaddr, uint64_t paddr) + set_addresses(uint64_t v_addr, uint64_t p_addr) { - this->vaddr_ = vaddr; - this->paddr_ = paddr; + this->vaddr_ = v_addr; + this->paddr_ = p_addr; this->are_addresses_set_ = true; } // Set the segment flags. This is only used if we have a PHDRS // clause which explicitly specifies the flags. void - set_flags(elfcpp::Elf_Word flags) - { this->flags_ = flags; } + set_flags(elfcpp::Elf_Word seg_flags) + { this->flags_ = seg_flags; } // Set the address of the segment to ADDR and the offset to *POFF // and set the addresses and offsets of all contained output diff --git a/gold/parameters.cc b/gold/parameters.cc index 2a53998be..cd08c6215 100644 --- a/gold/parameters.cc +++ b/gold/parameters.cc @@ -1,6 +1,6 @@ // parameters.cc -- general parameters for a link using gold -// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -31,50 +31,50 @@ namespace gold { void -Parameters::set_errors(Errors* errors) +Parameters::set_errors(Errors* errs) { gold_assert(this->errors_ == NULL); - this->errors_ = errors; + this->errors_ = errs; } void -Parameters::set_options(const General_options* options) +Parameters::set_options(const General_options* opts) { gold_assert(!this->options_valid()); - this->options_ = options; + this->options_ = opts; // For speed, we convert the options() debug var from a string to an // enum (from debug.h). this->debug_ = debug_string_to_enum(this->options().debug()); // If --verbose is set, it acts as "--debug=files". - if (options->verbose()) + if (opts->verbose()) this->debug_ |= DEBUG_FILES; } void -Parameters::set_doing_static_link(bool doing_static_link) +Parameters::set_doing_static_link(bool doing_staticlink) { gold_assert(!this->doing_static_link_valid_); - this->doing_static_link_ = doing_static_link; + this->doing_static_link_ = doing_staticlink; this->doing_static_link_valid_ = true; } void -Parameters::set_target(Target* target) +Parameters::set_target(Target* targ) { if (!this->target_valid()) - this->target_ = target; + this->target_ = targ; else - gold_assert(target == this->target_); + gold_assert(targ == this->target_); } // Return whether TARGET is compatible with the target we are using. bool -Parameters::is_compatible_target(const Target* target) const +Parameters::is_compatible_target(const Target* targ) const { if (this->target_ == NULL) return true; - return target == this->target_; + return targ == this->target_; } Parameters::Target_size_endianness diff --git a/gold/plugin.cc b/gold/plugin.cc index ff9f98f28..de676eb44 100644 --- a/gold/plugin.cc +++ b/gold/plugin.cc @@ -318,7 +318,7 @@ Plugin_manager::claim_file(Input_file* input_file, off_t offset, void Plugin_manager::all_symbols_read(Workqueue* workqueue, Task* task, Input_objects* input_objects, - Symbol_table* symtab, Layout* layout, + Symbol_table* symtab, Layout* alayout, Dirsearch* dirpath, Mapfile* mapfile, Task_token** last_blocker) { @@ -327,7 +327,7 @@ Plugin_manager::all_symbols_read(Workqueue* workqueue, Task* task, this->task_ = task; this->input_objects_ = input_objects; this->symtab_ = symtab; - this->layout_ = layout; + this->layout_ = alayout; this->dirpath_ = dirpath; this->mapfile_ = mapfile; this->this_blocker_ = NULL; @@ -446,10 +446,10 @@ Plugin_manager::add_input_file(char *pathname, bool is_lib) // Class Pluginobj. -Pluginobj::Pluginobj(const std::string& name, Input_file* input_file, - off_t offset, off_t filesize) - : Object(name, input_file, false, offset), - nsyms_(0), syms_(NULL), symbols_(), filesize_(filesize), comdat_map_() +Pluginobj::Pluginobj(const std::string& aname, Input_file* ainput_file, + off_t aoffset, off_t afilesize) + : Object(aname, ainput_file, false, aoffset), + nsyms_(0), syms_(NULL), symbols_(), filesize_(afilesize), comdat_map_() { } @@ -521,7 +521,7 @@ Pluginobj::get_symbol_resolution_info(int nsyms, ld_plugin_symbol* syms) const // should be kept. bool -Pluginobj::include_comdat_group(std::string comdat_key, Layout* layout) +Pluginobj::include_comdat_group(std::string comdat_key, Layout* alayout) { std::pair ins = this->comdat_map_.insert(std::make_pair(comdat_key, false)); @@ -529,9 +529,9 @@ Pluginobj::include_comdat_group(std::string comdat_key, Layout* layout) // If this is the first time we've seen this comdat key, ask the // layout object whether it should be included. if (ins.second) - ins.first->second = layout->find_or_add_kept_section(comdat_key, - NULL, 0, true, - true, NULL); + ins.first->second = alayout->find_or_add_kept_section(comdat_key, + NULL, 0, true, + true, NULL); return ins.first->second; } @@ -540,11 +540,11 @@ Pluginobj::include_comdat_group(std::string comdat_key, Layout* layout) template Sized_pluginobj::Sized_pluginobj( - const std::string& name, - Input_file* input_file, - off_t offset, - off_t filesize) - : Pluginobj(name, input_file, offset, filesize) + const std::string& aname, + Input_file* ainput_file, + off_t aoffset, + off_t afilesize) + : Pluginobj(aname, ainput_file, aoffset, afilesize) { } @@ -573,7 +573,7 @@ template void Sized_pluginobj::do_add_symbols(Symbol_table* symtab, Read_symbols_data*, - Layout* layout) + Layout* alayout) { const int sym_size = elfcpp::Elf_sizes::sym_size; unsigned char symbuf[sym_size]; @@ -587,14 +587,14 @@ Sized_pluginobj::do_add_symbols(Symbol_table* symtab, for (int i = 0; i < this->nsyms_; ++i) { const struct ld_plugin_symbol *isym = &this->syms_[i]; - const char* name = isym->name; + const char* aname = isym->name; const char* ver = isym->version; elfcpp::Elf_Half shndx; elfcpp::STB bind; elfcpp::STV vis; - if (name != NULL && name[0] == '\0') - name = NULL; + if (aname != NULL && aname[0] == '\0') + aname = NULL; if (ver != NULL && ver[0] == '\0') ver = NULL; @@ -647,7 +647,7 @@ Sized_pluginobj::do_add_symbols(Symbol_table* symtab, if (isym->comdat_key != NULL && isym->comdat_key[0] != '\0' - && !this->include_comdat_group(isym->comdat_key, layout)) + && !this->include_comdat_group(isym->comdat_key, alayout)) shndx = elfcpp::SHN_UNDEF; osym.put_st_name(0); @@ -658,7 +658,7 @@ Sized_pluginobj::do_add_symbols(Symbol_table* symtab, osym.put_st_shndx(shndx); this->symbols_[i] = - symtab->add_from_pluginobj(this, name, ver, &sym); + symtab->add_from_pluginobj(this, aname, ver, &sym); } } diff --git a/gold/powerpc.cc b/gold/powerpc.cc index bd5571cbf..8bb633ffb 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -890,10 +890,10 @@ template void Output_data_plt_powerpc::do_write(Output_file* of) { - const off_t offset = this->offset(); + const off_t off = this->offset(); const section_size_type oview_size = convert_to_section_size_type(this->data_size()); - unsigned char* const oview = of->get_output_view(offset, oview_size); + unsigned char* const oview = of->get_output_view(off, oview_size); unsigned char* pov = oview; memset(pov, 0, base_plt_entry_size * 4); @@ -924,7 +924,7 @@ Output_data_plt_powerpc::do_write(Output_file* of) gold_assert(static_cast(pov - oview) == oview_size); - of->write_output_view(offset, oview_size, oview); + of->write_output_view(off, oview_size, oview); } // Create a PLT entry for a global symbol. @@ -1458,9 +1458,9 @@ Target_powerpc::gc_process_relocs( const unsigned char* plocal_symbols) { typedef Target_powerpc Powerpc; - typedef typename Target_powerpc::Scan Scan; + typedef typename Target_powerpc::Scan scan; - gold::gc_process_relocs( + gold::gc_process_relocs( symtab, layout, this, @@ -1492,7 +1492,7 @@ Target_powerpc::scan_relocs( const unsigned char* plocal_symbols) { typedef Target_powerpc Powerpc; - typedef typename Target_powerpc::Scan Scan; + typedef typename Target_powerpc::Scan scan; static Output_data_space* sdata; if (sh_type == elfcpp::SHT_REL) @@ -1520,7 +1520,7 @@ Target_powerpc::scan_relocs( false, false); } - gold::scan_relocs( + gold::scan_relocs( symtab, layout, this, @@ -1992,17 +1992,17 @@ public: (big_endian ? "elf32-powerpc" : "elf32-powerpcle"))) { } - Target* do_recognize(int machine, int, int) + Target* do_recognize(int amachine, int, int) { switch (size) { case 64: - if (machine != elfcpp::EM_PPC64) + if (amachine != elfcpp::EM_PPC64) return NULL; break; case 32: - if (machine != elfcpp::EM_PPC) + if (amachine != elfcpp::EM_PPC) return NULL; break; diff --git a/gold/reduced_debug_output.cc b/gold/reduced_debug_output.cc index 5bc8053f9..d2b0e3d0a 100644 --- a/gold/reduced_debug_output.cc +++ b/gold/reduced_debug_output.cc @@ -1,6 +1,6 @@ // reduced_debug_output.cc -- output reduced debugging information to save space -// Copyright 2008 Free Software Foundation, Inc. +// Copyright 2008, 2009 Free Software Foundation, Inc. // Written by Caleb Howe . // This file is part of gold. @@ -213,15 +213,15 @@ Output_reduced_debug_abbrev_section::set_final_data_size() void Output_reduced_debug_abbrev_section::do_write(Output_file* of) { - off_t offset = this->offset(); - off_t data_size = this->data_size(); - unsigned char* view = of->get_output_view(offset, data_size); + off_t off = this->offset(); + off_t datasize = this->data_size(); + unsigned char* view = of->get_output_view(off, datasize); if (this->failed_) memcpy(view, this->postprocessing_buffer(), this->postprocessing_buffer_size()); else - memcpy(view, &this->data_.front(), data_size); - of->write_output_view(offset, data_size, view); + memcpy(view, &this->data_.front(), datasize); + of->write_output_view(off, datasize, view); } // Locates the abbreviation with abbreviation_number abbrev_number in the @@ -353,15 +353,15 @@ void Output_reduced_debug_info_section::set_final_data_size() void Output_reduced_debug_info_section::do_write(Output_file* of) { - off_t offset = this->offset(); - off_t data_size = this->data_size(); - unsigned char* view = of->get_output_view(offset, data_size); + off_t off = this->offset(); + off_t datasize = this->data_size(); + unsigned char* view = of->get_output_view(off, datasize); if (this->failed_) memcpy(view, this->postprocessing_buffer(), this->postprocessing_buffer_size()); else - memcpy(view, &this->data_.front(), data_size); - of->write_output_view(offset, data_size, view); + memcpy(view, &this->data_.front(), datasize); + of->write_output_view(off, datasize, view); } } // End namespace gold. diff --git a/gold/reduced_debug_output.h b/gold/reduced_debug_output.h index d1682288c..e6a083c09 100644 --- a/gold/reduced_debug_output.h +++ b/gold/reduced_debug_output.h @@ -1,6 +1,6 @@ // reduced_debug_output.h -- reduce debugging information -*- C++ -*- -// Copyright 2008 Free Software Foundation, Inc. +// Copyright 2008, 2009 Free Software Foundation, Inc. // Written by Caleb Howe . // This file is part of gold. @@ -42,9 +42,9 @@ namespace gold class Output_reduced_debug_abbrev_section : public Output_section { public: - Output_reduced_debug_abbrev_section(const char* name, elfcpp::Elf_Word flags, - elfcpp::Elf_Xword type) - : Output_section(name, flags, type), sized_(false), + Output_reduced_debug_abbrev_section(const char* aname, elfcpp::Elf_Word aflags, + elfcpp::Elf_Xword atype) + : Output_section(aname, aflags, atype), sized_(false), abbrev_count_(0), failed_(false) { this->set_requires_postprocessing(); } @@ -88,9 +88,9 @@ class Output_reduced_debug_abbrev_section : public Output_section class Output_reduced_debug_info_section : public Output_section { public: - Output_reduced_debug_info_section(const char* name, elfcpp::Elf_Word flags, - elfcpp::Elf_Xword type) - : Output_section(name, flags, type), failed_(false) + Output_reduced_debug_info_section(const char* aname, elfcpp::Elf_Word aflags, + elfcpp::Elf_Xword atype) + : Output_section(aname, aflags, atype), failed_(false) { this->set_requires_postprocessing(); } void diff --git a/gold/reloc.cc b/gold/reloc.cc index 858778e8e..dfe50b3db 100644 --- a/gold/reloc.cc +++ b/gold/reloc.cc @@ -239,21 +239,21 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) { rd->relocs.clear(); - unsigned int shnum = this->shnum(); - if (shnum == 0) + unsigned int sec_shnum = this->shnum(); + if (sec_shnum == 0) return; - rd->relocs.reserve(shnum / 2); + rd->relocs.reserve(sec_shnum / 2); const Output_sections& out_sections(this->output_sections()); const std::vector
& out_offsets(this->section_offsets_); const unsigned char *pshdrs = this->get_view(this->elf_file_.shoff(), - shnum * This::shdr_size, + sec_shnum * This::shdr_size, true, true); // Skip the first, dummy, section. const unsigned char *ps = pshdrs + This::shdr_size; - for (unsigned int i = 1; i < shnum; ++i, ps += This::shdr_size) + for (unsigned int i = 1; i < sec_shnum; ++i, ps += This::shdr_size) { typename This::Shdr shdr(ps); @@ -262,7 +262,7 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) continue; unsigned int shndx = this->adjust_shndx(shdr.get_sh_info()); - if (shndx >= shnum) + if (shndx >= sec_shnum) { this->error(_("relocation section %u has bad info %u"), i, shndx); @@ -341,10 +341,10 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) typename This::Shdr symtabshdr(pshdrs + this->symtab_shndx_ * This::shdr_size); gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB); - const int sym_size = This::sym_size; + const int symsize = This::sym_size; const unsigned int loccount = this->local_symbol_count_; gold_assert(loccount == symtabshdr.get_sh_info()); - off_t locsize = loccount * sym_size; + off_t locsize = loccount * symsize; rd->local_symbols = this->get_lasting_view(symtabshdr.get_sh_offset(), locsize, true, true); } @@ -357,7 +357,7 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) template void Sized_relobj::do_gc_process_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_relocs_data* rd) { Sized_target* target = @@ -379,7 +379,7 @@ Sized_relobj::do_gc_process_relocs(Symbol_table* symtab, // only scan allocated sections. We may see a non-allocated // section here if we are emitting relocs. if (p->is_data_section_allocated) - target->gc_process_relocs(symtab, layout, this, + target->gc_process_relocs(symtab, alayout, this, p->data_shndx, p->sh_type, p->contents->data(), p->reloc_count, p->output_section, @@ -397,7 +397,7 @@ Sized_relobj::do_gc_process_relocs(Symbol_table* symtab, template void Sized_relobj::do_scan_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_relocs_data* rd) { Sized_target* target = @@ -428,21 +428,21 @@ Sized_relobj::do_scan_relocs(Symbol_table* symtab, // only scan allocated sections. We may see a non-allocated // section here if we are emitting relocs. if (p->is_data_section_allocated) - target->scan_relocs(symtab, layout, this, p->data_shndx, + target->scan_relocs(symtab, alayout, this, p->data_shndx, p->sh_type, p->contents->data(), p->reloc_count, p->output_section, p->needs_special_offset_handling, this->local_symbol_count_, local_symbols); if (parameters->options().emit_relocs()) - this->emit_relocs_scan(symtab, layout, local_symbols, p); + this->emit_relocs_scan(symtab, alayout, local_symbols, p); } else { Relocatable_relocs* rr = this->relocatable_relocs(p->reloc_shndx); gold_assert(rr != NULL); rr->set_reloc_count(p->reloc_count); - target->scan_relocatable_relocs(symtab, layout, this, + target->scan_relocatable_relocs(symtab, alayout, this, p->data_shndx, p->sh_type, p->contents->data(), p->reloc_count, @@ -505,7 +505,7 @@ template void Sized_relobj::emit_relocs_scan( Symbol_table* symtab, - Layout* layout, + Layout* alayout, const unsigned char* plocal_syms, const Read_relocs_data::Relocs_list::iterator& p) { @@ -514,12 +514,12 @@ Sized_relobj::emit_relocs_scan( rr->set_reloc_count(p->reloc_count); if (p->sh_type == elfcpp::SHT_REL) - this->emit_relocs_scan_reltype(symtab, layout, + this->emit_relocs_scan_reltype(symtab, alayout, plocal_syms, p, rr); else { gold_assert(p->sh_type == elfcpp::SHT_RELA); - this->emit_relocs_scan_reltype(symtab, layout, + this->emit_relocs_scan_reltype(symtab, alayout, plocal_syms, p, rr); } } @@ -532,7 +532,7 @@ template void Sized_relobj::emit_relocs_scan_reltype( Symbol_table* symtab, - Layout* layout, + Layout* alayout, const unsigned char* plocal_syms, const Read_relocs_data::Relocs_list::iterator& p, Relocatable_relocs* rr) @@ -540,7 +540,7 @@ Sized_relobj::emit_relocs_scan_reltype( scan_relocatable_relocs >( symtab, - layout, + alayout, this, p->data_shndx, p->contents->data(), @@ -557,18 +557,18 @@ Sized_relobj::emit_relocs_scan_reltype( template void Sized_relobj::do_relocate(const Symbol_table* symtab, - const Layout* layout, + const Layout* alayout, Output_file* of) { - unsigned int shnum = this->shnum(); + unsigned int sec_shnum = this->shnum(); // Read the section headers. const unsigned char* pshdrs = this->get_view(this->elf_file_.shoff(), - shnum * This::shdr_size, + sec_shnum * This::shdr_size, true, true); Views views; - views.resize(shnum); + views.resize(sec_shnum); // Make two passes over the sections. The first one copies the // section data to the output file. The second one applies @@ -582,14 +582,14 @@ Sized_relobj::do_relocate(const Symbol_table* symtab, // Apply relocations. - this->relocate_sections(symtab, layout, pshdrs, &views); + this->relocate_sections(symtab, alayout, pshdrs, &views); // After we've done the relocations, we release the hash tables, // since we no longer need them. this->free_input_to_output_maps(); // Write out the accumulated views. - for (unsigned int i = 1; i < shnum; ++i) + for (unsigned int i = 1; i < sec_shnum; ++i) { if (views[i].view != NULL) { @@ -607,8 +607,8 @@ Sized_relobj::do_relocate(const Symbol_table* symtab, } // Write out the local symbols. - this->write_local_symbols(of, layout->sympool(), layout->dynpool(), - layout->symtab_xindex(), layout->dynsym_xindex()); + this->write_local_symbols(of, alayout->sympool(), alayout->dynpool(), + alayout->symtab_xindex(), alayout->dynsym_xindex()); // We should no longer need the local symbol values. this->clear_local_symbols(); @@ -633,7 +633,7 @@ Sized_relobj::write_sections(const unsigned char* pshdrs, Output_file* of, Views* pviews) { - unsigned int shnum = this->shnum(); + unsigned int sec_shnum = this->shnum(); const Output_sections& out_sections(this->output_sections()); const std::vector
& out_offsets(this->section_offsets_); @@ -641,7 +641,7 @@ Sized_relobj::write_sections(const unsigned char* pshdrs, bool is_sorted = true; const unsigned char* p = pshdrs + This::shdr_size; - for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size) + for (unsigned int i = 1; i < sec_shnum; ++i, p += This::shdr_size) { View_size* pvs = &(*pviews)[i]; @@ -702,16 +702,16 @@ Sized_relobj::write_sections(const unsigned char* pshdrs, // buffer, and the output section is responsible for writing the // final data to the output file. - off_t output_section_offset; + off_t out_section_offset; Address output_section_size; if (!os->requires_postprocessing()) { - output_section_offset = os->offset(); + out_section_offset = os->offset(); output_section_size = convert_types(os->data_size()); } else { - output_section_offset = 0; + out_section_offset = 0; output_section_size = convert_types(os->postprocessing_buffer_size()); } @@ -720,12 +720,12 @@ Sized_relobj::write_sections(const unsigned char* pshdrs, section_size_type view_size; if (output_offset != invalid_address) { - view_start = output_section_offset + output_offset; + view_start = out_section_offset + output_offset; view_size = convert_to_section_size_type(shdr.get_sh_size()); } else { - view_start = output_section_offset; + view_start = out_section_offset; view_size = convert_to_section_size_type(output_section_size); } @@ -735,36 +735,36 @@ Sized_relobj::write_sections(const unsigned char* pshdrs, gold_assert(output_offset == invalid_address || output_offset + view_size <= output_section_size); - unsigned char* view; + unsigned char* aview; if (os->requires_postprocessing()) { unsigned char* buffer = os->postprocessing_buffer(); - view = buffer + view_start; + aview = buffer + view_start; if (output_offset != invalid_address) { off_t sh_offset = shdr.get_sh_offset(); if (!rm.empty() && rm.back().file_offset > sh_offset) is_sorted = false; rm.push_back(File_read::Read_multiple_entry(sh_offset, - view_size, view)); + view_size, aview)); } } else { if (output_offset == invalid_address) - view = of->get_input_output_view(view_start, view_size); + aview = of->get_input_output_view(view_start, view_size); else { - view = of->get_output_view(view_start, view_size); + aview = of->get_output_view(view_start, view_size); off_t sh_offset = shdr.get_sh_offset(); if (!rm.empty() && rm.back().file_offset > sh_offset) is_sorted = false; rm.push_back(File_read::Read_multiple_entry(sh_offset, - view_size, view)); + view_size, aview)); } } - pvs->view = view; + pvs->view = aview; pvs->address = os->address(); if (output_offset != invalid_address) pvs->address += output_offset; @@ -790,11 +790,11 @@ template void Sized_relobj::do_relocate_sections( const Symbol_table* symtab, - const Layout* layout, + const Layout* alayout, const unsigned char* pshdrs, Views* pviews) { - unsigned int shnum = this->shnum(); + unsigned int sec_shnum = this->shnum(); Sized_target* target = parameters->sized_target(); @@ -803,11 +803,11 @@ Sized_relobj::do_relocate_sections( Relocate_info relinfo; relinfo.symtab = symtab; - relinfo.layout = layout; + relinfo.layout = alayout; relinfo.object = this; const unsigned char* p = pshdrs + This::shdr_size; - for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size) + for (unsigned int i = 1; i < sec_shnum; ++i, p += This::shdr_size) { typename This::Shdr shdr(p); @@ -880,7 +880,7 @@ Sized_relobj::do_relocate_sections( relinfo.reloc_shdr = p; relinfo.data_shndx = index; relinfo.data_shdr = pshdrs + index * This::shdr_size; - unsigned char* view = (*pviews)[index].view; + unsigned char* aview = (*pviews)[index].view; Address address = (*pviews)[index].address; section_size_type view_size = (*pviews)[index].view_size; @@ -890,7 +890,7 @@ Sized_relobj::do_relocate_sections( typename This::Shdr data_shdr(pshdrs + index * This::shdr_size); if ((data_shdr.get_sh_flags() & elfcpp::SHF_EXECINSTR) != 0) this->split_stack_adjust(symtab, pshdrs, sh_type, index, - prelocs, reloc_count, view, view_size, + prelocs, reloc_count, aview, view_size, &reloc_map); } @@ -898,10 +898,10 @@ Sized_relobj::do_relocate_sections( { target->relocate_section(&relinfo, sh_type, prelocs, reloc_count, os, output_offset == invalid_address, - view, address, view_size, reloc_map); + aview, address, view_size, reloc_map); if (parameters->options().emit_relocs()) this->emit_relocs(&relinfo, i, sh_type, prelocs, reloc_count, - os, output_offset, view, address, view_size, + os, output_offset, aview, address, view_size, (*pviews)[i].view, (*pviews)[i].view_size); } else @@ -909,7 +909,7 @@ Sized_relobj::do_relocate_sections( Relocatable_relocs* rr = this->relocatable_relocs(i); target->relocate_for_relocatable(&relinfo, sh_type, prelocs, reloc_count, os, output_offset, rr, - view, address, view_size, + aview, address, view_size, (*pviews)[i].view, (*pviews)[i].view_size); } @@ -926,9 +926,9 @@ Sized_relobj::emit_relocs( unsigned int sh_type, const unsigned char* prelocs, size_t reloc_count, - Output_section* output_section, + Output_section* aoutput_section, typename elfcpp::Elf_types::Elf_Addr offset_in_output_section, - unsigned char* view, + unsigned char* aview, typename elfcpp::Elf_types::Elf_Addr address, section_size_type view_size, unsigned char* reloc_view, @@ -936,17 +936,17 @@ Sized_relobj::emit_relocs( { if (sh_type == elfcpp::SHT_REL) this->emit_relocs_reltype(relinfo, i, prelocs, - reloc_count, output_section, + reloc_count, aoutput_section, offset_in_output_section, - view, address, view_size, + aview, address, view_size, reloc_view, reloc_view_size); else { gold_assert(sh_type == elfcpp::SHT_RELA); this->emit_relocs_reltype(relinfo, i, prelocs, - reloc_count, output_section, + reloc_count, aoutput_section, offset_in_output_section, - view, address, view_size, + aview, address, view_size, reloc_view, reloc_view_size); } } @@ -962,9 +962,9 @@ Sized_relobj::emit_relocs_reltype( unsigned int i, const unsigned char* prelocs, size_t reloc_count, - Output_section* output_section, + Output_section* aoutput_section, typename elfcpp::Elf_types::Elf_Addr offset_in_output_section, - unsigned char* view, + unsigned char* aview, typename elfcpp::Elf_types::Elf_Addr address, section_size_type view_size, unsigned char* reloc_view, @@ -975,10 +975,10 @@ Sized_relobj::emit_relocs_reltype( relinfo, prelocs, reloc_count, - output_section, + aoutput_section, offset_in_output_section, rr, - view, + aview, address, view_size, reloc_view, @@ -1029,21 +1029,21 @@ Sized_relobj::split_stack_adjust( unsigned int shndx, const unsigned char* prelocs, size_t reloc_count, - unsigned char* view, + unsigned char* aview, section_size_type view_size, Reloc_symbol_changes** reloc_map) { if (sh_type == elfcpp::SHT_REL) this->split_stack_adjust_reltype(symtab, pshdrs, shndx, prelocs, reloc_count, - view, view_size, + aview, view_size, reloc_map); else { gold_assert(sh_type == elfcpp::SHT_RELA); this->split_stack_adjust_reltype(symtab, pshdrs, shndx, prelocs, reloc_count, - view, view_size, + aview, view_size, reloc_map); } } @@ -1060,7 +1060,7 @@ Sized_relobj::split_stack_adjust_reltype( unsigned int shndx, const unsigned char* prelocs, size_t reloc_count, - unsigned char* view, + unsigned char* aview, section_size_type view_size, Reloc_symbol_changes** reloc_map) { @@ -1097,9 +1097,9 @@ Sized_relobj::split_stack_adjust_reltype( && gsym->source() == Symbol::FROM_OBJECT && !gsym->object()->uses_split_stack()) { - section_offset_type offset = + section_offset_type off = convert_to_section_size_type(reloc.get_r_offset()); - non_split_refs.push_back(offset); + non_split_refs.push_back(off); } } @@ -1152,7 +1152,7 @@ Sized_relobj::split_stack_adjust_reltype( std::string from; std::string to; parameters->target().calls_non_split(this, shndx, p->first, p->second, - view, view_size, &from, &to); + aview, view_size, &from, &to); if (!from.empty()) { gold_assert(!to.empty()); @@ -1171,10 +1171,10 @@ Sized_relobj::split_stack_adjust_reltype( if (r_sym < local_count) continue; - section_offset_type offset = + section_offset_type off = convert_to_section_size_type(reloc.get_r_offset()); - if (offset < p->first - || (offset + if (off < p->first + || (off >= (p->first + static_cast(p->second)))) continue; @@ -1216,8 +1216,8 @@ Sized_relobj::find_functions( // We need to read the symbols to find the functions. If we wanted // to, we could cache reading the symbols across all sections in the // object. - const unsigned int symtab_shndx = this->symtab_shndx_; - typename This::Shdr symtabshdr(pshdrs + symtab_shndx * This::shdr_size); + const unsigned int sym_tab_shndx = this->symtab_shndx_; + typename This::Shdr symtabshdr(pshdrs + sym_tab_shndx * This::shdr_size); gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB); typename elfcpp::Elf_types::Elf_WXword sh_size = @@ -1225,9 +1225,9 @@ Sized_relobj::find_functions( const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(), sh_size, true, true); - const int sym_size = This::sym_size; - const unsigned int symcount = sh_size / sym_size; - for (unsigned int i = 0; i < symcount; ++i, psyms += sym_size) + const int symsize = This::sym_size; + const unsigned int symcount = sh_size / symsize; + for (unsigned int i = 0; i < symcount; ++i, psyms += symsize) { typename elfcpp::Sym isym(psyms); @@ -1419,7 +1419,7 @@ Sized_relobj<64, true>::do_read_relocs(Read_relocs_data* rd); template void Sized_relobj<32, false>::do_gc_process_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_relocs_data* rd); #endif @@ -1427,7 +1427,7 @@ Sized_relobj<32, false>::do_gc_process_relocs(Symbol_table* symtab, template void Sized_relobj<32, true>::do_gc_process_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_relocs_data* rd); #endif @@ -1435,7 +1435,7 @@ Sized_relobj<32, true>::do_gc_process_relocs(Symbol_table* symtab, template void Sized_relobj<64, false>::do_gc_process_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_relocs_data* rd); #endif @@ -1443,7 +1443,7 @@ Sized_relobj<64, false>::do_gc_process_relocs(Symbol_table* symtab, template void Sized_relobj<64, true>::do_gc_process_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_relocs_data* rd); #endif @@ -1451,7 +1451,7 @@ Sized_relobj<64, true>::do_gc_process_relocs(Symbol_table* symtab, template void Sized_relobj<32, false>::do_scan_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_relocs_data* rd); #endif @@ -1459,7 +1459,7 @@ Sized_relobj<32, false>::do_scan_relocs(Symbol_table* symtab, template void Sized_relobj<32, true>::do_scan_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_relocs_data* rd); #endif @@ -1467,7 +1467,7 @@ Sized_relobj<32, true>::do_scan_relocs(Symbol_table* symtab, template void Sized_relobj<64, false>::do_scan_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_relocs_data* rd); #endif @@ -1475,7 +1475,7 @@ Sized_relobj<64, false>::do_scan_relocs(Symbol_table* symtab, template void Sized_relobj<64, true>::do_scan_relocs(Symbol_table* symtab, - Layout* layout, + Layout* alayout, Read_relocs_data* rd); #endif @@ -1483,7 +1483,7 @@ Sized_relobj<64, true>::do_scan_relocs(Symbol_table* symtab, template void Sized_relobj<32, false>::do_relocate(const Symbol_table* symtab, - const Layout* layout, + const Layout* alayout, Output_file* of); #endif @@ -1491,7 +1491,7 @@ Sized_relobj<32, false>::do_relocate(const Symbol_table* symtab, template void Sized_relobj<32, true>::do_relocate(const Symbol_table* symtab, - const Layout* layout, + const Layout* alayout, Output_file* of); #endif @@ -1499,7 +1499,7 @@ Sized_relobj<32, true>::do_relocate(const Symbol_table* symtab, template void Sized_relobj<64, false>::do_relocate(const Symbol_table* symtab, - const Layout* layout, + const Layout* alayout, Output_file* of); #endif @@ -1507,7 +1507,7 @@ Sized_relobj<64, false>::do_relocate(const Symbol_table* symtab, template void Sized_relobj<64, true>::do_relocate(const Symbol_table* symtab, - const Layout* layout, + const Layout* alayout, Output_file* of); #endif @@ -1516,7 +1516,7 @@ template void Sized_relobj<32, false>::do_relocate_sections( const Symbol_table* symtab, - const Layout* layout, + const Layout* alayout, const unsigned char* pshdrs, Views* pviews); #endif @@ -1526,7 +1526,7 @@ template void Sized_relobj<32, true>::do_relocate_sections( const Symbol_table* symtab, - const Layout* layout, + const Layout* alayout, const unsigned char* pshdrs, Views* pviews); #endif @@ -1536,7 +1536,7 @@ template void Sized_relobj<64, false>::do_relocate_sections( const Symbol_table* symtab, - const Layout* layout, + const Layout* alayout, const unsigned char* pshdrs, Views* pviews); #endif diff --git a/gold/reloc.h b/gold/reloc.h index 5dd4c8515..30a55ff2d 100644 --- a/gold/reloc.h +++ b/gold/reloc.h @@ -259,10 +259,10 @@ class Relocatable_relocs // Record what to do for the next reloc. void - set_next_reloc_strategy(Reloc_strategy strategy) + set_next_reloc_strategy(Reloc_strategy astrategy) { - this->reloc_strategies_.push_back(static_cast(strategy)); - if (strategy != RELOC_DISCARD) + this->reloc_strategies_.push_back(static_cast(astrategy)); + if (astrategy != RELOC_DISCARD) ++this->output_reloc_count_; } diff --git a/gold/resolve.cc b/gold/resolve.cc index 89b10b9f9..1d77a9263 100644 --- a/gold/resolve.cc +++ b/gold/resolve.cc @@ -37,9 +37,9 @@ namespace gold // VERSION. Update the VERSION_ field accordingly. inline void -Symbol::override_version(const char* version) +Symbol::override_version(const char* aversion) { - if (version == NULL) + if (aversion == NULL) { // This is the case where this symbol is NAME/VERSION, and the // version was not marked as hidden. That makes it the default @@ -49,7 +49,7 @@ Symbol::override_version(const char* version) // override NAME/VERSION as well. They are already the same // Symbol structure. Setting the VERSION_ field to NULL ensures // that it will be output with the correct, empty, version. - this->version_ = version; + this->version_ = aversion; } else { @@ -58,8 +58,8 @@ Symbol::override_version(const char* version) // overriding NAME. If VERSION_ONE and VERSION_TWO are // different, then this can only happen when VERSION_ONE is NULL // and VERSION_TWO is not hidden. - gold_assert(this->version_ == version || this->version_ == NULL); - this->version_ = version; + gold_assert(this->version_ == aversion || this->version_ == NULL); + this->version_ = aversion; } } @@ -67,19 +67,19 @@ Symbol::override_version(const char* version) // is VISIBILITY. Updated the VISIBILITY_ field accordingly. inline void -Symbol::override_visibility(elfcpp::STV visibility) +Symbol::override_visibility(elfcpp::STV avisibility) { // The rule for combining visibility is that we always choose the // most constrained visibility. In order of increasing constraint, // visibility goes PROTECTED, HIDDEN, INTERNAL. This is the reverse // of the numeric values, so the effect is that we always want the // smallest non-zero value. - if (visibility != elfcpp::STV_DEFAULT) + if (avisibility != elfcpp::STV_DEFAULT) { if (this->visibility_ == elfcpp::STV_DEFAULT) - this->visibility_ = visibility; - else if (this->visibility_ > visibility) - this->visibility_ = visibility; + this->visibility_ = avisibility; + else if (this->visibility_ > avisibility) + this->visibility_ = avisibility; } } @@ -89,18 +89,18 @@ template void Symbol::override_base(const elfcpp::Sym& sym, unsigned int st_shndx, bool is_ordinary, - Object* object, const char* version) + Object* aobject, const char* aversion) { gold_assert(this->source_ == FROM_OBJECT); - this->u_.from_object.object = object; - this->override_version(version); + this->u_.from_object.object = aobject; + this->override_version(aversion); this->u_.from_object.shndx = st_shndx; this->is_ordinary_shndx_ = is_ordinary; this->type_ = sym.get_st_type(); this->binding_ = sym.get_st_bind(); this->override_visibility(sym.get_st_visibility()); this->nonvis_ = sym.get_st_nonvis(); - if (object->is_dynamic()) + if (aobject->is_dynamic()) this->in_dyn_ = true; else this->in_reg_ = true; @@ -113,9 +113,9 @@ template void Sized_symbol::override(const elfcpp::Sym& sym, unsigned st_shndx, bool is_ordinary, - Object* object, const char* version) + Object* aobject, const char* aversion) { - this->override_base(sym, st_shndx, is_ordinary, object, version); + this->override_base(sym, st_shndx, is_ordinary, aobject, aversion); this->value_ = sym.get_st_value(); this->symsize_ = sym.get_st_size(); } @@ -128,9 +128,9 @@ void Symbol_table::override(Sized_symbol* tosym, const elfcpp::Sym& fromsym, unsigned int st_shndx, bool is_ordinary, - Object* object, const char* version) + Object* aobject, const char* aversion) { - tosym->override(fromsym, st_shndx, is_ordinary, object, version); + tosym->override(fromsym, st_shndx, is_ordinary, aobject, aversion); if (tosym->has_alias()) { Symbol* sym = this->weak_aliases_[tosym]; @@ -138,7 +138,7 @@ Symbol_table::override(Sized_symbol* tosym, Sized_symbol* ssym = this->get_sized_symbol(sym); do { - ssym->override(fromsym, st_shndx, is_ordinary, object, version); + ssym->override(fromsym, st_shndx, is_ordinary, aobject, aversion); sym = this->weak_aliases_[ssym]; gold_assert(sym != NULL); ssym = this->get_sized_symbol(sym); diff --git a/gold/script-sections.cc b/gold/script-sections.cc index f38cbd0f0..b8e1cefb2 100644 --- a/gold/script-sections.cc +++ b/gold/script-sections.cc @@ -1171,8 +1171,8 @@ Output_section_element_input::match_name(const char* file_name, class Input_section_info { public: - Input_section_info(const Output_section::Simple_input_section& input_section) - : input_section_(input_section), section_name_(), + Input_section_info(const Output_section::Simple_input_section& inputsection) + : input_section_(inputsection), section_name_(), size_(0), addralign_(1) { } @@ -1198,8 +1198,8 @@ class Input_section_info // Set the section name. void - set_section_name(const std::string name) - { this->section_name_ = name; } + set_section_name(const std::string aname) + { this->section_name_ = aname; } // Return the section size. uint64_t @@ -1208,8 +1208,8 @@ class Input_section_info // Set the section size. void - set_size(uint64_t size) - { this->size_ = size; } + set_size(uint64_t sec_size) + { this->size_ = sec_size; } // Return the address alignment. uint64_t @@ -1218,8 +1218,8 @@ class Input_section_info // Set the address alignment. void - set_addralign(uint64_t addralign) - { this->addralign_ = addralign; } + set_addralign(uint64_t addr_align) + { this->addralign_ = addr_align; } private: // Input section, can be a relaxed section. @@ -1388,12 +1388,12 @@ Output_section_element_input::set_section_addresses( Input_section_sorter(this->filename_sort_, isp.sort)); - for (std::vector::const_iterator p = + for (std::vector::const_iterator q = matching_sections[i].begin(); - p != matching_sections[i].end(); - ++p) + q != matching_sections[i].end(); + ++q) { - uint64_t this_subalign = p->addralign(); + uint64_t this_subalign = q->addralign(); if (this_subalign < subalign) this_subalign = subalign; @@ -1409,11 +1409,11 @@ Output_section_element_input::set_section_addresses( layout->new_output_section_data_from_script(posd); } - output_section->add_input_section_for_script(p->input_section(), - p->size(), + output_section->add_input_section_for_script(q->input_section(), + q->size(), this_subalign); - dot = address + p->size(); + dot = address + q->size(); } } @@ -2127,7 +2127,7 @@ bool Output_section_definition::get_output_section_info(const char* name, uint64_t* address, uint64_t* load_address, - uint64_t* addralign, + uint64_t* addr_align, uint64_t* size) const { if (this->name_ != name) @@ -2140,14 +2140,14 @@ Output_section_definition::get_output_section_info(const char* name, *load_address = this->output_section_->load_address(); else *load_address = *address; - *addralign = this->output_section_->addralign(); + *addr_align = this->output_section_->addralign(); *size = this->output_section_->current_data_size(); } else { *address = this->evaluated_address_; *load_address = this->evaluated_load_address_; - *addralign = this->evaluated_addralign_; + *addr_align = this->evaluated_addralign_; *size = 0; } @@ -2297,7 +2297,7 @@ Orphan_output_section::set_section_addresses(Symbol_table*, Layout*, p != input_sections.end(); ++p) { - uint64_t addralign; + uint64_t addr_align; uint64_t size; // We know what are single-threaded, so it is OK to lock the @@ -2305,7 +2305,7 @@ Orphan_output_section::set_section_addresses(Symbol_table*, Layout*, { const Task* task = reinterpret_cast(-1); Task_lock_obj tl(task, p->relobj()); - addralign = p->relobj()->section_addralign(p->shndx()); + addr_align = p->relobj()->section_addralign(p->shndx()); if (p->is_relaxed_input_section()) // We use current data size because relxed section sizes may not // have finalized yet. @@ -2314,8 +2314,8 @@ Orphan_output_section::set_section_addresses(Symbol_table*, Layout*, size = p->relobj()->section_size(p->shndx()); } - address = align_address(address, addralign); - this->os_->add_input_section_for_script(*p, size, addralign); + address = align_address(address, addr_align); + this->os_->add_input_section_for_script(*p, size, addr_align); address += size; } @@ -2351,13 +2351,13 @@ Orphan_output_section::allocate_to_segment(String_list**, bool* orphan) class Phdrs_element { public: - Phdrs_element(const char* name, size_t namelen, unsigned int type, - bool includes_filehdr, bool includes_phdrs, + Phdrs_element(const char* aname, size_t namelen, unsigned int atype, + bool include_filehdr, bool include_phdrs, bool is_flags_valid, unsigned int flags, - Expression* load_address) - : name_(name, namelen), type_(type), includes_filehdr_(includes_filehdr), - includes_phdrs_(includes_phdrs), is_flags_valid_(is_flags_valid), - flags_(flags), load_address_(load_address), load_address_value_(0), + Expression* aload_address) + : name_(aname, namelen), type_(atype), includes_filehdr_(include_filehdr), + includes_phdrs_(include_phdrs), is_flags_valid_(is_flags_valid), + flags_(flags), load_address_(aload_address), load_address_value_(0), segment_(NULL) { } @@ -2388,10 +2388,10 @@ class Phdrs_element // Evaluate the load address expression if there is one. void - eval_load_address(Symbol_table* symtab, Layout* layout) + eval_load_address(Symbol_table* symtab, Layout* alayout) { if (this->load_address_ != NULL) - this->load_address_value_ = this->load_address_->eval(symtab, layout, + this->load_address_value_ = this->load_address_->eval(symtab, alayout, true); } @@ -3496,7 +3496,7 @@ Script_sections::put_headers_in_phdrs(Output_data* file_header, bool Script_sections::get_output_section_info(const char* name, uint64_t* address, uint64_t* load_address, - uint64_t* addralign, + uint64_t* addr_align, uint64_t* size) const { if (!this->saw_sections_clause_) @@ -3504,7 +3504,7 @@ Script_sections::get_output_section_info(const char* name, uint64_t* address, for (Sections_elements::const_iterator p = this->sections_elements_->begin(); p != this->sections_elements_->end(); ++p) - if ((*p)->get_output_section_info(name, address, load_address, addralign, + if ((*p)->get_output_section_info(name, address, load_address, addr_align, size)) return true; return false; diff --git a/gold/script.cc b/gold/script.cc index 8839213bc..ec7ce07fe 100644 --- a/gold/script.cc +++ b/gold/script.cc @@ -78,28 +78,28 @@ class Token { } // A general token with no value. - Token(Classification classification, int lineno, int charpos) - : classification_(classification), value_(NULL), value_length_(0), - opcode_(0), lineno_(lineno), charpos_(charpos) + Token(Classification aclassification, int linenum, int char_pos) + : classification_(aclassification), value_(NULL), value_length_(0), + opcode_(0), lineno_(linenum), charpos_(char_pos) { - gold_assert(classification == TOKEN_INVALID - || classification == TOKEN_EOF); + gold_assert(aclassification == TOKEN_INVALID + || aclassification == TOKEN_EOF); } // A general token with a value. - Token(Classification classification, const char* value, size_t length, - int lineno, int charpos) - : classification_(classification), value_(value), value_length_(length), - opcode_(0), lineno_(lineno), charpos_(charpos) + Token(Classification aclassification, const char* value, size_t length, + int linenum, int char_pos) + : classification_(aclassification), value_(value), value_length_(length), + opcode_(0), lineno_(linenum), charpos_(char_pos) { - gold_assert(classification != TOKEN_INVALID - && classification != TOKEN_EOF); + gold_assert(aclassification != TOKEN_INVALID + && aclassification != TOKEN_EOF); } // A token representing an operator. - Token(int opcode, int lineno, int charpos) + Token(int opcode, int linenum, int char_pos) : classification_(TOKEN_OPERATOR), value_(NULL), value_length_(0), - opcode_(opcode), lineno_(lineno), charpos_(charpos) + opcode_(opcode), lineno_(linenum), charpos_(char_pos) { } // Return whether the token is invalid. @@ -213,8 +213,8 @@ class Lex // Set the lexing mode. void - set_mode(Mode mode) - { this->mode_ = mode; } + set_mode(Mode mde) + { this->mode_ = mde; } private: Lex(const Lex&); @@ -1160,19 +1160,19 @@ Script_options::set_section_addresses(Symbol_table* symtab, Layout* layout) class Parser_closure { public: - Parser_closure(const char* filename, + Parser_closure(const char* afilename, const Position_dependent_options& posdep_options, - bool in_group, bool is_in_sysroot, - Command_line* command_line, - Script_options* script_options, + bool in_a_group, bool is_in_a_sysroot, + Command_line* acommand_line, + Script_options* script_opts, Lex* lex, - bool skip_on_incompatible_target) - : filename_(filename), posdep_options_(posdep_options), - in_group_(in_group), is_in_sysroot_(is_in_sysroot), - skip_on_incompatible_target_(skip_on_incompatible_target), + bool skip_on_a_incompatible_target) + : filename_(afilename), posdep_options_(posdep_options), + in_group_(in_a_group), is_in_sysroot_(is_in_a_sysroot), + skip_on_incompatible_target_(skip_on_a_incompatible_target), found_incompatible_target_(false), - command_line_(command_line), script_options_(script_options), - version_script_info_(script_options->version_script_info()), + command_line_(acommand_line), script_options_(script_opts), + version_script_info_(script_opts->version_script_info()), lex_(lex), lineno_(0), charpos_(0), lex_mode_stack_(), inputs_(NULL) { // We start out processing C symbols in the default lex mode. @@ -1814,10 +1814,10 @@ Lazy_demangler::get() // For example, pattern="std::map*" and language="C++". // pattern and language should be from the stringpool struct Version_expression { - Version_expression(const std::string& pattern, - const std::string& language, - bool exact_match) - : pattern(pattern), language(language), exact_match(exact_match) {} + Version_expression(const std::string& apattern, + const std::string& alanguage, + bool is_exact_match) + : pattern(apattern), language(alanguage), exact_match(is_exact_match) {} std::string pattern; std::string language; diff --git a/gold/script.h b/gold/script.h index 755bb7947..1afe44dc7 100644 --- a/gold/script.h +++ b/gold/script.h @@ -261,9 +261,9 @@ class Symbol_assignment class Script_assertion { public: - Script_assertion(Expression* check, const char* message, + Script_assertion(Expression* echeck, const char* message, size_t messagelen) - : check_(check), message_(message, messagelen) + : check_(echeck), message_(message, messagelen) { } // Check the assertion. @@ -390,8 +390,8 @@ class Script_options class Script_info { public: - Script_info(Input_arguments* inputs) - : inputs_(inputs) + Script_info(Input_arguments* arg_inputs) + : inputs_(arg_inputs) { } // Returns the input files included because of this script. diff --git a/gold/sparc.cc b/gold/sparc.cc index 8047a1153..43c6e34b0 100644 --- a/gold/sparc.cc +++ b/gold/sparc.cc @@ -401,13 +401,13 @@ private: rela(unsigned char* view, unsigned int right_shift, typename elfcpp::Elf_types::Elf_Addr dst_mask, - typename elfcpp::Swap::Valtype value, + typename elfcpp::Swap::Valtype avalue, typename elfcpp::Swap::Valtype addend) { typedef typename elfcpp::Swap::Valtype Valtype; Valtype* wv = reinterpret_cast(view); Valtype val = elfcpp::Swap::readval(wv); - Valtype reloc = ((value + addend) >> right_shift); + Valtype reloc = ((avalue + addend) >> right_shift); val &= ~dst_mask; reloc &= dst_mask; @@ -589,10 +589,10 @@ public: // R_SPARC_HI22: (Symbol + Addend) >> 10 static inline void hi22(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr value, + typename elfcpp::Elf_types::Elf_Addr avalue, typename elfcpp::Elf_types::Elf_Addr addend) { - This_insn::template rela<32>(view, 10, 0x003fffff, value, addend); + This_insn::template rela<32>(view, 10, 0x003fffff, avalue, addend); } // R_SPARC_HI22: (Symbol + Addend) >> 10 @@ -620,10 +620,10 @@ public: // R_SPARC_LO10: (Symbol + Addend) & 0x3ff static inline void lo10(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr value, + typename elfcpp::Elf_types::Elf_Addr avalue, typename elfcpp::Elf_types::Elf_Addr addend) { - This_insn::template rela<32>(view, 0, 0x000003ff, value, addend); + This_insn::template rela<32>(view, 0, 0x000003ff, avalue, addend); } // R_SPARC_LO10: (Symbol + Addend) & 0x3ff @@ -682,10 +682,10 @@ public: // R_SPARC_13: (Symbol + Addend) static inline void rela32_13(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr value, + typename elfcpp::Elf_types::Elf_Addr avalue, typename elfcpp::Elf_types::Elf_Addr addend) { - This_insn::template rela<32>(view, 0, 0x00001fff, value, addend); + This_insn::template rela<32>(view, 0, 0x00001fff, avalue, addend); } // R_SPARC_13: (Symbol + Addend) @@ -904,22 +904,22 @@ public: // R_SPARC_TLS_LDO_HIX22: @dtpoff(Symbol + Addend) >> 10 static inline void ldo_hix22(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr value, + typename elfcpp::Elf_types::Elf_Addr avalue, typename elfcpp::Elf_types::Elf_Addr addend) { - This_insn::hi22(view, value, addend); + This_insn::hi22(view, avalue, addend); } // R_SPARC_TLS_LDO_LOX10: @dtpoff(Symbol + Addend) & 0x3ff static inline void ldo_lox10(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr value, + typename elfcpp::Elf_types::Elf_Addr avalue, typename elfcpp::Elf_types::Elf_Addr addend) { typedef typename elfcpp::Swap<32, true>::Valtype Valtype; Valtype* wv = reinterpret_cast(view); Valtype val = elfcpp::Swap<32, true>::readval(wv); - Valtype reloc = (value + addend); + Valtype reloc = (avalue + addend); val &= ~0x1fff; reloc &= 0x3ff; @@ -930,13 +930,13 @@ public: // R_SPARC_TLS_LE_HIX22: (@tpoff(Symbol + Addend) ^ 0xffffffffffffffff) >> 10 static inline void hix22(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr value, + typename elfcpp::Elf_types::Elf_Addr avalue, typename elfcpp::Elf_types::Elf_Addr addend) { typedef typename elfcpp::Swap<32, true>::Valtype Valtype; Valtype* wv = reinterpret_cast(view); Valtype val = elfcpp::Swap<32, true>::readval(wv); - Valtype reloc = (value + addend); + Valtype reloc = (avalue + addend); val &= ~0x3fffff; @@ -974,13 +974,13 @@ public: // R_SPARC_TLS_LE_LOX10: (@tpoff(Symbol + Addend) & 0x3ff) | 0x1c00 static inline void lox10(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr value, + typename elfcpp::Elf_types::Elf_Addr avalue, typename elfcpp::Elf_types::Elf_Addr addend) { typedef typename elfcpp::Swap<32, true>::Valtype Valtype; Valtype* wv = reinterpret_cast(view); Valtype val = elfcpp::Swap<32, true>::readval(wv); - Valtype reloc = (value + addend); + Valtype reloc = (avalue + addend); val &= ~0x1fff; reloc &= 0x3ff; @@ -1220,10 +1220,10 @@ template void Output_data_plt_sparc::do_write(Output_file* of) { - const off_t offset = this->offset(); + const off_t off = this->offset(); const section_size_type oview_size = convert_to_section_size_type(this->data_size()); - unsigned char* const oview = of->get_output_view(offset, oview_size); + unsigned char* const oview = of->get_output_view(off, oview_size); unsigned char* pov = oview; memset(pov, 0, base_plt_entry_size * 4); @@ -1347,7 +1347,7 @@ Output_data_plt_sparc::do_write(Output_file* of) gold_assert(static_cast(pov - oview) == oview_size); - of->write_output_view(offset, oview_size, oview); + of->write_output_view(off, oview_size, oview); } // Create a PLT entry for a global symbol. @@ -2260,9 +2260,9 @@ Target_sparc::gc_process_relocs( const unsigned char* plocal_symbols) { typedef Target_sparc Sparc; - typedef typename Target_sparc::Scan Scan; + typedef typename Target_sparc::Scan scan; - gold::gc_process_relocs( + gold::gc_process_relocs( symtab, layout, this, @@ -2294,7 +2294,7 @@ Target_sparc::scan_relocs( const unsigned char* plocal_symbols) { typedef Target_sparc Sparc; - typedef typename Target_sparc::Scan Scan; + typedef typename Target_sparc::Scan scan; if (sh_type == elfcpp::SHT_REL) { @@ -2303,7 +2303,7 @@ Target_sparc::scan_relocs( return; } - gold::scan_relocs( + gold::scan_relocs( symtab, layout, this, @@ -2415,11 +2415,11 @@ Target_sparc::Relocate::relocate( || r_type == elfcpp::R_SPARC_WDISP19 || r_type == elfcpp::R_SPARC_WDISP16)) { - elfcpp::Elf_Xword value; + elfcpp::Elf_Xword avalue; - value = target->plt_section()->address() + gsym->plt_offset(); + avalue = target->plt_section()->address() + gsym->plt_offset(); - symval.set_output_value(value); + symval.set_output_value(avalue); psymval = &symval; } @@ -2740,7 +2740,7 @@ Target_sparc::Relocate::relocate_tls( typedef typename elfcpp::Swap<32, true>::Valtype Insntype; const elfcpp::Elf_Xword addend = rela.get_r_addend(); - typename elfcpp::Elf_types::Elf_Addr value = psymval->value(object, 0); + typename elfcpp::Elf_types::Elf_Addr avalue = psymval->value(object, 0); const bool is_final = (gsym == NULL @@ -2760,18 +2760,18 @@ Target_sparc::Relocate::relocate_tls( Insntype* wv = reinterpret_cast(view); Insntype val; - value -= tls_segment->memsz(); + avalue -= tls_segment->memsz(); switch (r_type) { case elfcpp::R_SPARC_TLS_GD_HI22: // TLS_GD_HI22 --> TLS_LE_HIX22 - Reloc::hix22(view, value, addend); + Reloc::hix22(view, avalue, addend); break; case elfcpp::R_SPARC_TLS_GD_LO10: // TLS_GD_LO10 --> TLS_LE_LOX10 - Reloc::lox10(view, value, addend); + Reloc::lox10(view, avalue, addend); break; case elfcpp::R_SPARC_TLS_GD_ADD: @@ -2795,13 +2795,13 @@ Target_sparc::Relocate::relocate_tls( if (gsym != NULL) { gold_assert(gsym->has_got_offset(got_type)); - value = gsym->got_offset(got_type); + avalue = gsym->got_offset(got_type); } else { unsigned int r_sym = elfcpp::elf_r_sym(rela.get_r_info()); gold_assert(object->local_has_got_offset(r_sym, got_type)); - value = object->local_got_offset(r_sym, got_type); + avalue = object->local_got_offset(r_sym, got_type); } if (optimized_type == tls::TLSOPT_TO_IE) { @@ -2812,12 +2812,12 @@ Target_sparc::Relocate::relocate_tls( { case elfcpp::R_SPARC_TLS_GD_HI22: // TLS_GD_HI22 --> TLS_IE_HI22 - Reloc::hi22(view, value, addend); + Reloc::hi22(view, avalue, addend); break; case elfcpp::R_SPARC_TLS_GD_LO10: // TLS_GD_LO10 --> TLS_IE_LO10 - Reloc::lo10(view, value, addend); + Reloc::lo10(view, avalue, addend); break; case elfcpp::R_SPARC_TLS_GD_ADD: @@ -2867,24 +2867,24 @@ Target_sparc::Relocate::relocate_tls( switch (r_type) { case elfcpp::R_SPARC_TLS_GD_HI22: - Reloc::hi22(view, value, addend); + Reloc::hi22(view, avalue, addend); break; case elfcpp::R_SPARC_TLS_GD_LO10: - Reloc::lo10(view, value, addend); + Reloc::lo10(view, avalue, addend); break; case elfcpp::R_SPARC_TLS_GD_ADD: break; case elfcpp::R_SPARC_TLS_GD_CALL: { Symbol_value symval; - elfcpp::Elf_Xword value; + elfcpp::Elf_Xword xvalue; Symbol* tsym; tsym = target->tls_get_addr_sym_; gold_assert(tsym); - value = (target->plt_section()->address() + - tsym->plt_offset()); - symval.set_output_value(value); + xvalue = (target->plt_section()->address() + + tsym->plt_offset()); + symval.set_output_value(xvalue); Reloc::wdisp30(view, object, &symval, addend, address); } break; @@ -2939,14 +2939,14 @@ Target_sparc::Relocate::relocate_tls( case elfcpp::R_SPARC_TLS_LDM_CALL: { Symbol_value symval; - elfcpp::Elf_Xword value; + elfcpp::Elf_Xword xvalue; Symbol* tsym; tsym = target->tls_get_addr_sym_; gold_assert(tsym); - value = (target->plt_section()->address() + - tsym->plt_offset()); - symval.set_output_value(value); + xvalue = (target->plt_section()->address() + + tsym->plt_offset()); + symval.set_output_value(xvalue); Reloc::wdisp30(view, object, &symval, addend, address); } break; @@ -2964,20 +2964,20 @@ Target_sparc::Relocate::relocate_tls( case elfcpp::R_SPARC_TLS_LDO_HIX22: if (optimized_type == tls::TLSOPT_TO_LE) { - value -= tls_segment->memsz(); - Reloc::hix22(view, value, addend); + avalue -= tls_segment->memsz(); + Reloc::hix22(view, avalue, addend); } else - Reloc::ldo_hix22(view, value, addend); + Reloc::ldo_hix22(view, avalue, addend); break; case elfcpp::R_SPARC_TLS_LDO_LOX10: if (optimized_type == tls::TLSOPT_TO_LE) { - value -= tls_segment->memsz(); - Reloc::lox10(view, value, addend); + avalue -= tls_segment->memsz(); + Reloc::lox10(view, avalue, addend); } else - Reloc::ldo_lox10(view, value, addend); + Reloc::ldo_lox10(view, avalue, addend); break; case elfcpp::R_SPARC_TLS_LDO_ADD: if (optimized_type == tls::TLSOPT_TO_LE) @@ -3018,16 +3018,16 @@ Target_sparc::Relocate::relocate_tls( case elfcpp::R_SPARC_TLS_IE_LO10: if (optimized_type == tls::TLSOPT_TO_LE) { - value -= tls_segment->memsz(); + avalue -= tls_segment->memsz(); switch (r_type) { case elfcpp::R_SPARC_TLS_IE_HI22: // IE_HI22 --> LE_HIX22 - Reloc::hix22(view, value, addend); + Reloc::hix22(view, avalue, addend); break; case elfcpp::R_SPARC_TLS_IE_LO10: // IE_LO10 --> LE_LOX10 - Reloc::lox10(view, value, addend); + Reloc::lox10(view, avalue, addend); break; } break; @@ -3039,23 +3039,23 @@ Target_sparc::Relocate::relocate_tls( if (gsym != NULL) { gold_assert(gsym->has_got_offset(GOT_TYPE_TLS_OFFSET)); - value = gsym->got_offset(GOT_TYPE_TLS_OFFSET); + avalue = gsym->got_offset(GOT_TYPE_TLS_OFFSET); } else { unsigned int r_sym = elfcpp::elf_r_sym(rela.get_r_info()); gold_assert(object->local_has_got_offset(r_sym, GOT_TYPE_TLS_OFFSET)); - value = object->local_got_offset(r_sym, - GOT_TYPE_TLS_OFFSET); + avalue = object->local_got_offset(r_sym, + GOT_TYPE_TLS_OFFSET); } switch (r_type) { case elfcpp::R_SPARC_TLS_IE_HI22: - Reloc::hi22(view, value, addend); + Reloc::hi22(view, avalue, addend); break; case elfcpp::R_SPARC_TLS_IE_LO10: - Reloc::lo10(view, value, addend); + Reloc::lo10(view, avalue, addend); break; } break; @@ -3076,8 +3076,8 @@ Target_sparc::Relocate::relocate_tls( // have been created for this location, so do not apply it now. if (!parameters->options().shared()) { - value -= tls_segment->memsz(); - Reloc::hix22(view, value, addend); + avalue -= tls_segment->memsz(); + Reloc::hix22(view, avalue, addend); } break; @@ -3086,8 +3086,8 @@ Target_sparc::Relocate::relocate_tls( // have been created for this location, so do not apply it now. if (!parameters->options().shared()) { - value -= tls_segment->memsz(); - Reloc::lox10(view, value, addend); + avalue -= tls_segment->memsz(); + Reloc::lox10(view, avalue, addend); } break; } @@ -3238,18 +3238,18 @@ public: (size == 64 ? "elf64-sparc" : "elf32-sparc")) { } - Target* do_recognize(int machine, int, int) + Target* do_recognize(int amachine, int, int) { switch (size) { case 64: - if (machine != elfcpp::EM_SPARCV9) + if (amachine != elfcpp::EM_SPARCV9) return NULL; break; case 32: - if (machine != elfcpp::EM_SPARC - && machine != elfcpp::EM_SPARC32PLUS) + if (amachine != elfcpp::EM_SPARC + && amachine != elfcpp::EM_SPARC32PLUS) return NULL; break; diff --git a/gold/symtab.cc b/gold/symtab.cc index 7e8a89021..30ed8f787 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -50,20 +50,20 @@ namespace gold // and source_. void -Symbol::init_fields(const char* name, const char* version, - elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis) +Symbol::init_fields(const char* aname, const char* aversion, + elfcpp::STT atype, elfcpp::STB abinding, + elfcpp::STV avisibility, unsigned char non_vis) { - this->name_ = name; - this->version_ = version; + this->name_ = aname; + this->version_ = aversion; this->symtab_index_ = 0; this->dynsym_index_ = 0; this->got_offsets_.init(); this->plt_offset_ = 0; - this->type_ = type; - this->binding_ = binding; - this->visibility_ = visibility; - this->nonvis_ = nonvis; + this->type_ = atype; + this->binding_ = abinding; + this->visibility_ = avisibility; + this->nonvis_ = non_vis; this->is_target_special_ = false; this->is_def_ = false; this->is_forwarder_ = false; @@ -83,16 +83,16 @@ Symbol::init_fields(const char* name, const char* version, // if the --demangle flag was set. static std::string -demangle(const char* name) +demangle(const char* aname) { if (!parameters->options().do_demangle()) - return name; + return aname; // cplus_demangle allocates memory for the result it returns, // and returns NULL if the name is already demangled. - char* demangled_name = cplus_demangle(name, DMGL_ANSI | DMGL_PARAMS); + char* demangled_name = cplus_demangle(aname, DMGL_ANSI | DMGL_PARAMS); if (demangled_name == NULL) - return name; + return aname; std::string retval(demangled_name); free(demangled_name); @@ -109,33 +109,33 @@ Symbol::demangled_name() const template void -Symbol::init_base_object(const char* name, const char* version, Object* object, +Symbol::init_base_object(const char* aname, const char* aversion, Object* aobject, const elfcpp::Sym& sym, unsigned int st_shndx, bool is_ordinary) { - this->init_fields(name, version, sym.get_st_type(), sym.get_st_bind(), + this->init_fields(aname, aversion, sym.get_st_type(), sym.get_st_bind(), sym.get_st_visibility(), sym.get_st_nonvis()); - this->u_.from_object.object = object; + this->u_.from_object.object = aobject; this->u_.from_object.shndx = st_shndx; this->is_ordinary_shndx_ = is_ordinary; this->source_ = FROM_OBJECT; - this->in_reg_ = !object->is_dynamic(); - this->in_dyn_ = object->is_dynamic(); - this->in_real_elf_ = object->pluginobj() == NULL; + this->in_reg_ = !aobject->is_dynamic(); + this->in_dyn_ = aobject->is_dynamic(); + this->in_real_elf_ = aobject->pluginobj() == NULL; } // Initialize the fields in the base class Symbol for a symbol defined // in an Output_data. void -Symbol::init_base_output_data(const char* name, const char* version, - Output_data* od, elfcpp::STT type, - elfcpp::STB binding, elfcpp::STV visibility, - unsigned char nonvis, bool offset_is_from_end) +Symbol::init_base_output_data(const char* aname, const char* aversion, + Output_data* od, elfcpp::STT atype, + elfcpp::STB abinding, elfcpp::STV avisibility, + unsigned char non_vis, bool offset_is_from_the_end) { - this->init_fields(name, version, type, binding, visibility, nonvis); + this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis); this->u_.in_output_data.output_data = od; - this->u_.in_output_data.offset_is_from_end = offset_is_from_end; + this->u_.in_output_data.offset_is_from_end = offset_is_from_the_end; this->source_ = IN_OUTPUT_DATA; this->in_reg_ = true; this->in_real_elf_ = true; @@ -145,15 +145,15 @@ Symbol::init_base_output_data(const char* name, const char* version, // in an Output_segment. void -Symbol::init_base_output_segment(const char* name, const char* version, - Output_segment* os, elfcpp::STT type, - elfcpp::STB binding, elfcpp::STV visibility, - unsigned char nonvis, - Segment_offset_base offset_base) +Symbol::init_base_output_segment(const char* aname, const char* aversion, + Output_segment* os, elfcpp::STT atype, + elfcpp::STB abinding, elfcpp::STV avisibility, + unsigned char non_vis, + Segment_offset_base offsetbase) { - this->init_fields(name, version, type, binding, visibility, nonvis); + this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis); this->u_.in_output_segment.output_segment = os; - this->u_.in_output_segment.offset_base = offset_base; + this->u_.in_output_segment.offset_base = offsetbase; this->source_ = IN_OUTPUT_SEGMENT; this->in_reg_ = true; this->in_real_elf_ = true; @@ -163,11 +163,11 @@ Symbol::init_base_output_segment(const char* name, const char* version, // as a constant. void -Symbol::init_base_constant(const char* name, const char* version, - elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis) +Symbol::init_base_constant(const char* aname, const char* aversion, + elfcpp::STT atype, elfcpp::STB abinding, + elfcpp::STV avisibility, unsigned char non_vis) { - this->init_fields(name, version, type, binding, visibility, nonvis); + this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis); this->source_ = IS_CONSTANT; this->in_reg_ = true; this->in_real_elf_ = true; @@ -177,11 +177,11 @@ Symbol::init_base_constant(const char* name, const char* version, // symbol. void -Symbol::init_base_undefined(const char* name, const char* version, - elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis) +Symbol::init_base_undefined(const char* aname, const char* aversion, + elfcpp::STT atype, elfcpp::STB abinding, + elfcpp::STV avisibility, unsigned char non_vis) { - this->init_fields(name, version, type, binding, visibility, nonvis); + this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis); this->dynsym_index_ = -1U; this->source_ = IS_UNDEFINED; this->in_reg_ = true; @@ -204,12 +204,12 @@ Symbol::allocate_base_common(Output_data* od) template template void -Sized_symbol::init_object(const char* name, const char* version, - Object* object, +Sized_symbol::init_object(const char* aname, const char* aversion, + Object* aobject, const elfcpp::Sym& sym, unsigned int st_shndx, bool is_ordinary) { - this->init_base_object(name, version, object, sym, st_shndx, is_ordinary); + this->init_base_object(aname, aversion, aobject, sym, st_shndx, is_ordinary); this->value_ = sym.get_st_value(); this->symsize_ = sym.get_st_size(); } @@ -219,18 +219,18 @@ Sized_symbol::init_object(const char* name, const char* version, template void -Sized_symbol::init_output_data(const char* name, const char* version, - Output_data* od, Value_type value, - Size_type symsize, elfcpp::STT type, - elfcpp::STB binding, - elfcpp::STV visibility, - unsigned char nonvis, - bool offset_is_from_end) +Sized_symbol::init_output_data(const char* aname, const char* aversion, + Output_data* od, Value_type avalue, + Size_type sym_size, elfcpp::STT atype, + elfcpp::STB abinding, + elfcpp::STV avisibility, + unsigned char non_vis, + bool offset_is_from_the_end) { - this->init_base_output_data(name, version, od, type, binding, visibility, - nonvis, offset_is_from_end); - this->value_ = value; - this->symsize_ = symsize; + this->init_base_output_data(aname, aversion, od, atype, abinding, avisibility, + non_vis, offset_is_from_the_end); + this->value_ = avalue; + this->symsize_ = sym_size; } // Initialize the fields in Sized_symbol for a symbol defined in an @@ -238,18 +238,18 @@ Sized_symbol::init_output_data(const char* name, const char* version, template void -Sized_symbol::init_output_segment(const char* name, const char* version, - Output_segment* os, Value_type value, - Size_type symsize, elfcpp::STT type, - elfcpp::STB binding, - elfcpp::STV visibility, - unsigned char nonvis, - Segment_offset_base offset_base) +Sized_symbol::init_output_segment(const char* aname, const char* aversion, + Output_segment* os, Value_type avalue, + Size_type sym_size, elfcpp::STT atype, + elfcpp::STB abinding, + elfcpp::STV avisibility, + unsigned char non_vis, + Segment_offset_base offsetbase) { - this->init_base_output_segment(name, version, os, type, binding, visibility, - nonvis, offset_base); - this->value_ = value; - this->symsize_ = symsize; + this->init_base_output_segment(aname, aversion, os, atype, abinding, avisibility, + non_vis, offsetbase); + this->value_ = avalue; + this->symsize_ = sym_size; } // Initialize the fields in Sized_symbol for a symbol defined as a @@ -257,25 +257,25 @@ Sized_symbol::init_output_segment(const char* name, const char* version, template void -Sized_symbol::init_constant(const char* name, const char* version, - Value_type value, Size_type symsize, - elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis) +Sized_symbol::init_constant(const char* aname, const char* aversion, + Value_type avalue, Size_type sym_size, + elfcpp::STT atype, elfcpp::STB abinding, + elfcpp::STV avisibility, unsigned char non_vis) { - this->init_base_constant(name, version, type, binding, visibility, nonvis); - this->value_ = value; - this->symsize_ = symsize; + this->init_base_constant(aname, aversion, atype, abinding, avisibility, non_vis); + this->value_ = avalue; + this->symsize_ = sym_size; } // Initialize the fields in Sized_symbol for an undefined symbol. template void -Sized_symbol::init_undefined(const char* name, const char* version, - elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis) +Sized_symbol::init_undefined(const char* aname, const char* aversion, + elfcpp::STT atype, elfcpp::STB abinding, + elfcpp::STV avisibility, unsigned char non_vis) { - this->init_base_undefined(name, version, type, binding, visibility, nonvis); + this->init_base_undefined(aname, aversion, atype, abinding, avisibility, non_vis); this->value_ = 0; this->symsize_ = 0; } @@ -283,21 +283,21 @@ Sized_symbol::init_undefined(const char* name, const char* version, // Return true if SHNDX represents a common symbol. bool -Symbol::is_common_shndx(unsigned int shndx) +Symbol::is_common_shndx(unsigned int sec_shndx) { - return (shndx == elfcpp::SHN_COMMON - || shndx == parameters->target().small_common_shndx() - || shndx == parameters->target().large_common_shndx()); + return (sec_shndx == elfcpp::SHN_COMMON + || sec_shndx == parameters->target().small_common_shndx() + || sec_shndx == parameters->target().large_common_shndx()); } // Allocate a common symbol. template void -Sized_symbol::allocate_common(Output_data* od, Value_type value) +Sized_symbol::allocate_common(Output_data* od, Value_type avalue) { this->allocate_base_common(od); - this->value_ = value; + this->value_ = avalue; } // The ""'s around str ensure str is a string literal, so sizeof works. @@ -323,9 +323,9 @@ Symbol::should_add_dynsym_entry() const { Relobj* relobj = static_cast(this->object()); bool is_ordinary; - unsigned int shndx = this->shndx(&is_ordinary); - if (is_ordinary && shndx != elfcpp::SHN_UNDEF - && !relobj->is_section_included(shndx)) + unsigned int sec_shndx = this->shndx(&is_ordinary); + if (is_ordinary && sec_shndx != elfcpp::SHN_UNDEF + && !relobj->is_section_included(sec_shndx)) return false; } @@ -351,28 +351,28 @@ Symbol::should_add_dynsym_entry() const { // TODO(csilvers): We could probably figure out if we're an operator // new/delete or typeinfo without the need to demangle. - char* demangled_name = cplus_demangle(this->name(), - DMGL_ANSI | DMGL_PARAMS); - if (demangled_name == NULL) + char* ademangled_name = cplus_demangle(this->name(), + DMGL_ANSI | DMGL_PARAMS); + if (ademangled_name == NULL) { // Not a C++ symbol, so it can't satisfy these flags } else if (parameters->options().dynamic_list_cpp_new() - && (strprefix(demangled_name, "operator new") - || strprefix(demangled_name, "operator delete"))) + && (strprefix(ademangled_name, "operator new") + || strprefix(ademangled_name, "operator delete"))) { - free(demangled_name); + free(ademangled_name); return true; } else if (parameters->options().dynamic_list_cpp_typeinfo() - && (strprefix(demangled_name, "typeinfo name for") - || strprefix(demangled_name, "typeinfo for"))) + && (strprefix(ademangled_name, "typeinfo name for") + || strprefix(ademangled_name, "typeinfo for"))) { - free(demangled_name); + free(ademangled_name); return true; } else - free(demangled_name); + free(ademangled_name); } // If exporting all symbols or building a shared library, @@ -434,13 +434,13 @@ Symbol::output_section() const { case FROM_OBJECT: { - unsigned int shndx = this->u_.from_object.shndx; - if (shndx != elfcpp::SHN_UNDEF && this->is_ordinary_shndx_) + unsigned int sec_shndx = this->u_.from_object.shndx; + if (sec_shndx != elfcpp::SHN_UNDEF && this->is_ordinary_shndx_) { gold_assert(!this->u_.from_object.object->is_dynamic()); gold_assert(this->u_.from_object.object->pluginobj() == NULL); Relobj* relobj = static_cast(this->u_.from_object.object); - return relobj->output_section(shndx); + return relobj->output_section(sec_shndx); } return NULL; } @@ -486,11 +486,11 @@ Symbol::set_output_section(Output_section* os) // Class Symbol_table. Symbol_table::Symbol_table(unsigned int count, - const Version_script_info& version_script) + const Version_script_info& aversion_script) : saw_undefined_(0), offset_(0), table_(count), namepool_(), forwarders_(), commons_(), tls_commons_(), small_commons_(), large_commons_(), forced_locals_(), warnings_(), - version_script_(version_script), gc_(NULL), icf_(NULL) + version_script_(aversion_script), gc_(NULL), icf_(NULL) { namepool_.reserve(count); } @@ -518,10 +518,10 @@ Symbol_table::Symbol_table_eq::operator()(const Symbol_table_key& k1, } bool -Symbol_table::is_section_folded(Object* obj, unsigned int shndx) const +Symbol_table::is_section_folded(Object* obj, unsigned int sec_shndx) const { return (parameters->options().icf_enabled() - && this->icf_->is_section_folded(obj, shndx)); + && this->icf_->is_section_folded(obj, sec_shndx)); } // For symbols that have been listed with -u option, add them to the @@ -535,19 +535,19 @@ Symbol_table::gc_mark_undef_symbols() p != parameters->options().undefined_end(); ++p) { - const char* name = p->c_str(); - Symbol* sym = this->lookup(name); + const char* aname = p->c_str(); + Symbol* sym = this->lookup(aname); gold_assert (sym != NULL); if (sym->source() == Symbol::FROM_OBJECT && !sym->object()->is_dynamic()) { Relobj* obj = static_cast(sym->object()); bool is_ordinary; - unsigned int shndx = sym->shndx(&is_ordinary); + unsigned int sec_shndx = sym->shndx(&is_ordinary); if (is_ordinary) { gold_assert(this->gc_ != NULL); - this->gc_->worklist().push(Section_id(obj, shndx)); + this->gc_->worklist().push(Section_id(obj, sec_shndx)); } } } @@ -562,11 +562,11 @@ Symbol_table::gc_mark_symbol_for_shlib(Symbol* sym) //Add the object and section to the work list. Relobj* obj = static_cast(sym->object()); bool is_ordinary; - unsigned int shndx = sym->shndx(&is_ordinary); - if (is_ordinary && shndx != elfcpp::SHN_UNDEF) + unsigned int sec_shndx = sym->shndx(&is_ordinary); + if (is_ordinary && sec_shndx != elfcpp::SHN_UNDEF) { gold_assert(this->gc_!= NULL); - this->gc_->worklist().push(Section_id(obj, shndx)); + this->gc_->worklist().push(Section_id(obj, sec_shndx)); } } } @@ -581,11 +581,11 @@ Symbol_table::gc_mark_dyn_syms(Symbol* sym) { Relobj *obj = static_cast(sym->object()); bool is_ordinary; - unsigned int shndx = sym->shndx(&is_ordinary); - if (is_ordinary && shndx != elfcpp::SHN_UNDEF) + unsigned int sec_shndx = sym->shndx(&is_ordinary); + if (is_ordinary && sec_shndx != elfcpp::SHN_UNDEF) { gold_assert(this->gc_ != NULL); - this->gc_->worklist().push(Section_id(obj, shndx)); + this->gc_->worklist().push(Section_id(obj, sec_shndx)); } } } @@ -616,18 +616,18 @@ Symbol_table::resolve_forwards(const Symbol* from) const // Look up a symbol by name. Symbol* -Symbol_table::lookup(const char* name, const char* version) const +Symbol_table::lookup(const char* aname, const char* aversion) const { Stringpool::Key name_key; - name = this->namepool_.find(name, &name_key); - if (name == NULL) + aname = this->namepool_.find(aname, &name_key); + if (aname == NULL) return NULL; Stringpool::Key version_key = 0; - if (version != NULL) + if (aversion != NULL) { - version = this->namepool_.find(version, &version_key); - if (version == NULL) + aversion = this->namepool_.find(aversion, &version_key); + if (aversion == NULL) return NULL; } @@ -656,8 +656,8 @@ Symbol_table::resolve(Sized_symbol* to, const Sized_symbol* from) esym.put_st_info(from->binding(), from->type()); esym.put_st_other(from->visibility(), from->nonvis()); bool is_ordinary; - unsigned int shndx = from->shndx(&is_ordinary); - this->resolve(to, esym.sym(), shndx, is_ordinary, shndx, from->object(), + unsigned int sec_shndx = from->shndx(&is_ordinary); + this->resolve(to, esym.sym(), sec_shndx, is_ordinary, sec_shndx, from->object(), from->version()); if (from->in_reg()) to->set_in_reg(); @@ -689,25 +689,25 @@ Symbol_table::force_local(Symbol* sym) // option was used. const char* -Symbol_table::wrap_symbol(const char* name, Stringpool::Key* name_key) +Symbol_table::wrap_symbol(const char* aname, Stringpool::Key* name_key) { // For some targets, we need to ignore a specific character when // wrapping, and add it back later. char prefix = '\0'; - if (name[0] == parameters->target().wrap_char()) + if (aname[0] == parameters->target().wrap_char()) { - prefix = name[0]; - ++name; + prefix = aname[0]; + ++aname; } - if (parameters->options().is_wrap(name)) + if (parameters->options().is_wrap(aname)) { // Turn NAME into __wrap_NAME. std::string s; if (prefix != '\0') s += prefix; s += "__wrap_"; - s += name; + s += aname; // This will give us both the old and new name in NAMEPOOL_, but // that is OK. Only the versions we need will wind up in the @@ -717,18 +717,18 @@ Symbol_table::wrap_symbol(const char* name, Stringpool::Key* name_key) const char* const real_prefix = "__real_"; const size_t real_prefix_length = strlen(real_prefix); - if (strncmp(name, real_prefix, real_prefix_length) == 0 - && parameters->options().is_wrap(name + real_prefix_length)) + if (strncmp(aname, real_prefix, real_prefix_length) == 0 + && parameters->options().is_wrap(aname + real_prefix_length)) { // Turn __real_NAME into NAME. std::string s; if (prefix != '\0') s += prefix; - s += name + real_prefix_length; + s += aname + real_prefix_length; return this->namepool_.add(s.c_str(), true, name_key); } - return name; + return aname; } // This is called when we see a symbol NAME/VERSION, and the symbol @@ -839,10 +839,10 @@ Symbol_table::define_default_version(Sized_symbol* sym, template Sized_symbol* -Symbol_table::add_from_object(Object* object, - const char *name, +Symbol_table::add_from_object(Object* aobject, + const char *aname, Stringpool::Key name_key, - const char *version, + const char *aversion, Stringpool::Key version_key, bool def, const elfcpp::Sym& sym, @@ -851,12 +851,12 @@ Symbol_table::add_from_object(Object* object, unsigned int orig_st_shndx) { // Print a message if this symbol is being traced. - if (parameters->options().is_trace_symbol(name)) + if (parameters->options().is_trace_symbol(aname)) { if (orig_st_shndx == elfcpp::SHN_UNDEF) - gold_info(_("%s: reference to %s"), object->name().c_str(), name); + gold_info(_("%s: reference to %s"), aobject->name().c_str(), aname); else - gold_info(_("%s: definition of %s"), object->name().c_str(), name); + gold_info(_("%s: definition of %s"), aobject->name().c_str(), aname); } // For an undefined symbol, we may need to adjust the name using @@ -864,17 +864,17 @@ Symbol_table::add_from_object(Object* object, if (orig_st_shndx == elfcpp::SHN_UNDEF && parameters->options().any_wrap()) { - const char* wrap_name = this->wrap_symbol(name, &name_key); - if (wrap_name != name) + const char* wrap_name = this->wrap_symbol(aname, &name_key); + if (wrap_name != aname) { // If we see a reference to malloc with version GLIBC_2.0, // and we turn it into a reference to __wrap_malloc, then we // discard the version number. Otherwise the user would be // required to specify the correct version for // __wrap_malloc. - version = NULL; + aversion = NULL; version_key = 0; - name = wrap_name; + aname = wrap_name; } } @@ -910,8 +910,8 @@ Symbol_table::add_from_object(Object* object, was_undefined = ret->is_undefined(); was_common = ret->is_common(); - this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, object, - version); + this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, aobject, + aversion); if (parameters->options().gc_sections()) this->gc_mark_dyn_syms(ret); @@ -933,8 +933,8 @@ Symbol_table::add_from_object(Object* object, was_undefined = ret->is_undefined(); was_common = ret->is_common(); - this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, object, - version); + this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, aobject, + aversion); if (parameters->options().gc_sections()) this->gc_mark_dyn_syms(ret); ins.first->second = ret; @@ -968,7 +968,7 @@ Symbol_table::add_from_object(Object* object, } } - ret->init_object(name, version, object, sym, st_shndx, is_ordinary); + ret->init_object(aname, aversion, aobject, sym, st_shndx, is_ordinary); ins.first->second = ret; if (def) @@ -1055,7 +1055,7 @@ Symbol_table::add_from_relobj( continue; } - const char* name = sym_names + st_name; + const char* aname = sym_names + st_name; bool is_ordinary; unsigned int st_shndx = relobj->adjust_sym_shndx(i + symndx_offset, @@ -1078,7 +1078,7 @@ Symbol_table::add_from_relobj( // In an object file, an '@' in the name separates the symbol // name from the version name. If there are two '@' characters, // this is the default version. - const char* ver = strchr(name, '@'); + const char* ver = strchr(aname, '@'); Stringpool::Key ver_key = 0; int namelen = 0; // DEF: is the version default? LOCAL: is the symbol forced local? @@ -1088,7 +1088,7 @@ Symbol_table::add_from_relobj( if (ver != NULL) { // The symbol name is of the form foo@VERSION or foo@@VERSION - namelen = ver - name; + namelen = ver - aname; ++ver; if (*ver == '@') { @@ -1102,27 +1102,27 @@ Symbol_table::add_from_relobj( // about a common symbol? else { - namelen = strlen(name); + namelen = strlen(aname); if (!this->version_script_.empty() && st_shndx != elfcpp::SHN_UNDEF) { // The symbol name did not have a version, but the // version script may assign a version anyway. - std::string version; - if (this->version_script_.get_symbol_version(name, &version)) + std::string aversion; + if (this->version_script_.get_symbol_version(aname, &aversion)) { // The version can be empty if the version script is // only used to force some symbols to be local. - if (!version.empty()) + if (!aversion.empty()) { - ver = this->namepool_.add_with_length(version.c_str(), - version.length(), + ver = this->namepool_.add_with_length(aversion.c_str(), + aversion.length(), true, &ver_key); def = true; } } - else if (this->version_script_.symbol_is_local(name)) + else if (this->version_script_.symbol_is_local(aname)) local = true; } } @@ -1171,11 +1171,11 @@ Symbol_table::add_from_relobj( } Stringpool::Key name_key; - name = this->namepool_.add_with_length(name, namelen, true, + aname = this->namepool_.add_with_length(aname, namelen, true, &name_key); Sized_symbol* res; - res = this->add_from_object(relobj, name, name_key, ver, ver_key, + res = this->add_from_object(relobj, aname, name_key, ver, ver_key, def, *psym, st_shndx, is_ordinary, orig_st_shndx); @@ -1198,7 +1198,7 @@ template Symbol* Symbol_table::add_from_pluginobj( Sized_pluginobj* obj, - const char* name, + const char* aname, const char* ver, elfcpp::Sym* sym) { @@ -1223,30 +1223,30 @@ Symbol_table::add_from_pluginobj( { // The symbol name did not have a version, but the // version script may assign a version anyway. - std::string version; - if (this->version_script_.get_symbol_version(name, &version)) + std::string aversion; + if (this->version_script_.get_symbol_version(aname, &aversion)) { // The version can be empty if the version script is // only used to force some symbols to be local. - if (!version.empty()) + if (!aversion.empty()) { - ver = this->namepool_.add_with_length(version.c_str(), - version.length(), + ver = this->namepool_.add_with_length(aversion.c_str(), + aversion.length(), true, &ver_key); def = true; } } - else if (this->version_script_.symbol_is_local(name)) + else if (this->version_script_.symbol_is_local(aname)) local = true; } } Stringpool::Key name_key; - name = this->namepool_.add(name, true, &name_key); + aname = this->namepool_.add(aname, true, &name_key); Sized_symbol* res; - res = this->add_from_object(obj, name, name_key, ver, ver_key, + res = this->add_from_object(obj, aname, name_key, ver, ver_key, def, *sym, st_shndx, is_ordinary, st_shndx); if (local) @@ -1337,7 +1337,7 @@ Symbol_table::add_from_dynobj( continue; } - const char* name = sym_names + st_name; + const char* aname = sym_names + st_name; bool is_ordinary; unsigned int st_shndx = dynobj->adjust_sym_shndx(i, psym->get_st_shndx(), @@ -1351,8 +1351,8 @@ Symbol_table::add_from_dynobj( if (versym == NULL) { Stringpool::Key name_key; - name = this->namepool_.add(name, true, &name_key); - res = this->add_from_object(dynobj, name, name_key, NULL, 0, + aname = this->namepool_.add(aname, true, &name_key); + res = this->add_from_object(dynobj, aname, name_key, NULL, 0, false, *psym, st_shndx, is_ordinary, st_shndx); } @@ -1381,13 +1381,13 @@ Symbol_table::add_from_dynobj( // At this point we are definitely going to add this symbol. Stringpool::Key name_key; - name = this->namepool_.add(name, true, &name_key); + aname = this->namepool_.add(aname, true, &name_key); if (v == static_cast(elfcpp::VER_NDX_LOCAL) || v == static_cast(elfcpp::VER_NDX_GLOBAL)) { // This symbol does not have a version. - res = this->add_from_object(dynobj, name, name_key, NULL, 0, + res = this->add_from_object(dynobj, aname, name_key, NULL, 0, false, *psym, st_shndx, is_ordinary, st_shndx); } @@ -1400,8 +1400,8 @@ Symbol_table::add_from_dynobj( continue; } - const char* version = (*version_map)[v]; - if (version == NULL) + const char* aversion = (*version_map)[v]; + if (aversion == NULL) { dynobj->error(_("versym for symbol %zu has no name: %u"), i, v); @@ -1409,7 +1409,7 @@ Symbol_table::add_from_dynobj( } Stringpool::Key version_key; - version = this->namepool_.add(version, true, &version_key); + aversion = this->namepool_.add(aversion, true, &version_key); // If this is an absolute symbol, and the version name // and symbol name are the same, then this is the @@ -1419,14 +1419,14 @@ Symbol_table::add_from_dynobj( if (st_shndx == elfcpp::SHN_ABS && !is_ordinary && name_key == version_key) - res = this->add_from_object(dynobj, name, name_key, NULL, 0, + res = this->add_from_object(dynobj, aname, name_key, NULL, 0, false, *psym, st_shndx, is_ordinary, st_shndx); else { const bool def = (!hidden && st_shndx != elfcpp::SHN_UNDEF); - res = this->add_from_object(dynobj, name, name_key, version, + res = this->add_from_object(dynobj, aname, name_key, aversion, version_key, def, *psym, st_shndx, is_ordinary, st_shndx); } @@ -1684,25 +1684,25 @@ Symbol_table::define_special_symbol(const char** pname, const char** pversion, // Define a symbol based on an Output_data. Symbol* -Symbol_table::define_in_output_data(const char* name, - const char* version, +Symbol_table::define_in_output_data(const char* aname, + const char* aversion, Output_data* od, - uint64_t value, - uint64_t symsize, + uint64_t avalue, + uint64_t sym_size, elfcpp::STT type, elfcpp::STB binding, elfcpp::STV visibility, unsigned char nonvis, - bool offset_is_from_end, + bool offset_is_from_the_end, bool only_if_ref) { if (parameters->target().get_size() == 32) { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG) - return this->do_define_in_output_data<32>(name, version, od, - value, symsize, type, binding, + return this->do_define_in_output_data<32>(aname, aversion, od, + avalue, sym_size, type, binding, visibility, nonvis, - offset_is_from_end, + offset_is_from_the_end, only_if_ref); #else gold_unreachable(); @@ -1711,10 +1711,10 @@ Symbol_table::define_in_output_data(const char* name, else if (parameters->target().get_size() == 64) { #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG) - return this->do_define_in_output_data<64>(name, version, od, - value, symsize, type, binding, + return this->do_define_in_output_data<64>(aname, aversion, od, + avalue, sym_size, type, binding, visibility, nonvis, - offset_is_from_end, + offset_is_from_the_end, only_if_ref); #else gold_unreachable(); @@ -1729,16 +1729,16 @@ Symbol_table::define_in_output_data(const char* name, template Sized_symbol* Symbol_table::do_define_in_output_data( - const char* name, - const char* version, + const char* aname, + const char* aversion, Output_data* od, - typename elfcpp::Elf_types::Elf_Addr value, - typename elfcpp::Elf_types::Elf_WXword symsize, + typename elfcpp::Elf_types::Elf_Addr avalue, + typename elfcpp::Elf_types::Elf_WXword sym_size, elfcpp::STT type, elfcpp::STB binding, elfcpp::STV visibility, unsigned char nonvis, - bool offset_is_from_end, + bool offset_is_from_the_end, bool only_if_ref) { Sized_symbol* sym; @@ -1748,7 +1748,7 @@ Symbol_table::do_define_in_output_data( if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol(&name, &version, + sym = this->define_special_symbol(&aname, &aversion, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1758,7 +1758,7 @@ Symbol_table::do_define_in_output_data( else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol(&name, &version, + sym = this->define_special_symbol(&aname, &aversion, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1769,15 +1769,15 @@ Symbol_table::do_define_in_output_data( if (sym == NULL) return NULL; - sym->init_output_data(name, version, od, value, symsize, type, binding, - visibility, nonvis, offset_is_from_end); + sym->init_output_data(aname, aversion, od, avalue, sym_size, type, binding, + visibility, nonvis, offset_is_from_the_end); if (oldsym == NULL) { if (binding == elfcpp::STB_LOCAL - || this->version_script_.symbol_is_local(name)) + || this->version_script_.symbol_is_local(aname)) this->force_local(sym); - else if (version != NULL) + else if (aversion != NULL) sym->set_is_default(); return sym; } @@ -1797,24 +1797,24 @@ Symbol_table::do_define_in_output_data( // Define a symbol based on an Output_segment. Symbol* -Symbol_table::define_in_output_segment(const char* name, - const char* version, Output_segment* os, - uint64_t value, - uint64_t symsize, +Symbol_table::define_in_output_segment(const char* aname, + const char* aversion, Output_segment* os, + uint64_t avalue, + uint64_t sym_size, elfcpp::STT type, elfcpp::STB binding, elfcpp::STV visibility, unsigned char nonvis, - Symbol::Segment_offset_base offset_base, + Symbol::Segment_offset_base offsetbase, bool only_if_ref) { if (parameters->target().get_size() == 32) { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG) - return this->do_define_in_output_segment<32>(name, version, os, - value, symsize, type, + return this->do_define_in_output_segment<32>(aname, aversion, os, + avalue, sym_size, type, binding, visibility, nonvis, - offset_base, only_if_ref); + offsetbase, only_if_ref); #else gold_unreachable(); #endif @@ -1822,10 +1822,10 @@ Symbol_table::define_in_output_segment(const char* name, else if (parameters->target().get_size() == 64) { #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG) - return this->do_define_in_output_segment<64>(name, version, os, - value, symsize, type, + return this->do_define_in_output_segment<64>(aname, aversion, os, + avalue, sym_size, type, binding, visibility, nonvis, - offset_base, only_if_ref); + offsetbase, only_if_ref); #else gold_unreachable(); #endif @@ -1839,16 +1839,16 @@ Symbol_table::define_in_output_segment(const char* name, template Sized_symbol* Symbol_table::do_define_in_output_segment( - const char* name, - const char* version, + const char* aname, + const char* aversion, Output_segment* os, - typename elfcpp::Elf_types::Elf_Addr value, - typename elfcpp::Elf_types::Elf_WXword symsize, + typename elfcpp::Elf_types::Elf_Addr avalue, + typename elfcpp::Elf_types::Elf_WXword sym_size, elfcpp::STT type, elfcpp::STB binding, elfcpp::STV visibility, unsigned char nonvis, - Symbol::Segment_offset_base offset_base, + Symbol::Segment_offset_base offsetbase, bool only_if_ref) { Sized_symbol* sym; @@ -1858,7 +1858,7 @@ Symbol_table::do_define_in_output_segment( if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol(&name, &version, + sym = this->define_special_symbol(&aname, &aversion, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1868,7 +1868,7 @@ Symbol_table::do_define_in_output_segment( else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol(&name, &version, + sym = this->define_special_symbol(&aname, &aversion, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1879,15 +1879,15 @@ Symbol_table::do_define_in_output_segment( if (sym == NULL) return NULL; - sym->init_output_segment(name, version, os, value, symsize, type, binding, - visibility, nonvis, offset_base); + sym->init_output_segment(aname, aversion, os, avalue, sym_size, type, binding, + visibility, nonvis, offsetbase); if (oldsym == NULL) { if (binding == elfcpp::STB_LOCAL - || this->version_script_.symbol_is_local(name)) + || this->version_script_.symbol_is_local(aname)) this->force_local(sym); - else if (version != NULL) + else if (aversion != NULL) sym->set_is_default(); return sym; } @@ -1908,10 +1908,10 @@ Symbol_table::do_define_in_output_segment( // definition error if this symbol is already defined. Symbol* -Symbol_table::define_as_constant(const char* name, - const char* version, - uint64_t value, - uint64_t symsize, +Symbol_table::define_as_constant(const char* aname, + const char* aversion, + uint64_t avalue, + uint64_t sym_size, elfcpp::STT type, elfcpp::STB binding, elfcpp::STV visibility, @@ -1922,8 +1922,8 @@ Symbol_table::define_as_constant(const char* name, if (parameters->target().get_size() == 32) { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG) - return this->do_define_as_constant<32>(name, version, value, - symsize, type, binding, + return this->do_define_as_constant<32>(aname, aversion, avalue, + sym_size, type, binding, visibility, nonvis, only_if_ref, force_override); #else @@ -1933,8 +1933,8 @@ Symbol_table::define_as_constant(const char* name, else if (parameters->target().get_size() == 64) { #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG) - return this->do_define_as_constant<64>(name, version, value, - symsize, type, binding, + return this->do_define_as_constant<64>(aname, aversion, avalue, + sym_size, type, binding, visibility, nonvis, only_if_ref, force_override); #else @@ -1950,10 +1950,10 @@ Symbol_table::define_as_constant(const char* name, template Sized_symbol* Symbol_table::do_define_as_constant( - const char* name, - const char* version, - typename elfcpp::Elf_types::Elf_Addr value, - typename elfcpp::Elf_types::Elf_WXword symsize, + const char* aname, + const char* aversion, + typename elfcpp::Elf_types::Elf_Addr avalue, + typename elfcpp::Elf_types::Elf_WXword sym_size, elfcpp::STT type, elfcpp::STB binding, elfcpp::STV visibility, @@ -1968,7 +1968,7 @@ Symbol_table::do_define_as_constant( if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol(&name, &version, + sym = this->define_special_symbol(&aname, &aversion, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1978,7 +1978,7 @@ Symbol_table::do_define_as_constant( else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol(&name, &version, + sym = this->define_special_symbol(&aname, &aversion, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1989,21 +1989,21 @@ Symbol_table::do_define_as_constant( if (sym == NULL) return NULL; - sym->init_constant(name, version, value, symsize, type, binding, visibility, + sym->init_constant(aname, aversion, avalue, sym_size, type, binding, visibility, nonvis); if (oldsym == NULL) { // Version symbols are absolute symbols with name == version. // We don't want to force them to be local. - if ((version == NULL - || name != version - || value != 0) + if ((aversion == NULL + || aname != aversion + || avalue != 0) && (binding == elfcpp::STB_LOCAL - || this->version_script_.symbol_is_local(name))) + || this->version_script_.symbol_is_local(aname))) this->force_local(sym); - else if (version != NULL - && (name != version || value != 0)) + else if (aversion != NULL + && (aname != aversion || avalue != 0)) sym->set_is_default(); return sym; } @@ -2079,13 +2079,13 @@ void Symbol_table::define_with_copy_reloc( Sized_symbol* csym, Output_data* posd, - typename elfcpp::Elf_types::Elf_Addr value) + typename elfcpp::Elf_types::Elf_Addr avalue) { gold_assert(csym->is_from_dynobj()); gold_assert(!csym->is_copied_from_dynobj()); - Object* object = csym->object(); - gold_assert(object->is_dynamic()); - Dynobj* dynobj = static_cast(object); + Object* aobject = csym->object(); + gold_assert(aobject->is_dynamic()); + Dynobj* dynobj = static_cast(aobject); // Our copied variable has to override any variable in a shared // library. @@ -2094,7 +2094,7 @@ Symbol_table::define_with_copy_reloc( binding = elfcpp::STB_GLOBAL; this->define_in_output_data(csym->name(), csym->version(), - posd, value, csym->symsize(), + posd, avalue, csym->symsize(), csym->type(), binding, csym->visibility(), csym->nonvis(), false, false); @@ -2172,12 +2172,12 @@ Symbol_table::do_add_undefined_symbols_from_command_line() p != parameters->options().undefined_end(); ++p) { - const char* name = p->c_str(); + const char* aname = p->c_str(); - if (this->lookup(name) != NULL) + if (this->lookup(aname) != NULL) continue; - const char* version = NULL; + const char* aversion = NULL; Sized_symbol* sym; Sized_symbol* oldsym; @@ -2185,7 +2185,7 @@ Symbol_table::do_add_undefined_symbols_from_command_line() if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol(&name, &version, + sym = this->define_special_symbol(&aname, &aversion, false, &oldsym, &resolve_oldsym); #else @@ -2195,7 +2195,7 @@ Symbol_table::do_add_undefined_symbols_from_command_line() else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol(&name, &version, + sym = this->define_special_symbol(&aname, &aversion, false, &oldsym, &resolve_oldsym); #else @@ -2205,7 +2205,7 @@ Symbol_table::do_add_undefined_symbols_from_command_line() gold_assert(oldsym == NULL); - sym->init_undefined(name, version, elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL, + sym->init_undefined(aname, aversion, elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL, elfcpp::STV_DEFAULT, 0); ++this->saw_undefined_; } @@ -2375,18 +2375,18 @@ Symbol_table::compute_final_value( Compute_final_value_status* pstatus) const { typedef typename Sized_symbol::Value_type Value_type; - Value_type value; + Value_type avalue; switch (sym->source()) { case Symbol::FROM_OBJECT: { bool is_ordinary; - unsigned int shndx = sym->shndx(&is_ordinary); + unsigned int sec_shndx = sym->shndx(&is_ordinary); if (!is_ordinary - && shndx != elfcpp::SHN_ABS - && !Symbol::is_common_shndx(shndx)) + && sec_shndx != elfcpp::SHN_ABS + && !Symbol::is_common_shndx(sec_shndx)) { *pstatus = CFVS_UNSUPPORTED_SYMBOL_SECTION; return 0; @@ -2395,32 +2395,32 @@ Symbol_table::compute_final_value( Object* symobj = sym->object(); if (symobj->is_dynamic()) { - value = 0; - shndx = elfcpp::SHN_UNDEF; + avalue = 0; + sec_shndx = elfcpp::SHN_UNDEF; } else if (symobj->pluginobj() != NULL) { - value = 0; - shndx = elfcpp::SHN_UNDEF; + avalue = 0; + sec_shndx = elfcpp::SHN_UNDEF; } - else if (shndx == elfcpp::SHN_UNDEF) - value = 0; + else if (sec_shndx == elfcpp::SHN_UNDEF) + avalue = 0; else if (!is_ordinary - && (shndx == elfcpp::SHN_ABS - || Symbol::is_common_shndx(shndx))) - value = sym->value(); + && (sec_shndx == elfcpp::SHN_ABS + || Symbol::is_common_shndx(sec_shndx))) + avalue = sym->value(); else { Relobj* relobj = static_cast(symobj); - Output_section* os = relobj->output_section(shndx); - uint64_t secoff64 = relobj->output_section_offset(shndx); + Output_section* os = relobj->output_section(sec_shndx); + uint64_t secoff64 = relobj->output_section_offset(sec_shndx); - if (this->is_section_folded(relobj, shndx)) + if (this->is_section_folded(relobj, sec_shndx)) { gold_assert(os == NULL); // Get the os of the section it is folded onto. Section_id folded = this->icf_->get_folded_section(relobj, - shndx); + sec_shndx); gold_assert(folded.first != NULL); Relobj* folded_obj = reinterpret_cast(folded.first); os = folded_obj->output_section(folded.second); @@ -2442,16 +2442,16 @@ Symbol_table::compute_final_value( { // The section needs special handling (e.g., a merge section). - value = os->output_address(relobj, shndx, sym->value()); + avalue = os->output_address(relobj, sec_shndx, sym->value()); } else { Value_type secoff = convert_types(secoff64); if (sym->type() == elfcpp::STT_TLS) - value = sym->value() + os->tls_offset() + secoff; + avalue = sym->value() + os->tls_offset() + secoff; else - value = sym->value() + os->address() + secoff; + avalue = sym->value() + os->address() + secoff; } } } @@ -2460,35 +2460,35 @@ Symbol_table::compute_final_value( case Symbol::IN_OUTPUT_DATA: { Output_data* od = sym->output_data(); - value = sym->value(); + avalue = sym->value(); if (sym->type() != elfcpp::STT_TLS) - value += od->address(); + avalue += od->address(); else { Output_section* os = od->output_section(); gold_assert(os != NULL); - value += os->tls_offset() + (od->address() - os->address()); + avalue += os->tls_offset() + (od->address() - os->address()); } if (sym->offset_is_from_end()) - value += od->data_size(); + avalue += od->data_size(); } break; case Symbol::IN_OUTPUT_SEGMENT: { Output_segment* os = sym->output_segment(); - value = sym->value(); + avalue = sym->value(); if (sym->type() != elfcpp::STT_TLS) - value += os->vaddr(); + avalue += os->vaddr(); switch (sym->offset_base()) { case Symbol::SEGMENT_START: break; case Symbol::SEGMENT_END: - value += os->memsz(); + avalue += os->memsz(); break; case Symbol::SEGMENT_BSS: - value += os->filesz(); + avalue += os->filesz(); break; default: gold_unreachable(); @@ -2497,11 +2497,11 @@ Symbol_table::compute_final_value( break; case Symbol::IS_CONSTANT: - value = sym->value(); + avalue = sym->value(); break; case Symbol::IS_UNDEFINED: - value = 0; + avalue = 0; break; default: @@ -2509,7 +2509,7 @@ Symbol_table::compute_final_value( } *pstatus = CFVS_OK; - return value; + return avalue; } // Finalize the symbol SYM. This returns true if the symbol should be @@ -2538,7 +2538,7 @@ Symbol_table::sized_finalize_symbol(Symbol* unsized_sym) // Compute final symbol value. Compute_final_value_status status; - Value_type value = this->compute_final_value(sym, &status); + Value_type avalue = this->compute_final_value(sym, &status); switch (status) { @@ -2547,9 +2547,9 @@ Symbol_table::sized_finalize_symbol(Symbol* unsized_sym) case CFVS_UNSUPPORTED_SYMBOL_SECTION: { bool is_ordinary; - unsigned int shndx = sym->shndx(&is_ordinary); + unsigned int sec_shndx = sym->shndx(&is_ordinary); gold_error(_("%s: unsupported symbol section 0x%x"), - sym->demangled_name().c_str(), shndx); + sym->demangled_name().c_str(), sec_shndx); } break; case CFVS_NO_OUTPUT_SECTION: @@ -2559,7 +2559,7 @@ Symbol_table::sized_finalize_symbol(Symbol* unsized_sym) gold_unreachable(); } - sym->set_value(value); + sym->set_value(avalue); if (parameters->options().strip_all() || !parameters->options().should_retain_symbol(sym->name())) @@ -2666,7 +2666,7 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, continue; } - unsigned int shndx; + unsigned int sec_shndx; typename elfcpp::Elf_types::Elf_Addr sym_value = sym->value(); typename elfcpp::Elf_types::Elf_Addr dynsym_value = sym_value; switch (sym->source()) @@ -2682,7 +2682,7 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, { gold_error(_("%s: unsupported symbol section 0x%x"), sym->demangled_name().c_str(), in_shndx); - shndx = in_shndx; + sec_shndx = in_shndx; } else { @@ -2691,15 +2691,15 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, { if (sym->needs_dynsym_value()) dynsym_value = target.dynsym_value(sym); - shndx = elfcpp::SHN_UNDEF; + sec_shndx = elfcpp::SHN_UNDEF; } else if (symobj->pluginobj() != NULL) - shndx = elfcpp::SHN_UNDEF; + sec_shndx = elfcpp::SHN_UNDEF; else if (in_shndx == elfcpp::SHN_UNDEF || (!is_ordinary && (in_shndx == elfcpp::SHN_ABS || Symbol::is_common_shndx(in_shndx)))) - shndx = in_shndx; + sec_shndx = in_shndx; else { Relobj* relobj = static_cast(symobj); @@ -2718,15 +2718,15 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, gold_assert(os != NULL); } gold_assert(os != NULL); - shndx = os->out_shndx(); + sec_shndx = os->out_shndx(); - if (shndx >= elfcpp::SHN_LORESERVE) + if (sec_shndx >= elfcpp::SHN_LORESERVE) { if (sym_index != -1U) - symtab_xindex->add(sym_index, shndx); + symtab_xindex->add(sym_index, sec_shndx); if (dynsym_index != -1U) - dynsym_xindex->add(dynsym_index, shndx); - shndx = elfcpp::SHN_XINDEX; + dynsym_xindex->add(dynsym_index, sec_shndx); + sec_shndx = elfcpp::SHN_XINDEX; } // In object files symbol values are section @@ -2739,27 +2739,27 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, break; case Symbol::IN_OUTPUT_DATA: - shndx = sym->output_data()->out_shndx(); - if (shndx >= elfcpp::SHN_LORESERVE) + sec_shndx = sym->output_data()->out_shndx(); + if (sec_shndx >= elfcpp::SHN_LORESERVE) { if (sym_index != -1U) - symtab_xindex->add(sym_index, shndx); + symtab_xindex->add(sym_index, sec_shndx); if (dynsym_index != -1U) - dynsym_xindex->add(dynsym_index, shndx); - shndx = elfcpp::SHN_XINDEX; + dynsym_xindex->add(dynsym_index, sec_shndx); + sec_shndx = elfcpp::SHN_XINDEX; } break; case Symbol::IN_OUTPUT_SEGMENT: - shndx = elfcpp::SHN_ABS; + sec_shndx = elfcpp::SHN_ABS; break; case Symbol::IS_CONSTANT: - shndx = elfcpp::SHN_ABS; + sec_shndx = elfcpp::SHN_ABS; break; case Symbol::IS_UNDEFINED: - shndx = elfcpp::SHN_UNDEF; + sec_shndx = elfcpp::SHN_UNDEF; break; default: @@ -2771,7 +2771,7 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, sym_index -= first_global_index; gold_assert(sym_index < output_count); unsigned char* ps = psyms + (sym_index * sym_size); - this->sized_write_symbol(sym, sym_value, shndx, + this->sized_write_symbol(sym, sym_value, sec_shndx, sympool, ps); } @@ -2780,7 +2780,7 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, dynsym_index -= first_dynamic_global_index; gold_assert(dynsym_index < dynamic_count); unsigned char* pd = dynamic_view + (dynsym_index * sym_size); - this->sized_write_symbol(sym, dynsym_value, shndx, + this->sized_write_symbol(sym, dynsym_value, sec_shndx, dynpool, pd); } } @@ -2797,16 +2797,16 @@ template void Symbol_table::sized_write_symbol( Sized_symbol* sym, - typename elfcpp::Elf_types::Elf_Addr value, - unsigned int shndx, + typename elfcpp::Elf_types::Elf_Addr avalue, + unsigned int sec_shndx, const Stringpool* pool, unsigned char* p) const { elfcpp::Sym_write osym(p); osym.put_st_name(pool->get_offset(sym->name())); - osym.put_st_value(value); + osym.put_st_value(avalue); // Use a symbol size of zero for undefined symbols from shared libraries. - if (shndx == elfcpp::SHN_UNDEF && sym->is_from_dynobj()) + if (sec_shndx == elfcpp::SHN_UNDEF && sym->is_from_dynobj()) osym.put_st_size(0); else osym.put_st_size(sym->symsize()); @@ -2821,7 +2821,7 @@ Symbol_table::sized_write_symbol( else osym.put_st_info(elfcpp::elf_st_info(sym->binding(), type)); osym.put_st_other(elfcpp::elf_st_other(sym->visibility(), sym->nonvis())); - osym.put_st_shndx(shndx); + osym.put_st_shndx(sec_shndx); } // Check for unresolved symbols in shared libraries. This is @@ -2920,13 +2920,13 @@ Symbol_table::sized_write_section_symbol(const Output_section* os, elfcpp::STT_SECTION)); osym.put_st_other(elfcpp::elf_st_other(elfcpp::STV_DEFAULT, 0)); - unsigned int shndx = os->out_shndx(); - if (shndx >= elfcpp::SHN_LORESERVE) + unsigned int sec_shndx = os->out_shndx(); + if (sec_shndx >= elfcpp::SHN_LORESERVE) { - symtab_xindex->add(os->symtab_index(), shndx); - shndx = elfcpp::SHN_XINDEX; + symtab_xindex->add(os->symtab_index(), sec_shndx); + sec_shndx = elfcpp::SHN_XINDEX; } - osym.put_st_shndx(shndx); + osym.put_st_shndx(sec_shndx); of->write_output_view(offset, sym_size, pov); } @@ -3029,11 +3029,11 @@ Symbol_table::detect_odr_violations(const Task* task, // Add a new warning. void -Warnings::add_warning(Symbol_table* symtab, const char* name, Object* obj, +Warnings::add_warning(Symbol_table* symtab, const char* aname, Object* obj, const std::string& warning) { - name = symtab->canonicalize_name(name); - this->warnings_[name].set(obj, warning); + aname = symtab->canonicalize_name(aname); + this->warnings_[aname].set(obj, warning); } // Look through the warnings and mark the symbols for which we should @@ -3253,7 +3253,7 @@ void Symbol_table::define_with_copy_reloc<32>( Sized_symbol<32>* sym, Output_data* posd, - elfcpp::Elf_types<32>::Elf_Addr value); + elfcpp::Elf_types<32>::Elf_Addr avalue); #endif #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG) @@ -3262,7 +3262,7 @@ void Symbol_table::define_with_copy_reloc<64>( Sized_symbol<64>* sym, Output_data* posd, - elfcpp::Elf_types<64>::Elf_Addr value); + elfcpp::Elf_types<64>::Elf_Addr avalue); #endif #ifdef HAVE_TARGET_32_LITTLE diff --git a/gold/symtab.h b/gold/symtab.h index c153150e1..2beece803 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -220,8 +220,8 @@ class Symbol // Set the visibility. void - set_visibility(elfcpp::STV visibility) - { this->visibility_ = visibility; } + set_visibility(elfcpp::STV vis) + { this->visibility_ = vis; } // Override symbol visibility. void @@ -368,15 +368,15 @@ class Symbol unsigned int got_offset(unsigned int got_type) const { - unsigned int got_offset = this->got_offsets_.get_offset(got_type); - gold_assert(got_offset != -1U); - return got_offset; + unsigned int got_off = this->got_offsets_.get_offset(got_type); + gold_assert(got_off != -1U); + return got_off; } // Set the GOT offset of this symbol. void - set_got_offset(unsigned int got_type, unsigned int got_offset) - { this->got_offsets_.set_offset(got_type, got_offset); } + set_got_offset(unsigned int got_type, unsigned int got_off) + { this->got_offsets_.set_offset(got_type, got_off); } // Return whether this symbol has an entry in the PLT section. bool @@ -393,10 +393,10 @@ class Symbol // Set the PLT offset of this symbol. void - set_plt_offset(unsigned int plt_offset) + set_plt_offset(unsigned int plt_off) { this->has_plt_offset_ = true; - this->plt_offset_ = plt_offset; + this->plt_offset_ = plt_off; } // Return whether this dynamic symbol needs a special value in the @@ -432,10 +432,10 @@ class Symbol bool is_ordinary; if (this->source_ != FROM_OBJECT) return this->source_ != IS_UNDEFINED; - unsigned int shndx = this->shndx(&is_ordinary); + unsigned int sec_shndx = this->shndx(&is_ordinary); return (is_ordinary - ? shndx != elfcpp::SHN_UNDEF - : !Symbol::is_common_shndx(shndx)); + ? sec_shndx != elfcpp::SHN_UNDEF + : !Symbol::is_common_shndx(sec_shndx)); } // Return true if this symbol is from a dynamic object. @@ -481,8 +481,8 @@ class Symbol if (this->source_ != FROM_OBJECT) return false; bool is_ordinary; - unsigned int shndx = this->shndx(&is_ordinary); - return !is_ordinary && Symbol::is_common_shndx(shndx); + unsigned int sec_shndx = this->shndx(&is_ordinary); + return !is_ordinary && Symbol::is_common_shndx(sec_shndx); } // Return whether this symbol can be seen outside this object. @@ -1004,14 +1004,14 @@ class Sized_symbol : public Symbol // Set the symbol size. This is used when resolving common symbols. void - set_symsize(Size_type symsize) - { this->symsize_ = symsize; } + set_symsize(Size_type symsz) + { this->symsize_ = symsz; } // Set the symbol value. This is called when we store the final // values of the symbols into the symbol table. void - set_value(Value_type value) - { this->value_ = value; } + set_value(Value_type val) + { this->value_ = val; } // Allocate a common symbol by giving it a location in the output // file. @@ -1184,8 +1184,8 @@ class Symbol_table ~Symbol_table(); void - set_icf(Icf* icf) - { this->icf_ = icf;} + set_icf(Icf* _icf) + { this->icf_ = _icf;} Icf* icf() const @@ -1196,8 +1196,8 @@ class Symbol_table is_section_folded(Object* obj, unsigned int shndx) const; void - set_gc(Garbage_collection* gc) - { this->gc_ = gc; } + set_gc(Garbage_collection* garbage) + { this->gc_ = garbage; } Garbage_collection* gc() const diff --git a/gold/target-select.cc b/gold/target-select.cc index dcd3017f0..ac311fba3 100644 --- a/gold/target-select.cc +++ b/gold/target-select.cc @@ -1,6 +1,6 @@ // target-select.cc -- select a target for an object file -// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -43,10 +43,10 @@ namespace gold // list. This runs at global constructor time, so we want it to be // fast. -Target_selector::Target_selector(int machine, int size, bool is_big_endian, - const char* bfd_name) - : machine_(machine), size_(size), is_big_endian_(is_big_endian), - bfd_name_(bfd_name), instantiated_target_(NULL), lock_(NULL), +Target_selector::Target_selector(int amachine, int size, bool is_big_end, + const char* bfdname) + : machine_(amachine), size_(size), is_big_endian_(is_big_end), + bfd_name_(bfdname), instantiated_target_(NULL), lock_(NULL), initialize_lock_(&this->lock_) { diff --git a/gold/target-select.h b/gold/target-select.h index d1cd44f22..c5f469b36 100644 --- a/gold/target-select.h +++ b/gold/target-select.h @@ -1,6 +1,6 @@ // target-select.h -- select a target for an object file -*- C++ -*- -// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -57,8 +57,8 @@ class Target_selector // If we can handle this target, return a pointer to a target // structure. The size and endianness are known. Target* - recognize(int machine, int osabi, int abiversion) - { return this->do_recognize(machine, osabi, abiversion); } + recognize(int mach, int osabi, int abiversion) + { return this->do_recognize(mach, osabi, abiversion); } // If NAME matches the target, return a pointer to a target // structure. diff --git a/gold/token.h b/gold/token.h index dcf00b668..d477be101 100644 --- a/gold/token.h +++ b/gold/token.h @@ -91,8 +91,8 @@ class Task_list class Task_token { public: - Task_token(bool is_blocker) - : is_blocker_(is_blocker), blockers_(0), writer_(NULL), waiting_() + Task_token(bool tis_blocker) + : is_blocker_(tis_blocker), blockers_(0), writer_(NULL), waiting_() { } ~Task_token() diff --git a/gold/workqueue.cc b/gold/workqueue.cc index 18c39003a..565c7fd2c 100644 --- a/gold/workqueue.cc +++ b/gold/workqueue.cc @@ -1,6 +1,6 @@ // workqueue.cc -- the workqueue for gold -// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -148,7 +148,7 @@ Workqueue::~Workqueue() // waiting for a Token. void -Workqueue::add_to_queue(Task_list* queue, Task* t, bool front) +Workqueue::add_to_queue(Task_list* que, Task* t, bool front) { Hold_lock hl(this->lock_); @@ -164,9 +164,9 @@ Workqueue::add_to_queue(Task_list* queue, Task* t, bool front) else { if (front) - queue->push_front(t); + que->push_front(t); else - queue->push_back(t); + que->push_back(t); // Tell any waiting thread that there is work to do. this->condvar_.signal(); } @@ -441,11 +441,11 @@ Workqueue::release_locks(Task* t, Task_locker* tl) { // The token has been unblocked. Every waiting Task may // now be runnable. - Task* t; - while ((t = token->remove_first_waiting()) != NULL) + Task* tok; + while ((tok = token->remove_first_waiting()) != NULL) { --this->waiting_; - this->return_or_queue(t, true, &ret); + this->return_or_queue(tok, true, &ret); } } } @@ -458,11 +458,11 @@ Workqueue::release_locks(Task* t, Task_locker* tl) // move all the Tasks to the runnable queue, to avoid a // potential deadlock if the locking status changes before // we run the next thread. - Task* t; - while ((t = token->remove_first_waiting()) != NULL) + Task* tok; + while ((tok = token->remove_first_waiting()) != NULL) { --this->waiting_; - if (this->return_or_queue(t, false, &ret)) + if (this->return_or_queue(tok, false, &ret)) break; } } diff --git a/gold/workqueue.h b/gold/workqueue.h index 75452241d..a17ec9df6 100644 --- a/gold/workqueue.h +++ b/gold/workqueue.h @@ -150,8 +150,8 @@ class Task_function : public Task // RUNNER and BLOCKER should be allocated using new, and will be // deleted after the task runs. Task_function(Task_function_runner* runner, Task_token* blocker, - const char* name) - : runner_(runner), blocker_(blocker), name_(name) + const char* tname) + : runner_(runner), blocker_(blocker), name_(tname) { } ~Task_function() diff --git a/gold/x86_64.cc b/gold/x86_64.cc index e51b4ab74..00fbf3fc1 100644 --- a/gold/x86_64.cc +++ b/gold/x86_64.cc @@ -702,10 +702,10 @@ unsigned char Output_data_plt_x86_64::tlsdesc_plt_entry[plt_entry_size] = void Output_data_plt_x86_64::do_write(Output_file* of) { - const off_t offset = this->offset(); + const off_t off = this->offset(); const section_size_type oview_size = convert_to_section_size_type(this->data_size()); - unsigned char* const oview = of->get_output_view(offset, oview_size); + unsigned char* const oview = of->get_output_view(off, oview_size); const off_t got_file_offset = this->got_plt_->offset(); const section_size_type got_size = @@ -785,7 +785,7 @@ Output_data_plt_x86_64::do_write(Output_file* of) gold_assert(static_cast(pov - oview) == oview_size); gold_assert(static_cast(got_pov - got_view) == got_size); - of->write_output_view(offset, oview_size, oview); + of->write_output_view(off, oview_size, oview); of->write_output_view(got_file_offset, got_size, got_view); } diff --git a/gprof/ChangeLog b/gprof/ChangeLog index e9ae218f4..acc8697dc 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,12 @@ +2009-12-11 Nick Clifton + + * Makefile.in: Regenerate. + * cg_arcs.c: Fix shadowed variable warnings. + * cg_dfn.c: Likewise. + * cg_print.c: Likewise. + * configure: Likewise. + * hist.c: Likewise. + 2009-11-30 Joseph Myers * configure: Regenerate. diff --git a/gprof/Makefile.in b/gprof/Makefile.in index c67e91392..291c018e5 100644 --- a/gprof/Makefile.in +++ b/gprof/Makefile.in @@ -47,9 +47,11 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../bfd/warning.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 \ + $(top_srcdir)/../config/plugins.m4 \ $(top_srcdir)/../config/po.m4 \ $(top_srcdir)/../config/progtest.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ diff --git a/gprof/cg_arcs.c b/gprof/cg_arcs.c index 10f3f973a..1fa619dbd 100644 --- a/gprof/cg_arcs.c +++ b/gprof/cg_arcs.c @@ -437,13 +437,13 @@ inherit_flags (Sym *child) static void propagate_flags (Sym **symbols) { - int index; + int sym_index; Sym *old_head, *child; old_head = 0; - for (index = symtab.len - 1; index >= 0; --index) + for (sym_index = symtab.len - 1; sym_index >= 0; --sym_index) { - child = symbols[index]; + child = symbols[sym_index]; /* * If we haven't done this function or cycle, inherit things * from parent. This way, we are linear in the number of arcs @@ -587,23 +587,20 @@ cmp_total (const PTR lp, const PTR rp) } -/* - * Topologically sort the graph (collapsing cycles), and propagates - * time bottom up and flags top down. - */ +/* Topologically sort the graph (collapsing cycles), and propagates + time bottom up and flags top down. */ + Sym ** -cg_assemble () +cg_assemble (void) { Sym *parent, **time_sorted_syms, **top_sorted_syms; - unsigned int index; + unsigned int sym_index; Arc *arc; - /* - * initialize various things: - * zero out child times. - * count self-recursive calls. - * indicate that nothing is on cycles. - */ + /* Initialize various things: + Zero out child times. + Count self-recursive calls. + Indicate that nothing is on cycles. */ for (parent = symtab.base; parent < symtab.limit; parent++) { parent->cg.child_time = 0.0; @@ -626,80 +623,65 @@ cg_assemble () parent->cg.cyc.head = parent; parent->cg.cyc.next = 0; if (ignore_direct_calls) - { - find_call (parent, parent->addr, (parent + 1)->addr); - } + find_call (parent, parent->addr, (parent + 1)->addr); } - /* - * Topologically order things. If any node is unnumbered, number - * it and any of its descendents. - */ + + /* Topologically order things. If any node is unnumbered, number + it and any of its descendents. */ for (parent = symtab.base; parent < symtab.limit; parent++) { if (parent->cg.top_order == DFN_NAN) - { - cg_dfn (parent); - } + cg_dfn (parent); } - /* link together nodes on the same cycle: */ + /* Link together nodes on the same cycle. */ cycle_link (); - /* sort the symbol table in reverse topological order: */ + /* Sort the symbol table in reverse topological order. */ top_sorted_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *)); - for (index = 0; index < symtab.len; ++index) - { - top_sorted_syms[index] = &symtab.base[index]; - } + for (sym_index = 0; sym_index < symtab.len; ++sym_index) + top_sorted_syms[sym_index] = &symtab.base[sym_index]; + qsort (top_sorted_syms, symtab.len, sizeof (Sym *), cmp_topo); DBG (DFNDEBUG, printf ("[cg_assemble] topological sort listing\n"); - for (index = 0; index < symtab.len; ++index) - { - printf ("[cg_assemble] "); - printf ("%d:", top_sorted_syms[index]->cg.top_order); - print_name (top_sorted_syms[index]); - printf ("\n"); - } + for (sym_index = 0; sym_index < symtab.len; ++sym_index) + { + printf ("[cg_assemble] "); + printf ("%d:", top_sorted_syms[sym_index]->cg.top_order); + print_name (top_sorted_syms[sym_index]); + printf ("\n"); + } ); - /* - * Starting from the topological top, propagate print flags to - * children. also, calculate propagation fractions. this happens - * before time propagation since time propagation uses the - * fractions. - */ + + /* Starting from the topological top, propagate print flags to + children. also, calculate propagation fractions. this happens + before time propagation since time propagation uses the + fractions. */ propagate_flags (top_sorted_syms); - /* - * Starting from the topological bottom, propogate children times - * up to parents. - */ + /* Starting from the topological bottom, propogate children times + up to parents. */ cycle_time (); - for (index = 0; index < symtab.len; ++index) - { - propagate_time (top_sorted_syms[index]); - } + for (sym_index = 0; sym_index < symtab.len; ++sym_index) + propagate_time (top_sorted_syms[sym_index]); free (top_sorted_syms); - /* - * Now, sort by CG.PROP.SELF + CG.PROP.CHILD. Sorting both the regular - * function names and cycle headers. - */ + /* Now, sort by CG.PROP.SELF + CG.PROP.CHILD. Sorting both the regular + function names and cycle headers. */ time_sorted_syms = (Sym **) xmalloc ((symtab.len + num_cycles) * sizeof (Sym *)); - for (index = 0; index < symtab.len; index++) - { - time_sorted_syms[index] = &symtab.base[index]; - } - for (index = 1; index <= num_cycles; index++) - { - time_sorted_syms[symtab.len + index - 1] = &cycle_header[index]; - } + for (sym_index = 0; sym_index < symtab.len; sym_index++) + time_sorted_syms[sym_index] = &symtab.base[sym_index]; + + for (sym_index = 1; sym_index <= num_cycles; sym_index++) + time_sorted_syms[symtab.len + sym_index - 1] = &cycle_header[sym_index]; + qsort (time_sorted_syms, symtab.len + num_cycles, sizeof (Sym *), cmp_total); - for (index = 0; index < symtab.len + num_cycles; index++) - { - time_sorted_syms[index]->cg.index = index + 1; - } + + for (sym_index = 0; sym_index < symtab.len + num_cycles; sym_index++) + time_sorted_syms[sym_index]->cg.index = sym_index + 1; + return time_sorted_syms; } diff --git a/gprof/cg_dfn.c b/gprof/cg_dfn.c index 6ded5564f..1da4c66b8 100644 --- a/gprof/cg_dfn.c +++ b/gprof/cg_dfn.c @@ -92,7 +92,7 @@ find_cycle (Sym *child) Sym *head = 0; Sym *tail; int cycle_top; - int index; + int cycle_index; for (cycle_top = dfn_depth; cycle_top > 0; --cycle_top) { @@ -169,9 +169,9 @@ find_cycle (Sym *child) print_name (head); printf ("\n")); } - for (index = cycle_top + 1; index <= dfn_depth; ++index) + for (cycle_index = cycle_top + 1; cycle_index <= dfn_depth; ++cycle_index) { - child = dfn_stack[index].sym; + child = dfn_stack[cycle_index].sym; if (child->cg.cyc.head == child) { /* diff --git a/gprof/cg_print.c b/gprof/cg_print.c index 0b2e989c2..c1cb40068 100644 --- a/gprof/cg_print.c +++ b/gprof/cg_print.c @@ -499,7 +499,7 @@ print_line (Sym *np) void cg_print (Sym ** timesortsym) { - unsigned int index; + unsigned int sym_index; Sym *parent; if (print_descriptions && bsd_style_output) @@ -507,9 +507,9 @@ cg_print (Sym ** timesortsym) print_header (); - for (index = 0; index < symtab.len + num_cycles; ++index) + for (sym_index = 0; sym_index < symtab.len + num_cycles; ++sym_index) { - parent = timesortsym[index]; + parent = timesortsym[sym_index]; if ((ignore_zeros && parent->ncalls == 0 && parent->cg.self_calls == 0 && parent->cg.prop.self == 0 @@ -560,7 +560,7 @@ cmp_name (const PTR left, const PTR right) void cg_print_index () { - unsigned int index; + unsigned int sym_index; unsigned int nnames, todo, i, j; int col, starting_col; Sym **name_sorted_syms, *sym; @@ -572,30 +572,30 @@ cg_print_index () alphabetically to create an index. */ name_sorted_syms = (Sym **) xmalloc ((symtab.len + num_cycles) * sizeof (Sym *)); - for (index = 0, nnames = 0; index < symtab.len; index++) + for (sym_index = 0, nnames = 0; sym_index < symtab.len; sym_index++) { - if (ignore_zeros && symtab.base[index].ncalls == 0 - && symtab.base[index].hist.time == 0) + if (ignore_zeros && symtab.base[sym_index].ncalls == 0 + && symtab.base[sym_index].hist.time == 0) continue; - name_sorted_syms[nnames++] = &symtab.base[index]; + name_sorted_syms[nnames++] = &symtab.base[sym_index]; } qsort (name_sorted_syms, nnames, sizeof (Sym *), cmp_name); - for (index = 1, todo = nnames; index <= num_cycles; index++) - name_sorted_syms[todo++] = &cycle_header[index]; + for (sym_index = 1, todo = nnames; sym_index <= num_cycles; sym_index++) + name_sorted_syms[todo++] = &cycle_header[sym_index]; printf ("\f\n"); printf (_("Index by function name\n\n")); - index = (todo + 2) / 3; + sym_index = (todo + 2) / 3; - for (i = 0; i < index; i++) + for (i = 0; i < sym_index; i++) { col = 0; starting_col = 0; - for (j = i; j < todo; j += index) + for (j = i; j < todo; j += sym_index) { sym = name_sorted_syms[j]; @@ -771,9 +771,11 @@ cmp_fun_nuses (const PTR left, const PTR right) of function ordering). */ void -cg_print_function_ordering () +cg_print_function_ordering (void) { - unsigned long index, used, unused, scratch_index; + unsigned long sym_index; + unsigned long arc_index; + unsigned long used, unused, scratch_index; unsigned long unplaced_arc_count, high_arc_count, scratch_arc_count; #ifdef __GNUC__ unsigned long long total_arcs, tmp_arcs_count; @@ -783,7 +785,7 @@ cg_print_function_ordering () Sym **unused_syms, **used_syms, **scratch_syms; Arc **unplaced_arcs, **high_arcs, **scratch_arcs; - index = 0; + sym_index = 0; used = 0; unused = 0; scratch_index = 0; @@ -801,20 +803,20 @@ cg_print_function_ordering () /* Walk through all the functions; mark those which are never called as placed (we'll emit them as a group later). */ - for (index = 0, used = 0, unused = 0; index < symtab.len; index++) + for (sym_index = 0, used = 0, unused = 0; sym_index < symtab.len; sym_index++) { - if (symtab.base[index].ncalls == 0) + if (symtab.base[sym_index].ncalls == 0) { - unused_syms[unused++] = &symtab.base[index]; - symtab.base[index].has_been_placed = 1; + unused_syms[unused++] = &symtab.base[sym_index]; + symtab.base[sym_index].has_been_placed = 1; } else { - used_syms[used++] = &symtab.base[index]; - symtab.base[index].has_been_placed = 0; - symtab.base[index].next = 0; - symtab.base[index].prev = 0; - symtab.base[index].nuses = 0; + used_syms[used++] = &symtab.base[sym_index]; + symtab.base[sym_index].has_been_placed = 0; + symtab.base[sym_index].next = 0; + symtab.base[sym_index].prev = 0; + symtab.base[sym_index].nuses = 0; } } @@ -827,26 +829,26 @@ cg_print_function_ordering () Overflow is much less likely when this file is compiled with GCC as it can double-wide integers via long long. */ total_arcs = 0; - for (index = 0; index < numarcs; index++) + for (arc_index = 0; arc_index < numarcs; arc_index++) { - total_arcs += arcs[index]->count; - arcs[index]->has_been_placed = 0; + total_arcs += arcs[arc_index]->count; + arcs[arc_index]->has_been_placed = 0; } /* We want to pull out those functions which are referenced by many highly used arcs and emit them as a group. This could probably use some tuning. */ tmp_arcs_count = 0; - for (index = 0; index < numarcs; index++) + for (arc_index = 0; arc_index < numarcs; arc_index++) { - tmp_arcs_count += arcs[index]->count; + tmp_arcs_count += arcs[arc_index]->count; /* Count how many times each parent and child are used up to our threshhold of arcs (90%). */ if ((double)tmp_arcs_count / (double)total_arcs > 0.90) break; - arcs[index]->child->nuses++; + arcs[arc_index]->child->nuses++; } /* Now sort a temporary symbol table based on the number of @@ -856,9 +858,9 @@ cg_print_function_ordering () /* Now pick out those symbols we're going to emit as a group. We take up to 1.25% of the used symbols. */ - for (index = 0; index < used / 80; index++) + for (sym_index = 0; sym_index < used / 80; sym_index++) { - Sym *sym = scratch_syms[index]; + Sym *sym = scratch_syms[sym_index]; Arc *arc; /* If we hit symbols that aren't used from many call sites, @@ -897,7 +899,7 @@ cg_print_function_ordering () } /* Keep track of how many symbols we're going to place. */ - scratch_index = index; + scratch_index = sym_index; /* A lie, but it makes identifying these functions easier later. */ @@ -906,16 +908,16 @@ cg_print_function_ordering () /* Now walk through the temporary arcs and copy those we care about into the high arcs array. */ - for (index = 0; index < scratch_arc_count; index++) + for (arc_index = 0; arc_index < scratch_arc_count; arc_index++) { - Arc *arc = scratch_arcs[index]; + Arc *arc = scratch_arcs[arc_index]; /* If this arc refers to highly used functions, then then we want to keep it. */ if (arc->child->has_been_placed && arc->parent->has_been_placed) { - high_arcs[high_arc_count++] = scratch_arcs[index]; + high_arcs[high_arc_count++] = scratch_arcs[arc_index]; /* We need to turn of has_been_placed since we're going to use the main arc placement algorithm on these arcs. */ @@ -926,10 +928,10 @@ cg_print_function_ordering () /* Dump the multi-site high usage functions which are not going to be ordered by the main ordering algorithm. */ - for (index = 0; index < scratch_index; index++) + for (sym_index = 0; sym_index < scratch_index; sym_index++) { - if (scratch_syms[index]->has_been_placed) - printf ("%s\n", scratch_syms[index]->name); + if (scratch_syms[sym_index]->has_been_placed) + printf ("%s\n", scratch_syms[sym_index]->name); } /* Now we can order the multi-site high use @@ -948,13 +950,13 @@ cg_print_function_ordering () scratch_arcs, &scratch_arc_count); /* Output any functions not emitted by the order_and_dump calls. */ - for (index = 0; index < used; index++) - if (used_syms[index]->has_been_placed == 0) - printf("%s\n", used_syms[index]->name); + for (sym_index = 0; sym_index < used; sym_index++) + if (used_syms[sym_index]->has_been_placed == 0) + printf("%s\n", used_syms[sym_index]->name); /* Output the unused functions. */ - for (index = 0; index < unused; index++) - printf("%s\n", unused_syms[index]->name); + for (sym_index = 0; sym_index < unused; sym_index++) + printf("%s\n", unused_syms[sym_index]->name); unused_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *)); used_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *)); @@ -992,7 +994,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all, #else unsigned long tmp_arcs, total_arcs; #endif - unsigned int index; + unsigned int arc_index; /* If needed, compute the total arc count. @@ -1000,27 +1002,27 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all, if (! all) { total_arcs = 0; - for (index = 0; index < arc_count; index++) - total_arcs += the_arcs[index]->count; + for (arc_index = 0; arc_index < arc_count; arc_index++) + total_arcs += the_arcs[arc_index]->count; } else total_arcs = 0; tmp_arcs = 0; - for (index = 0; index < arc_count; index++) + for (arc_index = 0; arc_index < arc_count; arc_index++) { Sym *sym1, *sym2; Sym *child, *parent; - tmp_arcs += the_arcs[index]->count; + tmp_arcs += the_arcs[arc_index]->count; /* Ignore this arc if it's already been placed. */ - if (the_arcs[index]->has_been_placed) + if (the_arcs[arc_index]->has_been_placed) continue; - child = the_arcs[index]->child; - parent = the_arcs[index]->parent; + child = the_arcs[arc_index]->child; + parent = the_arcs[arc_index]->parent; /* If we're not using all arcs, and this is a rarely used arc, then put it on the unplaced_arc list. Similarly @@ -1028,7 +1030,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all, if ((! all && (double)tmp_arcs / (double)total_arcs > MOST) || child->has_been_placed || parent->has_been_placed) { - unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index]; + unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index]; continue; } @@ -1038,7 +1040,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all, algorithm can use it to place function chains. */ if (parent->next && parent->prev && child->next && child->prev) { - unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index]; + unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index]; continue; } @@ -1093,7 +1095,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all, { /* Couldn't find anywhere to attach the functions, put the arc on the unplaced arc list. */ - unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index]; + unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index]; continue; } @@ -1118,7 +1120,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all, && sym2 == parent) { /* This would tie two ends together. */ - unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index]; + unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index]; continue; } @@ -1130,7 +1132,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all, /* parent-prev and child-next */ parent->prev = child; child->next = parent; - the_arcs[index]->has_been_placed = 1; + the_arcs[arc_index]->has_been_placed = 1; } } else if (parent->prev) @@ -1141,7 +1143,7 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all, /* parent-next and child-prev */ parent->next = child; child->prev = parent; - the_arcs[index]->has_been_placed = 1; + the_arcs[arc_index]->has_been_placed = 1; } } else @@ -1153,27 +1155,27 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all, /* parent-prev and child-next. */ parent->prev = child; child->next = parent; - the_arcs[index]->has_been_placed = 1; + the_arcs[arc_index]->has_been_placed = 1; } else { /* parent-next and child-prev. */ parent->next = child; child->prev = parent; - the_arcs[index]->has_been_placed = 1; + the_arcs[arc_index]->has_been_placed = 1; } } } /* Dump the chains of functions we've made. */ - for (index = 0; index < arc_count; index++) + for (arc_index = 0; arc_index < arc_count; arc_index++) { Sym *sym; - if (the_arcs[index]->parent->has_been_placed - || the_arcs[index]->child->has_been_placed) + if (the_arcs[arc_index]->parent->has_been_placed + || the_arcs[arc_index]->child->has_been_placed) continue; - sym = the_arcs[index]->parent; + sym = the_arcs[arc_index]->parent; /* If this symbol isn't attached to any other symbols, then we've got a rarely used arc. @@ -1199,14 +1201,14 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all, /* If we want to place all the arcs, then output those which weren't placed by the main algorithm. */ if (all) - for (index = 0; index < arc_count; index++) + for (arc_index = 0; arc_index < arc_count; arc_index++) { Sym *sym; - if (the_arcs[index]->parent->has_been_placed - || the_arcs[index]->child->has_been_placed) + if (the_arcs[arc_index]->parent->has_been_placed + || the_arcs[arc_index]->child->has_been_placed) continue; - sym = the_arcs[index]->parent; + sym = the_arcs[arc_index]->parent; sym->has_been_placed = 1; printf ("%s\n", sym->name); @@ -1230,42 +1232,44 @@ cmp_symbol_map (const void * l, const void * r) void cg_print_file_ordering (void) { - unsigned long scratch_arc_count, index; + unsigned long scratch_arc_count; + unsigned long arc_index; + unsigned long sym_index; Arc **scratch_arcs; char *last; scratch_arc_count = 0; scratch_arcs = (Arc **) xmalloc (numarcs * sizeof (Arc *)); - for (index = 0; index < numarcs; index++) + for (arc_index = 0; arc_index < numarcs; arc_index++) { - if (! arcs[index]->parent->mapped - || ! arcs[index]->child->mapped) - arcs[index]->has_been_placed = 1; + if (! arcs[arc_index]->parent->mapped + || ! arcs[arc_index]->child->mapped) + arcs[arc_index]->has_been_placed = 1; } order_and_dump_functions_by_arcs (arcs, numarcs, 0, scratch_arcs, &scratch_arc_count); /* Output .o's not handled by the main placement algorithm. */ - for (index = 0; index < symtab.len; index++) + for (sym_index = 0; sym_index < symtab.len; sym_index++) { - if (symtab.base[index].mapped - && ! symtab.base[index].has_been_placed) - printf ("%s\n", symtab.base[index].name); + if (symtab.base[sym_index].mapped + && ! symtab.base[sym_index].has_been_placed) + printf ("%s\n", symtab.base[sym_index].name); } qsort (symbol_map, symbol_map_count, sizeof (struct function_map), cmp_symbol_map); /* Now output any .o's that didn't have any text symbols. */ last = NULL; - for (index = 0; index < symbol_map_count; index++) + for (sym_index = 0; sym_index < symbol_map_count; sym_index++) { unsigned int index2; /* Don't bother searching if this symbol is the same as the previous one. */ - if (last && !strcmp (last, symbol_map[index].file_name)) + if (last && !strcmp (last, symbol_map[sym_index].file_name)) continue; for (index2 = 0; index2 < symtab.len; index2++) @@ -1273,14 +1277,14 @@ cg_print_file_ordering (void) if (! symtab.base[index2].mapped) continue; - if (!strcmp (symtab.base[index2].name, symbol_map[index].file_name)) + if (!strcmp (symtab.base[index2].name, symbol_map[sym_index].file_name)) break; } /* If we didn't find it in the symbol table, then it must be a .o with no text symbols. Output it last. */ if (index2 == symtab.len) - printf ("%s\n", symbol_map[index].file_name); - last = symbol_map[index].file_name; + printf ("%s\n", symbol_map[sym_index].file_name); + last = symbol_map[sym_index].file_name; } } diff --git a/gprof/configure b/gprof/configure index f45fa4243..60b2d1800 100755 --- a/gprof/configure +++ b/gprof/configure @@ -11883,7 +11883,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/gprof/hist.c b/gprof/hist.c index 6f4ead83a..25364b215 100644 --- a/gprof/hist.c +++ b/gprof/hist.c @@ -366,7 +366,7 @@ hist_assign_samples_1 (histogram *r) bfd_vma overlap, addr; unsigned int bin_count; unsigned int i, j; - double time, credit; + double count_time, credit; bfd_vma lowpc = r->lowpc / sizeof (UNIT); @@ -379,7 +379,7 @@ hist_assign_samples_1 (histogram *r) bin_low_pc = lowpc + (bfd_vma) (hist_scale * i); bin_high_pc = lowpc + (bfd_vma) (hist_scale * (i + 1)); - time = bin_count; + count_time = bin_count; DBG (SAMPLEDEBUG, printf ( @@ -387,7 +387,7 @@ hist_assign_samples_1 (histogram *r) (unsigned long) (sizeof (UNIT) * bin_low_pc), (unsigned long) (sizeof (UNIT) * bin_high_pc), bin_count)); - total_time += time; + total_time += count_time; /* Credit all symbols that are covered by bin I. */ for (j = j - 1; j < symtab.len; ++j) @@ -414,11 +414,11 @@ hist_assign_samples_1 (histogram *r) "[assign_samples] [0x%lx,0x%lx) %s gets %f ticks %ld overlap\n", (unsigned long) symtab.base[j].addr, (unsigned long) (sizeof (UNIT) * sym_high_pc), - symtab.base[j].name, overlap * time / hist_scale, + symtab.base[j].name, overlap * count_time / hist_scale, (long) overlap)); addr = symtab.base[j].addr; - credit = overlap * time / hist_scale; + credit = overlap * count_time / hist_scale; /* Credit symbol if it appears in INCL_FLAT or that table is empty and it does not appear it in @@ -563,9 +563,9 @@ void hist_print () { Sym **time_sorted_syms, *top_dog, *sym; - unsigned int index; + unsigned int sym_index; unsigned log_scale; - double top_time, time; + double top_time; bfd_vma addr; if (first_output) @@ -592,8 +592,8 @@ hist_print () and tertiary keys). */ time_sorted_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *)); - for (index = 0; index < symtab.len; ++index) - time_sorted_syms[index] = &symtab.base[index]; + for (sym_index = 0; sym_index < symtab.len; ++sym_index) + time_sorted_syms[sym_index] = &symtab.base[sym_index]; qsort (time_sorted_syms, symtab.len, sizeof (Sym *), cmp_time); @@ -609,18 +609,20 @@ hist_print () top_dog = 0; top_time = 0.0; - for (index = 0; index < symtab.len; ++index) + for (sym_index = 0; sym_index < symtab.len; ++sym_index) { - sym = time_sorted_syms[index]; + sym = time_sorted_syms[sym_index]; if (sym->ncalls != 0) { - time = (sym->hist.time + sym->cg.child_time) / sym->ncalls; + double call_time; - if (time > top_time) + call_time = (sym->hist.time + sym->cg.child_time) / sym->ncalls; + + if (call_time > top_time) { top_dog = sym; - top_time = time; + top_time = call_time; } } } @@ -644,16 +646,16 @@ hist_print () I-cache misses etc.). */ print_header (SItab[log_scale].prefix); - for (index = 0; index < symtab.len; ++index) + for (sym_index = 0; sym_index < symtab.len; ++sym_index) { - addr = time_sorted_syms[index]->addr; + addr = time_sorted_syms[sym_index]->addr; /* Print symbol if its in INCL_FLAT table or that table is empty and the symbol is not in EXCL_FLAT. */ if (sym_lookup (&syms[INCL_FLAT], addr) || (syms[INCL_FLAT].len == 0 && !sym_lookup (&syms[EXCL_FLAT], addr))) - print_line (time_sorted_syms[index], SItab[log_scale].scale); + print_line (time_sorted_syms[sym_index], SItab[log_scale].scale); } free (time_sorted_syms); diff --git a/ld/ChangeLog b/ld/ChangeLog index 0abce2d96..2f7b131ae 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2009-12-11 Nick Clifton + + * Makefile.in: Regenerate. + * configure: Regenerate. + * deffilep.y: Fix shadowed variable warnings. + * ldlang.c: Likewise. + * ldmain.c: Likewise. + * pe-dll.c: Likewise. + * emultempl/elf32.em: Likewise. + 2009-12-09 Alan Modra PR ld/11012 diff --git a/ld/Makefile.in b/ld/Makefile.in index 0da0fff50..2c2e01408 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -49,12 +49,15 @@ DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \ $(srcdir)/../ylwrap $(ld_TEXINFOS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/zlib.m4 \ $(top_srcdir)/../bfd/warning.m4 $(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 \ + $(top_srcdir)/../config/plugins.m4 \ $(top_srcdir)/../config/po.m4 \ $(top_srcdir)/../config/progtest.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ diff --git a/ld/configure b/ld/configure index 6febc32f5..e0ff7582d 100755 --- a/ld/configure +++ b/ld/configure @@ -4336,7 +4336,7 @@ $as_echo "#define GOT_HANDLING_DEFAULT GOT_HANDLING_MULTIGOT" >>confdefs.h esac -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/ld/deffilep.y b/ld/deffilep.y index 672c18674..43847bcd2 100644 --- a/ld/deffilep.y +++ b/ld/deffilep.y @@ -357,183 +357,185 @@ def_file_parse (const char *filename, def_file *add_to) } void -def_file_free (def_file *def) +def_file_free (def_file *fdef) { int i; - if (!def) + if (!fdef) return; - if (def->name) - free (def->name); - if (def->description) - free (def->description); + if (fdef->name) + free (fdef->name); + if (fdef->description) + free (fdef->description); - if (def->section_defs) + if (fdef->section_defs) { - for (i = 0; i < def->num_section_defs; i++) + for (i = 0; i < fdef->num_section_defs; i++) { - if (def->section_defs[i].name) - free (def->section_defs[i].name); - if (def->section_defs[i].class) - free (def->section_defs[i].class); + if (fdef->section_defs[i].name) + free (fdef->section_defs[i].name); + if (fdef->section_defs[i].class) + free (fdef->section_defs[i].class); } - free (def->section_defs); + free (fdef->section_defs); } - if (def->exports) + if (fdef->exports) { for (i = 0; i < def->num_exports; i++) { - if (def->exports[i].internal_name - && def->exports[i].internal_name != def->exports[i].name) - free (def->exports[i].internal_name); - if (def->exports[i].name) - free (def->exports[i].name); - if (def->exports[i].its_name) - free (def->exports[i].its_name); + if (fdef->exports[i].internal_name + && fdef->exports[i].internal_name != fdef->exports[i].name) + free (fdef->exports[i].internal_name); + if (fdef->exports[i].name) + free (fdef->exports[i].name); + if (fdef->exports[i].its_name) + free (fdef->exports[i].its_name); } - free (def->exports); + free (fdef->exports); } - if (def->imports) + if (fdef->imports) { - for (i = 0; i < def->num_imports; i++) + for (i = 0; i < fdef->num_imports; i++) { - if (def->imports[i].internal_name - && def->imports[i].internal_name != def->imports[i].name) - free (def->imports[i].internal_name); - if (def->imports[i].name) - free (def->imports[i].name); - if (def->imports[i].its_name) - free (def->imports[i].its_name); + if (fdef->imports[i].internal_name + && fdef->imports[i].internal_name != fdef->imports[i].name) + free (fdef->imports[i].internal_name); + if (fdef->imports[i].name) + free (fdef->imports[i].name); + if (fdef->imports[i].its_name) + free (fdef->imports[i].its_name); } - free (def->imports); + free (fdef->imports); } - while (def->modules) + while (fdef->modules) { - def_file_module *m = def->modules; - def->modules = def->modules->next; + def_file_module *m = fdef->modules; + + fdef->modules = fdef->modules->next; free (m); } - while (def->aligncomms) + while (fdef->aligncomms) { - def_file_aligncomm *c = def->aligncomms; - def->aligncomms = def->aligncomms->next; + def_file_aligncomm *c = fdef->aligncomms; + + fdef->aligncomms = fdef->aligncomms->next; free (c->symbol_name); free (c); } - free (def); + free (fdef); } #ifdef DEF_FILE_PRINT void -def_file_print (FILE *file, def_file *def) +def_file_print (FILE *file, def_file *fdef) { int i; - fprintf (file, ">>>> def_file at 0x%08x\n", def); - if (def->name) - fprintf (file, " name: %s\n", def->name ? def->name : "(unspecified)"); - if (def->is_dll != -1) - fprintf (file, " is dll: %s\n", def->is_dll ? "yes" : "no"); - if (def->base_address != (bfd_vma) -1) - fprintf (file, " base address: 0x%08x\n", def->base_address); - if (def->description) - fprintf (file, " description: `%s'\n", def->description); - if (def->stack_reserve != -1) - fprintf (file, " stack reserve: 0x%08x\n", def->stack_reserve); - if (def->stack_commit != -1) - fprintf (file, " stack commit: 0x%08x\n", def->stack_commit); - if (def->heap_reserve != -1) - fprintf (file, " heap reserve: 0x%08x\n", def->heap_reserve); - if (def->heap_commit != -1) - fprintf (file, " heap commit: 0x%08x\n", def->heap_commit); - - if (def->num_section_defs > 0) + fprintf (file, ">>>> def_file at 0x%08x\n", fdef); + if (fdef->name) + fprintf (file, " name: %s\n", fdef->name ? fdef->name : "(unspecified)"); + if (fdef->is_dll != -1) + fprintf (file, " is dll: %s\n", fdef->is_dll ? "yes" : "no"); + if (fdef->base_address != (bfd_vma) -1) + fprintf (file, " base address: 0x%08x\n", fdef->base_address); + if (fdef->description) + fprintf (file, " description: `%s'\n", fdef->description); + if (fdef->stack_reserve != -1) + fprintf (file, " stack reserve: 0x%08x\n", fdef->stack_reserve); + if (fdef->stack_commit != -1) + fprintf (file, " stack commit: 0x%08x\n", fdef->stack_commit); + if (fdef->heap_reserve != -1) + fprintf (file, " heap reserve: 0x%08x\n", fdef->heap_reserve); + if (fdef->heap_commit != -1) + fprintf (file, " heap commit: 0x%08x\n", fdef->heap_commit); + + if (fdef->num_section_defs > 0) { fprintf (file, " section defs:\n"); - for (i = 0; i < def->num_section_defs; i++) + for (i = 0; i < fdef->num_section_defs; i++) { fprintf (file, " name: `%s', class: `%s', flags:", - def->section_defs[i].name, def->section_defs[i].class); - if (def->section_defs[i].flag_read) + fdef->section_defs[i].name, fdef->section_defs[i].class); + if (fdef->section_defs[i].flag_read) fprintf (file, " R"); - if (def->section_defs[i].flag_write) + if (fdef->section_defs[i].flag_write) fprintf (file, " W"); - if (def->section_defs[i].flag_execute) + if (fdef->section_defs[i].flag_execute) fprintf (file, " X"); - if (def->section_defs[i].flag_shared) + if (fdef->section_defs[i].flag_shared) fprintf (file, " S"); fprintf (file, "\n"); } } - if (def->num_exports > 0) + if (fdef->num_exports > 0) { fprintf (file, " exports:\n"); - for (i = 0; i < def->num_exports; i++) + for (i = 0; i < fdef->num_exports; i++) { fprintf (file, " name: `%s', int: `%s', ordinal: %d, flags:", - def->exports[i].name, def->exports[i].internal_name, - def->exports[i].ordinal); - if (def->exports[i].flag_private) + fdef->exports[i].name, fdef->exports[i].internal_name, + fdef->exports[i].ordinal); + if (fdef->exports[i].flag_private) fprintf (file, " P"); - if (def->exports[i].flag_constant) + if (fdef->exports[i].flag_constant) fprintf (file, " C"); - if (def->exports[i].flag_noname) + if (fdef->exports[i].flag_noname) fprintf (file, " N"); - if (def->exports[i].flag_data) + if (fdef->exports[i].flag_data) fprintf (file, " D"); fprintf (file, "\n"); } } - if (def->num_imports > 0) + if (fdef->num_imports > 0) { fprintf (file, " imports:\n"); - for (i = 0; i < def->num_imports; i++) + for (i = 0; i < fdef->num_imports; i++) { fprintf (file, " int: %s, from: `%s', name: `%s', ordinal: %d\n", - def->imports[i].internal_name, - def->imports[i].module, - def->imports[i].name, - def->imports[i].ordinal); + fdef->imports[i].internal_name, + fdef->imports[i].module, + fdef->imports[i].name, + fdef->imports[i].ordinal); } } - if (def->version_major != -1) - fprintf (file, " version: %d.%d\n", def->version_major, def->version_minor); + if (fdef->version_major != -1) + fprintf (file, " version: %d.%d\n", fdef->version_major, fdef->version_minor); fprintf (file, "<<<< def_file at 0x%08x\n", def); } #endif def_file_export * -def_file_add_export (def_file *def, +def_file_add_export (def_file *fdef, const char *external_name, const char *internal_name, int ordinal, const char *its_name) { def_file_export *e; - int max_exports = ROUND_UP(def->num_exports, 32); + int max_exports = ROUND_UP(fdef->num_exports, 32); - if (def->num_exports >= max_exports) + if (fdef->num_exports >= max_exports) { - max_exports = ROUND_UP(def->num_exports + 1, 32); - if (def->exports) - def->exports = xrealloc (def->exports, + max_exports = ROUND_UP(fdef->num_exports + 1, 32); + if (fdef->exports) + fdef->exports = xrealloc (fdef->exports, max_exports * sizeof (def_file_export)); else - def->exports = xmalloc (max_exports * sizeof (def_file_export)); + fdef->exports = xmalloc (max_exports * sizeof (def_file_export)); } - e = def->exports + def->num_exports; + e = fdef->exports + fdef->num_exports; memset (e, 0, sizeof (def_file_export)); if (internal_name && !external_name) external_name = internal_name; @@ -543,16 +545,16 @@ def_file_add_export (def_file *def, e->internal_name = xstrdup (internal_name); e->its_name = (its_name ? xstrdup (its_name) : NULL); e->ordinal = ordinal; - def->num_exports++; + fdef->num_exports++; return e; } def_file_module * -def_get_module (def_file *def, const char *name) +def_get_module (def_file *fdef, const char *name) { def_file_module *s; - for (s = def->modules; s; s = s->next) + for (s = fdef->modules; s; s = s->next) if (strcmp (s->name, name) == 0) return s; @@ -560,22 +562,22 @@ def_get_module (def_file *def, const char *name) } static def_file_module * -def_stash_module (def_file *def, const char *name) +def_stash_module (def_file *fdef, const char *name) { def_file_module *s; - if ((s = def_get_module (def, name)) != NULL) + if ((s = def_get_module (fdef, name)) != NULL) return s; s = xmalloc (sizeof (def_file_module) + strlen (name)); s->next = def->modules; - def->modules = s; + fdef->modules = s; s->user_data = 0; strcpy (s->name, name); return s; } def_file_import * -def_file_add_import (def_file *def, +def_file_add_import (def_file *fdef, const char *name, const char *module, int ordinal, @@ -583,19 +585,19 @@ def_file_add_import (def_file *def, const char *its_name) { def_file_import *i; - int max_imports = ROUND_UP (def->num_imports, 16); + int max_imports = ROUND_UP (fdef->num_imports, 16); - if (def->num_imports >= max_imports) + if (fdef->num_imports >= max_imports) { - max_imports = ROUND_UP (def->num_imports+1, 16); + max_imports = ROUND_UP (fdef->num_imports+1, 16); - if (def->imports) - def->imports = xrealloc (def->imports, + if (fdef->imports) + fdef->imports = xrealloc (fdef->imports, max_imports * sizeof (def_file_import)); else - def->imports = xmalloc (max_imports * sizeof (def_file_import)); + fdef->imports = xmalloc (max_imports * sizeof (def_file_import)); } - i = def->imports + def->num_imports; + i = fdef->imports + fdef->num_imports; memset (i, 0, sizeof (def_file_import)); if (name) i->name = xstrdup (name); @@ -607,7 +609,7 @@ def_file_add_import (def_file *def, else i->internal_name = i->name; i->its_name = (its_name ? xstrdup (its_name) : NULL); - def->num_imports++; + fdef->num_imports++; return i; } @@ -660,7 +662,7 @@ def_file_add_directive (def_file *my_def, const char *param, int len) for (i = 0; diropts[i].param; i++) { - int len = strlen (diropts[i].param); + len = strlen (diropts[i].param); if (tend - param >= len && strncmp (param, diropts[i].param, len) == 0 @@ -704,6 +706,7 @@ def_image_name (const char *name, int base, int is_dll) if (*name) { const char* image_name = lbasename (name); + if (image_name != name) einfo ("%s:%d: Warning: path components stripped from %s, '%s'\n", def_filename, linenumber, is_dll ? "LIBRARY" : "NAME", diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index b07ab15e7..7215ff07f 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -342,14 +342,14 @@ gld${EMULATION_NAME}_try_needed (struct dt_needed *needed, if (! force) { - struct bfd_link_needed_list *needed; + struct bfd_link_needed_list *needs; - if (! bfd_elf_get_bfd_needed_list (abfd, &needed)) + if (! bfd_elf_get_bfd_needed_list (abfd, &needs)) einfo ("%F%P:%B: bfd_elf_get_bfd_needed_list failed: %E\n", abfd); - if (needed != NULL) + if (needs != NULL) { - global_vercheck_needed = needed; + global_vercheck_needed = needs; global_vercheck_failed = FALSE; lang_for_each_input_file (gld${EMULATION_NAME}_vercheck); if (global_vercheck_failed) @@ -374,7 +374,7 @@ case ${target} in { struct bfd_link_needed_list *l; - for (l = needed; l != NULL; l = l->next) + for (l = needs; l != NULL; l = l->next) if (CONST_STRNEQ (l->name, "libc.so")) break; if (l == NULL) @@ -884,9 +884,9 @@ fragment <emit_note_gnu_build_id; + const char *style = linfo->emit_note_gnu_build_id; bfd_size_type size; abfd = abfd; @@ -1414,23 +1414,23 @@ fragment <flags; /* We don't copy the SEC_NEVER_LOAD flag from an input section to an output section, because we want to be able to include a @@ -2214,7 +2211,6 @@ lang_add_section (lang_statement_list_type *ptr, section (I don't know why we want to do this, but we do). build_link_order in ldwrite.c handles this case by turning the embedded SEC_NEVER_LOAD section into a fill. */ - flags &= ~ SEC_NEVER_LOAD; switch (output->sectype) @@ -4618,12 +4614,12 @@ static void os_region_check (lang_output_section_statement_type *os, lang_memory_region_type *region, etree_type *tree, - bfd_vma base) + bfd_vma rbase) { if ((region->current < region->origin || (region->current - region->origin > region->length)) && ((region->current != region->origin + region->length) - || base == 0)) + || rbase == 0)) { if (tree != NULL) { diff --git a/ld/ldmain.c b/ld/ldmain.c index e0917f668..08679ecbb 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -1104,7 +1104,7 @@ warning_callback (struct bfd_link_info *info ATTRIBUTE_UNUSED, einfo ("%B: %s%s\n", abfd, _("warning: "), warning); else { - struct warning_callback_info info; + struct warning_callback_info cinfo; /* Look through the relocs to see if we can find a plausible address. */ @@ -1112,13 +1112,13 @@ warning_callback (struct bfd_link_info *info ATTRIBUTE_UNUSED, if (!bfd_generic_link_read_symbols (abfd)) einfo (_("%B%F: could not read symbols: %E\n"), abfd); - info.found = FALSE; - info.warning = warning; - info.symbol = symbol; - info.asymbols = bfd_get_outsymbols (abfd); - bfd_map_over_sections (abfd, warning_find_reloc, &info); + cinfo.found = FALSE; + cinfo.warning = warning; + cinfo.symbol = symbol; + cinfo.asymbols = bfd_get_outsymbols (abfd); + bfd_map_over_sections (abfd, warning_find_reloc, &cinfo); - if (! info.found) + if (! cinfo.found) einfo ("%B: %s%s\n", abfd, _("warning: "), warning); } diff --git a/ld/pe-dll.c b/ld/pe-dll.c index fb94813a8..9b3c699fb 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -1306,7 +1306,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info) for (bi = 0, b = info->input_bfds; b; bi++, b = b->link_next) { arelent **relocs; - int relsize, nrelocs, i; + int relsize, nrelocs; for (s = b->sections; s; s = s->next) { @@ -2366,7 +2366,7 @@ make_import_fixup_mark (arelent *rel) static bfd * make_import_fixup_entry (const char *name, const char *fixup_name, - const char *dll_symname, + const char *symname, bfd *parent) { asection *id2; @@ -2390,7 +2390,7 @@ make_import_fixup_entry (const char *name, id2 = quick_section (abfd, ".idata$2", SEC_HAS_CONTENTS, 2); quick_symbol (abfd, U ("_nm_thnk_"), name, "", UNDSEC, BSF_GLOBAL, 0); - quick_symbol (abfd, U (""), dll_symname, "_iname", UNDSEC, BSF_GLOBAL, 0); + quick_symbol (abfd, U (""), symname, "_iname", UNDSEC, BSF_GLOBAL, 0); /* For relocator v2 we have to use the .idata$5 element and not fixup_name. */ if (link_info.pei386_runtime_pseudo_reloc == 2) @@ -2574,7 +2574,7 @@ pe_create_import_fixup (arelent *rel, asection *s, bfd_vma addend) if (need_import_table == 1 && (!name_thunk_sym || name_thunk_sym->type != bfd_link_hash_defined)) { - bfd *b = make_singleton_name_thunk (name, link_info.output_bfd); + b = make_singleton_name_thunk (name, link_info.output_bfd); add_bfd_to_link (b, b->filename, &link_info); /* If we ever use autoimport, we have to cast text section writable. @@ -2595,9 +2595,9 @@ pe_create_import_fixup (arelent *rel, asection *s, bfd_vma addend) && need_import_table == 1) { extern char * pe_data_import_dll; - char * dll_symname = pe_data_import_dll ? pe_data_import_dll : "unknown"; + char * symname = pe_data_import_dll ? pe_data_import_dll : "unknown"; - b = make_import_fixup_entry (name, fixup_name, dll_symname, + b = make_import_fixup_entry (name, fixup_name, symname, link_info.output_bfd); add_bfd_to_link (b, b->filename, &link_info); } @@ -2793,7 +2793,7 @@ pe_find_cdecl_alias_match (char *name) } static void -add_bfd_to_link (bfd *abfd, const char *name, struct bfd_link_info *link_info) +add_bfd_to_link (bfd *abfd, const char *name, struct bfd_link_info *linfo) { lang_input_statement_type *fake_file; @@ -2803,12 +2803,12 @@ add_bfd_to_link (bfd *abfd, const char *name, struct bfd_link_info *link_info) fake_file->the_bfd = abfd; ldlang_add_file (fake_file); - if (!bfd_link_add_symbols (abfd, link_info)) + if (!bfd_link_add_symbols (abfd, linfo)) einfo ("%Xaddsym %s: %E\n", name); } void -pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *link_info) +pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *linfo) { def_file_module *module; @@ -2850,7 +2850,7 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *link_info) sprintf (name, "%s%s",U (""), pe_def_file->imports[i].internal_name); - blhe = bfd_link_hash_lookup (link_info->hash, name, + blhe = bfd_link_hash_lookup (linfo->hash, name, FALSE, FALSE, FALSE); /* Include the jump stub for only if the @@ -2864,7 +2864,7 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *link_info) sprintf (name, "%s%s%s", "__imp_", U (""), pe_def_file->imports[i].internal_name); - blhe = bfd_link_hash_lookup (link_info->hash, name, + blhe = bfd_link_hash_lookup (linfo->hash, name, FALSE, FALSE, FALSE); } else @@ -2887,7 +2887,7 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *link_info) if (!do_this_dll) { bfd *ar_head = make_head (output_bfd); - add_bfd_to_link (ar_head, ar_head->filename, link_info); + add_bfd_to_link (ar_head, ar_head->filename, linfo); do_this_dll = 1; } exp.internal_name = pe_def_file->imports[i].internal_name; @@ -2900,13 +2900,13 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *link_info) exp.flag_data = pe_def_file->imports[i].data; exp.flag_noname = exp.name ? 0 : 1; one = make_one (&exp, output_bfd, (! exp.flag_data) && include_jmp_stub); - add_bfd_to_link (one, one->filename, link_info); + add_bfd_to_link (one, one->filename, linfo); } } if (do_this_dll) { bfd *ar_tail = make_tail (output_bfd); - add_bfd_to_link (ar_tail, ar_tail->filename, link_info); + add_bfd_to_link (ar_tail, ar_tail->filename, linfo); } free (dll_symname); @@ -2955,7 +2955,7 @@ pe_implied_import_dll (const char *filename) unsigned char *expdata; char *erva; bfd_vma name_rvas, ordinals, nexp, ordbase; - const char *dll_name; + const char *dllname; /* Initialization with start > end guarantees that is_data will not be set by mistake, and avoids compiler warning. */ bfd_vma data_start = 1; @@ -3094,15 +3094,15 @@ pe_implied_import_dll (const char *filename) /* Use internal dll name instead of filename to enable symbolic dll linking. */ - dll_name = erva + pe_as32 (expdata + 12); + dllname = erva + pe_as32 (expdata + 12); /* Check to see if the dll has already been added to the definition list and if so return without error. This avoids multiple symbol definitions. */ - if (def_get_module (pe_def_file, dll_name)) + if (def_get_module (pe_def_file, dllname)) { if (pe_dll_extra_pe_debug) - printf ("%s is already loaded\n", dll_name); + printf ("%s is already loaded\n", dllname); return TRUE; } @@ -3128,13 +3128,13 @@ pe_implied_import_dll (const char *filename) || (func_rva >= bss_start && func_rva < bss_end); imp = def_file_add_import (pe_def_file, erva + name_rva, - dll_name, i, 0, NULL); + dllname, i, 0, NULL); /* Mark symbol type. */ imp->data = is_data; if (pe_dll_extra_pe_debug) printf ("%s dll-name: %s sym: %s addr: 0x%lx %s\n", - __FUNCTION__, dll_name, erva + name_rva, + __FUNCTION__, dllname, erva + name_rva, (unsigned long) func_rva, is_data ? "(data)" : ""); } } diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 9e2dfbd3c..04d35ff62 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,34 @@ +2009-12-11 Nick Clifton + + * Makefile.in: Regenerate. + * configure: Regenerate. + * arm-dis.c: Fix shadowed variable warnings. + * cgen-opc.c: Likewise. + * cr16-dis.c: Likewise. + * crx-dis.c: Likewise. + * d30v-dis.c: Likewise. + * fr30-dis.c: Likewise. + * frv-opc.c: Likewise. + * h8500-dis.c: Likewise. + * i386-dis.c: Likewise. + * i960-dis.c: Likewise. + * ia64-gen.c: Likewise. + * ia64-opc.c: Likewise. + * m32c-asm.c: Likewise. + * m32c-dis.c: Likewise. + * m68k-dis.c: Likewise. + * maxq-dis.c: Likewise. + * mcore-dis.c: Likewise. + * mep-asm.c: Likewise. + * microblaze-dis.c: Likewise. + * mmix-dis.c: Likewise. + * ns32k-dis.c: Likewise. + * or32-opc.c: Likewise. + * s390-dis.c: Likewise. + * sh64-dis.c: Likewise. + * spu-dis.c: Likewise. + * tic30-dis.c: Likewise. + 2009-12-09 Nick Clifton PR 10924 diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index 4b9c47def..6b6aae81c 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -45,6 +45,7 @@ DIST_COMMON = ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/po/Make-in $(srcdir)/../depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/zlib.m4 \ $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \ $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \ diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c index 3bfad52e5..88b5cf1c4 100644 --- a/opcodes/arm-dis.c +++ b/opcodes/arm-dis.c @@ -1973,7 +1973,6 @@ print_insn_coprocessor (bfd_vma pc, case '5': case '6': case '7': case '8': case '9': { int width; - unsigned long value; c = arm_decode_bitfield (c, given, &value, &width); @@ -2142,7 +2141,6 @@ print_insn_coprocessor (bfd_vma pc, case 'Z': { - int value; /* given (20, 23) | given (0, 3) */ value = ((given >> 16) & 0xf0) | (given & 0xf); func (stream, "%d", value); @@ -2537,7 +2535,7 @@ print_insn_neon (struct disassemble_info *info, long given, bfd_boolean thumb) func (stream, "}, [%s", arm_regnames[rn]); if (align) { - int align = (8 * (type + 1)) << size; + align = (8 * (type + 1)) << size; if (type == 3) align = (size > 1) ? align >> 1 : align; if (type == 2 || (type == 0 && !size)) @@ -3171,10 +3169,10 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given) { long msb = (given & 0x001f0000) >> 16; long lsb = (given & 0x00000f80) >> 7; - long width = msb - lsb + 1; + long w = msb - lsb + 1; - if (width > 0) - func (stream, "#%lu, #%lu", lsb, width); + if (w > 0) + func (stream, "#%lu, #%lu", lsb, w); else func (stream, "(invalid: %lu:%lu)", lsb, msb); } diff --git a/opcodes/cgen-opc.c b/opcodes/cgen-opc.c index 7d5228463..263eb2c4d 100644 --- a/opcodes/cgen-opc.c +++ b/opcodes/cgen-opc.c @@ -376,10 +376,11 @@ cgen_get_insn_value (CGEN_CPU_DESC cd, unsigned char *buf, int length) for (i = 0; i < length; i += insn_chunk_bitsize) /* NB: i == bits */ { - int index; + int bit_index; bfd_vma this_value; - index = i; /* NB: not dependent on endianness; opposite of cgen_put_insn_value! */ - this_value = bfd_get_bits (& buf[index / 8], insn_chunk_bitsize, big_p); + + bit_index = i; /* NB: not dependent on endianness; opposite of cgen_put_insn_value! */ + this_value = bfd_get_bits (& buf[bit_index / 8], insn_chunk_bitsize, big_p); value = (value << insn_chunk_bitsize) | this_value; } } @@ -414,9 +415,10 @@ cgen_put_insn_value (CGEN_CPU_DESC cd, for (i = 0; i < length; i += insn_chunk_bitsize) /* NB: i == bits */ { - int index; - index = (length - insn_chunk_bitsize - i); /* NB: not dependent on endianness! */ - bfd_put_bits ((bfd_vma) value, & buf[index / 8], insn_chunk_bitsize, big_p); + int bit_index; + + bit_index = (length - insn_chunk_bitsize - i); /* NB: not dependent on endianness! */ + bfd_put_bits ((bfd_vma) value, & buf[bit_index / 8], insn_chunk_bitsize, big_p); value >>= insn_chunk_bitsize; } } diff --git a/opcodes/configure b/opcodes/configure index 83b973cf6..67fab59ed 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -11376,7 +11376,7 @@ esac 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/opcodes/cr16-dis.c b/opcodes/cr16-dis.c index 3a31d926b..0aaf61c32 100644 --- a/opcodes/cr16-dis.c +++ b/opcodes/cr16-dis.c @@ -162,9 +162,9 @@ getargtype (operand_type op) string. This routine is used when disassembling the 'CC' instruction. */ static char * -getccstring (unsigned cc) +getccstring (unsigned cc_insn) { - return (char *) cr16_b_cond_tab[cc]; + return (char *) cr16_b_cond_tab[cc_insn]; } @@ -187,12 +187,12 @@ getcinvstring (const char *str) This routine is used when disassembling the 'excp' instruction. */ static char * -gettrapstring (unsigned int index) +gettrapstring (unsigned int trap_index) { const trap_entry *trap; for (trap = cr16_traps; trap < cr16_traps + NUMTRAPS; trap++) - if (trap->entry == index) + if (trap->entry == trap_index) return trap->name; return ILLEGAL; @@ -203,12 +203,12 @@ gettrapstring (unsigned int index) static char * getregname (reg r) { - const reg_entry *reg = cr16_regtab + r; + const reg_entry * regentry = cr16_regtab + r; - if (reg->type != CR16_R_REGTYPE) + if (regentry->type != CR16_R_REGTYPE) return ILLEGAL; - return reg->name; + return regentry->name; } /* Given a register pair enum value, retrieve its name. */ @@ -216,12 +216,12 @@ getregname (reg r) static char * getregpname (reg r) { - const reg_entry *reg = cr16_regptab + r; + const reg_entry * regentry = cr16_regptab + r; - if (reg->type != CR16_RP_REGTYPE) + if (regentry->type != CR16_RP_REGTYPE) return ILLEGAL; - return reg->name; + return regentry->name; } /* Given a index register pair enum value, retrieve its name. */ @@ -229,7 +229,7 @@ getregpname (reg r) static char * getidxregpname (reg r) { - const reg_entry *reg; + const reg_entry * regentry; switch (r) { @@ -245,23 +245,23 @@ getidxregpname (reg r) break; } - reg = cr16_regptab + r; + regentry = cr16_regptab + r; - if (reg->type != CR16_RP_REGTYPE) + if (regentry->type != CR16_RP_REGTYPE) return ILLEGAL; - return reg->name; + return regentry->name; } /* Getting a processor register name. */ static char * -getprocregname (int index) +getprocregname (int reg_index) { const reg_entry *r; for (r = cr16_pregtab; r < cr16_pregtab + NUMPREGS; r++) - if (r->image == index) + if (r->image == reg_index) return r->name; return "ILLEGAL REGISTER"; @@ -270,12 +270,12 @@ getprocregname (int index) /* Getting a processor register name - 32 bit size. */ static char * -getprocpregname (int index) +getprocpregname (int reg_index) { const reg_entry *r; for (r = cr16_pregptab; r < cr16_pregptab + NUMPREGPS; r++) - if (r->image == index) + if (r->image == reg_index) return r->name; return "ILLEGAL REGISTER"; @@ -697,7 +697,7 @@ print_arg (argument *a, bfd_vma memaddr, struct disassemble_info *info) /* Print all the arguments of CURRINSN instruction. */ static void -print_arguments (ins *currInsn, bfd_vma memaddr, struct disassemble_info *info) +print_arguments (ins *currentInsn, bfd_vma memaddr, struct disassemble_info *info) { int i; @@ -705,13 +705,13 @@ print_arguments (ins *currInsn, bfd_vma memaddr, struct disassemble_info *info) if ((IS_INSN_MNEMONIC ("pop") || (IS_INSN_MNEMONIC ("popret") || (IS_INSN_MNEMONIC ("push")))) - && currInsn->nargs == 1) + && currentInsn->nargs == 1) { info->fprintf_func (info->stream, "RA"); return; } - for (i = 0; i < currInsn->nargs; i++) + for (i = 0; i < currentInsn->nargs; i++) { processing_argument_number = i; @@ -725,9 +725,9 @@ print_arguments (ins *currInsn, bfd_vma memaddr, struct disassemble_info *info) if ((INST_HAS_REG_LIST) && (i == 2)) info->fprintf_func (info->stream, "RA"); else - print_arg (&currInsn->arg[i], memaddr, info); + print_arg (¤tInsn->arg[i], memaddr, info); - if ((i != currInsn->nargs - 1) && (!IS_INSN_MNEMONIC ("b"))) + if ((i != currentInsn->nargs - 1) && (!IS_INSN_MNEMONIC ("b"))) info->fprintf_func (info->stream, ","); } } diff --git a/opcodes/crx-dis.c b/opcodes/crx-dis.c index c75245726..f90989744 100644 --- a/opcodes/crx-dis.c +++ b/opcodes/crx-dis.c @@ -155,12 +155,12 @@ getargtype (operand_type op) This routine is used when disassembling the 'excp' instruction. */ static char * -gettrapstring (unsigned int index) +gettrapstring (unsigned int trap_index) { const trap_entry *trap; for (trap = crx_traps; trap < crx_traps + NUMTRAPS; trap++) - if (trap->entry == index) + if (trap->entry == trap_index) return trap->name; return ILLEGAL; @@ -186,12 +186,12 @@ getcinvstring (unsigned int num) char * getregname (reg r) { - const reg_entry *reg = &crx_regtab[r]; + const reg_entry * regentry = &crx_regtab[r]; - if (reg->type != CRX_R_REGTYPE) + if (regentry->type != CRX_R_REGTYPE) return ILLEGAL; else - return reg->name; + return regentry->name; } /* Given a coprocessor register enum value, retrieve its name. */ @@ -199,28 +199,28 @@ getregname (reg r) char * getcopregname (copreg r, reg_type type) { - const reg_entry *reg; + const reg_entry * regentry; if (type == CRX_C_REGTYPE) - reg = &crx_copregtab[r]; + regentry = &crx_copregtab[r]; else if (type == CRX_CS_REGTYPE) - reg = &crx_copregtab[r+(cs0-c0)]; + regentry = &crx_copregtab[r+(cs0-c0)]; else return ILLEGAL; - return reg->name; + return regentry->name; } /* Getting a processor register name. */ static char * -getprocregname (int index) +getprocregname (int reg_index) { const reg_entry *r; for (r = crx_regtab; r < crx_regtab + NUMREGS; r++) - if (r->image == index) + if (r->image == reg_index) return r->name; return "ILLEGAL REGISTER"; @@ -634,17 +634,17 @@ print_arg (argument *a, bfd_vma memaddr, struct disassemble_info *info) /* Print all the arguments of CURRINSN instruction. */ static void -print_arguments (ins *currInsn, bfd_vma memaddr, struct disassemble_info *info) +print_arguments (ins *currentInsn, bfd_vma memaddr, struct disassemble_info *info) { int i; - for (i = 0; i < currInsn->nargs; i++) + for (i = 0; i < currentInsn->nargs; i++) { processing_argument_number = i; - print_arg (&currInsn->arg[i], memaddr, info); + print_arg (¤tInsn->arg[i], memaddr, info); - if (i != currInsn->nargs - 1) + if (i != currentInsn->nargs - 1) info->fprintf_func (info->stream, ", "); } } diff --git a/opcodes/d30v-dis.c b/opcodes/d30v-dis.c index ec21305dc..5f5d07fcd 100644 --- a/opcodes/d30v-dis.c +++ b/opcodes/d30v-dis.c @@ -34,7 +34,7 @@ static int lookup_opcode (struct d30v_insn *insn, long num, int is_long) { - int i = 0, index; + int i = 0, op_index; struct d30v_format *f; struct d30v_opcode *op = (struct d30v_opcode *) d30v_opcode_table; int op1 = (num >> 25) & 0x7; @@ -56,11 +56,11 @@ lookup_opcode (struct d30v_insn *insn, long num, int is_long) while (op->op1 == op1 && op->op2 == op2) { /* Scan through all the formats for the opcode. */ - index = op->format[i++]; + op_index = op->format[i++]; do { - f = (struct d30v_format *) &d30v_format_table[index]; - while (f->form == index) + f = (struct d30v_format *) &d30v_format_table[op_index]; + while (f->form == op_index) { if ((!is_long || f->form >= LONG) && (f->modifier == mod)) { @@ -72,7 +72,7 @@ lookup_opcode (struct d30v_insn *insn, long num, int is_long) if (insn->form) break; } - while ((index = op->format[i++]) != 0); + while ((op_index = op->format[i++]) != 0); if (insn->form) break; op++; diff --git a/opcodes/fr30-dis.c b/opcodes/fr30-dis.c index 6f82bd733..807a5fdd6 100644 --- a/opcodes/fr30-dis.c +++ b/opcodes/fr30-dis.c @@ -67,7 +67,7 @@ print_register_list (void * dis_info, { disassemble_info *info = dis_info; int mask; - int index = 0; + int reg_index = 0; char * comma = ""; if (load_store) @@ -77,11 +77,11 @@ print_register_list (void * dis_info, if (value & mask) { - (*info->fprintf_func) (info->stream, "r%li", index + offset); + (*info->fprintf_func) (info->stream, "r%li", reg_index + offset); comma = ","; } - for (index = 1; index <= 7; ++index) + for (reg_index = 1; reg_index <= 7; ++reg_index) { if (load_store) mask >>= 1; @@ -90,7 +90,7 @@ print_register_list (void * dis_info, if (value & mask) { - (*info->fprintf_func) (info->stream, "%sr%li", comma, index + offset); + (*info->fprintf_func) (info->stream, "%sr%li", comma, reg_index + offset); comma = ","; } } diff --git a/opcodes/frv-opc.c b/opcodes/frv-opc.c index 8da1596c4..3abe96ea1 100644 --- a/opcodes/frv-opc.c +++ b/opcodes/frv-opc.c @@ -795,7 +795,7 @@ check_insn_major_constraints (FRV_VLIW *vliw, int frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) { - int index; + int slot_index; CGEN_ATTR_VALUE_ENUM_TYPE major; CGEN_ATTR_VALUE_ENUM_TYPE unit; VLIW_COMBO *new_vliw; @@ -803,8 +803,8 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) if (vliw->constraint_violation || CGEN_INSN_INVALID_P (insn)) return 1; - index = vliw->next_slot; - if (index >= FRV_VLIW_SIZE) + slot_index = vliw->next_slot; + if (slot_index >= FRV_VLIW_SIZE) return 1; unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT); @@ -831,7 +831,7 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) break; } - if (index <= 0) + if (slot_index <= 0) { /* Any insn can be added to slot 0. */ while (! match_unit (vliw, unit, (*vliw->current_vliw)[0])) @@ -851,8 +851,8 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) if (new_vliw && check_insn_major_constraints (vliw, major, insn)) { vliw->current_vliw = new_vliw; - vliw->major[index] = major; - vliw->insn[index] = insn; + vliw->major[slot_index] = major; + vliw->insn[slot_index] = insn; vliw->next_slot++; return 0; } diff --git a/opcodes/h8500-dis.c b/opcodes/h8500-dis.c index d19ef7fad..1c9463afb 100644 --- a/opcodes/h8500-dis.c +++ b/opcodes/h8500-dis.c @@ -97,7 +97,7 @@ print_insn_h8500 (bfd_vma addr, disassemble_info *info) int rd = 0; int rs = 0; int disp = 0; - int abs = 0; + int abs_val = 0; int imm = 0; int pcrel = 0; int qim = 0; @@ -154,17 +154,17 @@ print_insn_h8500 (bfd_vma addr, disassemble_info *info) break; case ABS24: FETCH_DATA (info, buffer + byte + 3); - abs = + abs_val = (buffer[byte] << 16) | (buffer[byte + 1] << 8) | (buffer[byte + 2]); break; case ABS16: FETCH_DATA (info, buffer + byte + 2); - abs = (buffer[byte] << 8) | (buffer[byte + 1]); + abs_val = (buffer[byte] << 8) | (buffer[byte + 1]); break; case ABS8: - abs = (buffer[byte]); + abs_val = (buffer[byte]); break; case IMM16: FETCH_DATA (info, buffer + byte + 2); @@ -265,28 +265,28 @@ print_insn_h8500 (bfd_vma addr, disassemble_info *info) func (stream, "@-sp"); break; case ABS24: - func (stream, "@0x%0x:24", abs); + func (stream, "@0x%0x:24", abs_val); break; case ABS16: - func (stream, "@0x%0x:16", abs & 0xffff); + func (stream, "@0x%0x:16", abs_val & 0xffff); break; case ABS8: - func (stream, "@0x%0x:8", abs & 0xff); + func (stream, "@0x%0x:8", abs_val & 0xff); break; case IMM16: func (stream, "#0x%0x:16", imm & 0xffff); break; case RLIST: { - int i; + int j; int nc = 0; func (stream, "("); - for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) { - if (imm & (1 << i)) + if (imm & (1 << j)) { - func (stream, "r%d", i); + func (stream, "r%d", j); if (nc) func (stream, ","); nc = 1; diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 0e5b0ab01..5ecf963c8 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -10204,7 +10204,7 @@ with the -M switch (multiple options should be separated by commas):\n")); static const struct dis386 * get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) { - int index, vex_table_index; + int vindex, vex_table_index; if (dp->name != NULL) return dp; @@ -10216,8 +10216,8 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) break; case USE_MOD_TABLE: - index = modrm.mod == 0x3 ? 1 : 0; - dp = &mod_table[dp->op[1].bytemode][index]; + vindex = modrm.mod == 0x3 ? 1 : 0; + dp = &mod_table[dp->op[1].bytemode][vindex]; break; case USE_RM_TABLE: @@ -10231,16 +10231,16 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) switch (vex.prefix) { case 0: - index = 0; + vindex = 0; break; case REPE_PREFIX_OPCODE: - index = 1; + vindex = 1; break; case DATA_PREFIX_OPCODE: - index = 2; + vindex = 2; break; case REPNE_PREFIX_OPCODE: - index = 3; + vindex = 3; break; default: abort (); @@ -10249,11 +10249,11 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) } else { - index = 0; + vindex = 0; used_prefixes |= (prefixes & PREFIX_REPZ); if (prefixes & PREFIX_REPZ) { - index = 1; + vindex = 1; all_prefixes[last_repz_prefix] = 0; } else @@ -10263,7 +10263,7 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) used_prefixes |= (prefixes & PREFIX_REPNZ); if (prefixes & PREFIX_REPNZ) { - index = 3; + vindex = 3; all_prefixes[last_repnz_prefix] = 0; } else @@ -10271,24 +10271,24 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) used_prefixes |= (prefixes & PREFIX_DATA); if (prefixes & PREFIX_DATA) { - index = 2; + vindex = 2; all_prefixes[last_data_prefix] = 0; } } } } - dp = &prefix_table[dp->op[1].bytemode][index]; + dp = &prefix_table[dp->op[1].bytemode][vindex]; break; case USE_X86_64_TABLE: - index = address_mode == mode_64bit ? 1 : 0; - dp = &x86_64_table[dp->op[1].bytemode][index]; + vindex = address_mode == mode_64bit ? 1 : 0; + dp = &x86_64_table[dp->op[1].bytemode][vindex]; break; case USE_3BYTE_TABLE: FETCH_DATA (info, codep + 2); - index = *codep++; - dp = &three_byte_table[dp->op[1].bytemode][index]; + vindex = *codep++; + dp = &three_byte_table[dp->op[1].bytemode][vindex]; modrm.mod = (*codep >> 6) & 3; modrm.reg = (*codep >> 3) & 7; modrm.rm = *codep & 7; @@ -10301,17 +10301,17 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) switch (vex.length) { case 128: - index = 0; + vindex = 0; break; case 256: - index = 1; + vindex = 1; break; default: abort (); break; } - dp = &vex_len_table[dp->op[1].bytemode][index]; + dp = &vex_len_table[dp->op[1].bytemode][vindex]; break; case USE_XOP_8F_TABLE: @@ -10364,8 +10364,8 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) need_vex = 1; need_vex_reg = 1; codep++; - index = *codep++; - dp = &xop_table[vex_table_index][index]; + vindex = *codep++; + dp = &xop_table[vex_table_index][vindex]; FETCH_DATA (info, codep + 1); modrm.mod = (*codep >> 6) & 3; @@ -10421,10 +10421,10 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) need_vex = 1; need_vex_reg = 1; codep++; - index = *codep++; - dp = &vex_table[vex_table_index][index]; + vindex = *codep++; + dp = &vex_table[vex_table_index][vindex]; /* There is no MODRM byte for VEX [82|77]. */ - if (index != 0x77 && index != 0x82) + if (vindex != 0x77 && vindex != 0x82) { FETCH_DATA (info, codep + 1); modrm.mod = (*codep >> 6) & 3; @@ -10463,10 +10463,10 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) need_vex = 1; need_vex_reg = 1; codep++; - index = *codep++; - dp = &vex_table[dp->op[1].bytemode][index]; + vindex = *codep++; + dp = &vex_table[dp->op[1].bytemode][vindex]; /* There is no MODRM byte for VEX [82|77]. */ - if (index != 0x77 && index != 0x82) + if (vindex != 0x77 && vindex != 0x82) { FETCH_DATA (info, codep + 1); modrm.mod = (*codep >> 6) & 3; @@ -12158,7 +12158,7 @@ OP_E_memory (int bytemode, int sizeflag) int haveindex; int needindex; int base, rbase; - int index = 0; + int vindex = 0; int scale = 0; havesib = 0; @@ -12170,13 +12170,13 @@ OP_E_memory (int bytemode, int sizeflag) { havesib = 1; FETCH_DATA (the_info, codep + 1); - index = (*codep >> 3) & 7; + vindex = (*codep >> 3) & 7; scale = (*codep >> 6) & 3; base = *codep & 7; USED_REX (REX_X); if (rex & REX_X) - index += 8; - haveindex = index != 4; + vindex += 8; + haveindex = vindex != 4; codep++; } rbase = base + add; @@ -12260,7 +12260,7 @@ OP_E_memory (int bytemode, int sizeflag) if (haveindex) oappend (address_mode == mode_64bit && (sizeflag & AFLAG) - ? names64[index] : names32[index]); + ? names64[vindex] : names32[vindex]); else oappend (address_mode == mode_64bit && (sizeflag & AFLAG) diff --git a/opcodes/i960-dis.c b/opcodes/i960-dis.c index 52eb86e03..53d723cc1 100644 --- a/opcodes/i960-dis.c +++ b/opcodes/i960-dis.c @@ -824,7 +824,7 @@ ea (bfd_vma memaddr, int mode, const char *reg2, const char *reg3, int word1, /* Register Instruction Operand. */ static void -regop (int mode, int spec, int reg, int fp) +regop (int mode, int spec, int fp_reg, int fp) { if (fp) { @@ -832,7 +832,7 @@ regop (int mode, int spec, int reg, int fp) if (mode == 1) { /* FP operand. */ - switch (reg) + switch (fp_reg) { case 0: (*info->fprintf_func) (stream, "fp0"); break; @@ -853,7 +853,7 @@ regop (int mode, int spec, int reg, int fp) else { /* Non-FP register. */ - (*info->fprintf_func) (stream, reg_names[reg]); + (*info->fprintf_func) (stream, reg_names[fp_reg]); } } else @@ -862,15 +862,15 @@ regop (int mode, int spec, int reg, int fp) if (mode == 1) { /* Literal. */ - (*info->fprintf_func) (stream, "%d", reg); + (*info->fprintf_func) (stream, "%d", fp_reg); } else { /* Register. */ if (spec == 0) - (*info->fprintf_func) (stream, reg_names[reg]); + (*info->fprintf_func) (stream, reg_names[fp_reg]); else - (*info->fprintf_func) (stream, "sf%d", reg); + (*info->fprintf_func) (stream, "sf%d", fp_reg); } } } @@ -878,15 +878,15 @@ regop (int mode, int spec, int reg, int fp) /* Register Instruction Destination Operand. */ static void -dstop (int mode, int reg, int fp) +dstop (int mode, int dest_reg, int fp) { /* 'dst' operand can't be a literal. On non-FP instructions, register mode is assumed and "m3" acts as if were "s3"; on FP-instructions, sf registers are not allowed so m3 acts normally. */ if (fp) - regop (mode, 0, reg, fp); + regop (mode, 0, dest_reg, fp); else - regop (0, mode, reg, fp); + regop (0, mode, dest_reg, fp); } static void diff --git a/opcodes/ia64-gen.c b/opcodes/ia64-gen.c index 587fd8a22..eefa81c6a 100644 --- a/opcodes/ia64-gen.c +++ b/opcodes/ia64-gen.c @@ -2697,7 +2697,7 @@ static void print_main_table (void) { struct main_entry *ptr = maintable; - int index = 0; + int tindex = 0; printf ("static const struct ia64_main_table\nmain_table[] = {\n"); while (ptr != NULL) @@ -2718,7 +2718,7 @@ print_main_table (void) ptr->opcode->flags, ptr->completers->num); - ptr->main_index = index++; + ptr->main_index = tindex++; ptr = ptr->next; } diff --git a/opcodes/ia64-opc.c b/opcodes/ia64-opc.c index 7938fbc9f..539fa9b2d 100644 --- a/opcodes/ia64-opc.c +++ b/opcodes/ia64-opc.c @@ -1,5 +1,5 @@ /* ia64-opc.c -- Functions to access the compacted opcode table - Copyright 1999, 2000, 2001, 2003, 2005, 2007 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. Written by Bob Manson of Cygnus Solutions, This file is part of the GNU opcodes library. @@ -718,13 +718,13 @@ ia64_free_opcode (struct ia64_opcode *ent) } const struct ia64_dependency * -ia64_find_dependency (int index) +ia64_find_dependency (int dep_index) { - index = DEP(index); + dep_index = DEP(dep_index); - if (index < 0 - || index >= (int)(sizeof(dependencies) / sizeof(dependencies[0]))) + if (dep_index < 0 + || dep_index >= (int) ARRAY_SIZE (dependencies)) return NULL; - return &dependencies[index]; + return &dependencies[dep_index]; } diff --git a/opcodes/m32c-asm.c b/opcodes/m32c-asm.c index c45d91d43..d5168b2e6 100644 --- a/opcodes/m32c-asm.c +++ b/opcodes/m32c-asm.c @@ -4,7 +4,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. - the resultant file is machine generated, cgen-asm.in isn't - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007, 2008 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of libopcodes. @@ -125,27 +125,26 @@ parse_unsigned8 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { const char *errmsg = 0; - unsigned long value; + unsigned long value = 0; long have_zero = 0; if (strncasecmp (*strp, "%dsp8(", 6) == 0) { enum cgen_parse_operand_result result_type; - bfd_vma value; - const char *errmsg; + bfd_vma val; *strp += 6; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_8, - & result_type, & value); + & result_type, & val); if (**strp != ')') return _("missing `)'"); (*strp) ++; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - { - return _("%dsp8() takes a symbolic address, not a number"); - } + return _("%dsp8() takes a symbolic address, not a number"); + + value = val; *valuep = value; return errmsg; } @@ -222,26 +221,25 @@ parse_signed8 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) { const char *errmsg = 0; - signed long value; + signed long value = 0; if (strncasecmp (*strp, "%hi8(", 5) == 0) { enum cgen_parse_operand_result result_type; - bfd_vma value; - const char *errmsg; + bfd_vma val; *strp += 5; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_M32C_HI8, - & result_type, & value); + & result_type, & val); if (**strp != ')') return _("missing `)'"); (*strp) ++; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - { - value >>= 16; - } + val >>= 16; + + value = val; *valuep = value; return errmsg; } @@ -263,27 +261,26 @@ parse_unsigned16 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { const char *errmsg = 0; - unsigned long value; + unsigned long value = 0; long have_zero = 0; if (strncasecmp (*strp, "%dsp16(", 7) == 0) { enum cgen_parse_operand_result result_type; - bfd_vma value; - const char *errmsg; + bfd_vma val; *strp += 7; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_16, - & result_type, & value); + & result_type, & val); if (**strp != ')') return _("missing `)'"); (*strp) ++; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - { - return _("%dsp16() takes a symbolic address, not a number"); - } + return _("%dsp16() takes a symbolic address, not a number"); + + value = val; *valuep = value; return errmsg; } @@ -323,26 +320,25 @@ parse_signed16 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) { const char *errmsg = 0; - signed long value; + signed long value = 0; if (strncasecmp (*strp, "%lo16(", 6) == 0) { enum cgen_parse_operand_result result_type; - bfd_vma value; - const char *errmsg; + bfd_vma val; *strp += 6; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16, - & result_type, & value); + & result_type, & val); if (**strp != ')') return _("missing `)'"); (*strp) ++; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - { - value &= 0xffff; - } + val &= 0xffff; + + value = val; *valuep = value; return errmsg; } @@ -350,21 +346,20 @@ parse_signed16 (CGEN_CPU_DESC cd, const char **strp, if (strncasecmp (*strp, "%hi16(", 6) == 0) { enum cgen_parse_operand_result result_type; - bfd_vma value; - const char *errmsg; + bfd_vma val; *strp += 6; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16, - & result_type, & value); + & result_type, & val); if (**strp != ')') return _("missing `)'"); (*strp) ++; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - { - value >>= 16; - } + val >>= 16; + + value = val; *valuep = value; return errmsg; } diff --git a/opcodes/m32c-dis.c b/opcodes/m32c-dis.c index 1b912d92b..e78bcd179 100644 --- a/opcodes/m32c-dis.c +++ b/opcodes/m32c-dis.c @@ -210,7 +210,7 @@ print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, }; disassemble_info *info = dis_info; int mask; - int index = 0; + int reg_index = 0; char* comma = ""; if (push) @@ -224,7 +224,7 @@ print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, comma = ","; } - for (index = 1; index <= 7; ++index) + for (reg_index = 1; reg_index <= 7; ++reg_index) { if (push) mask >>= 1; @@ -234,7 +234,7 @@ print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, if (value & mask) { (*info->fprintf_func) (info->stream, "%s%s", comma, - m16c_register_names [index]); + m16c_register_names [reg_index]); comma = ","; } } diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c index 627abcc2a..326e42999 100644 --- a/opcodes/m68k-dis.c +++ b/opcodes/m68k-dis.c @@ -1232,7 +1232,6 @@ print_insn_arg (const char *d, case '2': case '3': { - int val; char *name = 0; FETCH_ARG (5, val); diff --git a/opcodes/maxq-dis.c b/opcodes/maxq-dis.c index d9977ea30..2f82c4d46 100644 --- a/opcodes/maxq-dis.c +++ b/opcodes/maxq-dis.c @@ -1,6 +1,6 @@ /* Instruction printing code for the MAXQ - Copyright 2004, 2005, 2007 Free Software Foundation, Inc. + Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc. Written by Vineet Sharma(vineets@noida.hcltech.com) Inderpreet S.(inderpreetb@noida.hcltech.com) @@ -151,21 +151,21 @@ static char * get_reg_name (unsigned char reg_code, type1 arg_pos) { unsigned char module; - unsigned char index; + unsigned char r_index; int ix = 0; reg_entry const *reg_x; mem_access_syntax const *syntax; mem_access *mem_acc; module = 0; - index = 0; + r_index = 0; module = (reg_code & MASK_LOW_BYTE); - index = (reg_code & MASK_HIGH_BYTE); - index = index >> 4; + r_index = (reg_code & MASK_HIGH_BYTE); + r_index = r_index >> 4; /* Search the system register table. */ for (reg_x = &system_reg_table[0]; reg_x->reg_name != NULL; ++reg_x) - if ((reg_x->Mod_name == module) && (reg_x->Mod_index == index)) + if ((reg_x->Mod_name == module) && (reg_x->Mod_index == r_index)) return reg_x->reg_name; /* Serch pheripheral table. */ @@ -173,7 +173,7 @@ get_reg_name (unsigned char reg_code, type1 arg_pos) { reg_x = &new_reg_table[ix]; - if ((reg_x->Mod_name == module) && (reg_x->Mod_index == index)) + if ((reg_x->Mod_name == module) && (reg_x->Mod_index == r_index)) return reg_x->reg_name; } @@ -195,7 +195,7 @@ get_reg_name (unsigned char reg_code, type1 arg_pos) } memset (unres_reg_name, 0, 20); - sprintf (unres_reg_name, "%01x%01xh", index, module); + sprintf (unres_reg_name, "%01x%01xh", r_index, module); return unres_reg_name; } diff --git a/opcodes/mcore-dis.c b/opcodes/mcore-dis.c index b8ef515a2..39412663e 100644 --- a/opcodes/mcore-dis.c +++ b/opcodes/mcore-dis.c @@ -1,5 +1,5 @@ /* Disassemble Motorola M*Core instructions. - Copyright 1993, 1999, 2000, 2001, 2002, 2005, 2007 + Copyright 1993, 1999, 2000, 2001, 2002, 2005, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -94,7 +94,7 @@ print_insn_mcore (memaddr, info) struct disassemble_info *info; { unsigned char ibytes[4]; - fprintf_ftype fprintf = info->fprintf_func; + fprintf_ftype print_func = info->fprintf_func; void *stream = info->stream; unsigned short inst; const mcore_opcode_info *op; @@ -123,12 +123,12 @@ print_insn_mcore (memaddr, info) break; if (op->name == 0) - (*fprintf) (stream, ".short 0x%04x", inst); + (*print_func) (stream, ".short 0x%04x", inst); else { const char *name = grname[inst & 0x0F]; - (*fprintf) (stream, "%s", op->name); + (*print_func) (stream, "%s", op->name); switch (op->opclass) { @@ -136,42 +136,42 @@ print_insn_mcore (memaddr, info) break; case OT: - (*fprintf) (stream, "\t%d", inst & 0x3); + (*print_func) (stream, "\t%d", inst & 0x3); break; case O1: case JMP: case JSR: - (*fprintf) (stream, "\t%s", name); + (*print_func) (stream, "\t%s", name); break; case OC: - (*fprintf) (stream, "\t%s, %s", name, crname[(inst >> 4) & 0x1F]); + (*print_func) (stream, "\t%s, %s", name, crname[(inst >> 4) & 0x1F]); break; case O1R1: - (*fprintf) (stream, "\t%s, r1", name); + (*print_func) (stream, "\t%s, r1", name); break; case MULSH: case O2: - (*fprintf) (stream, "\t%s, %s", name, grname[(inst >> 4) & 0xF]); + (*print_func) (stream, "\t%s, %s", name, grname[(inst >> 4) & 0xF]); break; case X1: - (*fprintf) (stream, "\tr1, %s", name); + (*print_func) (stream, "\tr1, %s", name); break; case OI: - (*fprintf) (stream, "\t%s, %d", name, ((inst >> 4) & 0x1F) + 1); + (*print_func) (stream, "\t%s, %d", name, ((inst >> 4) & 0x1F) + 1); break; case RM: - (*fprintf) (stream, "\t%s-r15, (r0)", name); + (*print_func) (stream, "\t%s-r15, (r0)", name); break; case RQ: - (*fprintf) (stream, "\tr4-r7, (%s)", name); + (*print_func) (stream, "\tr4-r7, (%s)", name); break; case OB: @@ -183,16 +183,16 @@ print_insn_mcore (memaddr, info) case OMa: case OMb: case OMc: - (*fprintf) (stream, "\t%s, %d", name, (inst >> 4) & 0x1F); + (*print_func) (stream, "\t%s, %d", name, (inst >> 4) & 0x1F); break; case I7: - (*fprintf) (stream, "\t%s, %d", name, (inst >> 4) & 0x7F); + (*print_func) (stream, "\t%s, %d", name, (inst >> 4) & 0x7F); break; case LS: - (*fprintf) (stream, "\t%s, (%s, %d)", grname[(inst >> 8) & 0xF], - name, ((inst >> 4) & 0xF) << isiz[(inst >> 13) & 3]); + (*print_func) (stream, "\t%s, (%s, %d)", grname[(inst >> 8) & 0xF], + name, ((inst >> 4) & 0xF) << isiz[(inst >> 13) & 3]); break; case BR: @@ -202,7 +202,7 @@ print_insn_mcore (memaddr, info) if (inst & 0x400) val |= 0xFFFFFC00; - (*fprintf) (stream, "\t0x%lx", (long)(memaddr + 2 + (val << 1))); + (*print_func) (stream, "\t0x%lx", (long)(memaddr + 2 + (val << 1))); if (strcmp (op->name, "bsr") == 0) { @@ -211,7 +211,7 @@ print_insn_mcore (memaddr, info) if (info->print_address_func && val != 0) { - (*fprintf) (stream, "\t// "); + (*print_func) (stream, "\t// "); info->print_address_func (val, info); } } @@ -222,9 +222,9 @@ print_insn_mcore (memaddr, info) { long val; val = (inst & 0x000F); - (*fprintf) (stream, "\t%s, 0x%lx", - grname[(inst >> 4) & 0xF], - (long) (memaddr - (val << 1))); + (*print_func) (stream, "\t%s, 0x%lx", + grname[(inst >> 4) & 0xF], + (long) (memaddr - (val << 1))); } break; @@ -249,12 +249,12 @@ print_insn_mcore (memaddr, info) | (ibytes[2] << 8) | (ibytes[3]); /* Removed [] around literal value to match ABI syntax 12/95. */ - (*fprintf) (stream, "\t%s, 0x%lX", grname[(inst >> 8) & 0xF], val); + (*print_func) (stream, "\t%s, 0x%lX", grname[(inst >> 8) & 0xF], val); if (val == 0) - (*fprintf) (stream, "\t// from address pool at 0x%lx", - (long) (memaddr + 2 - + ((inst & 0xFF) << 2)) & 0xFFFFFFFC); + (*print_func) (stream, "\t// from address pool at 0x%lx", + (long) (memaddr + 2 + + ((inst & 0xFF) << 2)) & 0xFFFFFFFC); } break; @@ -279,18 +279,18 @@ print_insn_mcore (memaddr, info) | (ibytes[2] << 8) | (ibytes[3]); /* Removed [] around literal value to match ABI syntax 12/95. */ - (*fprintf) (stream, "\t0x%lX", val); + (*print_func) (stream, "\t0x%lX", val); /* For jmpi/jsri, we'll try to get a symbol for the target. */ if (info->print_address_func && val != 0) { - (*fprintf) (stream, "\t// "); + (*print_func) (stream, "\t// "); info->print_address_func (val, info); } else { - (*fprintf) (stream, "\t// from address pool at 0x%lx", - (long) (memaddr + 2 - + ((inst & 0xFF) << 2)) & 0xFFFFFFFC); + (*print_func) (stream, "\t// from address pool at 0x%lx", + (long) (memaddr + 2 + + ((inst & 0xFF) << 2)) & 0xFFFFFFFC); } } break; @@ -302,13 +302,13 @@ print_insn_mcore (memaddr, info) "ee", "ee,ie", "ee,fe", "ee,fe,ie" }; - (*fprintf) (stream, "\t%s", fields[inst & 0x7]); + (*print_func) (stream, "\t%s", fields[inst & 0x7]); } break; default: /* If the disassembler lags the instruction set. */ - (*fprintf) (stream, "\tundecoded operands, inst is 0x%04x", inst); + (*print_func) (stream, "\tundecoded operands, inst is 0x%04x", inst); break; } } diff --git a/opcodes/mep-asm.c b/opcodes/mep-asm.c index 294db360a..40ef82bf3 100644 --- a/opcodes/mep-asm.c +++ b/opcodes/mep-asm.c @@ -633,7 +633,7 @@ expand_macro (arg *args, int narg, macro *mac) char *result = 0, *rescanned_result = 0; char *e = mac->expansion; char *mark = e; - int arg = 0; + int mac_arg = 0; /* printf("expanding macro %s with %d args\n", mac->name, narg + 1); */ while (*e) @@ -644,9 +644,9 @@ expand_macro (arg *args, int narg, macro *mac) ((*(e + 1) - '1') <= narg)) { result = str_append (result, mark, e - mark); - arg = (*(e + 1) - '1'); - /* printf("replacing `%d with %s\n", arg+1, args[arg].start); */ - result = str_append (result, args[arg].start, args[arg].len); + mac_arg = (*(e + 1) - '1'); + /* printf("replacing `%d with %s\n", mac_arg+1, args[mac_arg].start); */ + result = str_append (result, args[mac_arg].start, args[mac_arg].len); ++e; mark = e+1; } @@ -678,8 +678,7 @@ expand_string (const char *in, int first_only) arg args[MAXARGS]; int state = IN_TEXT; const char *mark = in; - macro *macro = 0; - + macro *pmacro = NULL; char *expansion = 0; char *result = 0; @@ -690,18 +689,18 @@ expand_string (const char *in, int first_only) case IN_TEXT: if (*in == '%' && *(in + 1) && (!first_only || num_expansions == 0)) { - macro = lookup_macro (in + 1); - if (macro) + pmacro = lookup_macro (in + 1); + if (pmacro) { /* printf("entering state %d at '%s'...\n", state, in); */ result = str_append (result, mark, in - mark); mark = in; - in += 1 + strlen (macro->name); + in += 1 + strlen (pmacro->name); while (*in == ' ') ++in; if (*in != '(') { state = IN_TEXT; - macro = 0; + pmacro = NULL; } else { @@ -727,10 +726,10 @@ expand_string (const char *in, int first_only) case ')': state = IN_TEXT; /* printf("entering state %d at '%s'...\n", state, in); */ - if (macro) + if (pmacro) { expansion = 0; - expansion = expand_macro (args, narg, macro); + expansion = expand_macro (args, narg, pmacro); num_expansions++; if (expansion) { @@ -742,7 +741,7 @@ expand_string (const char *in, int first_only) { result = str_append (result, mark, in - mark); } - macro = 0; + pmacro = NULL; mark = in + 1; break; case '(': diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c index b4723c20e..1bbeeaddc 100644 --- a/opcodes/microblaze-dis.c +++ b/opcodes/microblaze-dis.c @@ -186,7 +186,7 @@ read_insn_microblaze (bfd_vma memaddr, int print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) { - fprintf_ftype fprintf = info->fprintf_func; + fprintf_ftype print_func = info->fprintf_func; void * stream = info->stream; unsigned long inst, prev_inst; struct op_code_struct * op, *pop; @@ -227,19 +227,19 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) prev_insn_vma = curr_insn_vma; if (op->name == NULL) - fprintf (stream, ".short 0x%04x", inst); + print_func (stream, ".short 0x%04x", inst); else { - fprintf (stream, "%s", op->name); + print_func (stream, "%s", op->name); switch (op->inst_type) { case INST_TYPE_RD_R1_R2: - fprintf (stream, "\t%s, %s, %s", get_field_rd (inst), + print_func (stream, "\t%s, %s, %s", get_field_rd (inst), get_field_r1(inst), get_field_r2 (inst)); break; case INST_TYPE_RD_R1_IMM: - fprintf (stream, "\t%s, %s, %s", get_field_rd (inst), + print_func (stream, "\t%s, %s, %s", get_field_rd (inst), get_field_r1(inst), get_field_imm (inst)); if (info->print_address_func && get_int_field_r1 (inst) == 0 && info->symbol_at_address_func) @@ -254,37 +254,37 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) } if (immval > 0 && info->symbol_at_address_func (immval, info)) { - fprintf (stream, "\t// "); + print_func (stream, "\t// "); info->print_address_func (immval, info); } } break; case INST_TYPE_RD_R1_IMM5: - fprintf (stream, "\t%s, %s, %s", get_field_rd (inst), + print_func (stream, "\t%s, %s, %s", get_field_rd (inst), get_field_r1(inst), get_field_imm5 (inst)); break; case INST_TYPE_RD_RFSL: - fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_rfsl (inst)); + print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_rfsl (inst)); break; case INST_TYPE_R1_RFSL: - fprintf (stream, "\t%s, %s", get_field_r1 (inst), get_field_rfsl (inst)); + print_func (stream, "\t%s, %s", get_field_r1 (inst), get_field_rfsl (inst)); break; case INST_TYPE_RD_SPECIAL: - fprintf (stream, "\t%s, %s", get_field_rd (inst), + print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_special (inst, op)); break; case INST_TYPE_SPECIAL_R1: - fprintf (stream, "\t%s, %s", get_field_special (inst, op), + print_func (stream, "\t%s, %s", get_field_special (inst, op), get_field_r1(inst)); break; case INST_TYPE_RD_R1: - fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_r1 (inst)); + print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_r1 (inst)); break; case INST_TYPE_R1_R2: - fprintf (stream, "\t%s, %s", get_field_r1 (inst), get_field_r2 (inst)); + print_func (stream, "\t%s, %s", get_field_r1 (inst), get_field_r2 (inst)); break; case INST_TYPE_R1_IMM: - fprintf (stream, "\t%s, %s", get_field_r1 (inst), get_field_imm (inst)); + print_func (stream, "\t%s, %s", get_field_r1 (inst), get_field_imm (inst)); /* The non-pc relative instructions are returns, which shouldn't have a label printed. */ if (info->print_address_func && op->inst_offset_type == INST_PC_OFFSET @@ -301,18 +301,18 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) immval += memaddr; if (immval > 0 && info->symbol_at_address_func (immval, info)) { - fprintf (stream, "\t// "); + print_func (stream, "\t// "); info->print_address_func (immval, info); } else { - fprintf (stream, "\t\t// "); - fprintf (stream, "%x", immval); + print_func (stream, "\t\t// "); + print_func (stream, "%x", immval); } } break; case INST_TYPE_RD_IMM: - fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_imm (inst)); + print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_imm (inst)); if (info->print_address_func && info->symbol_at_address_func) { if (immfound) @@ -327,13 +327,13 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) immval += (int) memaddr; if (info->symbol_at_address_func (immval, info)) { - fprintf (stream, "\t// "); + print_func (stream, "\t// "); info->print_address_func (immval, info); } } break; case INST_TYPE_IMM: - fprintf (stream, "\t%s", get_field_imm (inst)); + print_func (stream, "\t%s", get_field_imm (inst)); if (info->print_address_func && info->symbol_at_address_func && op->instr != imm) { @@ -349,41 +349,41 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) immval += (int) memaddr; if (immval > 0 && info->symbol_at_address_func (immval, info)) { - fprintf (stream, "\t// "); + print_func (stream, "\t// "); info->print_address_func (immval, info); } else if (op->inst_offset_type == INST_PC_OFFSET) { - fprintf (stream, "\t\t// "); - fprintf (stream, "%x", immval); + print_func (stream, "\t\t// "); + print_func (stream, "%x", immval); } } break; case INST_TYPE_RD_R2: - fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_r2 (inst)); + print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_r2 (inst)); break; case INST_TYPE_R2: - fprintf (stream, "\t%s", get_field_r2 (inst)); + print_func (stream, "\t%s", get_field_r2 (inst)); break; case INST_TYPE_R1: - fprintf (stream, "\t%s", get_field_r1 (inst)); + print_func (stream, "\t%s", get_field_r1 (inst)); break; case INST_TYPE_RD_R1_SPECIAL: - fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_r2 (inst)); + print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_r2 (inst)); break; case INST_TYPE_RD_IMM15: - fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_imm15 (inst)); + print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_imm15 (inst)); break; /* For tuqula instruction */ case INST_TYPE_RD: - fprintf (stream, "\t%s", get_field_rd (inst)); + print_func (stream, "\t%s", get_field_rd (inst)); break; case INST_TYPE_RFSL: - fprintf (stream, "\t%s", get_field_rfsl (inst)); + print_func (stream, "\t%s", get_field_rfsl (inst)); break; default: /* If the disassembler lags the instruction set. */ - fprintf (stream, "\tundecoded operands, inst is 0x%04x", inst); + print_func (stream, "\tundecoded operands, inst is 0x%04x", inst); break; } } @@ -418,7 +418,7 @@ get_insn_microblaze (long inst, } enum microblaze_instr -microblaze_decode_insn (long insn, int *rd, int *ra, int *rb, int *imm) +microblaze_decode_insn (long insn, int *rd, int *ra, int *rb, int *immed) { enum microblaze_instr op; bfd_boolean t1; @@ -430,7 +430,7 @@ microblaze_decode_insn (long insn, int *rd, int *ra, int *rb, int *imm) *ra = (insn & RA_MASK) >> RA_LOW; *rb = (insn & RB_MASK) >> RB_LOW; t3 = (insn & IMM_MASK) >> IMM_LOW; - *imm = (int) t3; + *immed = (int) t3; return (op); } diff --git a/opcodes/mmix-dis.c b/opcodes/mmix-dis.c index 9ca845f6e..22db268af 100644 --- a/opcodes/mmix-dis.c +++ b/opcodes/mmix-dis.c @@ -73,7 +73,7 @@ static bfd_boolean initialize_mmix_dis_info (struct disassemble_info *info) { struct mmix_dis_info *minfop = malloc (sizeof (struct mmix_dis_info)); - int i; + long i; if (minfop == NULL) return FALSE; @@ -98,7 +98,6 @@ initialize_mmix_dis_info (struct disassemble_info *info) long symsize = bfd_get_symtab_upper_bound (abfd); asymbol **syms = malloc (symsize); long nsyms; - long i; if (syms == NULL) { @@ -125,7 +124,7 @@ initialize_mmix_dis_info (struct disassemble_info *info) for (i = 0; i < 256; i++) if (minfop->reg_name[i] == NULL) { - sprintf (minfop->basic_reg_name[i], "$%d", i); + sprintf (minfop->basic_reg_name[i], "$%ld", i); minfop->reg_name[i] = minfop->basic_reg_name[i]; } diff --git a/opcodes/ns32k-dis.c b/opcodes/ns32k-dis.c index e96bdf447..ed6e16507 100644 --- a/opcodes/ns32k-dis.c +++ b/opcodes/ns32k-dis.c @@ -1,6 +1,6 @@ /* Print National Semiconductor 32000 instructions. - Copyright 1986, 1988, 1991, 1992, 1994, 1998, 2001, 2002, 2005, 2007 - Free Software Foundation, Inc. + Copyright 1986, 1988, 1991, 1992, 1994, 1998, 2001, 2002, 2005, 2007, + 2009 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -466,7 +466,6 @@ print_insn_arg (int d, int Ivalue; int addr_mode; int disp1, disp2; - int index; int size; switch (d) @@ -616,17 +615,17 @@ print_insn_arg (int d, case 0x1d: case 0x1e: case 0x1f: - /* Scaled index basemode[R0 -- R7:B,W,D,Q]. */ - index = bit_extract (buffer, index_offset - 8, 3); - print_insn_arg (d, index_offset, aoffsetp, buffer, addr, - result, 0); { + int bit_index; static const char *ind = "bwdq"; char *off; - + + /* Scaled index basemode[R0 -- R7:B,W,D,Q]. */ + bit_index = bit_extract (buffer, index_offset - 8, 3); + print_insn_arg (d, index_offset, aoffsetp, buffer, addr, + result, 0); off = result + strlen (result); - sprintf (off, "[r%d:%c]", index, - ind[addr_mode & 3]); + sprintf (off, "[r%d:%c]", bit_index, ind[addr_mode & 3]); } break; } diff --git a/opcodes/or32-opc.c b/opcodes/or32-opc.c index 24ab5cf28..ff624e7a8 100644 --- a/opcodes/or32-opc.c +++ b/opcodes/or32-opc.c @@ -345,7 +345,7 @@ const unsigned int or32_num_opcodes = ((sizeof(or32_opcodes)) / (sizeof(struct o /* Calculates instruction length in bytes. Always 4 for OR32. */ int -insn_len (int insn_index ATTRIBUTE_UNUSED) +insn_len (int i_index ATTRIBUTE_UNUSED) { return 4; } @@ -409,10 +409,10 @@ insn_index (char *insn) } const char * -insn_name (int index) +insn_name (int op_index) { - if (index >= 0 && index < (int) or32_num_opcodes) - return or32_opcodes[index].name; + if (op_index >= 0 && op_index < (int) or32_num_opcodes) + return or32_opcodes[op_index].name; else return "???"; } @@ -985,12 +985,12 @@ or32_print_immediate (char param_ch, char *encoding, unsigned long insn) int disassemble_insn (unsigned long insn) { - int index; - index = insn_decode (insn); + int op_index; + op_index = insn_decode (insn); - if (index >= 0) + if (op_index >= 0) { - struct or32_opcode const *opcode = &or32_opcodes[index]; + struct or32_opcode const *opcode = &or32_opcodes[op_index]; char *s; sprintf (disassembled, "%s ", opcode->name); diff --git a/opcodes/s390-dis.c b/opcodes/s390-dis.c index 986e4b50c..b9eeb7976 100644 --- a/opcodes/s390-dis.c +++ b/opcodes/s390-dis.c @@ -196,8 +196,6 @@ print_insn_s390 (bfd_vma memaddr, struct disassemble_info *info) separator = 0; for (opindex = opcode->operands; *opindex != 0; opindex++) { - unsigned int value; - operand = s390_operands + *opindex; value = s390_extract_operand (buffer, operand); diff --git a/opcodes/sh64-dis.c b/opcodes/sh64-dis.c index edb738211..60963e7fc 100644 --- a/opcodes/sh64-dis.c +++ b/opcodes/sh64-dis.c @@ -195,8 +195,6 @@ print_insn_shmedia (bfd_vma memaddr, struct disassemble_info *info) can get as .byte:s. */ if (status != 0) { - int i; - for (i = 0; i < 3; i++) { status = info->read_memory_func (memaddr + i, insn, 1, info); diff --git a/opcodes/spu-dis.c b/opcodes/spu-dis.c index eae950323..3e6a7620f 100644 --- a/opcodes/spu-dis.c +++ b/opcodes/spu-dis.c @@ -53,7 +53,7 @@ init_spu_disassemble (void) static const struct spu_opcode * get_index_for_opcode (unsigned int insn) { - const struct spu_opcode *index; + const struct spu_opcode *op_index; unsigned int opcode = insn >> (32-11); /* Init the table. This assumes that element 0/opcode 0 (currently @@ -61,28 +61,28 @@ get_index_for_opcode (unsigned int insn) if (spu_disassemble_table[0] == 0) init_spu_disassemble (); - if ((index = spu_disassemble_table[opcode & 0x780]) != 0 - && index->insn_type == RRR) - return index; + if ((op_index = spu_disassemble_table[opcode & 0x780]) != 0 + && op_index->insn_type == RRR) + return op_index; - if ((index = spu_disassemble_table[opcode & 0x7f0]) != 0 - && (index->insn_type == RI18 || index->insn_type == LBT)) - return index; + if ((op_index = spu_disassemble_table[opcode & 0x7f0]) != 0 + && (op_index->insn_type == RI18 || op_index->insn_type == LBT)) + return op_index; - if ((index = spu_disassemble_table[opcode & 0x7f8]) != 0 - && index->insn_type == RI10) - return index; + if ((op_index = spu_disassemble_table[opcode & 0x7f8]) != 0 + && op_index->insn_type == RI10) + return op_index; - if ((index = spu_disassemble_table[opcode & 0x7fc]) != 0 - && (index->insn_type == RI16)) - return index; + if ((op_index = spu_disassemble_table[opcode & 0x7fc]) != 0 + && (op_index->insn_type == RI16)) + return op_index; - if ((index = spu_disassemble_table[opcode & 0x7fe]) != 0 - && (index->insn_type == RI8)) - return index; + if ((op_index = spu_disassemble_table[opcode & 0x7fe]) != 0 + && (op_index->insn_type == RI8)) + return op_index; - if ((index = spu_disassemble_table[opcode & 0x7ff]) != 0) - return index; + if ((op_index = spu_disassemble_table[opcode & 0x7ff]) != 0) + return op_index; return 0; } @@ -97,7 +97,7 @@ print_insn_spu (bfd_vma memaddr, struct disassemble_info *info) int hex_value; int status; unsigned int insn; - const struct spu_opcode *index; + const struct spu_opcode *op_index; enum spu_insns tag; status = (*info->read_memory_func) (memaddr, buffer, 4, info); @@ -109,9 +109,9 @@ print_insn_spu (bfd_vma memaddr, struct disassemble_info *info) insn = bfd_getb32 (buffer); - index = get_index_for_opcode (insn); + op_index = get_index_for_opcode (insn); - if (index == 0) + if (op_index == 0) { (*info->fprintf_func) (info->stream, ".long 0x%x", insn); } @@ -119,8 +119,8 @@ print_insn_spu (bfd_vma memaddr, struct disassemble_info *info) { int i; int paren = 0; - tag = (enum spu_insns)(index - spu_opcodes); - (*info->fprintf_func) (info->stream, "%s", index->mnemonic); + tag = (enum spu_insns)(op_index - spu_opcodes); + (*info->fprintf_func) (info->stream, "%s", op_index->mnemonic); if (tag == M_BI || tag == M_BISL || tag == M_IRET || tag == M_BISLED || tag == M_BIHNZ || tag == M_BIHZ || tag == M_BINZ || tag == M_BIZ || tag == M_SYNC || tag == M_HBR) @@ -133,12 +133,12 @@ print_insn_spu (bfd_vma memaddr, struct disassemble_info *info) if (fb & 0x10) (*info->fprintf_func) (info->stream, "e"); } - if (index->arg[0] != 0) + if (op_index->arg[0] != 0) (*info->fprintf_func) (info->stream, "\t"); hex_value = 0; - for (i = 1; i <= index->arg[0]; i++) + for (i = 1; i <= op_index->arg[0]; i++) { - int arg = index->arg[i]; + int arg = op_index->arg[i]; if (arg != A_P && !paren && i > 1) (*info->fprintf_func) (info->stream, ","); diff --git a/opcodes/tic30-dis.c b/opcodes/tic30-dis.c index d4ece4087..c6d0e3ed7 100644 --- a/opcodes/tic30-dis.c +++ b/opcodes/tic30-dis.c @@ -275,7 +275,7 @@ get_indirect_operand (unsigned short fragment, static int cnvt_tmsfloat_ieee (unsigned long tmsfloat, int size, float *ieeefloat) { - unsigned long exp, sign, mant; + unsigned long exponent, sign, mant; union { unsigned long l; @@ -292,16 +292,16 @@ cnvt_tmsfloat_ieee (unsigned long tmsfloat, int size, float *ieeefloat) tmsfloat = (long) tmsfloat >> 4; } } - exp = tmsfloat & 0xFF000000; - if (exp == 0x80000000) + exponent = tmsfloat & 0xFF000000; + if (exponent == 0x80000000) { *ieeefloat = 0.0; return 1; } - exp += 0x7F000000; + exponent += 0x7F000000; sign = (tmsfloat & 0x00800000) << 8; mant = tmsfloat & 0x007FFFFF; - if (exp == 0xFF000000) + if (exponent == 0xFF000000) { if (mant == 0) *ieeefloat = ERANGE; @@ -318,18 +318,18 @@ cnvt_tmsfloat_ieee (unsigned long tmsfloat, int size, float *ieeefloat) #endif return 1; } - exp >>= 1; + exponent >>= 1; if (sign) { mant = (~mant) & 0x007FFFFF; mant += 1; - exp += mant & 0x00800000; - exp &= 0x7F800000; + exponent += mant & 0x00800000; + exponent &= 0x7F800000; mant &= 0x007FFFFF; } if (tmsfloat == 0x80000000) - sign = mant = exp = 0; - tmsfloat = sign | exp | mant; + sign = mant = exponent = 0; + tmsfloat = sign | exponent | mant; val.l = tmsfloat; *ieeefloat = val.f; return 1; -- 2.11.4.GIT