X-Git-Url: https://repo.jachan.dev/binutils.git/blobdiff_plain/fb3be09b66b5ae3bd4e59a8b4d11ba61beb8fa98..96ad107bcc9a8adb87dc4ce233b0d17c5e61db96:/bfd/aoutf1.h diff --git a/bfd/aoutf1.h b/bfd/aoutf1.h index 2ced6eb9c6..b5dcecfdda 100644 --- a/bfd/aoutf1.h +++ b/bfd/aoutf1.h @@ -1,5 +1,5 @@ -/* A.out "format 1" file handling code - Copyright (C) 1990-1991 Free Software Foundation, Inc. +/* A.out "format 1" file handling code for BFD. + Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -18,16 +18,25 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include #include "bfd.h" -#include "libaout.h" +#include "sysdep.h" #include "libbfd.h" -#include "aout64.h" -#include "stab.gnu.h" -#include "ar.h" +#include "aout/sun4.h" +#include "libaout.h" /* BFD a.out internal data structures */ + +#include "aout/aout64.h" +#include "aout/stab_gnu.h" +#include "aout/ar.h" + +/* This is needed to reject a NewsOS file, e.g. in + gdb/testsuite/gdb.t10/crossload.exp. + I needed to add M_UNKNOWN to recognize a 68000 object, so this will + probably no longer reject a NewsOS object. . */ +#define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \ + || (mtype) == M_68010 \ + || (mtype) == M_68020 \ + || (mtype) == M_SPARC) /* The file @code{aoutf1.h} contains the code for BFD's @@ -51,152 +60,206 @@ The name put into the target vector. */ -void (*bfd_error_trap)(); - -static bfd_target *sunos4_callback (); - /*SUPPRESS558*/ /*SUPPRESS529*/ -bfd_target * -DEFUN(NAME(sunos,object_p), (abfd), - bfd *abfd) -{ - unsigned char magicbuf[4]; /* Raw bytes of magic number from file */ - unsigned long magic; /* Swapped magic number */ - - bfd_error = system_call_error; - - if (bfd_read ((PTR)magicbuf, 1 , 4, abfd) != - sizeof (magicbuf)) - return 0; - magic = bfd_h_get_32 (abfd, magicbuf); - - if (N_BADMAG (*((struct internal_exec *) &magic))) return 0; - - return NAME(aout,some_aout_object_p) (abfd, sunos4_callback); -} - - /* Determine the size of a relocation entry, based on the architecture */ -static void -DEFUN(choose_reloc_size,(abfd), -bfd *abfd) - { - switch (abfd->obj_arch) { - case bfd_arch_sparc: - case bfd_arch_a29k: - obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; - break; - default: - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - break; - } - } - -/* Set parameters about this a.out file that are machine-dependent. - This routine is called from some_aout_object_p just before it returns. */ - -static bfd_target * -sunos4_callback (abfd) - bfd *abfd; +void +DEFUN(NAME(sunos,set_arch_mach), (abfd, machtype), + bfd *abfd AND int machtype) { - struct internal_exec *execp = exec_hdr (abfd); - - WORK_OUT_FILE_POSITIONS(abfd, execp); - /* Determine the architecture and machine type of the object file. */ - switch (N_MACHTYPE (*exec_hdr (abfd))) { - + enum bfd_architecture arch; + long machine; + switch (machtype) { + case M_UNKNOWN: - abfd->obj_arch = bfd_arch_unknown; - abfd->obj_machine = 0; + /* Some Sun3s make magic numbers without cpu types in them, so + we'll default to the 68000. */ + arch = bfd_arch_m68k; + machine = 68000; break; case M_68010: - abfd->obj_arch = bfd_arch_m68k; - abfd->obj_machine = 68010; + case M_HP200: + arch = bfd_arch_m68k; + machine = 68010; break; case M_68020: - abfd->obj_arch = bfd_arch_m68k; - abfd->obj_machine = 68020; + case M_HP300: + arch = bfd_arch_m68k; + machine = 68020; break; case M_SPARC: - abfd->obj_arch = bfd_arch_sparc; - abfd->obj_machine = 0; + arch = bfd_arch_sparc; + machine = 0; break; case M_386: - abfd->obj_arch = bfd_arch_i386; - abfd->obj_machine = 0; + case M_386_DYNIX: + arch = bfd_arch_i386; + machine = 0; break; case M_29K: - abfd->obj_arch = bfd_arch_a29k; - abfd->obj_machine = 0; + arch = bfd_arch_a29k; + machine = 0; break; + case M_HPUX: + arch = bfd_arch_m68k; + machine = 0; + break; + default: - abfd->obj_arch = bfd_arch_obscure; - abfd->obj_machine = 0; + arch = bfd_arch_obscure; + machine = 0; break; } - - choose_reloc_size(abfd); - return abfd->xvec; + bfd_set_arch_mach(abfd, arch, machine); } +#define SET_ARCH_MACH(ABFD, EXEC) \ + NAME(sunos,set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \ + choose_reloc_size(ABFD); + +/* Determine the size of a relocation entry, based on the architecture */ +static void +DEFUN(choose_reloc_size,(abfd), +bfd *abfd) +{ + switch (bfd_get_arch(abfd)) { + case bfd_arch_sparc: + case bfd_arch_a29k: + obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; + break; + default: + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + break; + } +} /* Write an object file in SunOS format. -Section contents have already been written. We write the -file header, symbols, and relocation. */ + Section contents have already been written. We write the + file header, symbols, and relocation. */ -boolean -DEFUN(NAME(aout,sunos4_write_object_contents),(abfd), +static boolean +DEFUN(NAME(aout,sunos4_write_object_contents), + (abfd), bfd *abfd) - - { - bfd_size_type data_pad = 0; - struct external_exec exec_bytes; - struct internal_exec *execp = exec_hdr (abfd); - - - - execp->a_text = obj_textsec (abfd)->size; +{ + struct external_exec exec_bytes; + struct internal_exec *execp = exec_hdr (abfd); - /* Magic number, maestro, please! */ - switch (bfd_get_architecture(abfd)) { - case bfd_arch_m68k: - switch (bfd_get_machine(abfd)) { - case 68010: - N_SET_MACHTYPE(*execp, M_68010); - break; - default: - case 68020: - N_SET_MACHTYPE(*execp, M_68020); - break; - } - break; - case bfd_arch_sparc: - N_SET_MACHTYPE(*execp, M_SPARC); - break; - case bfd_arch_i386: - N_SET_MACHTYPE(*execp, M_386); - break; - case bfd_arch_a29k: - N_SET_MACHTYPE(*execp, M_29K); + /* Magic number, maestro, please! */ + switch (bfd_get_arch(abfd)) { + case bfd_arch_m68k: + switch (bfd_get_mach(abfd)) { + case 68010: + N_SET_MACHTYPE(*execp, M_68010); break; default: - N_SET_MACHTYPE(*execp, M_UNKNOWN); + case 68020: + N_SET_MACHTYPE(*execp, M_68020); + break; } + break; + case bfd_arch_sparc: + N_SET_MACHTYPE(*execp, M_SPARC); + break; + case bfd_arch_i386: + N_SET_MACHTYPE(*execp, M_386); + break; + case bfd_arch_a29k: + N_SET_MACHTYPE(*execp, M_29K); + break; + default: + N_SET_MACHTYPE(*execp, M_UNKNOWN); + } - choose_reloc_size(abfd); + choose_reloc_size(abfd); - /* FIXME */ - N_SET_FLAGS (*execp, 0x1); - - WRITE_HEADERS(abfd, execp); +#if 0 + /* Some tools want this to be 0, some tools want this to be one. + Today, it seems that 0 is the most important setting (PR1927) */ + N_SET_FLAGS (*execp, 0x0); +#else + + /* Fri Jun 11 14:23:31 PDT 1993 + FIXME + Today's optimal setting is 1. This is a pain, since it + reopens 1927. This should be readdressed by creating a new + target for each each supported, giving perhaps sun3/m68k + and sun4/sparc a.out formats. + */ + N_SET_FLAGS (*execp, 1); +#endif + + N_SET_DYNAMIC(*execp, bfd_get_file_flags(abfd) & DYNAMIC); + + /* At least for SunOS, the dynamic symbols and relocs are embedded + in the .text section, and we do not want to write them out with + the symbol table. FIXME: This may be right if there is any other + form of a.out shared libraries. */ + if ((bfd_get_file_flags (abfd) & DYNAMIC) != 0 + && bfd_get_outsymbols (abfd) != (asymbol **) NULL) + { + bfd_size_type i; + asymbol **sym_ptr_ptr; + bfd_size_type count; + arelent **rel_ptr_ptr; + + sym_ptr_ptr = bfd_get_outsymbols (abfd); + count = bfd_get_symcount (abfd); + for (i = 0; i < count; i++, sym_ptr_ptr++) + { + if (((*sym_ptr_ptr)->flags & BSF_DYNAMIC) != 0) + { + /* This assumes that all dynamic symbols follow all + non-dynamic symbols, which is what slurp_symbol_table + does. */ + *sym_ptr_ptr = NULL; + bfd_get_symcount (abfd) = i; + break; + } + } + + if (obj_textsec (abfd)->reloc_count > 0) + { + rel_ptr_ptr = obj_textsec (abfd)->orelocation; + count = obj_textsec (abfd)->reloc_count; + for (i = 0; i < count; i++, rel_ptr_ptr++) + { + if (((*(*rel_ptr_ptr)->sym_ptr_ptr)->flags & BSF_DYNAMIC) != 0) + { + /* This assumes that all relocs against dynamic + symbols follow all relocs against other symbols, + which is what slurp_reloc_table does. */ + *rel_ptr_ptr = NULL; + obj_textsec (abfd)->reloc_count = i; + break; + } + } + } + + if (obj_datasec (abfd)->reloc_count > 0) + { + rel_ptr_ptr = obj_datasec (abfd)->orelocation; + count = obj_datasec (abfd)->reloc_count; + for (i = 0; i < count; i++, rel_ptr_ptr++) + { + if (((*(*rel_ptr_ptr)->sym_ptr_ptr)->flags & BSF_DYNAMIC) != 0) + { + *rel_ptr_ptr = NULL; + obj_datasec (abfd)->reloc_count = i; + break; + } + } + } + } + + WRITE_HEADERS(abfd, execp); return true; } @@ -207,14 +270,14 @@ DEFUN(NAME(aout,sunos4_write_object_contents),(abfd), #define CORE_NAMELEN 16 /* The core structure is taken from the Sun documentation. -Unfortunately, they don't document the FPA structure, or at least I -can't find it easily. Fortunately the core header contains its own -length. So this shouldn't cause problems, except for c_ucode, which -so far we don't use but is easy to find with a little arithmetic. */ + Unfortunately, they don't document the FPA structure, or at least I + can't find it easily. Fortunately the core header contains its own + length. So this shouldn't cause problems, except for c_ucode, which + so far we don't use but is easy to find with a little arithmetic. */ /* But the reg structure can be gotten from the SPARC processor handbook. -This really should be in a GNU include file though so that gdb can use -the same info. */ + This really should be in a GNU include file though so that gdb can use + the same info. */ struct regs { int r_psr; int r_pc; @@ -240,19 +303,19 @@ struct regs { /* Taken from Sun documentation: */ /* FIXME: It's worse than we expect. This struct contains TWO substructs -neither of whose size we know, WITH STUFF IN BETWEEN THEM! We can't -even portably access the stuff in between! */ + neither of whose size we know, WITH STUFF IN BETWEEN THEM! We can't + even portably access the stuff in between! */ struct external_sparc_core { int c_magic; /* Corefile magic number */ int c_len; /* Sizeof (struct core) */ #define SPARC_CORE_LEN 432 int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */ - struct external_exec c_aouthdr; /* A.out header */ - int c_signo; /* Killing signal, if any */ - int c_tsize; /* Text size (bytes) */ - int c_dsize; /* Data size (bytes) */ - int c_ssize; /* Stack size (bytes) */ + struct external_exec c_aouthdr; /* A.out header */ + int c_signo; /* Killing signal, if any */ + int c_tsize; /* Text size (bytes) */ + int c_dsize; /* Data size (bytes) */ + int c_ssize; /* Stack size (bytes) */ char c_cmdname[CORE_NAMELEN + 1]; /* Command name */ double fp_stuff[1]; /* external FPU state (size unknown by us) */ /* The type "double" is critical here, for alignment. @@ -288,12 +351,12 @@ struct internal_sunos_core { int c_len; /* Sizeof (struct core) */ long c_regs_pos; /* file offset of General purpose registers */ int c_regs_size; /* size of General purpose registers */ - struct internal_exec c_aouthdr; /* A.out header */ - int c_signo; /* Killing signal, if any */ - int c_tsize; /* Text size (bytes) */ - int c_dsize; /* Data size (bytes) */ - int c_ssize; /* Stack size (bytes) */ - long c_stacktop; /* Stack top (address) */ + struct internal_exec c_aouthdr; /* A.out header */ + int c_signo; /* Killing signal, if any */ + int c_tsize; /* Text size (bytes) */ + int c_dsize; /* Data size (bytes) */ + int c_ssize; /* Stack size (bytes) */ + bfd_vma c_stacktop; /* Stack top (address) */ char c_cmdname[CORE_NAMELEN + 1]; /* Command name */ long fp_stuff_pos; /* file offset of external FPU state (regs) */ int fp_stuff_size; /* Size of it */ @@ -308,7 +371,7 @@ DEFUN(swapcore_sun3,(abfd, ext, intcore), struct internal_sunos_core *intcore) { struct external_sun3_core *extcore = (struct external_sun3_core *)ext; - + intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_magic); intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_len ); intcore->c_regs_pos = (long) (((struct external_sun3_core *)0)->c_regs); @@ -318,15 +381,16 @@ DEFUN(swapcore_sun3,(abfd, ext, intcore), intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_tsize); intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_dsize); intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_ssize); - bcopy (extcore->c_cmdname, intcore->c_cmdname, sizeof (intcore->c_cmdname)); + memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); intcore->fp_stuff_pos = (long) (((struct external_sun3_core *)0)->fp_stuff); /* FP stuff takes up whole rest of struct, except c_ucode. */ intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - (file_ptr)(((struct external_sun3_core *)0)->fp_stuff); /* Ucode is the last thing in the struct -- just before the end */ - intcore->c_ucode = bfd_h_get_32 (abfd, - intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore); - intcore->c_stacktop = 0x0E000000; /* By experimentation */ + intcore->c_ucode = + bfd_h_get_32 (abfd, + intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore); + intcore->c_stacktop = 0x0E000000; /* By experimentation */ } @@ -348,29 +412,50 @@ DEFUN(swapcore_sparc,(abfd, ext, intcore), intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_tsize); intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_dsize); intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_ssize); - bcopy (extcore->c_cmdname, intcore->c_cmdname, sizeof (intcore->c_cmdname)); + memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); intcore->fp_stuff_pos = (long) (((struct external_sparc_core *)0)->fp_stuff); /* FP stuff takes up whole rest of struct, except c_ucode. */ intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - (file_ptr)(((struct external_sparc_core *)0)->fp_stuff); /* Ucode is the last thing in the struct -- just before the end */ - intcore->c_ucode = bfd_h_get_32 (abfd, - intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore); + intcore->c_ucode = + bfd_h_get_32 (abfd, + intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore); + /* Supposedly the user stack grows downward from the bottom of kernel memory. - Presuming that this remains true, this definition will work. */ -#define SPARC_USRSTACK (-(128*1024*1024)) - intcore->c_stacktop = SPARC_USRSTACK; /* By experimentation */ + Presuming that this remains true, this definition will work. */ + /* Now sun has provided us with another challenge. The value is different + for sparc2 and sparc10 (both running SunOS 4.1.3). We pick one or + the other based on the current value of the stack pointer. This + loses (a) if the stack pointer has been clobbered, or (b) if the stack + is larger than 128 megabytes. + + It's times like these you're glad they're switching to ELF. + + Note that using include files or nlist on /vmunix would be wrong, + because we want the value for this core file, no matter what kind of + machine we were compiled on or are running on. */ +#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000) +#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000) + { + bfd_vma sp = bfd_h_get_32 + (abfd, (unsigned char *)&((struct regs *)&extcore->c_regs[0])->r_o6); + if (sp < SPARC_USRSTACK_SPARC10) + intcore->c_stacktop = SPARC_USRSTACK_SPARC10; + else + intcore->c_stacktop = SPARC_USRSTACK_SPARC2; + } } /* need this cast because ptr is really void * */ -#define core_hdr(bfd) (((struct suncoredata *) (bfd->tdata))->hdr) -#define core_datasec(bfd) (((struct suncoredata *) ((bfd)->tdata))->data_section) -#define core_stacksec(bfd) (((struct suncoredata*)((bfd)->tdata))->stack_section) -#define core_regsec(bfd) (((struct suncoredata *) ((bfd)->tdata))->reg_section) -#define core_reg2sec(bfd) (((struct suncoredata *) ((bfd)->tdata))->reg2_section) +#define core_hdr(bfd) ((bfd)->tdata.sun_core_data) +#define core_datasec(bfd) (core_hdr(bfd)->data_section) +#define core_stacksec(bfd) (core_hdr(bfd)->stack_section) +#define core_regsec(bfd) (core_hdr(bfd)->reg_section) +#define core_reg2sec(bfd) (core_hdr(bfd)->reg2_section) /* These are stored in the bfd's tdata */ -struct suncoredata { +struct sun_core_struct { struct internal_sunos_core *hdr; /* core file header */ asection *data_section; asection *stack_section; @@ -388,13 +473,11 @@ DEFUN(sunos4_core_file_p,(abfd), struct internal_sunos_core *core; char *extcore; struct mergem { - struct suncoredata suncoredata; + struct sun_core_struct suncoredata; struct internal_sunos_core internal_sunos_core; char external_core[1]; } *mergem; - bfd_error = system_call_error; - if (bfd_read ((PTR)longbuf, 1, sizeof (longbuf), abfd) != sizeof (longbuf)) return 0; @@ -411,7 +494,7 @@ DEFUN(sunos4_core_file_p,(abfd), if (core_size > 20000) return 0; - if (bfd_seek (abfd, 0L, false) < 0) return 0; + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0) return 0; mergem = (struct mergem *)bfd_zalloc (abfd, core_size + sizeof (struct mergem)); if (mergem == NULL) { @@ -444,8 +527,8 @@ DEFUN(sunos4_core_file_p,(abfd), return 0; } - set_tdata (abfd, &mergem->suncoredata); - core_hdr (abfd) = core; + abfd->tdata.sun_core_data = &mergem->suncoredata; + abfd->tdata.sun_core_data->hdr = core; /* create the sections. This is raunchy, but bfd_close wants to reclaim them */ @@ -484,15 +567,15 @@ DEFUN(sunos4_core_file_p,(abfd), core_regsec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS; core_reg2sec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS; - core_stacksec (abfd)->size = core->c_ssize; - core_datasec (abfd)->size = core->c_dsize; - core_regsec (abfd)->size = core->c_regs_size; - core_reg2sec (abfd)->size = core->fp_stuff_size; + core_stacksec (abfd)->_raw_size = core->c_ssize; + core_datasec (abfd)->_raw_size = core->c_dsize; + core_regsec (abfd)->_raw_size = core->c_regs_size; + core_reg2sec (abfd)->_raw_size = core->fp_stuff_size; core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize); core_datasec (abfd)->vma = N_DATADDR(core->c_aouthdr); - core_regsec (abfd)->vma = -1; - core_reg2sec (abfd)->vma = -1; + core_regsec (abfd)->vma = 0; + core_reg2sec (abfd)->vma = 0; core_stacksec (abfd)->filepos = core->c_len + core->c_dsize; core_datasec (abfd)->filepos = core->c_len; @@ -519,14 +602,14 @@ DEFUN(sunos4_core_file_p,(abfd), static char *sunos4_core_file_failing_command (abfd) bfd *abfd; { - return core_hdr (abfd)->c_cmdname; + return core_hdr (abfd)->hdr->c_cmdname; } static int DEFUN(sunos4_core_file_failing_signal,(abfd), bfd *abfd) { - return core_hdr (abfd)->c_signo; + return core_hdr (abfd)->hdr->c_signo; } static boolean @@ -539,73 +622,62 @@ DEFUN(sunos4_core_file_matches_executable_p, (core_bfd, exec_bfd), return false; } - return (bcmp ((char *)&core_hdr (core_bfd)->c_aouthdr, - (char *) exec_hdr (exec_bfd), - sizeof (struct internal_exec)) == 0) ? true : false; + return (memcmp ((char *)&((core_hdr (core_bfd)->hdr)->c_aouthdr), + (char *) exec_hdr (exec_bfd), + sizeof (struct internal_exec)) == 0) ? true : false; } - -/* We use BFD generic archive files. */ -#define aout_32_openr_next_archived_file bfd_generic_openr_next_archived_file -#define aout_32_generic_stat_arch_elt bfd_generic_stat_arch_elt -#define aout_32_slurp_armap bfd_slurp_bsd_armap -#define aout_32_slurp_extended_name_table bfd_true -#define aout_32_write_armap bsd_write_armap -#define aout_32_truncate_arname bfd_bsd_truncate_arname -#define aout_32_machine_type sunos_machine_type - -#define aout_32_core_file_failing_command sunos4_core_file_failing_command -#define aout_32_core_file_failing_signal sunos4_core_file_failing_signal -#define aout_32_core_file_matches_executable_p sunos4_core_file_matches_executable_p - - -#define aout_64_openr_next_archived_file bfd_generic_openr_next_archived_file -#define aout_64_generic_stat_arch_elt bfd_generic_stat_arch_elt -#define aout_64_slurp_armap bfd_slurp_bsd_armap -#define aout_64_slurp_extended_name_table bfd_true -#define aout_64_write_armap bsd_write_armap -#define aout_64_truncate_arname bfd_bsd_truncate_arname -#define aout_64_machine_type sunos_machine_type - -#define aout_64_core_file_failing_command sunos4_core_file_failing_command -#define aout_64_core_file_failing_signal sunos4_core_file_failing_signal -#define aout_64_core_file_matches_executable_p sunos4_core_file_matches_executable_p - -#define aout_64_bfd_debug_info_start bfd_void -#define aout_64_bfd_debug_info_end bfd_void -#define aout_64_bfd_debug_info_accumulate bfd_void -#define aout_32_bfd_debug_info_start bfd_void -#define aout_32_bfd_debug_info_end bfd_void -#define aout_32_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void +#define MY_set_sizes sunos4_set_sizes +static boolean +DEFUN (sunos4_set_sizes, (abfd), + bfd *abfd) +{ + switch (bfd_get_arch (abfd)) + { + default: + return false; + case bfd_arch_sparc: + adata(abfd).page_size = 0x2000; + adata(abfd).segment_size = 0x2000; + adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; + return true; + case bfd_arch_m68k: + adata(abfd).page_size = 0x2000; + adata(abfd).segment_size = 0x20000; + adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; + return true; + } +} +#ifndef MY_read_dynamic_symbols +#define MY_read_dynamic_symbols 0 +#endif +#ifndef MY_read_dynamic_relocs +#define MY_read_dynamic_relocs 0 +#endif + +static CONST struct aout_backend_data sunos4_aout_backend = { + 0, /* zmagic files are not contiguous */ + 1, /* text includes header */ + 0, /* default text vma */ + sunos4_set_sizes, + 0, /* header is counted in zmagic text */ + MY_read_dynamic_symbols, + MY_read_dynamic_relocs +}; + +#define MY_core_file_failing_command sunos4_core_file_failing_command +#define MY_core_file_failing_signal sunos4_core_file_failing_signal +#define MY_core_file_matches_executable_p sunos4_core_file_matches_executable_p +#define MY_bfd_debug_info_start bfd_void +#define MY_bfd_debug_info_end bfd_void +#define MY_bfd_debug_info_accumulate \ + (void (*) PARAMS ((bfd *, struct sec *))) bfd_void +#define MY_core_file_p sunos4_core_file_p +#define MY_write_object_contents NAME(aout,sunos4_write_object_contents) +#define MY_backend_data &sunos4_aout_backend -/* We implement these routines ourselves, rather than using the generic -a.out versions. */ -#define aout_write_object_contents sunos4_write_object_contents +#define TARGET_IS_BIG_ENDIAN_P -bfd_target VECNAME = - { - TARGETNAME, - bfd_target_aout_flavour_enum, - true, /* target byte order */ - true, /* target headers byte order */ - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ - 3, /* minimum alignment power */ - _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */ - _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */ - - {_bfd_dummy_target, NAME(sunos,object_p), - bfd_generic_archive_p, sunos4_core_file_p}, - {bfd_false, NAME(aout,mkobject), - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, NAME(aout,sunos4_write_object_contents), /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - JUMP_TABLE(JNAME(aout)) - }; +#include "aout-target.h"