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 #include "bfd.h"
00028 #include "sysdep.h"
00029 #include "libbfd.h"
00030
00031 #include "aout/sun4.h"
00032 #include "libaout.h"
00033
00034 #include "aout/aout64.h"
00035 #include "aout/stab_gnu.h"
00036 #include "aout/ar.h"
00037
00038
00039
00040
00041
00042 #ifndef MACHTYPE_OK
00043 #define MACHTYPE_OK(mtype) \
00044 (((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL) \
00045 || (((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020) \
00046 && bfd_lookup_arch (bfd_arch_m68k, 0) != NULL))
00047 #endif
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 #if ARCH_SIZE == 64
00075 #define sunos_set_arch_mach sunos_64_set_arch_mach
00076 #define sunos_write_object_contents aout_64_sunos4_write_object_contents
00077 #else
00078 #define sunos_set_arch_mach sunos_32_set_arch_mach
00079 #define sunos_write_object_contents aout_32_sunos4_write_object_contents
00080 #endif
00081
00082 static bfd_boolean sunos_merge_private_bfd_data
00083 PARAMS ((bfd *, bfd *));
00084 static void sunos_set_arch_mach
00085 PARAMS ((bfd *, enum machine_type));
00086 static void choose_reloc_size
00087 PARAMS ((bfd *));
00088 static bfd_boolean sunos_write_object_contents
00089 PARAMS ((bfd *));
00090 static const bfd_target *sunos4_core_file_p
00091 PARAMS ((bfd *));
00092 static char *sunos4_core_file_failing_command
00093 PARAMS ((bfd *));
00094 static int sunos4_core_file_failing_signal
00095 PARAMS ((bfd *));
00096 static bfd_boolean sunos4_core_file_matches_executable_p
00097 PARAMS ((bfd *, bfd *));
00098 static bfd_boolean sunos4_set_sizes
00099 PARAMS ((bfd *));
00100
00101
00102
00103
00104
00105 #define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data
00106
00107 static bfd_boolean
00108 sunos_merge_private_bfd_data (ibfd, obfd)
00109 bfd *ibfd, *obfd;
00110 {
00111 if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour
00112 || bfd_get_flavour (obfd) != bfd_target_aout_flavour)
00113 return TRUE;
00114
00115 if (bfd_get_arch (obfd) == bfd_arch_sparc)
00116 {
00117 if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
00118 bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
00119 }
00120
00121 return TRUE;
00122 }
00123
00124
00125
00126
00127 static void
00128 sunos_set_arch_mach (abfd, machtype)
00129 bfd *abfd;
00130 enum machine_type machtype;
00131 {
00132
00133 enum bfd_architecture arch;
00134 unsigned long machine;
00135 switch (machtype)
00136 {
00137
00138 case M_UNKNOWN:
00139
00140
00141 arch = bfd_arch_m68k;
00142 machine = bfd_mach_m68000;
00143 break;
00144
00145 case M_68010:
00146 case M_HP200:
00147 arch = bfd_arch_m68k;
00148 machine = bfd_mach_m68010;
00149 break;
00150
00151 case M_68020:
00152 case M_HP300:
00153 arch = bfd_arch_m68k;
00154 machine = bfd_mach_m68020;
00155 break;
00156
00157 case M_SPARC:
00158 arch = bfd_arch_sparc;
00159 machine = 0;
00160 break;
00161
00162 case M_SPARCLET:
00163 arch = bfd_arch_sparc;
00164 machine = bfd_mach_sparc_sparclet;
00165 break;
00166
00167 case M_SPARCLITE_LE:
00168 arch = bfd_arch_sparc;
00169 machine = bfd_mach_sparc_sparclite_le;
00170 break;
00171
00172 case M_386:
00173 case M_386_DYNIX:
00174 arch = bfd_arch_i386;
00175 machine = 0;
00176 break;
00177
00178 case M_29K:
00179 arch = bfd_arch_a29k;
00180 machine = 0;
00181 break;
00182
00183 case M_HPUX:
00184 arch = bfd_arch_m68k;
00185 machine = 0;
00186 break;
00187
00188 default:
00189 arch = bfd_arch_obscure;
00190 machine = 0;
00191 break;
00192 }
00193 bfd_set_arch_mach (abfd, arch, machine);
00194 }
00195
00196 #define SET_ARCH_MACH(ABFD, EXEC) \
00197 NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
00198 choose_reloc_size(ABFD);
00199
00200
00201 static void
00202 choose_reloc_size (abfd)
00203 bfd *abfd;
00204 {
00205 switch (bfd_get_arch (abfd))
00206 {
00207 case bfd_arch_sparc:
00208 case bfd_arch_a29k:
00209 obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
00210 break;
00211 default:
00212 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
00213 break;
00214 }
00215 }
00216
00217
00218
00219
00220
00221
00222
00223 static bfd_boolean
00224 sunos_write_object_contents (abfd)
00225 bfd *abfd;
00226 {
00227 struct external_exec exec_bytes;
00228 struct internal_exec *execp = exec_hdr (abfd);
00229
00230
00231 switch (bfd_get_arch (abfd))
00232 {
00233 case bfd_arch_m68k:
00234 switch (bfd_get_mach (abfd))
00235 {
00236 case bfd_mach_m68000:
00237 N_SET_MACHTYPE (*execp, M_UNKNOWN);
00238 break;
00239 case bfd_mach_m68010:
00240 N_SET_MACHTYPE (*execp, M_68010);
00241 break;
00242 default:
00243 case bfd_mach_m68020:
00244 N_SET_MACHTYPE (*execp, M_68020);
00245 break;
00246 }
00247 break;
00248 case bfd_arch_sparc:
00249 switch (bfd_get_mach (abfd))
00250 {
00251 case bfd_mach_sparc_sparclet:
00252 N_SET_MACHTYPE (*execp, M_SPARCLET);
00253 break;
00254 case bfd_mach_sparc_sparclite_le:
00255 N_SET_MACHTYPE (*execp, M_SPARCLITE_LE);
00256 break;
00257 default:
00258 N_SET_MACHTYPE (*execp, M_SPARC);
00259 break;
00260 }
00261 break;
00262 case bfd_arch_i386:
00263 N_SET_MACHTYPE (*execp, M_386);
00264 break;
00265 case bfd_arch_a29k:
00266 N_SET_MACHTYPE (*execp, M_29K);
00267 break;
00268 default:
00269 N_SET_MACHTYPE (*execp, M_UNKNOWN);
00270 }
00271
00272 choose_reloc_size (abfd);
00273
00274 N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
00275
00276 N_SET_DYNAMIC (*execp, (long)(bfd_get_file_flags (abfd) & DYNAMIC));
00277
00278 WRITE_HEADERS (abfd, execp);
00279
00280 return TRUE;
00281 }
00282
00283
00284
00285 #define CORE_MAGIC 0x080456
00286 #define CORE_NAMELEN 16
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297 struct regs
00298 {
00299 int r_psr;
00300 int r_pc;
00301 int r_npc;
00302 int r_y;
00303 int r_g1;
00304 int r_g2;
00305 int r_g3;
00306 int r_g4;
00307 int r_g5;
00308 int r_g6;
00309 int r_g7;
00310 int r_o0;
00311 int r_o1;
00312 int r_o2;
00313 int r_o3;
00314 int r_o4;
00315 int r_o5;
00316 int r_o6;
00317 int r_o7;
00318 };
00319
00320
00321
00322
00323
00324
00325
00326 struct external_sparc_core
00327 {
00328 int c_magic;
00329 int c_len;
00330 #define SPARC_CORE_LEN 432
00331 int c_regs[19];
00332 struct external_exec c_aouthdr;
00333 int c_signo;
00334 int c_tsize;
00335 int c_dsize;
00336 int c_ssize;
00337 char c_cmdname[CORE_NAMELEN + 1];
00338 double fp_stuff[1];
00339
00340
00341
00342 int c_ucode;
00343
00344
00345 };
00346
00347
00348
00349 struct external_solaris_bcp_core
00350 {
00351 int c_magic;
00352 int c_len;
00353 #define SOLARIS_BCP_CORE_LEN 456
00354 int c_regs[19];
00355 int c_exdata_vp;
00356 int c_exdata_tsize;
00357 int c_exdata_dsize;
00358 int c_exdata_bsize;
00359 int c_exdata_lsize;
00360 int c_exdata_nshlibs;
00361 short c_exdata_mach;
00362 short c_exdata_mag;
00363 int c_exdata_toffset;
00364 int c_exdata_doffset;
00365 int c_exdata_loffset;
00366 int c_exdata_txtorg;
00367 int c_exdata_datorg;
00368 int c_exdata_entloc;
00369 int c_signo;
00370 int c_tsize;
00371 int c_dsize;
00372 int c_ssize;
00373 char c_cmdname[CORE_NAMELEN + 1];
00374 double fp_stuff[1];
00375
00376
00377
00378 int c_ucode;
00379
00380
00381 };
00382
00383 struct external_sun3_core
00384 {
00385 int c_magic;
00386 int c_len;
00387 #define SUN3_CORE_LEN 826
00388 int c_regs[18];
00389 struct external_exec c_aouthdr;
00390 int c_signo;
00391 int c_tsize;
00392 int c_dsize;
00393 int c_ssize;
00394 char c_cmdname[CORE_NAMELEN + 1];
00395 double fp_stuff[1];
00396
00397
00398
00399 int c_ucode;
00400
00401
00402 };
00403
00404 struct internal_sunos_core
00405 {
00406 int c_magic;
00407 int c_len;
00408 long c_regs_pos;
00409 int c_regs_size;
00410 struct internal_exec c_aouthdr;
00411 int c_signo;
00412 int c_tsize;
00413 int c_dsize;
00414 bfd_vma c_data_addr;
00415 int c_ssize;
00416 bfd_vma c_stacktop;
00417 char c_cmdname[CORE_NAMELEN + 1];
00418 long fp_stuff_pos;
00419 int fp_stuff_size;
00420 int c_ucode;
00421 };
00422
00423 static void swapcore_sun3
00424 PARAMS ((bfd *, char *, struct internal_sunos_core *));
00425 static void swapcore_sparc
00426 PARAMS ((bfd *, char *, struct internal_sunos_core *));
00427 static void swapcore_solaris_bcp
00428 PARAMS ((bfd *, char *, struct internal_sunos_core *));
00429
00430
00431 static void
00432 swapcore_sun3 (abfd, ext, intcore)
00433 bfd *abfd;
00434 char *ext;
00435 struct internal_sunos_core *intcore;
00436 {
00437 struct external_sun3_core *extcore = (struct external_sun3_core *) ext;
00438
00439 intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
00440 intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
00441 intcore->c_regs_pos = (long) (((struct external_sun3_core *) 0)->c_regs);
00442 intcore->c_regs_size = sizeof (extcore->c_regs);
00443 #if ARCH_SIZE == 64
00444 aout_64_swap_exec_header_in
00445 #else
00446 aout_32_swap_exec_header_in
00447 #endif
00448 (abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
00449 intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
00450 intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
00451 intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
00452 intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr);
00453 intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
00454 memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
00455 intcore->fp_stuff_pos = (long) (((struct external_sun3_core *) 0)->fp_stuff);
00456
00457 intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
00458 (file_ptr) (((struct external_sun3_core *) 0)->fp_stuff);
00459
00460 intcore->c_ucode = H_GET_32 (abfd,
00461 (intcore->c_len
00462 - sizeof (extcore->c_ucode)
00463 + (unsigned char *) extcore));
00464 intcore->c_stacktop = 0x0E000000;
00465 }
00466
00467
00468 static void
00469 swapcore_sparc (abfd, ext, intcore)
00470 bfd *abfd;
00471 char *ext;
00472 struct internal_sunos_core *intcore;
00473 {
00474 struct external_sparc_core *extcore = (struct external_sparc_core *) ext;
00475
00476 intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
00477 intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
00478 intcore->c_regs_pos = (long) (((struct external_sparc_core *) 0)->c_regs);
00479 intcore->c_regs_size = sizeof (extcore->c_regs);
00480 #if ARCH_SIZE == 64
00481 aout_64_swap_exec_header_in
00482 #else
00483 aout_32_swap_exec_header_in
00484 #endif
00485 (abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
00486 intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
00487 intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
00488 intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
00489 intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr);
00490 intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
00491 memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
00492 intcore->fp_stuff_pos = (long) (((struct external_sparc_core *) 0)->fp_stuff);
00493
00494 intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
00495 (file_ptr) (((struct external_sparc_core *) 0)->fp_stuff);
00496
00497 intcore->c_ucode = H_GET_32 (abfd,
00498 (intcore->c_len
00499 - sizeof (extcore->c_ucode)
00500 + (unsigned char *) extcore));
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515 #define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
00516 #define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
00517 {
00518 bfd_vma sp = H_GET_32 (abfd, &((struct regs *) &extcore->c_regs[0])->r_o6);
00519 if (sp < SPARC_USRSTACK_SPARC10)
00520 intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
00521 else
00522 intcore->c_stacktop = SPARC_USRSTACK_SPARC2;
00523 }
00524 }
00525
00526
00527 static void
00528 swapcore_solaris_bcp (abfd, ext, intcore)
00529 bfd *abfd;
00530 char *ext;
00531 struct internal_sunos_core *intcore;
00532 {
00533 struct external_solaris_bcp_core *extcore =
00534 (struct external_solaris_bcp_core *) ext;
00535
00536 intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
00537 intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
00538 intcore->c_regs_pos = (long) (((struct external_solaris_bcp_core *) 0)->c_regs);
00539 intcore->c_regs_size = sizeof (extcore->c_regs);
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551 memset ((PTR) &intcore->c_aouthdr, 0, sizeof (struct internal_exec));
00552 intcore->c_data_addr = H_GET_32 (abfd, &extcore->c_exdata_datorg);
00553 intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
00554 intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
00555 intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
00556 intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
00557 memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
00558 intcore->fp_stuff_pos =
00559 (long) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
00560
00561 intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
00562 (file_ptr) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
00563
00564 intcore->c_ucode = H_GET_32 (abfd,
00565 (intcore->c_len
00566 - sizeof (extcore->c_ucode)
00567 + (unsigned char *) extcore));
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582 #define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
00583 #define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
00584 {
00585 bfd_vma sp = H_GET_32 (abfd, &((struct regs *) &extcore->c_regs[0])->r_o6);
00586 if (sp < SPARC_USRSTACK_SPARC10)
00587 intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
00588 else
00589 intcore->c_stacktop = SPARC_USRSTACK_SPARC2;
00590 }
00591 }
00592
00593
00594 #define core_hdr(bfd) ((bfd)->tdata.sun_core_data)
00595 #define core_datasec(bfd) (core_hdr(bfd)->data_section)
00596 #define core_stacksec(bfd) (core_hdr(bfd)->stack_section)
00597 #define core_regsec(bfd) (core_hdr(bfd)->reg_section)
00598 #define core_reg2sec(bfd) (core_hdr(bfd)->reg2_section)
00599
00600
00601 struct sun_core_struct
00602 {
00603 struct internal_sunos_core *hdr;
00604 asection *data_section;
00605 asection *stack_section;
00606 asection *reg_section;
00607 asection *reg2_section;
00608 };
00609
00610 static const bfd_target *
00611 sunos4_core_file_p (abfd)
00612 bfd *abfd;
00613 {
00614 unsigned char longbuf[4];
00615 bfd_size_type core_size, amt;
00616 unsigned long core_mag;
00617 struct internal_sunos_core *core;
00618 char *extcore;
00619 struct mergem
00620 {
00621 struct sun_core_struct suncoredata;
00622 struct internal_sunos_core internal_sunos_core;
00623 char external_core[1];
00624 } *mergem;
00625
00626 if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
00627 != sizeof (longbuf))
00628 return 0;
00629 core_mag = H_GET_32 (abfd, longbuf);
00630
00631 if (core_mag != CORE_MAGIC)
00632 return 0;
00633
00634
00635 if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
00636 != sizeof (longbuf))
00637 return 0;
00638 core_size = H_GET_32 (abfd, longbuf);
00639
00640 if (core_size > 20000)
00641 return 0;
00642
00643 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
00644 return 0;
00645
00646 amt = core_size + sizeof (struct mergem);
00647 mergem = (struct mergem *) bfd_zalloc (abfd, amt);
00648 if (mergem == NULL)
00649 return 0;
00650
00651 extcore = mergem->external_core;
00652
00653 if ((bfd_bread ((PTR) extcore, core_size, abfd)) != core_size)
00654 {
00655 loser:
00656 bfd_release (abfd, (char *) mergem);
00657 abfd->tdata.any = NULL;
00658 bfd_section_list_clear (abfd);
00659 return 0;
00660 }
00661
00662
00663
00664
00665 core = &mergem->internal_sunos_core;
00666 switch (core_size)
00667 {
00668 case SPARC_CORE_LEN:
00669 swapcore_sparc (abfd, extcore, core);
00670 break;
00671 case SUN3_CORE_LEN:
00672 swapcore_sun3 (abfd, extcore, core);
00673 break;
00674 case SOLARIS_BCP_CORE_LEN:
00675 swapcore_solaris_bcp (abfd, extcore, core);
00676 break;
00677 default:
00678 bfd_set_error (bfd_error_system_call);
00679 goto loser;
00680 }
00681
00682 abfd->tdata.sun_core_data = &mergem->suncoredata;
00683 abfd->tdata.sun_core_data->hdr = core;
00684
00685
00686 core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
00687 if (core_stacksec (abfd) == NULL)
00688
00689 goto loser;
00690
00691 core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
00692 if (core_datasec (abfd) == NULL)
00693 goto loser;
00694
00695 core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
00696 if (core_regsec (abfd) == NULL)
00697 goto loser;
00698
00699 core_reg2sec (abfd) = bfd_make_section_anyway (abfd, ".reg2");
00700 if (core_reg2sec (abfd) == NULL)
00701 goto loser;
00702
00703 core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
00704 core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
00705 core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
00706 core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
00707
00708 core_stacksec (abfd)->size = core->c_ssize;
00709 core_datasec (abfd)->size = core->c_dsize;
00710 core_regsec (abfd)->size = core->c_regs_size;
00711 core_reg2sec (abfd)->size = core->fp_stuff_size;
00712
00713 core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize);
00714 core_datasec (abfd)->vma = core->c_data_addr;
00715 core_regsec (abfd)->vma = 0;
00716 core_reg2sec (abfd)->vma = 0;
00717
00718 core_stacksec (abfd)->filepos = core->c_len + core->c_dsize;
00719 core_datasec (abfd)->filepos = core->c_len;
00720
00721 core_regsec (abfd)->filepos = (file_ptr) core->c_regs_pos;
00722 core_reg2sec (abfd)->filepos = (file_ptr) core->fp_stuff_pos;
00723
00724
00725 core_stacksec (abfd)->alignment_power = 2;
00726 core_datasec (abfd)->alignment_power = 2;
00727 core_regsec (abfd)->alignment_power = 2;
00728 core_reg2sec (abfd)->alignment_power = 2;
00729
00730 return abfd->xvec;
00731 }
00732
00733 static char *
00734 sunos4_core_file_failing_command (abfd)
00735 bfd *abfd;
00736 {
00737 return core_hdr (abfd)->hdr->c_cmdname;
00738 }
00739
00740 static int
00741 sunos4_core_file_failing_signal (abfd)
00742 bfd *abfd;
00743 {
00744 return core_hdr (abfd)->hdr->c_signo;
00745 }
00746
00747 static bfd_boolean
00748 sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
00749 bfd *core_bfd;
00750 bfd *exec_bfd;
00751 {
00752 if (core_bfd->xvec != exec_bfd->xvec)
00753 {
00754 bfd_set_error (bfd_error_system_call);
00755 return FALSE;
00756 }
00757
00758
00759 if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN)
00760 return TRUE;
00761
00762 return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
00763 (char *) exec_hdr (exec_bfd),
00764 sizeof (struct internal_exec)) == 0);
00765 }
00766
00767 #define MY_set_sizes sunos4_set_sizes
00768 static bfd_boolean
00769 sunos4_set_sizes (abfd)
00770 bfd *abfd;
00771 {
00772 switch (bfd_get_arch (abfd))
00773 {
00774 default:
00775 return FALSE;
00776 case bfd_arch_sparc:
00777 adata (abfd).page_size = 0x2000;
00778 adata (abfd).segment_size = 0x2000;
00779 adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
00780 return TRUE;
00781 case bfd_arch_m68k:
00782 adata (abfd).page_size = 0x2000;
00783 adata (abfd).segment_size = 0x20000;
00784 adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
00785 return TRUE;
00786 }
00787 }
00788
00789
00790
00791 #ifndef MY_exec_hdr_flags
00792 #define MY_exec_hdr_flags 1
00793 #endif
00794
00795 #ifndef MY_entry_is_text_address
00796 #define MY_entry_is_text_address 0
00797 #endif
00798 #ifndef MY_add_dynamic_symbols
00799 #define MY_add_dynamic_symbols 0
00800 #endif
00801 #ifndef MY_add_one_symbol
00802 #define MY_add_one_symbol 0
00803 #endif
00804 #ifndef MY_link_dynamic_object
00805 #define MY_link_dynamic_object 0
00806 #endif
00807 #ifndef MY_write_dynamic_symbol
00808 #define MY_write_dynamic_symbol 0
00809 #endif
00810 #ifndef MY_check_dynamic_reloc
00811 #define MY_check_dynamic_reloc 0
00812 #endif
00813 #ifndef MY_finish_dynamic_link
00814 #define MY_finish_dynamic_link 0
00815 #endif
00816
00817 static const struct aout_backend_data sunos4_aout_backend =
00818 {
00819 0,
00820 1,
00821 MY_entry_is_text_address,
00822 MY_exec_hdr_flags,
00823 0,
00824 sunos4_set_sizes,
00825 0,
00826 MY_add_dynamic_symbols,
00827 MY_add_one_symbol,
00828 MY_link_dynamic_object,
00829 MY_write_dynamic_symbol,
00830 MY_check_dynamic_reloc,
00831 MY_finish_dynamic_link
00832 };
00833
00834 #define MY_core_file_failing_command sunos4_core_file_failing_command
00835 #define MY_core_file_failing_signal sunos4_core_file_failing_signal
00836 #define MY_core_file_matches_executable_p sunos4_core_file_matches_executable_p
00837
00838 #define MY_bfd_debug_info_start bfd_void
00839 #define MY_bfd_debug_info_end bfd_void
00840 #define MY_bfd_debug_info_accumulate \
00841 (void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void
00842 #define MY_core_file_p sunos4_core_file_p
00843 #define MY_write_object_contents NAME(aout,sunos4_write_object_contents)
00844 #define MY_backend_data &sunos4_aout_backend
00845
00846 #ifndef TARGET_IS_LITTLE_ENDIAN_P
00847 #define TARGET_IS_BIG_ENDIAN_P
00848 #endif
00849
00850 #include "aout-target.h"