* MAINTAINERS: Change my e-mail address.
[deliverable/binutils-gdb.git] / bfd / elfcore.h
index 724d607d3a6773bd5d95e992e597617e439e0599..81c4cff11393682e422117191edcf442af47e40a 100644 (file)
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 char*
-elf_core_file_failing_command (abfd)
-     bfd *abfd;
+elf_core_file_failing_command (bfd *abfd)
 {
   return elf_tdata (abfd)->core_command;
 }
 
 int
-elf_core_file_failing_signal (abfd)
-     bfd *abfd;
+elf_core_file_failing_signal (bfd *abfd)
 {
   return elf_tdata (abfd)->core_signal;
 }
 
 bfd_boolean
-elf_core_file_matches_executable_p (core_bfd, exec_bfd)
-     bfd *core_bfd;
-     bfd *exec_bfd;
+elf_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
 {
   char* corename;
 
@@ -55,7 +51,7 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
 
       execname = execname ? execname + 1 : exec_bfd->filename;
 
-      if (strcmp(execname, corename) != 0)
+      if (strcmp (execname, corename) != 0)
        return FALSE;
     }
 
@@ -74,22 +70,20 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
     floating point registers (.reg2).  */
 
 const bfd_target *
-elf_core_file_p (abfd)
-     bfd *abfd;
+elf_core_file_p (bfd *abfd)
 {
   Elf_External_Ehdr x_ehdr;    /* Elf file header, external form.  */
   Elf_Internal_Ehdr *i_ehdrp;  /* Elf file header, internal form.  */
   Elf_Internal_Phdr *i_phdrp;  /* Elf program header, internal form.  */
   unsigned int phindex;
-  struct elf_backend_data *ebd;
+  const struct elf_backend_data *ebd;
   struct bfd_preserve preserve;
   bfd_size_type amt;
 
   preserve.marker = NULL;
 
   /* Read in the ELF header in external format.  */
-  if (bfd_bread ((PTR) &x_ehdr, (bfd_size_type) sizeof (x_ehdr), abfd)
-      != sizeof (x_ehdr))
+  if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
     {
       if (bfd_get_error () != bfd_error_system_call)
        goto wrong;
@@ -122,15 +116,13 @@ elf_core_file_p (abfd)
       goto wrong;
     }
 
-  /* Give abfd an elf_obj_tdata.  */
-  amt = sizeof (struct elf_obj_tdata);
-  preserve.marker = bfd_zalloc (abfd, amt);
-  if (preserve.marker == NULL)
-    goto fail;
   if (!bfd_preserve_save (abfd, &preserve))
     goto fail;
 
-  elf_tdata (abfd) = preserve.marker;
+  /* Give abfd an elf_obj_tdata.  */
+  if (! (*abfd->xvec->_bfd_set_format[bfd_core]) (abfd))
+    goto fail;
+  preserve.marker = elf_tdata (abfd);
 
   /* Swap in the rest of the header, now that we have the byte order.  */
   i_ehdrp = elf_elfheader (abfd);
@@ -161,11 +153,11 @@ elf_core_file_p (abfd)
 
       for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
        {
-         struct elf_backend_data *back;
+         const struct elf_backend_data *back;
 
          if ((*target_ptr)->flavour != bfd_target_elf_flavour)
            continue;
-         back = (struct elf_backend_data *) (*target_ptr)->backend_data;
+         back = (const struct elf_backend_data *) (*target_ptr)->backend_data;
          if (back->elf_machine_code == i_ehdrp->e_machine
              || (back->elf_machine_alt1 != 0
                  && i_ehdrp->e_machine == back->elf_machine_alt1)
@@ -195,7 +187,7 @@ elf_core_file_p (abfd)
 
   /* Allocate space for the program headers.  */
   amt = sizeof (*i_phdrp) * i_ehdrp->e_phnum;
-  i_phdrp = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
+  i_phdrp = bfd_alloc (abfd, amt);
   if (!i_phdrp)
     goto fail;
 
@@ -206,8 +198,7 @@ elf_core_file_p (abfd)
     {
       Elf_External_Phdr x_phdr;
 
-      if (bfd_bread ((PTR) &x_phdr, (bfd_size_type) sizeof (x_phdr), abfd)
-         != sizeof (x_phdr))
+      if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
        goto fail;
 
       elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);
This page took 0.024601 seconds and 4 git commands to generate.