diff options
Diffstat (limited to 'bfd/i386os9k.c')
-rw-r--r-- | bfd/i386os9k.c | 89 |
1 files changed, 38 insertions, 51 deletions
diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index f825bc6..062f39b 100644 --- a/bfd/i386os9k.c +++ b/bfd/i386os9k.c @@ -1,6 +1,6 @@ /* BFD back-end for os9000 i386 binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002, - 2004, 2005 Free Software Foundation, Inc. + 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -27,22 +27,12 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #include "libaout.h" /* BFD a.out internal data structures */ #include "os9k.h" -static const bfd_target * os9k_callback - PARAMS ((bfd *)); -static const bfd_target * os9k_object_p - PARAMS ((bfd *)); -static int os9k_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); -bfd_boolean os9k_swap_exec_header_in - PARAMS ((bfd *, mh_com *, struct internal_exec *)); - /* Swaps the information in an executable header taken from a raw byte stream memory image, into the internal exec_header structure. */ -bfd_boolean -os9k_swap_exec_header_in (abfd, raw_bytes, execp) - bfd *abfd; - mh_com *raw_bytes; - struct internal_exec *execp; +static bfd_boolean +os9k_swap_exec_header_in (bfd *abfd, + mh_com *raw_bytes, + struct internal_exec *execp) { mh_com *bytes = (mh_com *) raw_bytes; unsigned int dload, dmemsize, dmemstart; @@ -77,44 +67,12 @@ os9k_swap_exec_header_in (abfd, raw_bytes, execp) return TRUE; } -static const bfd_target * -os9k_object_p (abfd) - bfd *abfd; -{ - struct internal_exec anexec; - mh_com exec_bytes; - - if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) MHCOM_BYTES_SIZE, abfd) - != MHCOM_BYTES_SIZE) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync); - if (N_BADMAG (anexec)) - { - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - if (! os9k_swap_exec_header_in (abfd, &exec_bytes, &anexec)) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - return aout_32_some_aout_object_p (abfd, &anexec, os9k_callback); -} - /* Finish up the opening of a b.out file for reading. Fill in all the fields that are not handled by common code. */ static const bfd_target * -os9k_callback (abfd) - bfd *abfd; +os9k_callback (bfd *abfd) { struct internal_exec *execp = exec_hdr (abfd); unsigned long bss_start; @@ -156,10 +114,39 @@ os9k_callback (abfd) return abfd->xvec; } +static const bfd_target * +os9k_object_p (bfd *abfd) +{ + struct internal_exec anexec; + mh_com exec_bytes; + + if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) MHCOM_BYTES_SIZE, abfd) + != MHCOM_BYTES_SIZE) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync); + if (N_BADMAG (anexec)) + { + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + if (! os9k_swap_exec_header_in (abfd, &exec_bytes, &anexec)) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + return aout_32_some_aout_object_p (abfd, &anexec, os9k_callback); +} + static int -os9k_sizeof_headers (ignore_abfd, ignore) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - bfd_boolean ignore ATTRIBUTE_UNUSED; +os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return sizeof (struct internal_exec); } |