2011-06-22 Pedro Alves <pedro@codesourcery.com>
[deliverable/binutils-gdb.git] / bfd / nlm32-sparc.c
index 8d4c54e24bed72068fd2fca8bcac1f50c7a820fc..ba60e44016d7828893d9bdf38a352e1245de6f55 100644 (file)
@@ -1,12 +1,12 @@
 /* Support for 32-bit SPARC NLM (NetWare Loadable Module)
-   Copyright 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-   Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+   2007, 2009, 2010 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "libbfd.h"
 
 #define ARCH_SIZE 32
@@ -92,17 +93,15 @@ 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;
+  asection *code_sec;
 
   if (bfd_bread (&tmp_reloc, (bfd_size_type) 12, abfd) != 12)
     return FALSE;
 
   code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
-  data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
-
   *secp = code_sec;
 
   val = bfd_get_32 (abfd, tmp_reloc.offset);
@@ -113,18 +112,19 @@ 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;
       }
 
 #ifdef DEBUG
-  fprintf (stderr, "%s:  address = %08lx, addend = %08lx, type = %d, howto = %08lx\n",
-          __FUNCTION__, rel->address, rel->addend, type, rel->howto);
+  fprintf (stderr, "%s:  address = %08lx, addend = %08lx, type = %u, howto = %p\n",
+          __FUNCTION__, (unsigned long) rel->address,
+          (unsigned long) rel->addend, type, rel->howto);
 #endif
   return TRUE;
 
@@ -137,15 +137,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
@@ -176,8 +176,9 @@ nlm_sparc_write_reloc (bfd * abfd, asection * sec, arelent * rel)
   val = bfd_get_section_vma (abfd, sec) + rel->address;
 
 #ifdef DEBUG
-  fprintf (stderr, "%s:  val = %08lx, addend = %08lx, type = %d\n",
-          __FUNCTION__, val, rel->addend, rel->howto->type);
+  fprintf (stderr, "%s:  val = %08lx, addend = %08lx, type = %u\n",
+          __FUNCTION__, (unsigned long) val, (unsigned long) rel->addend,
+          rel->howto->type);
 #endif
   bfd_put_32 (abfd, val, tmp_reloc.offset);
   bfd_put_32 (abfd, rel->addend, tmp_reloc.addend);
@@ -280,8 +281,8 @@ nlm_sparc_write_import (bfd * abfd, asection * sec, arelent * rel)
     base = 0;
 
 #ifdef DEBUG
-  fprintf (stderr, "%s:  <%x, 1>\n\t",
-          __FUNCTION__, base + (*rel->sym_ptr_ptr)->value);
+  fprintf (stderr, "%s:  <%lx, 1>\n\t",
+          __FUNCTION__, (unsigned long) (base + (*rel->sym_ptr_ptr)->value));
 #endif
   bfd_put_32 (abfd, base + (*rel->sym_ptr_ptr)->value, temp);
   if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4)
@@ -330,8 +331,8 @@ nlm_sparc_write_export (bfd * abfd, asymbol * sym, bfd_vma value)
   bfd_byte temp[4];
 
 #ifdef DEBUG
-  fprintf (stderr, "%s: <%x, %d, %s>\n",
-          __FUNCTION__, value, strlen (sym->name), sym->name);
+  fprintf (stderr, "%s: <%lx, %u, %s>\n",
+          __FUNCTION__, (unsigned long) value, strlen (sym->name), sym->name);
 #endif
   bfd_put_32 (abfd, value, temp);
   len = strlen (sym->name);
This page took 0.027248 seconds and 4 git commands to generate.