1 /* A.out "format 1" file handling code for BFD.
2 Copyright (C) 1990-2018 Free Software Foundation, Inc.
3 Written by Cygnus Support.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
26 #include "aout/sun4.h"
27 #include "libaout.h" /* BFD a.out internal data structures. */
29 #include "aout/aout64.h"
30 #include "aout/stab_gnu.h"
33 /* This is needed to reject a NewsOS file, e.g. in
34 gdb/testsuite/gdb.t10/crossload.exp. <kingdon@cygnus.com>
35 I needed to add M_UNKNOWN to recognize a 68000 object, so this will
36 probably no longer reject a NewsOS object. <ian@cygnus.com>. */
38 #define MACHTYPE_OK(mtype) \
39 ((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL)
42 /* The file @code{aoutf1.h} contains the code for BFD's
43 a.out back end. Control over the generated back end is given by these
44 two preprocessor names:
47 This value should be either 32 or 64, depending upon the size of an
48 int in the target format. It changes the sizes of the structs which
49 perform the memory/disk mapping of structures.
51 The 64 bit backend may only be used if the host compiler supports 64
52 ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}.
53 With this name defined, @emph{all} bfd operations are performed with 64bit
54 arithmetic, not just those to a 64bit target.
57 The name put into the target vector.
62 #define sunos_set_arch_mach sunos_64_set_arch_mach
63 #define sunos_write_object_contents aout_64_sunos4_write_object_contents
65 #define sunos_set_arch_mach sunos_32_set_arch_mach
66 #define sunos_write_object_contents aout_32_sunos4_write_object_contents
69 /* Merge backend data into the output file.
70 This is necessary on sparclet-aout where we want the resultant machine
71 number to be M_SPARCLET if any input file is M_SPARCLET. */
73 #define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data
76 sunos_merge_private_bfd_data (bfd
*ibfd
, struct bfd_link_info
*info
)
78 bfd
*obfd
= info
->output_bfd
;
79 if (bfd_get_flavour (ibfd
) != bfd_target_aout_flavour
80 || bfd_get_flavour (obfd
) != bfd_target_aout_flavour
)
83 if (bfd_get_arch (obfd
) == bfd_arch_sparc
)
85 if (bfd_get_mach (obfd
) < bfd_get_mach (ibfd
))
86 bfd_set_arch_mach (obfd
, bfd_arch_sparc
, bfd_get_mach (ibfd
));
92 /* This is either sunos_32_set_arch_mach or sunos_64_set_arch_mach,
93 depending upon ARCH_SIZE. */
96 sunos_set_arch_mach (bfd
*abfd
, enum machine_type machtype
)
98 /* Determine the architecture and machine type of the object file. */
99 enum bfd_architecture arch
;
100 unsigned long machine
;
105 arch
= bfd_arch_sparc
;
110 arch
= bfd_arch_sparc
;
111 machine
= bfd_mach_sparc_sparclet
;
115 arch
= bfd_arch_sparc
;
116 machine
= bfd_mach_sparc_sparclite_le
;
121 arch
= bfd_arch_i386
;
126 arch
= bfd_arch_obscure
;
130 bfd_set_arch_mach (abfd
, arch
, machine
);
133 #define SET_ARCH_MACH(ABFD, EXECP) \
134 NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXECP)); \
135 choose_reloc_size(ABFD);
137 /* Determine the size of a relocation entry, based on the architecture. */
140 choose_reloc_size (bfd
*abfd
)
142 switch (bfd_get_arch (abfd
))
145 obj_reloc_entry_size (abfd
) = RELOC_EXT_SIZE
;
148 obj_reloc_entry_size (abfd
) = RELOC_STD_SIZE
;
153 /* Write an object file in SunOS format. Section contents have
154 already been written. We write the file header, symbols, and
155 relocation. The real name of this function is either
156 aout_64_sunos4_write_object_contents or
157 aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */
160 sunos_write_object_contents (bfd
*abfd
)
162 struct external_exec exec_bytes
;
163 struct internal_exec
*execp
= exec_hdr (abfd
);
165 /* Magic number, maestro, please! */
166 switch (bfd_get_arch (abfd
))
169 switch (bfd_get_mach (abfd
))
171 case bfd_mach_sparc_sparclet
:
172 N_SET_MACHTYPE (execp
, M_SPARCLET
);
174 case bfd_mach_sparc_sparclite_le
:
175 N_SET_MACHTYPE (execp
, M_SPARCLITE_LE
);
178 N_SET_MACHTYPE (execp
, M_SPARC
);
183 N_SET_MACHTYPE (execp
, M_386
);
186 N_SET_MACHTYPE (execp
, M_UNKNOWN
);
189 choose_reloc_size (abfd
);
191 N_SET_FLAGS (execp
, aout_backend_info (abfd
)->exec_hdr_flags
);
193 N_SET_DYNAMIC (execp
, (long)(bfd_get_file_flags (abfd
) & DYNAMIC
));
195 WRITE_HEADERS (abfd
, execp
);
202 #define CORE_MAGIC 0x080456
203 #define CORE_NAMELEN 16
205 /* The core structure is taken from the Sun documentation.
206 Unfortunately, they don't document the FPA structure, or at least I
207 can't find it easily. Fortunately the core header contains its own
208 length. So this shouldn't cause problems, except for c_ucode, which
209 so far we don't use but is easy to find with a little arithmetic. */
211 /* But the reg structure can be gotten from the SPARC processor handbook.
212 This really should be in a GNU include file though so that gdb can use
237 /* Taken from Sun documentation: */
239 /* FIXME: It's worse than we expect. This struct contains TWO substructs
240 neither of whose size we know, WITH STUFF IN BETWEEN THEM! We can't
241 even portably access the stuff in between! */
243 struct external_sparc_core
245 int c_magic
; /* Corefile magic number. */
246 int c_len
; /* Sizeof (struct core). */
247 #define SPARC_CORE_LEN 432
248 struct regs c_regs
; /* General purpose registers -- MACHDEP SIZE. */
249 struct external_exec c_aouthdr
; /* A.out header. */
250 int c_signo
; /* Killing signal, if any. */
251 int c_tsize
; /* Text size (bytes). */
252 int c_dsize
; /* Data size (bytes). */
253 int c_ssize
; /* Stack size (bytes). */
254 char c_cmdname
[CORE_NAMELEN
+ 1]; /* Command name. */
255 double fp_stuff
[1]; /* External FPU state (size unknown by us). */
256 /* The type "double" is critical here, for alignment.
257 SunOS declares a struct here, but the struct's
258 alignment is double since it contains doubles. */
259 int c_ucode
; /* Exception no. from u_code. */
260 /* This member is not accessible by name since
261 we don't portably know the size of fp_stuff. */
264 /* Core files generated by the BCP (the part of Solaris which allows
265 it to run SunOS4 a.out files). */
266 struct external_solaris_bcp_core
268 int c_magic
; /* Corefile magic number. */
269 int c_len
; /* Sizeof (struct core). */
270 #define SOLARIS_BCP_CORE_LEN 456
271 struct regs c_regs
; /* General purpose registers -- MACHDEP SIZE. */
272 int c_exdata_vp
; /* Exdata structure. */
277 int c_exdata_nshlibs
;
280 int c_exdata_toffset
;
281 int c_exdata_doffset
;
282 int c_exdata_loffset
;
286 int c_signo
; /* Killing signal, if any. */
287 int c_tsize
; /* Text size (bytes). */
288 int c_dsize
; /* Data size (bytes). */
289 int c_ssize
; /* Stack size (bytes). */
290 char c_cmdname
[CORE_NAMELEN
+ 1]; /* Command name. */
291 double fp_stuff
[1]; /* External FPU state (size unknown by us). */
292 /* The type "double" is critical here, for alignment.
293 SunOS declares a struct here, but the struct's
294 alignment is double since it contains doubles. */
295 int c_ucode
; /* Exception no. from u_code. */
296 /* This member is not accessible by name since
297 we don't portably know the size of fp_stuff. */
300 struct external_sun3_core
302 int c_magic
; /* Corefile magic number. */
303 int c_len
; /* Sizeof (struct core). */
304 #define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1. */
305 int c_regs
[18]; /* General purpose registers -- MACHDEP SIZE. */
306 struct external_exec c_aouthdr
; /* A.out header. */
307 int c_signo
; /* Killing signal, if any. */
308 int c_tsize
; /* Text size (bytes). */
309 int c_dsize
; /* Data size (bytes). */
310 int c_ssize
; /* Stack size (bytes). */
311 char c_cmdname
[CORE_NAMELEN
+ 1]; /* Command name. */
312 double fp_stuff
[1]; /* External FPU state (size unknown by us). */
313 /* The type "double" is critical here, for alignment.
314 SunOS declares a struct here, but the struct's
315 alignment is double since it contains doubles. */
316 int c_ucode
; /* Exception no. from u_code. */
317 /* This member is not accessible by name since
318 we don't portably know the size of fp_stuff. */
321 struct internal_sunos_core
323 int c_magic
; /* Corefile magic number. */
324 int c_len
; /* Sizeof (struct core). */
325 long c_regs_pos
; /* File offset of General purpose registers. */
326 int c_regs_size
; /* Size of General purpose registers. */
327 struct internal_exec c_aouthdr
; /* A.out header. */
328 int c_signo
; /* Killing signal, if any. */
329 int c_tsize
; /* Text size (bytes). */
330 int c_dsize
; /* Data size (bytes). */
331 bfd_vma c_data_addr
; /* Data start (address). */
332 int c_ssize
; /* Stack size (bytes). */
333 bfd_vma c_stacktop
; /* Stack top (address). */
334 char c_cmdname
[CORE_NAMELEN
+ 1]; /* Command name. */
335 long fp_stuff_pos
; /* File offset of external FPU state (regs). */
336 int fp_stuff_size
; /* Size of it. */
337 int c_ucode
; /* Exception no. from u_code. */
340 /* Byte-swap in the Sun-3 core structure. */
343 swapcore_sun3 (bfd
*abfd
, char *ext
, struct internal_sunos_core
*intcore
)
345 struct external_sun3_core
*extcore
= (struct external_sun3_core
*) ext
;
347 intcore
->c_magic
= H_GET_32 (abfd
, &extcore
->c_magic
);
348 intcore
->c_len
= H_GET_32 (abfd
, &extcore
->c_len
);
349 intcore
->c_regs_pos
= offsetof (struct external_sun3_core
, c_regs
);
350 intcore
->c_regs_size
= sizeof (extcore
->c_regs
);
352 aout_64_swap_exec_header_in
354 aout_32_swap_exec_header_in
356 (abfd
, &extcore
->c_aouthdr
, &intcore
->c_aouthdr
);
357 intcore
->c_signo
= H_GET_32 (abfd
, &extcore
->c_signo
);
358 intcore
->c_tsize
= H_GET_32 (abfd
, &extcore
->c_tsize
);
359 intcore
->c_dsize
= H_GET_32 (abfd
, &extcore
->c_dsize
);
360 intcore
->c_data_addr
= N_DATADDR (&intcore
->c_aouthdr
);
361 intcore
->c_ssize
= H_GET_32 (abfd
, &extcore
->c_ssize
);
362 memcpy (intcore
->c_cmdname
, extcore
->c_cmdname
, sizeof (intcore
->c_cmdname
));
363 intcore
->fp_stuff_pos
= offsetof (struct external_sun3_core
, fp_stuff
);
364 /* FP stuff takes up whole rest of struct, except c_ucode. */
365 intcore
->fp_stuff_size
= intcore
->c_len
- (sizeof extcore
->c_ucode
) -
366 offsetof (struct external_sun3_core
, fp_stuff
);
367 /* Ucode is the last thing in the struct -- just before the end. */
368 intcore
->c_ucode
= H_GET_32 (abfd
,
370 - sizeof (extcore
->c_ucode
)
371 + (unsigned char *) extcore
));
372 intcore
->c_stacktop
= 0x0E000000; /* By experimentation. */
375 /* Byte-swap in the Sparc core structure. */
378 swapcore_sparc (bfd
*abfd
, char *ext
, struct internal_sunos_core
*intcore
)
380 struct external_sparc_core
*extcore
= (struct external_sparc_core
*) ext
;
382 intcore
->c_magic
= H_GET_32 (abfd
, &extcore
->c_magic
);
383 intcore
->c_len
= H_GET_32 (abfd
, &extcore
->c_len
);
384 intcore
->c_regs_pos
= offsetof (struct external_sparc_core
, c_regs
);
385 intcore
->c_regs_size
= sizeof (extcore
->c_regs
);
387 aout_64_swap_exec_header_in
389 aout_32_swap_exec_header_in
391 (abfd
, &extcore
->c_aouthdr
, &intcore
->c_aouthdr
);
392 intcore
->c_signo
= H_GET_32 (abfd
, &extcore
->c_signo
);
393 intcore
->c_tsize
= H_GET_32 (abfd
, &extcore
->c_tsize
);
394 intcore
->c_dsize
= H_GET_32 (abfd
, &extcore
->c_dsize
);
395 intcore
->c_data_addr
= N_DATADDR (&intcore
->c_aouthdr
);
396 intcore
->c_ssize
= H_GET_32 (abfd
, &extcore
->c_ssize
);
397 memcpy (intcore
->c_cmdname
, extcore
->c_cmdname
, sizeof (intcore
->c_cmdname
));
398 intcore
->fp_stuff_pos
= offsetof (struct external_sparc_core
, fp_stuff
);
399 /* FP stuff takes up whole rest of struct, except c_ucode. */
400 intcore
->fp_stuff_size
= intcore
->c_len
- (sizeof extcore
->c_ucode
) -
401 offsetof (struct external_sparc_core
, fp_stuff
);
402 /* Ucode is the last thing in the struct -- just before the end. */
403 intcore
->c_ucode
= H_GET_32 (abfd
,
405 - sizeof (extcore
->c_ucode
)
406 + (unsigned char *) extcore
));
408 /* Supposedly the user stack grows downward from the bottom of kernel memory.
409 Presuming that this remains true, this definition will work. */
410 /* Now sun has provided us with another challenge. The value is different
411 for sparc2 and sparc10 (both running SunOS 4.1.3). We pick one or
412 the other based on the current value of the stack pointer. This
413 loses (a) if the stack pointer has been clobbered, or (b) if the stack
414 is larger than 128 megabytes.
416 It's times like these you're glad they're switching to ELF.
418 Note that using include files or nlist on /vmunix would be wrong,
419 because we want the value for this core file, no matter what kind of
420 machine we were compiled on or are running on. */
421 #define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
422 #define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
424 bfd_vma sp
= H_GET_32 (abfd
, &extcore
->c_regs
.r_o6
);
425 if (sp
< SPARC_USRSTACK_SPARC10
)
426 intcore
->c_stacktop
= SPARC_USRSTACK_SPARC10
;
428 intcore
->c_stacktop
= SPARC_USRSTACK_SPARC2
;
432 /* Byte-swap in the Solaris BCP core structure. */
435 swapcore_solaris_bcp (bfd
*abfd
, char *ext
, struct internal_sunos_core
*intcore
)
437 struct external_solaris_bcp_core
*extcore
=
438 (struct external_solaris_bcp_core
*) ext
;
440 intcore
->c_magic
= H_GET_32 (abfd
, &extcore
->c_magic
);
441 intcore
->c_len
= H_GET_32 (abfd
, &extcore
->c_len
);
442 intcore
->c_regs_pos
= offsetof (struct external_solaris_bcp_core
, c_regs
);
443 intcore
->c_regs_size
= sizeof (extcore
->c_regs
);
445 /* The Solaris BCP exdata structure does not contain an a_syms field,
446 so we are unable to synthesize an internal exec header.
447 Luckily we are able to figure out the start address of the data section,
448 which is the only thing needed from the internal exec header,
449 from the exdata structure.
451 As of Solaris 2.3, BCP core files for statically linked executables
452 are buggy. The exdata structure is not properly filled in, and
453 the data section is written from address zero instead of the data
455 memset ((void *) &intcore
->c_aouthdr
, 0, sizeof (struct internal_exec
));
456 intcore
->c_data_addr
= H_GET_32 (abfd
, &extcore
->c_exdata_datorg
);
457 intcore
->c_signo
= H_GET_32 (abfd
, &extcore
->c_signo
);
458 intcore
->c_tsize
= H_GET_32 (abfd
, &extcore
->c_tsize
);
459 intcore
->c_dsize
= H_GET_32 (abfd
, &extcore
->c_dsize
);
460 intcore
->c_ssize
= H_GET_32 (abfd
, &extcore
->c_ssize
);
461 memcpy (intcore
->c_cmdname
, extcore
->c_cmdname
, sizeof (intcore
->c_cmdname
));
462 intcore
->fp_stuff_pos
=
463 offsetof (struct external_solaris_bcp_core
, fp_stuff
);
464 /* FP stuff takes up whole rest of struct, except c_ucode. */
465 intcore
->fp_stuff_size
= intcore
->c_len
- (sizeof extcore
->c_ucode
) -
466 offsetof (struct external_solaris_bcp_core
, fp_stuff
);
467 /* Ucode is the last thing in the struct -- just before the end */
468 intcore
->c_ucode
= H_GET_32 (abfd
,
470 - sizeof (extcore
->c_ucode
)
471 + (unsigned char *) extcore
));
473 /* Supposedly the user stack grows downward from the bottom of kernel memory.
474 Presuming that this remains true, this definition will work. */
475 /* Now sun has provided us with another challenge. The value is different
476 for sparc2 and sparc10 (both running SunOS 4.1.3). We pick one or
477 the other based on the current value of the stack pointer. This
478 loses (a) if the stack pointer has been clobbered, or (b) if the stack
479 is larger than 128 megabytes.
481 It's times like these you're glad they're switching to ELF.
483 Note that using include files or nlist on /vmunix would be wrong,
484 because we want the value for this core file, no matter what kind of
485 machine we were compiled on or are running on. */
486 #define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
487 #define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
489 bfd_vma sp
= H_GET_32 (abfd
, &extcore
->c_regs
.r_o6
);
490 if (sp
< SPARC_USRSTACK_SPARC10
)
491 intcore
->c_stacktop
= SPARC_USRSTACK_SPARC10
;
493 intcore
->c_stacktop
= SPARC_USRSTACK_SPARC2
;
497 /* Need this cast because ptr is really void *. */
498 #define core_hdr(bfd) ((bfd)->tdata.sun_core_data)
499 #define core_datasec(bfd) (core_hdr (bfd)->data_section)
500 #define core_stacksec(bfd) (core_hdr (bfd)->stack_section)
501 #define core_regsec(bfd) (core_hdr (bfd)->reg_section)
502 #define core_reg2sec(bfd) (core_hdr (bfd)->reg2_section)
504 /* These are stored in the bfd's tdata. */
505 struct sun_core_struct
507 struct internal_sunos_core
*hdr
; /* Core file header. */
508 asection
*data_section
;
509 asection
*stack_section
;
510 asection
*reg_section
;
511 asection
*reg2_section
;
514 static const bfd_target
*
515 sunos4_core_file_p (bfd
*abfd
)
517 unsigned char longbuf
[4]; /* Raw bytes of various header fields. */
518 bfd_size_type core_size
, amt
;
519 unsigned long core_mag
;
520 struct internal_sunos_core
*core
;
524 struct sun_core_struct suncoredata
;
525 struct internal_sunos_core internal_sunos_core
;
526 char external_core
[1];
530 if (bfd_bread ((void *) longbuf
, (bfd_size_type
) sizeof (longbuf
), abfd
)
533 core_mag
= H_GET_32 (abfd
, longbuf
);
535 if (core_mag
!= CORE_MAGIC
)
538 /* SunOS core headers can vary in length; second word is size; */
539 if (bfd_bread ((void *) longbuf
, (bfd_size_type
) sizeof (longbuf
), abfd
)
542 core_size
= H_GET_32 (abfd
, longbuf
);
544 if (core_size
> 20000)
547 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
550 amt
= core_size
+ sizeof (struct mergem
);
551 mergem
= bfd_zalloc (abfd
, amt
);
555 extcore
= mergem
->external_core
;
557 if ((bfd_bread ((void *) extcore
, core_size
, abfd
)) != core_size
)
560 bfd_release (abfd
, (char *) mergem
);
561 abfd
->tdata
.any
= NULL
;
562 bfd_section_list_clear (abfd
);
566 /* Validate that it's a core file we know how to handle, due to sun
567 botching the positioning of registers and other fields in a machine
569 core
= &mergem
->internal_sunos_core
;
573 swapcore_sparc (abfd
, extcore
, core
);
576 swapcore_sun3 (abfd
, extcore
, core
);
578 case SOLARIS_BCP_CORE_LEN
:
579 swapcore_solaris_bcp (abfd
, extcore
, core
);
582 bfd_set_error (bfd_error_system_call
); /* FIXME. */
586 abfd
->tdata
.sun_core_data
= &mergem
->suncoredata
;
587 abfd
->tdata
.sun_core_data
->hdr
= core
;
589 /* Create the sections. */
590 flags
= SEC_ALLOC
+ SEC_LOAD
+ SEC_HAS_CONTENTS
;
591 core_stacksec (abfd
) = bfd_make_section_anyway_with_flags (abfd
, ".stack",
593 if (core_stacksec (abfd
) == NULL
)
594 /* bfd_release frees everything allocated after it's arg. */
597 flags
= SEC_ALLOC
+ SEC_LOAD
+ SEC_HAS_CONTENTS
;
598 core_datasec (abfd
) = bfd_make_section_anyway_with_flags (abfd
, ".data",
600 if (core_datasec (abfd
) == NULL
)
603 flags
= SEC_HAS_CONTENTS
;
604 core_regsec (abfd
) = bfd_make_section_anyway_with_flags (abfd
, ".reg",
606 if (core_regsec (abfd
) == NULL
)
609 flags
= SEC_HAS_CONTENTS
;
610 core_reg2sec (abfd
) = bfd_make_section_anyway_with_flags (abfd
, ".reg2",
612 if (core_reg2sec (abfd
) == NULL
)
615 core_stacksec (abfd
)->size
= core
->c_ssize
;
616 core_datasec (abfd
)->size
= core
->c_dsize
;
617 core_regsec (abfd
)->size
= core
->c_regs_size
;
618 core_reg2sec (abfd
)->size
= core
->fp_stuff_size
;
620 core_stacksec (abfd
)->vma
= (core
->c_stacktop
- core
->c_ssize
);
621 core_datasec (abfd
)->vma
= core
->c_data_addr
;
622 core_regsec (abfd
)->vma
= 0;
623 core_reg2sec (abfd
)->vma
= 0;
625 core_stacksec (abfd
)->filepos
= core
->c_len
+ core
->c_dsize
;
626 core_datasec (abfd
)->filepos
= core
->c_len
;
627 /* We'll access the regs afresh in the core file, like any section: */
628 core_regsec (abfd
)->filepos
= (file_ptr
) core
->c_regs_pos
;
629 core_reg2sec (abfd
)->filepos
= (file_ptr
) core
->fp_stuff_pos
;
631 /* Align to word at least. */
632 core_stacksec (abfd
)->alignment_power
= 2;
633 core_datasec (abfd
)->alignment_power
= 2;
634 core_regsec (abfd
)->alignment_power
= 2;
635 core_reg2sec (abfd
)->alignment_power
= 2;
641 sunos4_core_file_failing_command (bfd
*abfd
)
643 return core_hdr (abfd
)->hdr
->c_cmdname
;
647 sunos4_core_file_failing_signal (bfd
*abfd
)
649 return core_hdr (abfd
)->hdr
->c_signo
;
653 sunos4_core_file_matches_executable_p (bfd
*core_bfd
, bfd
*exec_bfd
)
655 if (core_bfd
->xvec
!= exec_bfd
->xvec
)
657 bfd_set_error (bfd_error_system_call
);
661 /* Solaris core files do not include an aouthdr. */
662 if ((core_hdr (core_bfd
)->hdr
)->c_len
== SOLARIS_BCP_CORE_LEN
)
665 return memcmp ((char *) &((core_hdr (core_bfd
)->hdr
)->c_aouthdr
),
666 (char *) exec_hdr (exec_bfd
),
667 sizeof (struct internal_exec
)) == 0;
670 #define MY_set_sizes sunos4_set_sizes
673 sunos4_set_sizes (bfd
*abfd
)
675 switch (bfd_get_arch (abfd
))
680 adata (abfd
).page_size
= 0x2000;
681 adata (abfd
).segment_size
= 0x2000;
682 adata (abfd
).exec_bytes_size
= EXEC_BYTES_SIZE
;
687 /* We default to setting the toolversion field to 1, as is required by
689 #ifndef MY_exec_hdr_flags
690 #define MY_exec_hdr_flags 1
693 #ifndef MY_entry_is_text_address
694 #define MY_entry_is_text_address 0
696 #ifndef MY_add_dynamic_symbols
697 #define MY_add_dynamic_symbols 0
699 #ifndef MY_add_one_symbol
700 #define MY_add_one_symbol 0
702 #ifndef MY_link_dynamic_object
703 #define MY_link_dynamic_object 0
705 #ifndef MY_write_dynamic_symbol
706 #define MY_write_dynamic_symbol 0
708 #ifndef MY_check_dynamic_reloc
709 #define MY_check_dynamic_reloc 0
711 #ifndef MY_finish_dynamic_link
712 #define MY_finish_dynamic_link 0
715 static const struct aout_backend_data sunos4_aout_backend
=
717 0, /* Zmagic files are not contiguous. */
718 1, /* Text includes header. */
719 MY_entry_is_text_address
,
721 0, /* Default text vma. */
723 0, /* Header is counted in zmagic text. */
724 MY_add_dynamic_symbols
,
726 MY_link_dynamic_object
,
727 MY_write_dynamic_symbol
,
728 MY_check_dynamic_reloc
,
729 MY_finish_dynamic_link
732 #define MY_core_file_failing_command sunos4_core_file_failing_command
733 #define MY_core_file_failing_signal sunos4_core_file_failing_signal
734 #define MY_core_file_matches_executable_p sunos4_core_file_matches_executable_p
736 #define MY_bfd_debug_info_start _bfd_void_bfd
737 #define MY_bfd_debug_info_end _bfd_void_bfd
738 #define MY_bfd_debug_info_accumulate _bfd_void_bfd_asection
739 #define MY_core_file_p sunos4_core_file_p
740 #define MY_write_object_contents NAME(aout, sunos4_write_object_contents)
741 #define MY_backend_data & sunos4_aout_backend
743 #ifndef TARGET_IS_LITTLE_ENDIAN_P
744 #define TARGET_IS_BIG_ENDIAN_P
747 #include "aout-target.h"