diff options
author | obrien <obrien@FreeBSD.org> | 2004-06-16 05:45:41 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2004-06-16 05:45:41 +0000 |
commit | 2504df11e1275f63f4c53377bf91eee996360cb5 (patch) | |
tree | 04848ae93445e503c4190ca1748abe15eabc9e11 /contrib/binutils/bfd/netbsd-core.c | |
parent | 6b4c52b743ec5e2e9f65d42b517feefad5017901 (diff) | |
download | FreeBSD-src-2504df11e1275f63f4c53377bf91eee996360cb5.zip FreeBSD-src-2504df11e1275f63f4c53377bf91eee996360cb5.tar.gz |
Import of Binutils from the FSF 2.15 branch (just post-.0 release).
These bits are taken from the FSF anoncvs repo on 23-May-2004 04:41:00 UTC.
Diffstat (limited to 'contrib/binutils/bfd/netbsd-core.c')
-rw-r--r-- | contrib/binutils/bfd/netbsd-core.c | 105 |
1 files changed, 66 insertions, 39 deletions
diff --git a/contrib/binutils/bfd/netbsd-core.c b/contrib/binutils/bfd/netbsd-core.c index 2787c46..84f2ad7 100644 --- a/contrib/binutils/bfd/netbsd-core.c +++ b/contrib/binutils/bfd/netbsd-core.c @@ -1,6 +1,6 @@ /* BFD back end for NetBSD style core files Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001, - 2002 + 2002, 2003, 2004 Free Software Foundation, Inc. Written by Paul Kranenburg, EUR @@ -34,22 +34,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ * FIXME: On NetBSD/sparc CORE_FPU_OFFSET should be (sizeof (struct trapframe)) */ +/* Offset of StackGhost cookie within `struct md_coredump' on + OpenBSD/sparc. */ +#define CORE_WCOOKIE_OFFSET 344 + struct netbsd_core_struct { struct core core; } *rawptr; /* forward declarations */ -static const bfd_target *netbsd_core_file_p PARAMS ((bfd *abfd)); -static char *netbsd_core_file_failing_command PARAMS ((bfd *abfd)); -static int netbsd_core_file_failing_signal PARAMS ((bfd *abfd)); -static boolean netbsd_core_file_matches_executable_p +static const bfd_target *netbsd_core_file_p + PARAMS ((bfd *abfd)); +static char *netbsd_core_file_failing_command + PARAMS ((bfd *abfd)); +static int netbsd_core_file_failing_signal + PARAMS ((bfd *abfd)); +static bfd_boolean netbsd_core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); -static void swap_abort PARAMS ((void)); +static void swap_abort + PARAMS ((void)); /* Handle NetBSD-style core dump file. */ -/* ARGSUSED */ static const bfd_target * netbsd_core_file_p (abfd) bfd *abfd; @@ -136,6 +143,25 @@ netbsd_core_file_p (abfd) asect->filepos = offset; asect->alignment_power = 2; + if (CORE_GETMID (core) == M_SPARC_NETBSD + && CORE_GETFLAG (coreseg) == CORE_CPU + && coreseg.c_size > CORE_WCOOKIE_OFFSET) + { + /* Truncate the .reg section. */ + asect->_raw_size = CORE_WCOOKIE_OFFSET; + + /* And create the .wcookie section. */ + asect = bfd_make_section_anyway (abfd, ".wcookie"); + if (asect == NULL) + goto punt; + + asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS; + asect->_raw_size = 4; + asect->vma = 0; + asect->filepos = offset + CORE_WCOOKIE_OFFSET; + asect->alignment_power = 2; + } + offset += coreseg.c_size; #ifdef CORE_FPU_OFFSET @@ -175,7 +201,6 @@ netbsd_core_file_failing_command (abfd) return abfd->tdata.netbsd_core_data->core.c_name; } -/* ARGSUSED */ static int netbsd_core_file_failing_signal (abfd) bfd *abfd; @@ -184,13 +209,12 @@ netbsd_core_file_failing_signal (abfd) return abfd->tdata.netbsd_core_data->core.c_signo; } -/* ARGSUSED */ -static boolean +static bfd_boolean netbsd_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; bfd *exec_bfd ATTRIBUTE_UNUSED; { - return true; /* FIXME, We have no way of telling at this point */ + return TRUE; /* FIXME, We have no way of telling at this point */ } /* If somebody calls any byte-swapping routines, shoot them. */ @@ -199,10 +223,13 @@ swap_abort () { abort (); /* This way doesn't require any declaration for ANSI to fuck up */ } -#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) -#define NO_SIGNED_GET \ - ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) + +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) +#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort) +#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort) +#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort) const bfd_target netbsd_core_vec = { @@ -217,39 +244,39 @@ const bfd_target netbsd_core_vec = 0, /* symbol prefix */ ' ', /* ar_pad_char */ 16, /* ar_max_namelen */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */ + NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data. */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data. */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data. */ + NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs. */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs. */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs. */ { /* bfd_check_format */ - _bfd_dummy_target, /* unknown format */ - _bfd_dummy_target, /* object file */ - _bfd_dummy_target, /* archive */ - netbsd_core_file_p /* a core file */ + _bfd_dummy_target, /* unknown format */ + _bfd_dummy_target, /* object file */ + _bfd_dummy_target, /* archive */ + netbsd_core_file_p /* a core file */ }, { /* bfd_set_format */ - bfd_false, bfd_false, - bfd_false, bfd_false + bfd_false, bfd_false, + bfd_false, bfd_false }, { /* bfd_write_contents */ - bfd_false, bfd_false, - bfd_false, bfd_false + bfd_false, bfd_false, + bfd_false, bfd_false }, - BFD_JUMP_TABLE_GENERIC (_bfd_generic), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (netbsd), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), - BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), - BFD_JUMP_TABLE_WRITE (_bfd_generic), - BFD_JUMP_TABLE_LINK (_bfd_nolink), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (netbsd), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, (PTR) 0 /* backend_data */ -}; + }; |