More missing core file support changes.
* aix386-core.c (aix386_core_file_p): Return bfd_cleanup.
* aix5ppc-core.c (xcoff64_core_p): Likewise.
* cisco-core.c (cisco_core_file_validate): Likewise.
* hppabsd-core.c (hppabsd_core_core_file_p): Likewise.
* 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.
* netbsd-core.c (netbsd_core_file_p): Likewise.
* osf-core.c (osf_core_core_file_p): Likewise.
* ptrace-core.c (ptrace_unix_core_file_p): Likewise.
* sco5-core.c (sco5_core_file_p): Likewise.
+2020-03-02 Alan Modra <amodra@gmail.com>
+
+ * aix386-core.c (aix386_core_file_p): Return bfd_cleanup.
+ * aix5ppc-core.c (xcoff64_core_p): Likewise.
+ * cisco-core.c (cisco_core_file_validate): Likewise.
+ * hppabsd-core.c (hppabsd_core_core_file_p): Likewise.
+ * 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.
+ * netbsd-core.c (netbsd_core_file_p): Likewise.
+ * osf-core.c (osf_core_core_file_p): Likewise.
+ * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
+ * sco5-core.c (sco5_core_file_p): Likewise.
+
2020-03-02 H.J. Lu <hongjiu.lu@intel.com>
* trad-core.c (trad_unix_core_file_p): Return bfd_cleanup.
asection *sections[MAX_CORE_SEGS];
};
-static const bfd_target *
+static bfd_cleanup
aix386_core_file_p (bfd *abfd)
{
int i, n;
n++;
}
- return abfd->xvec;
+ return _bfd_no_cleanup;
}
static char *
#include "sysdep.h"
#include "bfd.h"
-const bfd_target *xcoff64_core_p (bfd *);
+bfd_cleanup xcoff64_core_p (bfd *);
bfd_boolean xcoff64_core_file_matches_executable_p (bfd *, bfd *);
char *xcoff64_core_file_failing_command (bfd *);
int xcoff64_core_file_failing_signal (bfd *);
#define CHECK_FILE_OFFSET(s, v) \
((bfd_signed_vma)(v) < 0 || (bfd_signed_vma)(v) > (bfd_signed_vma)(s).st_size)
-const bfd_target *
+bfd_cleanup
xcoff64_core_p (bfd *abfd)
{
enum bfd_architecture arch;
bfd_vma ld_offset;
bfd_size_type i;
struct vm_infox vminfo;
- const bfd_target *return_value = NULL;
flagword flags;
/* Get the header. */
{
bfd_set_error (bfd_error_file_truncated);
- return return_value;
+ return NULL;
}
new_core_hdr = bfd_zalloc (abfd, sizeof (struct core_dumpxx));
if (NULL == new_core_hdr)
- return return_value;
+ return NULL;
memcpy (new_core_hdr, &core, sizeof (struct core_dumpxx));
/* The core_hdr() macro is no longer used here because it would
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".stack", flags);
if (NULL == sec)
- return return_value;
+ return NULL;
sec->size = core.c_size;
sec->vma = core.c_stackorg;
flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
sec = bfd_make_section_anyway_with_flags (abfd, ".reg", flags);
if (NULL == sec)
- return return_value;
+ return NULL;
sec->size = sizeof (struct __context64);
sec->vma = 0;
flags = SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".ldinfo", flags);
if (NULL == sec)
- return return_value;
+ return NULL;
sec->size = core.c_lsize;
sec->vma = 0;
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (NULL == sec)
- return return_value;
+ return NULL;
sec->size = core.c_datasize;
sec->vma = core.c_dataorg;
while (1)
{
if (bfd_seek (abfd, ld_offset, SEEK_SET) != 0)
- return return_value;
+ return NULL;
if (sizeof (struct __ld_info64) !=
bfd_bread (&ldinfo, sizeof (struct __ld_info64), abfd))
- return return_value;
+ return NULL;
if (ldinfo.ldinfo_core)
{
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (NULL == sec)
- return return_value;
+ return NULL;
sec->size = ldinfo.ldinfo_datasize;
sec->vma = ldinfo.ldinfo_dataorg;
if (core.c_vmregions)
{
if (bfd_seek (abfd, core.c_vmm, SEEK_SET) != 0)
- return return_value;
+ return NULL;
for (i = 0; i < core.c_vmregions; i++)
if (sizeof (struct vm_infox) !=
bfd_bread (&vminfo, sizeof (struct vm_infox), abfd))
- return return_value;
+ return NULL;
if (vminfo.vminfo_offset)
{
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".vmdata", flags);
if (NULL == sec)
- return return_value;
+ return NULL;
sec->size = vminfo.vminfo_size;
sec->vma = vminfo.vminfo_addr;
mach = DEFAULT_MACHINE;
bfd_default_set_arch_mach (abfd, arch, mach);
- return_value = (bfd_target *) abfd->xvec; /* This is garbage for now. */
+ return _bfd_no_cleanup;
xcoff64_core_p_error:
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
- return return_value;
+ return NULL;
}
/* Return `TRUE' if given core is from the given executable. */
#else /* AIX_5_CORE */
-const bfd_target *
+bfd_cleanup
xcoff64_core_p (bfd *abfd ATTRIBUTE_UNUSED)
{
bfd_set_error (bfd_error_wrong_format);
/* Examine the file for a crash info struct at the offset given by
CRASH_INFO_LOC. */
-static const bfd_target *
+static bfd_cleanup
cisco_core_file_validate (bfd *abfd, int crash_info_loc)
{
char buf[4];
nread = statbuf.st_size - asect->filepos;
asect->size = (nread < 1024) ? nread : 1024;
- return abfd->xvec;
+ return _bfd_no_cleanup;
/* Get here if we have already started filling out the BFD
and there is an error of some kind. */
return asect;
}
-static const bfd_target *
+static bfd_cleanup
hppabsd_core_core_file_p (bfd *abfd)
{
int val;
strncpy (core_command (abfd), u.u_comm, MAXCOMLEN + 1);
core_signal (abfd) = u.u_code;
- return abfd->xvec;
+ return _bfd_no_cleanup;
fail:
bfd_release (abfd, abfd->tdata.any);
in which the core file is generated by some non-hpux application.
(I am just guessing here!)
*/
-static const bfd_target *
+static bfd_cleanup
hpux_core_core_file_p (bfd *abfd)
{
int good_sections = 0;
" As a result, some information may be unavailable.\n",
abfd);
- return abfd->xvec;
+ return _bfd_no_cleanup;
fail:
bfd_release (abfd, core_hdr (abfd));
return asect;
}
-static const bfd_target *
+static bfd_cleanup
irix_core_core_file_p (bfd *abfd)
{
int val;
/* OK, we believe you. You're a core file (sure, sure). */
bfd_default_set_arch_mach (abfd, bfd_arch_mips, 0);
- return abfd->xvec;
+ return _bfd_no_cleanup;
fail:
bfd_release (abfd, core_hdr (abfd));
return asect;
}
-const bfd_target *
+bfd_cleanup
lynx_core_file_p (bfd *abfd)
{
int secnum;
goto fail;
}
- return abfd->xvec;
+ return _bfd_no_cleanup;
fail:
bfd_release (abfd, core_hdr (abfd));
/* Handle NetBSD-style core dump file. */
-static const bfd_target *
+static bfd_cleanup
netbsd_core_file_p (bfd *abfd)
{
int val;
}
/* OK, we believe you. You're a core file (sure, sure). */
- return abfd->xvec;
+ return _bfd_no_cleanup;
punt:
bfd_release (abfd, abfd->tdata.any);
return asect;
}
-static const bfd_target *
+static bfd_cleanup
osf_core_core_file_p (bfd *abfd)
{
int val;
/* OK, we believe you. You're a core file (sure, sure). */
- return abfd->xvec;
+ return _bfd_no_cleanup;
fail:
bfd_release (abfd, core_hdr (abfd));
#define ptrace_unix_core_file_pid _bfd_nocore_core_file_pid
static void swap_abort (void);
-const bfd_target *
+bfd_cleanup
ptrace_unix_core_file_p (bfd *abfd)
{
int val;
core_datasec (abfd)->alignment_power = 2;
core_regsec (abfd)->alignment_power = 2;
- return abfd->xvec;
+ return _bfd_no_cleanup;
fail:
bfd_release (abfd, abfd->tdata.any);
return &rawptr->u;
}
-const bfd_target *
+const bfd_cleanup
sco5_core_file_p (bfd *abfd)
{
int coffset_siz, val, nsecs, cheadoffs;
}
- return abfd->xvec;
+ return _bfd_no_cleanup;
fail:
if (abfd->tdata.any)