This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
(at your option) any later version.
This program is distributed in the hope that it will be useful,
(at your option) any later version.
This program is distributed in the hope that it will be useful,
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+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 *);
+
-const bfd_target * xcoff64_core_p PARAMS ((bfd *));
-boolean xcoff64_core_file_matches_executable_p PARAMS ((bfd *, bfd *));
-char * xcoff64_core_file_failing_command PARAMS ((bfd *));
-int xcoff64_core_file_failing_signal PARAMS ((bfd *));
-
#define core_hdr(abfd) ((struct core_dumpxx *) abfd->tdata.any)
#define CHECK_FILE_OFFSET(s, v) \
((bfd_signed_vma)(v) < 0 || (bfd_signed_vma)(v) > (bfd_signed_vma)(s).st_size)
#define core_hdr(abfd) ((struct core_dumpxx *) abfd->tdata.any)
#define CHECK_FILE_OFFSET(s, v) \
((bfd_signed_vma)(v) < 0 || (bfd_signed_vma)(v) > (bfd_signed_vma)(s).st_size)
/* Get the header. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto xcoff64_core_p_error;
/* Get the header. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto xcoff64_core_p_error;
- if (sizeof (struct core_dumpxx)
- != bfd_read (&core, sizeof (struct core_dumpxx), 1, abfd))
+ if (sizeof (struct core_dumpxx)
+ != bfd_bread (&core, sizeof (struct core_dumpxx), abfd))
See rs6000-core.c for comment on size of core
If there isn't enough of a real core file, bail. */
See rs6000-core.c for comment on size of core
If there isn't enough of a real core file, bail. */
- if ((CORE_VERSION_1 != (core.c_flag & CORE_VERSION_1))
- || (0 != core.c_entries)
- || (! (IS_PROC64 (&core.c_u.U_proc)))
- || ((CHECK_FILE_OFFSET (statbuf, core.c_fdsinfox)))
- || ((CHECK_FILE_OFFSET (statbuf, core.c_loader)))
- || ((CHECK_FILE_OFFSET (statbuf, core.c_loader + core.c_lsize)))
- || ((CHECK_FILE_OFFSET (statbuf, core.c_thr)))
- || ((CHECK_FILE_OFFSET (statbuf, core.c_segregion)))
- || ((CHECK_FILE_OFFSET (statbuf, core.c_stack)))
- || ((CHECK_FILE_OFFSET (statbuf, core.c_stack + core.c_size)))
- || ((CHECK_FILE_OFFSET (statbuf, core.c_data)))
- || ((CHECK_FILE_OFFSET (statbuf, core.c_data + core.c_datasize)))
- || (! (core.c_flag & UBLOCK_VALID))
- || (! (core.c_flag & LE_VALID)))
+ if ((CORE_VERSION_1 != (core.c_flag & CORE_VERSION_1))
+ || (0 != core.c_entries)
+ || (! (IS_PROC64 (&core.c_u.U_proc)))
+ || ((CHECK_FILE_OFFSET (statbuf, core.c_fdsinfox)))
+ || ((CHECK_FILE_OFFSET (statbuf, core.c_loader)))
+ || ((CHECK_FILE_OFFSET (statbuf, core.c_loader + core.c_lsize)))
+ || ((CHECK_FILE_OFFSET (statbuf, core.c_thr)))
+ || ((CHECK_FILE_OFFSET (statbuf, core.c_segregion)))
+ || ((CHECK_FILE_OFFSET (statbuf, core.c_stack)))
+ || ((CHECK_FILE_OFFSET (statbuf, core.c_stack + core.c_size)))
+ || ((CHECK_FILE_OFFSET (statbuf, core.c_data)))
+ || ((CHECK_FILE_OFFSET (statbuf, core.c_data + core.c_datasize)))
+ || (! (core.c_flag & UBLOCK_VALID))
+ || (! (core.c_flag & LE_VALID)))
- new_core_hdr = (struct core_dumpxx *)
- bfd_zalloc (abfd, sizeof (struct core_dumpxx));
- if (NULL == new_core_hdr)
- return return_value;
+ new_core_hdr = bfd_zalloc (abfd, sizeof (struct core_dumpxx));
+ if (NULL == new_core_hdr)
+ return NULL;
- core_hdr(abfd) = (char *)new_core_hdr;
+ /* The core_hdr() macro is no longer used here because it would
+ expand to code relying on gcc's cast-as-lvalue extension,
+ which was removed in gcc 4.0. */
+ abfd->tdata.any = new_core_hdr;
- sec = bfd_make_section_anyway (abfd, ".stack");
- if (NULL == sec)
- return return_value;
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".stack", flags);
+ if (NULL == sec)
+ return NULL;
sec->vma = core.c_stackorg;
sec->filepos = core.c_stack;
/* .reg section for all registers. */
sec->vma = core.c_stackorg;
sec->filepos = core.c_stack;
/* .reg section for all registers. */
- sec = bfd_make_section_anyway (abfd, ".reg");
- if (NULL == sec)
- return return_value;
+ flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".reg", flags);
+ if (NULL == sec)
+ return NULL;
sec->vma = 0;
sec->filepos = 0;
sec->contents = (bfd_byte *)&new_core_hdr->c_flt.r64;
/* .ldinfo section.
To actually find out how long this section is in this particular
sec->vma = 0;
sec->filepos = 0;
sec->contents = (bfd_byte *)&new_core_hdr->c_flt.r64;
/* .ldinfo section.
To actually find out how long this section is in this particular
- sec = bfd_make_section_anyway (abfd, ".ldinfo");
+ flags = SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".ldinfo", flags);
sec->vma = 0;
sec->filepos = core.c_loader;
/* AIX 4 adds data sections from loaded objects to the core file,
which can be found by examining ldinfo, and anonymously mmapped
regions. */
sec->vma = 0;
sec->filepos = core.c_loader;
/* AIX 4 adds data sections from loaded objects to the core file,
which can be found by examining ldinfo, and anonymously mmapped
regions. */
- sec = bfd_make_section_anyway (abfd, ".data");
- if (NULL == sec)
- return return_value;
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
+ if (NULL == sec)
+ return NULL;
sec->vma = core.c_dataorg;
sec->filepos = core.c_data;
/* .data sections from loaded objects. */
ld_offset = core.c_loader;
sec->vma = core.c_dataorg;
sec->filepos = core.c_data;
/* .data sections from loaded objects. */
ld_offset = core.c_loader;
- bfd_read (&ldinfo, sizeof (struct __ld_info64), 1, abfd))
- return return_value;
+ bfd_bread (&ldinfo, sizeof (struct __ld_info64), abfd))
+ return NULL;
- sec = bfd_make_section_anyway (abfd, ".data");
- if (NULL == sec)
- return return_value;
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
+ if (NULL == sec)
+ return NULL;
- bfd_read (&vminfo, sizeof (struct vm_infox), 1, abfd))
- return return_value;
+ bfd_bread (&vminfo, sizeof (struct vm_infox), abfd))
+ return NULL;
- sec = bfd_make_section_anyway (abfd, ".vmdata");
- if (NULL == sec)
- return return_value;
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".vmdata", flags);
+ if (NULL == sec)
+ return NULL;
- return_value = abfd->xvec; /* This is garbage for now. */
-
+ /* Set the architecture and machine. */
+ arch = DEFAULT_ARCHITECTURE;
+ mach = DEFAULT_MACHINE;
+ bfd_default_set_arch_mach (abfd, arch, mach);
+
+ return _bfd_no_cleanup;
+
- bfd_read (&core, sizeof (struct core_dumpxx), 1, core_bfd))
+ bfd_bread (&core, sizeof (struct core_dumpxx), core_bfd))
-const bfd_target * xcoff64_core_p PARAMS ((bfd *));
-boolean xcoff64_core_file_matches_executable_p PARAMS ((bfd *, bfd *));
-char * xcoff64_core_file_failing_command PARAMS ((bfd *));
-int xcoff64_core_file_failing_signal PARAMS ((bfd *));
-
-const bfd_target *
-xcoff64_core_p (abfd)
- bfd *abfd ATTRIBUTE_UNUSED;
+bfd_cleanup
+xcoff64_core_p (bfd *abfd ATTRIBUTE_UNUSED)
-boolean
-xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd ATTRIBUTE_UNUSED;
- bfd *exec_bfd ATTRIBUTE_UNUSED;
+bfd_boolean
+xcoff64_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)