* elfcode.h (elf_object_p): Allocate tdata via _bfd_set_format.
authorAlan Modra <amodra@gmail.com>
Tue, 8 Jul 2003 08:08:00 +0000 (08:08 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 8 Jul 2003 08:08:00 +0000 (08:08 +0000)
* elfcore.h (elf_core_file_p): Likewise.
* section.c (bfd_section_init): Remove prototype.

bfd/ChangeLog
bfd/elfcode.h
bfd/elfcore.h
bfd/section.c

index aa0967d..fe29a94 100644 (file)
@@ -1,5 +1,11 @@
 2003-07-08  Alan Modra  <amodra@bigpond.net.au>
 
+       * elfcode.h (elf_object_p): Allocate tdata via _bfd_set_format.
+       * elfcore.h (elf_core_file_p): Likewise.
+       * section.c (bfd_section_init): Remove prototype.
+
+2003-07-08  Alan Modra  <amodra@bigpond.net.au>
+
        * elf-bfd.h (struct elf_link_hash_entry): Remove linker_section_pointer
        field.
        (enum elf_linker_section_enum): Delete.
index 6afaefa..abd7e04 100644 (file)
@@ -570,17 +570,15 @@ elf_object_p (abfd)
       goto got_wrong_format_error;
     }
 
+  if (!bfd_preserve_save (abfd, &preserve))
+    goto got_no_match;
+
   /* Allocate an instance of the elf_obj_tdata structure and hook it up to
      the tdata pointer in the bfd.  */
 
-  amt = sizeof (struct elf_obj_tdata);
-  preserve.marker = bfd_zalloc (abfd, amt);
-  if (preserve.marker == NULL)
+  if (! (*abfd->xvec->_bfd_set_format[bfd_object]) (abfd))
     goto got_no_match;
-  if (!bfd_preserve_save (abfd, &preserve))
-    goto got_no_match;
-
-  elf_tdata (abfd) = preserve.marker;
+  preserve.marker = elf_tdata (abfd);
 
   /* Now that we know the byte order, swap in the rest of the header */
   i_ehdrp = elf_elfheader (abfd);
index 724d607..cd21806 100644 (file)
@@ -122,15 +122,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);
index 020ab01..aaeb0ef 100644 (file)
@@ -705,8 +705,6 @@ bfd_section_hash_newfunc (struct bfd_hash_entry *entry,
 
 /* Initializes a new section.  NEWSECT->NAME is already set.  */
 
-static asection *bfd_section_init PARAMS ((bfd *, asection *));
-
 static asection *
 bfd_section_init (bfd *abfd, asection *newsect)
 {