#include "sysdep.h"
#include "libbfd.h"
-#include <a.out.sun4.h>
-#include "libaout.h"
+#include "aout/sun4.h"
+#include "libaout.h" /* BFD a.out internal data structures */
-#include "aout64.h"
-#include "stab.gnu.h"
-#include "ar.h"
+#include "aout/aout64.h"
+#include "aout/stab_gnu.h"
+#include "aout/ar.h"
/*
The file @code{aoutf1.h} contains the code for BFD's
switch (N_MACHTYPE (*exec_hdr (abfd))) {
case M_UNKNOWN:
- arch = bfd_arch_unknown;
- machine = 0;
+ /* Some Sun3s make magic numbers without cpu types in them, so
+ we'll default to the 68020. */
+ arch = bfd_arch_m68k;
+ machine = 68020;
break;
case M_68010:
}
-static boolean
-DEFUN(sunos_mkobject,(abfd),
- bfd *abfd)
-{
- if (NAME(aout,mkobject)(abfd) == false)
- return false;
- adata(abfd)->page_size = PAGE_SIZE;
-#ifdef SEGMENT_SIZE
- adata(abfd)->page_size = SEGMENT_SIZE;
-#else
- adata(abfd)->segment_size = PAGE_SIZE;
-#endif
- adata(abfd)->exec_bytes_size = EXEC_BYTES_SIZE;
- return true;
-}
-
/* Write an object file in SunOS format.
Section contents have already been written. We write the
file header, symbols, and relocation. */
-boolean
+static boolean
DEFUN(NAME(aout,sunos4_write_object_contents),
(abfd),
bfd *abfd)
sizeof (struct internal_exec)) == 0) ? true : false;
}
\f
-/* 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 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 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_bfd_debug_info_start bfd_void
+#define MY_bfd_debug_info_end bfd_void
+#define MY_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
+#define MY_object_p NAME(sunos,object_p)
+#define MY_core_file_p sunos4_core_file_p
+#define MY_write_object_contents NAME(aout,sunos4_write_object_contents)
+#define TARGET_IS_BIG_ENDIAN_P
-
-/* We implement these routines ourselves, rather than using the generic
-a.out versions. */
-#define aout_write_object_contents sunos4_write_object_contents
-
-bfd_target VECNAME =
- {
- TARGETNAME,
- bfd_target_aout_flavour,
- 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, sunos_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"
#include "bout.h"
-#include "stab.gnu.h"
+#include "aout/stab_gnu.h"
#include "libaout.h" /* BFD a.out internal data structures */
-/* Align an address by rounding it up to a power of two. It leaves the
- address unchanged if align == 0 (2^0 = alignment of 1 byte) */
-#define i960_align(addr, align) \
- ( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
-
-
PROTO (static boolean, b_out_squirt_out_relocs,(bfd *abfd, asection *section));
PROTO (static bfd_target *, b_out_callback, (bfd *));
obj_textsec (abfd)->vma = execp->a_tload;
obj_datasec (abfd)->vma = execp->a_dload;
bss_start = execp->a_dload + execp->a_data; /* BSS = end of data section */
- obj_bsssec (abfd)->vma = i960_align (bss_start, execp->a_balign);
+ obj_bsssec (abfd)->vma = align_power (bss_start, execp->a_balign);
/* The file positions of the sections */
obj_textsec (abfd)->filepos = N_TXTOFF(*execp);
obj_textsec (abfd)->rel_filepos = N_TROFF(*execp);
obj_datasec (abfd)->rel_filepos = N_DROFF(*execp);
+ adata(abfd)->page_size = 1; /* Not applicable. */
+ adata(abfd)->segment_size = 1; /* Not applicable. */
+ adata(abfd)->exec_bytes_size = EXEC_BYTES_SIZE;
+
return abfd->xvec;
}
bfd_seek (abfd, (long)(asect->rel_filepos), SEEK_SET);
count = reloc_size / sizeof (struct relocation_info);
- relocs = (struct relocation_info *) malloc (reloc_size);
+ relocs = (struct relocation_info *) bfd_xmalloc (reloc_size);
if (!relocs) {
bfd_error = no_memory;
return false;
}
- reloc_cache = (arelent *) malloc ((count+1) * sizeof (arelent));
+ reloc_cache = (arelent *) bfd_xmalloc ((count+1) * sizeof (arelent));
if (!reloc_cache) {
free ((char*)relocs);
bfd_error = no_memory;
int extern_mask, pcrel_mask, len_2, callj_mask;
if (count == 0) return true;
generic = section->orelocation;
- native = ((struct relocation_info *) malloc (natsize));
+ native = ((struct relocation_info *) bfd_xmalloc (natsize));
if (!native) {
bfd_error = no_memory;
return false;
/* Build the transfer vectors for Big and Little-Endian B.OUT files. */
/* We don't have core files. */
-#define aout_32_core_file_failing_command _bfd_dummy_core_file_failing_command
-#define aout_32_core_file_failing_signal _bfd_dummy_core_file_failing_signal
+#define aout_32_core_file_failing_command _bfd_dummy_core_file_failing_command
+#define aout_32_core_file_failing_signal _bfd_dummy_core_file_failing_signal
#define aout_32_core_file_matches_executable_p \
_bfd_dummy_core_file_matches_executable_p