00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #define MY(OP) CONCAT2 (sparclynx_aout_,OP)
00029 #define TARGETNAME "a.out-sparc-lynx"
00030
00031 #include "bfd.h"
00032 #include "sysdep.h"
00033 #include "libbfd.h"
00034
00035 #include "aout/sun4.h"
00036 #include "libaout.h"
00037
00038 #include "aout/aout64.h"
00039 #include "aout/stab_gnu.h"
00040 #include "aout/ar.h"
00041
00042 void NAME (lynx,set_arch_mach) PARAMS ((bfd *, unsigned long));
00043 static void choose_reloc_size PARAMS ((bfd *));
00044 static bfd_boolean NAME (aout,sparclynx_write_object_contents) PARAMS ((bfd *));
00045
00046
00047
00048
00049
00050 #define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \
00051 || (mtype) == M_68010 \
00052 || (mtype) == M_68020 \
00053 || (mtype) == M_SPARC)
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 void
00075 NAME(lynx,set_arch_mach) (abfd, machtype)
00076 bfd *abfd;
00077 unsigned long machtype;
00078 {
00079
00080 enum bfd_architecture arch;
00081 unsigned long machine;
00082
00083 switch (machtype)
00084 {
00085 case M_UNKNOWN:
00086
00087
00088 arch = bfd_arch_m68k;
00089 machine = bfd_mach_m68000;
00090 break;
00091
00092 case M_68010:
00093 case M_HP200:
00094 arch = bfd_arch_m68k;
00095 machine = bfd_mach_m68010;
00096 break;
00097
00098 case M_68020:
00099 case M_HP300:
00100 arch = bfd_arch_m68k;
00101 machine = bfd_mach_m68020;
00102 break;
00103
00104 case M_SPARC:
00105 arch = bfd_arch_sparc;
00106 machine = 0;
00107 break;
00108
00109 case M_386:
00110 case M_386_DYNIX:
00111 arch = bfd_arch_i386;
00112 machine = 0;
00113 break;
00114
00115 case M_29K:
00116 arch = bfd_arch_a29k;
00117 machine = 0;
00118 break;
00119
00120 case M_HPUX:
00121 arch = bfd_arch_m68k;
00122 machine = 0;
00123 break;
00124
00125 default:
00126 arch = bfd_arch_obscure;
00127 machine = 0;
00128 break;
00129 }
00130 bfd_set_arch_mach (abfd, arch, machine);
00131 }
00132
00133 #define SET_ARCH_MACH(ABFD, EXEC) \
00134 NAME(lynx,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
00135 choose_reloc_size(ABFD);
00136
00137
00138
00139 static void
00140 choose_reloc_size (abfd)
00141 bfd *abfd;
00142 {
00143 switch (bfd_get_arch (abfd))
00144 {
00145 case bfd_arch_sparc:
00146 case bfd_arch_a29k:
00147 obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
00148 break;
00149 default:
00150 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
00151 break;
00152 }
00153 }
00154
00155
00156
00157
00158
00159 static bfd_boolean
00160 NAME(aout,sparclynx_write_object_contents) (abfd)
00161 bfd *abfd;
00162 {
00163 struct external_exec exec_bytes;
00164 struct internal_exec *execp = exec_hdr (abfd);
00165
00166
00167 switch (bfd_get_arch (abfd))
00168 {
00169 case bfd_arch_m68k:
00170 switch (bfd_get_mach (abfd))
00171 {
00172 case bfd_mach_m68010:
00173 N_SET_MACHTYPE (*execp, M_68010);
00174 break;
00175 default:
00176 case bfd_mach_m68020:
00177 N_SET_MACHTYPE (*execp, M_68020);
00178 break;
00179 }
00180 break;
00181 case bfd_arch_sparc:
00182 N_SET_MACHTYPE (*execp, M_SPARC);
00183 break;
00184 case bfd_arch_i386:
00185 N_SET_MACHTYPE (*execp, M_386);
00186 break;
00187 case bfd_arch_a29k:
00188 N_SET_MACHTYPE (*execp, M_29K);
00189 break;
00190 default:
00191 N_SET_MACHTYPE (*execp, M_UNKNOWN);
00192 }
00193
00194 choose_reloc_size (abfd);
00195
00196 N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
00197
00198 WRITE_HEADERS (abfd, execp);
00199
00200 return TRUE;
00201 }
00202
00203 #define MY_set_sizes sparclynx_set_sizes
00204 static bfd_boolean sparclynx_set_sizes PARAMS ((bfd *));
00205
00206 static bfd_boolean
00207 sparclynx_set_sizes (abfd)
00208 bfd *abfd;
00209 {
00210 switch (bfd_get_arch (abfd))
00211 {
00212 default:
00213 return FALSE;
00214 case bfd_arch_sparc:
00215 adata (abfd).page_size = 0x2000;
00216 adata (abfd).segment_size = 0x2000;
00217 adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
00218 return TRUE;
00219 case bfd_arch_m68k:
00220 adata (abfd).page_size = 0x2000;
00221 adata (abfd).segment_size = 0x20000;
00222 adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
00223 return TRUE;
00224 }
00225 }
00226
00227 static const struct aout_backend_data sparclynx_aout_backend =
00228 {
00229 0, 1, 0, 1, 0, sparclynx_set_sizes, 0,
00230 0,
00231 0,
00232 0,
00233 0,
00234 0,
00235 0
00236 };
00237
00238
00239 #define MY_bfd_debug_info_start bfd_void
00240 #define MY_bfd_debug_info_end bfd_void
00241 #define MY_bfd_debug_info_accumulate \
00242 (void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void
00243
00244 #define MY_write_object_contents NAME(aout,sparclynx_write_object_contents)
00245 #define MY_backend_data &sparclynx_aout_backend
00246
00247 #define TARGET_IS_BIG_ENDIAN_P
00248
00249 #ifdef LYNX_CORE
00250
00251 char * lynx_core_file_failing_command ();
00252 int lynx_core_file_failing_signal ();
00253 bfd_boolean lynx_core_file_matches_executable_p ();
00254 const bfd_target * lynx_core_file_p ();
00255
00256 #define MY_core_file_failing_command lynx_core_file_failing_command
00257 #define MY_core_file_failing_signal lynx_core_file_failing_signal
00258 #define MY_core_file_matches_executable_p lynx_core_file_matches_executable_p
00259 #define MY_core_file_p lynx_core_file_p
00260
00261 #endif
00262
00263 #include "aout-target.h"