Add -Wshadow to the gcc command line options used when compiling the binutils.
[binutils-gdb.git] / bfd / pef.c
index fd52e78c9f10b84b87a264d417b7952ebade2497..788388cbf755ebed932e156be50fa1202968a862 100644 (file)
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -1,12 +1,12 @@
 /* PEF support for BFD.
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
+#include "sysdep.h"
 #include "safe-ctype.h"
 #include "pef.h"
 #include "pef-traceback.h"
 #include "bfd.h"
-#include "sysdep.h"
 #include "libbfd.h"
 #include "libiberty.h"
 
@@ -41,9 +42,6 @@
 #define bfd_pef_bfd_make_debug_symbol               _bfd_nosymbols_bfd_make_debug_symbol
 #define bfd_pef_read_minisymbols                    _bfd_generic_read_minisymbols
 #define bfd_pef_minisymbol_to_symbol                _bfd_generic_minisymbol_to_symbol
-#define bfd_pef_get_reloc_upper_bound               _bfd_norelocs_get_reloc_upper_bound
-#define bfd_pef_canonicalize_reloc                  _bfd_norelocs_canonicalize_reloc
-#define bfd_pef_bfd_reloc_type_lookup               _bfd_norelocs_bfd_reloc_type_lookup
 #define bfd_pef_set_arch_mach                       _bfd_generic_set_arch_mach
 #define bfd_pef_get_section_contents                _bfd_generic_get_section_contents
 #define bfd_pef_set_section_contents                _bfd_generic_set_section_contents
 #define bfd_pef_bfd_is_group_section               bfd_generic_is_group_section
 #define bfd_pef_bfd_discard_group                   bfd_generic_discard_group
 #define bfd_pef_section_already_linked             _bfd_generic_section_already_linked
+#define bfd_pef_bfd_define_common_symbol            bfd_generic_define_common_symbol
 #define bfd_pef_bfd_link_hash_table_create          _bfd_generic_link_hash_table_create
 #define bfd_pef_bfd_link_hash_table_free            _bfd_generic_link_hash_table_free
 #define bfd_pef_bfd_link_add_symbols                _bfd_generic_link_add_symbols
 #define bfd_pef_bfd_link_just_syms                  _bfd_generic_link_just_syms
+#define bfd_pef_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define bfd_pef_bfd_final_link                      _bfd_generic_final_link
 #define bfd_pef_bfd_link_split_section              _bfd_generic_link_split_section
 #define bfd_pef_get_section_contents_in_window      _bfd_generic_get_section_contents_in_window
@@ -99,7 +100,7 @@ bfd_pef_parse_traceback_table (bfd *abfd,
   if (! (table.flags2 & TB_NAME_PRESENT))
     return -1;
 
-  if (! table.flags1 & TB_HAS_TBOFF)
+  if (! (table.flags1 & TB_HAS_TBOFF))
     return -1;
 
   offset = 8;
@@ -188,7 +189,7 @@ bfd_pef_parse_traceback_table (bfd *abfd,
     offset += 4;
 
   if (file != NULL)
-    fprintf (file, " [length = 0x%lx]", (long) offset);
+    fprintf (file, " [length = 0x%lx]", (unsigned long) offset);
 
   return offset;
 }
@@ -362,7 +363,7 @@ bfd_pef_parse_imported_symbol (bfd *abfd ATTRIBUTE_UNUSED,
   BFD_ASSERT (len == 4);
 
   value = bfd_getb32 (buf);
-  symbol->class = value >> 24;
+  symbol->symbol_class = value >> 24;
   symbol->name = value & 0x00ffffff;
 
   return 0;
@@ -729,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;
 
@@ -782,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;
@@ -801,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;
@@ -818,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++)
          {
@@ -1048,7 +1045,7 @@ const bfd_target pef_vec =
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
   BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
   BFD_JUMP_TABLE_SYMBOLS (bfd_pef),
-  BFD_JUMP_TABLE_RELOCS (bfd_pef),
+  BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
   BFD_JUMP_TABLE_WRITE (bfd_pef),
   BFD_JUMP_TABLE_LINK (bfd_pef),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),