1 |
/* A.out "format 1" file handling code for BFD. |
/* A.out "format 1" file handling code for BFD. |
2 |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, |
3 |
2001, 2002 |
2001, 2002, 2003, 2004 |
4 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
5 |
Written by Cygnus Support. |
Written by Cygnus Support. |
6 |
|
|
75 |
#define sunos_write_object_contents aout_32_sunos4_write_object_contents |
#define sunos_write_object_contents aout_32_sunos4_write_object_contents |
76 |
#endif |
#endif |
77 |
|
|
78 |
static boolean sunos_merge_private_bfd_data PARAMS ((bfd *, bfd *)); |
static bfd_boolean sunos_merge_private_bfd_data |
79 |
static void sunos_set_arch_mach PARAMS ((bfd *, enum machine_type)); |
PARAMS ((bfd *, bfd *)); |
80 |
static void choose_reloc_size PARAMS ((bfd *)); |
static void sunos_set_arch_mach |
81 |
static boolean sunos_write_object_contents PARAMS ((bfd *)); |
PARAMS ((bfd *, enum machine_type)); |
82 |
static const bfd_target *sunos4_core_file_p PARAMS ((bfd *)); |
static void choose_reloc_size |
83 |
static char *sunos4_core_file_failing_command PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
84 |
static int sunos4_core_file_failing_signal PARAMS ((bfd *)); |
static bfd_boolean sunos_write_object_contents |
85 |
static boolean sunos4_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); |
PARAMS ((bfd *)); |
86 |
static boolean sunos4_set_sizes PARAMS ((bfd *)); |
static const bfd_target *sunos4_core_file_p |
87 |
|
PARAMS ((bfd *)); |
88 |
|
static char *sunos4_core_file_failing_command |
89 |
|
PARAMS ((bfd *)); |
90 |
|
static int sunos4_core_file_failing_signal |
91 |
|
PARAMS ((bfd *)); |
92 |
|
static bfd_boolean sunos4_core_file_matches_executable_p |
93 |
|
PARAMS ((bfd *, bfd *)); |
94 |
|
static bfd_boolean sunos4_set_sizes |
95 |
|
PARAMS ((bfd *)); |
96 |
|
|
97 |
/* Merge backend data into the output file. |
/* Merge backend data into the output file. |
98 |
This is necessary on sparclet-aout where we want the resultant machine |
This is necessary on sparclet-aout where we want the resultant machine |
100 |
|
|
101 |
#define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data |
#define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data |
102 |
|
|
103 |
static boolean |
static bfd_boolean |
104 |
sunos_merge_private_bfd_data (ibfd, obfd) |
sunos_merge_private_bfd_data (ibfd, obfd) |
105 |
bfd *ibfd, *obfd; |
bfd *ibfd, *obfd; |
106 |
{ |
{ |
107 |
if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour |
if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour |
108 |
|| bfd_get_flavour (obfd) != bfd_target_aout_flavour) |
|| bfd_get_flavour (obfd) != bfd_target_aout_flavour) |
109 |
return true; |
return TRUE; |
110 |
|
|
111 |
if (bfd_get_arch (obfd) == bfd_arch_sparc) |
if (bfd_get_arch (obfd) == bfd_arch_sparc) |
112 |
{ |
{ |
114 |
bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd)); |
bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd)); |
115 |
} |
} |
116 |
|
|
117 |
return true; |
return TRUE; |
118 |
} |
} |
119 |
|
|
120 |
/* This is either sunos_32_set_arch_mach or sunos_64_set_arch_mach, |
/* This is either sunos_32_set_arch_mach or sunos_64_set_arch_mach, |
216 |
aout_64_sunos4_write_object_contents or |
aout_64_sunos4_write_object_contents or |
217 |
aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */ |
aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */ |
218 |
|
|
219 |
static boolean |
static bfd_boolean |
220 |
sunos_write_object_contents (abfd) |
sunos_write_object_contents (abfd) |
221 |
bfd *abfd; |
bfd *abfd; |
222 |
{ |
{ |
273 |
|
|
274 |
WRITE_HEADERS (abfd, execp); |
WRITE_HEADERS (abfd, execp); |
275 |
|
|
276 |
return true; |
return TRUE; |
277 |
} |
} |
278 |
|
|
279 |
/* core files */ |
/* core files */ |
701 |
core_regsec (abfd)->flags = SEC_HAS_CONTENTS; |
core_regsec (abfd)->flags = SEC_HAS_CONTENTS; |
702 |
core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS; |
core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS; |
703 |
|
|
704 |
core_stacksec (abfd)->_raw_size = core->c_ssize; |
core_stacksec (abfd)->size = core->c_ssize; |
705 |
core_datasec (abfd)->_raw_size = core->c_dsize; |
core_datasec (abfd)->size = core->c_dsize; |
706 |
core_regsec (abfd)->_raw_size = core->c_regs_size; |
core_regsec (abfd)->size = core->c_regs_size; |
707 |
core_reg2sec (abfd)->_raw_size = core->fp_stuff_size; |
core_reg2sec (abfd)->size = core->fp_stuff_size; |
708 |
|
|
709 |
core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize); |
core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize); |
710 |
core_datasec (abfd)->vma = core->c_data_addr; |
core_datasec (abfd)->vma = core->c_data_addr; |
740 |
return core_hdr (abfd)->hdr->c_signo; |
return core_hdr (abfd)->hdr->c_signo; |
741 |
} |
} |
742 |
|
|
743 |
static boolean |
static bfd_boolean |
744 |
sunos4_core_file_matches_executable_p (core_bfd, exec_bfd) |
sunos4_core_file_matches_executable_p (core_bfd, exec_bfd) |
745 |
bfd *core_bfd; |
bfd *core_bfd; |
746 |
bfd *exec_bfd; |
bfd *exec_bfd; |
748 |
if (core_bfd->xvec != exec_bfd->xvec) |
if (core_bfd->xvec != exec_bfd->xvec) |
749 |
{ |
{ |
750 |
bfd_set_error (bfd_error_system_call); |
bfd_set_error (bfd_error_system_call); |
751 |
return false; |
return FALSE; |
752 |
} |
} |
753 |
|
|
754 |
/* Solaris core files do not include an aouthdr. */ |
/* Solaris core files do not include an aouthdr. */ |
755 |
if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN) |
if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN) |
756 |
return true; |
return TRUE; |
757 |
|
|
758 |
return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr), |
return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr), |
759 |
(char *) exec_hdr (exec_bfd), |
(char *) exec_hdr (exec_bfd), |
761 |
} |
} |
762 |
|
|
763 |
#define MY_set_sizes sunos4_set_sizes |
#define MY_set_sizes sunos4_set_sizes |
764 |
static boolean |
static bfd_boolean |
765 |
sunos4_set_sizes (abfd) |
sunos4_set_sizes (abfd) |
766 |
bfd *abfd; |
bfd *abfd; |
767 |
{ |
{ |
768 |
switch (bfd_get_arch (abfd)) |
switch (bfd_get_arch (abfd)) |
769 |
{ |
{ |
770 |
default: |
default: |
771 |
return false; |
return FALSE; |
772 |
case bfd_arch_sparc: |
case bfd_arch_sparc: |
773 |
adata (abfd).page_size = 0x2000; |
adata (abfd).page_size = 0x2000; |
774 |
adata (abfd).segment_size = 0x2000; |
adata (abfd).segment_size = 0x2000; |
775 |
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; |
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; |
776 |
return true; |
return TRUE; |
777 |
case bfd_arch_m68k: |
case bfd_arch_m68k: |
778 |
adata (abfd).page_size = 0x2000; |
adata (abfd).page_size = 0x2000; |
779 |
adata (abfd).segment_size = 0x20000; |
adata (abfd).segment_size = 0x20000; |
780 |
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; |
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; |
781 |
return true; |
return TRUE; |
782 |
} |
} |
783 |
} |
} |
784 |
|
|
834 |
#define MY_bfd_debug_info_start bfd_void |
#define MY_bfd_debug_info_start bfd_void |
835 |
#define MY_bfd_debug_info_end bfd_void |
#define MY_bfd_debug_info_end bfd_void |
836 |
#define MY_bfd_debug_info_accumulate \ |
#define MY_bfd_debug_info_accumulate \ |
837 |
(void (*) PARAMS ((bfd *, struct sec *))) bfd_void |
(void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void |
838 |
#define MY_core_file_p sunos4_core_file_p |
#define MY_core_file_p sunos4_core_file_p |
839 |
#define MY_write_object_contents NAME(aout,sunos4_write_object_contents) |
#define MY_write_object_contents NAME(aout,sunos4_write_object_contents) |
840 |
#define MY_backend_data &sunos4_aout_backend |
#define MY_backend_data &sunos4_aout_backend |