2001-08-20 H.J. Lu <hjl@gnu.org>
[deliverable/binutils-gdb.git] / bfd / elf.c
index b06417c5e1dfe46733c800644b1bb5e2923ee20d..79998036d61ed1c2a45655e6dea658ffdfe87b45 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2091,6 +2091,7 @@ elf_map_symbols (abfd)
   if (sect_syms == NULL)
     return false;
   elf_section_syms (abfd) = sect_syms;
+  elf_num_section_syms (abfd) = max_index;
 
   for (idx = 0; idx < symcount; idx++)
     {
@@ -3651,7 +3652,8 @@ _bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr)
        indx = asym_ptr->section->output_section->index;
       else
        indx = asym_ptr->section->index;
-      if (elf_section_syms (abfd)[indx])
+      if (indx < elf_num_section_syms (abfd)
+         && elf_section_syms (abfd)[indx] != NULL)
        asym_ptr->udata.i = elf_section_syms (abfd)[indx]->udata.i;
     }
 
@@ -5343,12 +5345,6 @@ _bfd_elf_rel_vtable_reloc_fn (abfd, re, symbol, data, is, obfd, errmsg)
 # include <sys/procfs.h>
 #endif
 
-/* Define offsetof for those systems which lack it.  */
-
-#ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
-#endif
-
 /* FIXME: this is kinda wrong, but it's what gdb wants.  */
 
 static int
@@ -5996,8 +5992,8 @@ bfd_get_elf_phdrs (abfd, phdrs)
 }
 
 void
-bfd_elf_sprintf_vma (abfd, buf, value)
-     bfd *abfd;
+_bfd_elf_sprintf_vma (abfd, buf, value)
+     bfd *abfd ATTRIBUTE_UNUSED;
      char *buf;
      bfd_vma value;
 {
@@ -6010,12 +6006,14 @@ bfd_elf_sprintf_vma (abfd, buf, value)
   else
     {
       if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
+       {
 #if BFD_HOST_64BIT_LONG
-       sprintf (buf, "%016lx", value);
+         sprintf (buf, "%016lx", value);
 #else
-       sprintf (buf, "%08lx%08lx", _bfd_int64_high (value),
-                _bfd_int64_low (value));
+         sprintf (buf, "%08lx%08lx", _bfd_int64_high (value),
+                  _bfd_int64_low (value));
 #endif
+       }
       else
        sprintf (buf, "%08lx", (unsigned long) (value & 0xffffffff));
     }
@@ -6025,8 +6023,8 @@ bfd_elf_sprintf_vma (abfd, buf, value)
 }
 
 void
-bfd_elf_fprintf_vma (abfd, stream, value)
-     bfd *abfd;
+_bfd_elf_fprintf_vma (abfd, stream, value)
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR stream;
      bfd_vma value;
 {
@@ -6039,12 +6037,14 @@ bfd_elf_fprintf_vma (abfd, stream, value)
   else
     {
       if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
+       {
 #if BFD_HOST_64BIT_LONG
-       fprintf ((FILE *) stream, "%016lx", value);
+         fprintf ((FILE *) stream, "%016lx", value);
 #else
-       fprintf ((FILE *) stream, "%08lx%08lx",
-                _bfd_int64_high (value), _bfd_int64_low (value));
+         fprintf ((FILE *) stream, "%08lx%08lx",
+                  _bfd_int64_high (value), _bfd_int64_low (value));
 #endif
+       }
       else
        fprintf ((FILE *) stream, "%08lx",
                 (unsigned long) (value & 0xffffffff));
This page took 0.024739 seconds and 4 git commands to generate.