Wed Oct 18 15:53:56 1995 steve chamberlain <sac@slash.cygnus.com>
[deliverable/binutils-gdb.git] / bfd / nlm32-sparc.c
index b7e5543b4d2f2f68bf4c559d9aa07f865d7acb61..5626a86611900e5e0ac7e0965e933667b9c114bd 100644 (file)
@@ -122,9 +122,7 @@ nlm_sparc_read_reloc (abfd, sym, secp, rel)
      asection **secp;
      arelent *rel;
 {
-  bfd_byte temp[4];
   bfd_vma val, addend;
-  const char *name;
   int index;
   unsigned int type;
   struct nlm32_sparc_reloc_ext tmp_reloc;
@@ -255,6 +253,7 @@ nlm_sparc_read_import (abfd, sym)
   bfd_size_type rcount;                        /* number of relocs */
   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
@@ -273,8 +272,8 @@ nlm_sparc_read_import (abfd, sym)
       != sizeof (symlength))
     return false;
   sym -> symbol.the_bfd = abfd;
-  sym -> symbol.name = bfd_alloc (abfd, symlength + 1);
-  if (!sym -> symbol.name)
+  name = bfd_alloc (abfd, symlength + 1);
+  if (name == NULL)
     {
       bfd_set_error (bfd_error_no_memory);
       return false;
@@ -284,9 +283,10 @@ nlm_sparc_read_import (abfd, sym)
    * Then read in the symbol
    */
   
-  if (bfd_read ((PTR) sym -> symbol.name, symlength, 1, abfd)
-      != symlength)
+  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;
This page took 0.023641 seconds and 4 git commands to generate.