/* ELF executable support for BFD.
- Copyright 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, from information published
in "UNIX System V Release 4, Programmers Guide: ANSI C and
extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *,
int));
- int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, struct sec *));
-
static long elf_slurp_symbol_table PARAMS ((bfd *, asymbol **, boolean));
static boolean elf_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **));
}
INLINE void
-elf_swap_dyn_in (abfd, src, dst)
+elf_swap_dyn_in (abfd, p, dst)
bfd *abfd;
- const Elf_External_Dyn *src;
+ const PTR p;
Elf_Internal_Dyn *dst;
{
+ const Elf_External_Dyn *src = (const Elf_External_Dyn *) p;
+
dst->d_tag = get_word (abfd, src->d_tag);
dst->d_un.d_val = get_word (abfd, src->d_un.d_val);
}
switch (x_ehdr.e_ident[EI_DATA])
{
case ELFDATA2MSB: /* Big-endian */
- if (!abfd->xvec->header_byteorder_big_p)
+ if (! bfd_header_big_endian (abfd))
goto got_wrong_format_error;
break;
case ELFDATA2LSB: /* Little-endian */
- if (abfd->xvec->header_byteorder_big_p)
+ if (! bfd_header_little_endian (abfd))
goto got_wrong_format_error;
break;
case ELFDATANONE: /* No data encoding specified */
/* Temporarily allocate room for the raw ELF symbols. */
x_symp = ((Elf_External_Sym *)
- malloc (symcount * sizeof (Elf_External_Sym)));
+ bfd_malloc (symcount * sizeof (Elf_External_Sym)));
if (x_symp == NULL && symcount != 0)
- {
- bfd_set_error (bfd_error_no_memory);
- goto error_return;
- }
+ goto error_return;
if (bfd_read ((PTR) x_symp, sizeof (Elf_External_Sym), symcount, abfd)
!= symcount * sizeof (Elf_External_Sym))
&& (asect->reloc_count
== d->rel_hdr.sh_size / d->rel_hdr.sh_entsize));
- allocated = (PTR) malloc ((size_t) d->rel_hdr.sh_size);
+ allocated = (PTR) bfd_malloc ((size_t) d->rel_hdr.sh_size);
if (allocated == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- goto error_return;
- }
+ goto error_return;
if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0
|| (bfd_read (allocated, 1, d->rel_hdr.sh_size, abfd)
elf_swap_symbol_out,
elf_slurp_reloc_table,
elf_slurp_symbol_table,
+ elf_swap_dyn_in
};