* section.c (bfd_section_init): Remove unnecessary initialisations.

(bfd_section_list_clear): New function.
	(bfd_section_list_remove, bfd_section_list_insert): New macros.
	(_bfd_strip_section_from_output): Use them.
	* coffcode.h (coff_set_alignment_hook): Likewise.
	* elf32-mips.c (_bfd_mips_elf_final_link): Likewise.
	* elf64-mips.c (mips_elf64_final_link): Likewise.
	* elf64-mmix.c (mmix_elf_final_link): Likewise.
	* sunos.c (sunos_add_dynamic_symbols): Likewise.
	* xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise.
	* bfd-in2.h: Regenerate.

	* netbsd-core.c (netbsd_core_file_p): Use bfd_make_section_anyway
	rather than doing our own section handling.  Clean up after errors
	with bfd_release and bfd_section_list_clear.  Handle unexpected
	flags.
	* aoutf1.h (sunos4_core_file_p): Likewise.
	* aix386-core.c (aix386_core_file_p): Likewise.
	* cisco-core.c (cisco_core_file_validate): Likewise.
	* ptrace-core.c (ptrace_unix_core_file_p): Likewise.
	* trad-core.c (trad_unix_core_file_p): Likewise.

	* hppabsd-core.c (hppabsd_core_core_file_p):  Clean up after errors
	with bfd_release and bfd_section_list_clear.
	* hpux-core.c (hpux_core_core_file_p): Likewise.
	* irix-core.c (irix_core_core_file_p): Likewise.
	* lynx-core.c (lynx_core_file_p): Likewise.
	* osf-core.c (osf_core_core_file_p): Likewise.
	* rs6000-core.c (rs6000coff_core_p): Likewise.
	* sco5-core.c (sco5_core_file_p): Likewise.
This commit is contained in:
Alan Modra
2002-01-05 13:11:33 +00:00
parent 3f0a7f7f73
commit 9e7b37b31f
22 changed files with 402 additions and 340 deletions

View File

@@ -1,5 +1,5 @@
/* BFD back end for SCO5 core files (U-area and raw sections)
Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Jouke Numan <jnuman@hiscom.nl>
This file is part of BFD, the Binary File Descriptor library.
@@ -176,15 +176,15 @@ sco5_core_file_p (abfd)
{
/* Old version, no section heads, read info from user struct */
u = read_uarea(abfd, coffsets.u_user);
u = read_uarea (abfd, coffsets.u_user);
if (! u)
return NULL;
goto fail;
if (!make_bfd_asection (abfd, ".reg", SEC_HAS_CONTENTS,
(bfd_size_type) coffsets.u_usize,
0 - (bfd_vma) u->u_ar0,
(file_ptr) coffsets.u_user))
return NULL;
goto fail;
if (!make_bfd_asection (abfd, ".data",
SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
@@ -192,14 +192,14 @@ sco5_core_file_p (abfd)
+ u->u_exdata.ux_bsize),
(bfd_vma) u->u_exdata.ux_datorg,
(file_ptr) coffsets.u_data))
return NULL;
goto fail;
if (!make_bfd_asection (abfd, ".stack",
SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
(bfd_size_type) u->u_ssize * NBPC,
(bfd_vma) u->u_sub,
(file_ptr) coffsets.u_stack))
return NULL;
goto fail;
return abfd->xvec; /* Done for version 1 */
}
@@ -223,7 +223,7 @@ sco5_core_file_p (abfd)
|| (chead.cs_x.csx_magic != COREMAGIC_NUMBER))
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
goto fail;
}
/* OK, we believe you. You're a core file (sure, sure). */
@@ -237,7 +237,7 @@ sco5_core_file_p (abfd)
!= sizeof chead))
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
goto fail;
}
switch (chead.cs_stype)
@@ -246,15 +246,15 @@ sco5_core_file_p (abfd)
if (chead.cs_x.csx_magic != COREMAGIC_NUMBER)
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
goto fail;
}
secname = NULL;
nsecs++; /* MAGIC not in section cnt!*/
break;
case CORES_UAREA: /* U-area, read in tdata */
u = read_uarea(abfd, chead.cs_sseek);
u = read_uarea (abfd, chead.cs_sseek);
if (! u)
return NULL;
goto fail;
/* This is tricky. As the "register section", we give them
the entire upage and stack. u.u_ar0 points to where
@@ -325,12 +325,20 @@ sco5_core_file_p (abfd)
(bfd_size_type) chead.cs_vsize,
(bfd_vma) chead.cs_vaddr,
(file_ptr) chead.cs_sseek))
return NULL;
goto fail;
}
return abfd->xvec;
fail:
if (abfd->tdata.any)
{
bfd_release (abfd, abfd->tdata.any);
abfd->tdata.any = NULL;
}
bfd_section_list_clear (abfd);
return NULL;
}
char *