Change defn of LOCAL_LABEL_PREFIX to ""
[deliverable/binutils-gdb.git] / bfd / nlm32-sparc.c
index 5626a86611900e5e0ac7e0965e933667b9c114bd..095b8bf892359adf2b0567247fde8459f6e0bb02 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for 32-bit SPARC NLM (NetWare Loadable Module)
-   Copyright (C) 1993 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -15,7 +15,7 @@ GNU General Public License for more details.
 
 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -44,8 +44,8 @@ static boolean nlm_sparc_write_external
 enum reloc_type
   {
     R_SPARC_NONE = 0,
-    R_SPARC_8,         R_SPARC_16,             R_SPARC_32, 
-    R_SPARC_DISP8,     R_SPARC_DISP16,         R_SPARC_DISP32, 
+    R_SPARC_8,         R_SPARC_16,             R_SPARC_32,
+    R_SPARC_DISP8,     R_SPARC_DISP16,         R_SPARC_DISP32,
     R_SPARC_WDISP30,   R_SPARC_WDISP22,
     R_SPARC_HI22,      R_SPARC_22,
     R_SPARC_13,                R_SPARC_LO10,
@@ -78,7 +78,7 @@ static CONST char *CONST reloc_type_names[] =
 };
 #endif
 
-static reloc_howto_type nlm32_sparc_howto_table[] = 
+static reloc_howto_type nlm32_sparc_howto_table[] =
 {
   HOWTO(R_SPARC_NONE,    0,0, 0,false,0,complain_overflow_dont,    0,"R_SPARC_NONE",    false,0,0x00000000,true),
   HOWTO(R_SPARC_8,       0,0, 8,false,0,complain_overflow_bitfield,0,"R_SPARC_8",       false,0,0x000000ff,true),
@@ -118,12 +118,12 @@ struct nlm32_sparc_reloc_ext {
 static boolean
 nlm_sparc_read_reloc (abfd, sym, secp, rel)
      bfd *abfd;
-     nlmNAME(symbol_type) *sym;
+     nlmNAME(symbol_type) *sym ATTRIBUTE_UNUSED;
      asection **secp;
      arelent *rel;
 {
   bfd_vma val, addend;
-  int index;
+  unsigned int index;
   unsigned int type;
   struct nlm32_sparc_reloc_ext tmp_reloc;
   asection *code_sec, *data_sec;
@@ -145,7 +145,7 @@ nlm_sparc_read_reloc (abfd, sym, secp, rel)
   rel->howto = NULL;
 
   for (index = 0;
-       index < sizeof(nlm32_sparc_howto_table) / sizeof(reloc_howto_type);
+       index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
        index++)
     if (nlm32_sparc_howto_table[index].type == type) {
       rel->howto = &nlm32_sparc_howto_table[index];
@@ -170,13 +170,12 @@ nlm_sparc_write_reloc (abfd, sec, rel)
 {
   bfd_vma val;
   struct nlm32_sparc_reloc_ext tmp_reloc;
-  int index;
+  unsigned int index;
   int type = -1;
   reloc_howto_type *tmp;
 
-  
   for (index = 0;
-       index < sizeof (nlm32_sparc_howto_table) / sizeof(reloc_howto_type);
+       index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
        index++) {
     tmp = &nlm32_sparc_howto_table[index];
 
@@ -192,7 +191,7 @@ nlm_sparc_write_reloc (abfd, sec, rel)
     }
   }
   if (type == -1)
-    abort();
+    abort ();
 
   /*
    * Netware wants a list of relocs for each address.
@@ -219,12 +218,10 @@ nlm_sparc_write_reloc (abfd, sec, rel)
 #endif
   bfd_put_32 (abfd, val, tmp_reloc.offset);
   bfd_put_32 (abfd, rel->addend, tmp_reloc.addend);
-  bfd_put_8 (abfd, (short)(rel->howto->type), tmp_reloc.type);
+  bfd_put_8 (abfd, (short) (rel->howto->type), tmp_reloc.type);
 
   if (bfd_write (&tmp_reloc, 12, 1, abfd) != 12)
-    {
-      abort();
-    }
+    return false;
 
   return true;
 }
@@ -234,11 +231,11 @@ nlm_sparc_write_reloc (abfd, sec, rel)
 
 static boolean
 nlm_sparc_mangle_relocs (abfd, sec, data, offset, count)
-     bfd *abfd;
-     asection *sec;
-     PTR data;
-     bfd_vma offset;
-     bfd_size_type count;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
+     bfd_vma offset ATTRIBUTE_UNUSED;
+     bfd_size_type count ATTRIBUTE_UNUSED;
 {
   return true;
 }
@@ -254,60 +251,54 @@ nlm_sparc_read_import (abfd, sym)
   bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */
   unsigned char symlength;             /* length of symbol name */
   char *name;
-  
+
   /*
    * First, read in the number of relocation
    * entries for this symbol
    */
   if (bfd_read ((PTR) temp, 4, 1, abfd) != 4)
     return false;
-  
+
   rcount = bfd_get_32 (abfd, temp);
-  
+
   /*
    * Next, read in the length of the symbol
    */
-  
+
   if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd)
       != sizeof (symlength))
     return false;
   sym -> symbol.the_bfd = abfd;
   name = bfd_alloc (abfd, symlength + 1);
   if (name == NULL)
-    {
-      bfd_set_error (bfd_error_no_memory);
-      return false;
-    }
-  
+    return false;
+
   /*
    * Then read in the symbol
    */
-  
+
   if (bfd_read (name, symlength, 1, abfd) != symlength)
     return false;
   name[symlength] = '\0';
   sym -> symbol.name = name;
   sym -> symbol.flags = 0;
   sym -> symbol.value = 0;
-  sym -> symbol.section = &bfd_und_section;
-  
+  sym -> symbol.section = bfd_und_section_ptr;
+
   /*
    * Next, start reading in the relocs.
    */
-  
+
   nlm_relocs = ((struct nlm_relent *)
                bfd_alloc (abfd, rcount * sizeof (struct nlm_relent)));
   if (!nlm_relocs)
-    {
-      bfd_set_error (bfd_error_no_memory);
-      return false;
-    }
+    return false;
   sym -> relocs = nlm_relocs;
   sym -> rcnt = 0;
   while (sym -> rcnt < rcount)
     {
       asection *section;
-      
+
       if (nlm_sparc_read_reloc (abfd, sym, &section,
                              &nlm_relocs -> reloc)
          == false)
@@ -348,9 +339,11 @@ nlm_sparc_write_import (abfd, sec, rel)
           __FUNCTION__, base + (*rel->sym_ptr_ptr)->value);
 #endif
   bfd_put_32 (abfd, base + (*rel->sym_ptr_ptr)->value, temp);
-  bfd_write ((PTR)temp, 4, 1, abfd);
+  if (bfd_write ((PTR)temp, 4, 1, abfd) != 4)
+    return false;
   bfd_put_32 (abfd, 1, temp);
-  bfd_write ((PTR)temp, 4, 1, abfd);
+  if (bfd_write ((PTR)temp, 4, 1, abfd) != 4)
+    return false;
   if (nlm_sparc_write_reloc (abfd, sec, rel) == false)
     return false;
   return true;
@@ -365,16 +358,16 @@ nlm_sparc_write_external (abfd, count, sym, relocs)
      asymbol *sym;
      struct reloc_and_sec *relocs;
 {
-  int i;
+  unsigned int i;
   bfd_byte len;
   unsigned char temp[NLM_TARGET_LONG_SIZE];
 
   bfd_put_32 (abfd, count, temp);
-  if (bfd_write (temp, sizeof(temp), 1, abfd) != sizeof (temp))
+  if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
     return false;
 
   len = strlen (sym->name);
-  if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof(bfd_byte))
+  if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte))
       || bfd_write (sym->name, len, 1, abfd) != len)
     return false;
 
This page took 0.028582 seconds and 4 git commands to generate.