* som.c (som_get_symtab_upper_bound): Use "sizeof (asymbol *)"
authorJeff Law <law@redhat.com>
Sat, 26 Feb 1994 00:39:03 +0000 (00:39 +0000)
committerJeff Law <law@redhat.com>
Sat, 26 Feb 1994 00:39:03 +0000 (00:39 +0000)
        not "sizeof (som_symbol_type *)".

        * elfcode.h (elf_get_symtab_upper_bound): Use "sizeof (asymbol *)"
        not "sizeof (asymbol").  Opps.

bfd/ChangeLog
bfd/elfcode.h
bfd/som.c

index 9581f8cf48f87357bd6cf26238d5b97e728bbf2a..e2ac8493d976f9c5a89cae48646ee4d712f9e368 100644 (file)
@@ -1,3 +1,11 @@
+Fri Feb 25 16:35:57 1994  Jeffrey A. Law  (law@snake.cs.utah.edu)
+
+       * som.c (som_get_symtab_upper_bound): Use "sizeof (asymbol *)"
+       not "sizeof (som_symbol_type *)".
+
+       * elfcode.h (elf_get_symtab_upper_bound): Use "sizeof (asymbol *)"
+       not "sizeof (asymbol").  Opps.
+
 Fri Feb 25 13:19:04 1994  Ted Lemon  (mellon@pepper.ncd.com)
 
        * bfd.c (bfd_get_gp_size): Can't return gp value on an archive.
index b515853e7c7f47cf3db3c3dc5d6df83ae57b6d52..b298763eb23469265def21a828974b879aa97560 100644 (file)
@@ -2742,7 +2742,7 @@ DEFUN (elf_get_symtab_upper_bound, (abfd), bfd * abfd)
 
   Elf_Internal_Shdr *hdr = &elf_tdata(abfd)->symtab_hdr;
   symcount = hdr->sh_size / sizeof (Elf_External_Sym);
-  symtab_size = (symcount - 1 + 1) * (sizeof (asymbol));
+  symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *));
 
   return symtab_size;
 }
@@ -3549,6 +3549,7 @@ DEFUN (elf_core_file_p, (abfd), bfd * abfd)
   Elf_External_Phdr x_phdr;    /* Program header table entry, external form */
   Elf_Internal_Phdr *i_phdrp;  /* Program header table, internal form */
   unsigned int phindex;
+  struct elf_backend_data *ebd;
 
   /* Read in the ELF header in external format.  */
 
@@ -3621,6 +3622,35 @@ DEFUN (elf_core_file_p, (abfd), bfd * abfd)
   elf_debug_file (i_ehdrp);
 #endif
 
+  ebd = get_elf_backend_data (abfd);
+
+  /* Check that the ELF e_machine field matches what this particular
+     BFD format expects.  */
+  if (ebd->elf_machine_code != i_ehdrp->e_machine)
+    {
+      bfd_target **target_ptr;
+
+      if (ebd->elf_machine_code != EM_NONE)
+       goto wrong;
+
+      /* This is the generic ELF target.  Let it match any ELF target
+        for which we do not have a specific backend.  */
+      for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
+       {
+         struct elf_backend_data *back;
+
+         if ((*target_ptr)->flavour != bfd_target_elf_flavour)
+           continue;
+         back = (struct elf_backend_data *) (*target_ptr)->backend_data;
+         if (back->elf_machine_code == i_ehdrp->e_machine)
+           {
+             /* target_ptr is an ELF backend which matches this
+                object file, so reject the generic ELF target.  */
+             goto wrong;
+           }
+       }
+    }
+
   /* If there is no program header, or the type is not a core file, then
      we are hosed. */
   if (i_ehdrp->e_phoff == 0 || i_ehdrp->e_type != ET_CORE)
index 4a4fc010961503d366ef40e6a51e8e156b9f5b3f..df78f00c1c850b1866247903e331b9ce3723197b 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -3190,7 +3190,8 @@ som_bfd_derive_misc_symbol_info (abfd, sym, info)
      for undefined or common symbols, but the HP linker will
      choke if it's not set to some "reasonable" value.  We
      use zero as a reasonable value.  */
-  if (sym->section == &bfd_com_section || sym->section == &bfd_und_section)
+  if (sym->section == &bfd_com_section || sym->section == &bfd_und_section
+      || sym->section == &bfd_abs_section)
     info->symbol_info = 0;
   /* For all other symbols, the symbol_info field contains the 
      subspace index of the space this symbol is contained in.  */
@@ -3334,7 +3335,7 @@ som_get_symtab_upper_bound (abfd)
   if (!som_slurp_symbol_table (abfd))
     return 0;
 
-  return (bfd_get_symcount (abfd) + 1) * (sizeof (som_symbol_type *));
+  return (bfd_get_symcount (abfd) + 1) * (sizeof (asymbol *));
 }
 
 /* Convert from a SOM subspace index to a BFD section.  */