From 0c83546ac6ce48331e66584c9119fe258d0d1bfc Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 8 Jul 2003 08:08:00 +0000 Subject: [PATCH] * 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. --- bfd/ChangeLog | 6 ++++++ bfd/elfcode.h | 12 +++++------- bfd/elfcore.h | 10 ++++------ bfd/section.c | 2 -- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index aa0967d151f..fe29a94b948 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2003-07-08 Alan Modra + + * 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 * elf-bfd.h (struct elf_link_hash_entry): Remove linker_section_pointer diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 6afaefa5e07..abd7e0460fc 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -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); diff --git a/bfd/elfcore.h b/bfd/elfcore.h index 724d607d3a6..cd218066dc4 100644 --- a/bfd/elfcore.h +++ b/bfd/elfcore.h @@ -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); diff --git a/bfd/section.c b/bfd/section.c index 020ab01fc55..aaeb0ef5060 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -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) { -- 2.30.2