* aoutf1.h (internal_sunos_core): Make c_stacktop a bfd_vma.
[deliverable/binutils-gdb.git] / bfd / aoutf1.h
CommitLineData
250351fc
JK
1/* A.out "format 1" file handling code for BFD.
2 Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
3c8a3c56 3 Written by Cygnus Support.
7ed4093a 4
3c8a3c56 5This file is part of BFD, the Binary File Descriptor library.
7ed4093a 6
3c8a3c56 7This program is free software; you can redistribute it and/or modify
7ed4093a 8it under the terms of the GNU General Public License as published by
3c8a3c56
JG
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
7ed4093a 11
3c8a3c56 12This program is distributed in the hope that it will be useful,
7ed4093a
SC
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
3c8a3c56
JG
18along with this program; if not, write to the Free Software
19Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
6f715d66 20
7ed4093a 21#include "bfd.h"
bbc8d484 22#include "sysdep.h"
7ed4093a
SC
23#include "libbfd.h"
24
c3eb25fc
SC
25#include "aout/sun4.h"
26#include "libaout.h" /* BFD a.out internal data structures */
bbc8d484 27
c3eb25fc
SC
28#include "aout/aout64.h"
29#include "aout/stab_gnu.h"
30#include "aout/ar.h"
7ed4093a 31
6f715d66 32/*
6f715d66
SC
33The file @code{aoutf1.h} contains the code for BFD's
34a.out back end. Control over the generated back end is given by these
4f8b8627 35two preprocessor names:
6f715d66 36@table @code
4f8b8627 37@item ARCH_SIZE
6f715d66
SC
38This value should be either 32 or 64, depending upon the size of an
39int in the target format. It changes the sizes of the structs which
40perform the memory/disk mapping of structures.
41
42The 64 bit backend may only be used if the host compiler supports 64
4f8b8627
JG
43ints (eg long long with gcc), by defining the name @code{HOST_64_BIT} in @code{bfd.h}.
44With this name defined, @emph{all} bfd operations are performed with 64bit
6f715d66
SC
45arithmetic, not just those to a 64bit target.
46
47@item TARGETNAME
4f8b8627 48The name put into the target vector.
6f715d66 49@item
4f8b8627 50@end table
6f715d66
SC
51
52*/
7ed4093a
SC
53
54void (*bfd_error_trap)();
55
7ed4093a
SC
56/*SUPPRESS558*/
57/*SUPPRESS529*/
58
214f8f23
KR
59void
60DEFUN(NAME(sunos,set_arch_mach), (abfd, machtype),
61 bfd *abfd AND int machtype)
7ed4093a 62{
214f8f23 63 /* Determine the architecture and machine type of the object file. */
9e2dad8e
JG
64 enum bfd_architecture arch;
65 long machine;
214f8f23 66 switch (machtype) {
9e2dad8e 67
7ed4093a 68 case M_UNKNOWN:
c3eb25fc
SC
69 /* Some Sun3s make magic numbers without cpu types in them, so
70 we'll default to the 68020. */
71 arch = bfd_arch_m68k;
72 machine = 68020;
7ed4093a
SC
73 break;
74
75 case M_68010:
522e0ead 76 case M_HP200:
9e2dad8e
JG
77 arch = bfd_arch_m68k;
78 machine = 68010;
7ed4093a
SC
79 break;
80
81 case M_68020:
522e0ead 82 case M_HP300:
9e2dad8e
JG
83 arch = bfd_arch_m68k;
84 machine = 68020;
7ed4093a
SC
85 break;
86
87 case M_SPARC:
9e2dad8e
JG
88 arch = bfd_arch_sparc;
89 machine = 0;
7ed4093a
SC
90 break;
91
92 case M_386:
9e2dad8e
JG
93 arch = bfd_arch_i386;
94 machine = 0;
7ed4093a
SC
95 break;
96
97 case M_29K:
9e2dad8e
JG
98 arch = bfd_arch_a29k;
99 machine = 0;
7ed4093a
SC
100 break;
101
522e0ead
SC
102 case M_HPUX:
103 arch = bfd_arch_m68k;
104 machine = 0;
105 break;
106
7ed4093a 107 default:
9e2dad8e
JG
108 arch = bfd_arch_obscure;
109 machine = 0;
7ed4093a
SC
110 break;
111 }
9e2dad8e 112 bfd_set_arch_mach(abfd, arch, machine);
7ed4093a
SC
113}
114
214f8f23
KR
115#define SET_ARCH_MACH(ABFD, EXEC) \
116 NAME(sunos,set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \
117 choose_reloc_size(ABFD);
118
119/* Determine the size of a relocation entry, based on the architecture */
120static void
121DEFUN(choose_reloc_size,(abfd),
122bfd *abfd)
123{
124 switch (bfd_get_arch(abfd)) {
125 case bfd_arch_sparc:
126 case bfd_arch_a29k:
127 obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
128 break;
129 default:
130 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
131 break;
132 }
133}
7ed4093a
SC
134
135/* Write an object file in SunOS format.
9e2dad8e
JG
136 Section contents have already been written. We write the
137 file header, symbols, and relocation. */
7ed4093a 138
c3eb25fc 139static boolean
9e2dad8e
JG
140DEFUN(NAME(aout,sunos4_write_object_contents),
141 (abfd),
7ed4093a 142 bfd *abfd)
9e2dad8e 143{
9e2dad8e
JG
144 struct external_exec exec_bytes;
145 struct internal_exec *execp = exec_hdr (abfd);
7ed4093a 146
9e2dad8e
JG
147 /* Magic number, maestro, please! */
148 switch (bfd_get_arch(abfd)) {
149 case bfd_arch_m68k:
150 switch (bfd_get_mach(abfd)) {
151 case 68010:
152 N_SET_MACHTYPE(*execp, M_68010);
7ed4093a
SC
153 break;
154 default:
9e2dad8e
JG
155 case 68020:
156 N_SET_MACHTYPE(*execp, M_68020);
157 break;
7ed4093a 158 }
9e2dad8e
JG
159 break;
160 case bfd_arch_sparc:
161 N_SET_MACHTYPE(*execp, M_SPARC);
162 break;
163 case bfd_arch_i386:
164 N_SET_MACHTYPE(*execp, M_386);
165 break;
166 case bfd_arch_a29k:
167 N_SET_MACHTYPE(*execp, M_29K);
168 break;
169 default:
170 N_SET_MACHTYPE(*execp, M_UNKNOWN);
171 }
7ed4093a 172
9e2dad8e 173 choose_reloc_size(abfd);
250351fc
JK
174
175 /* Some tools want this to be 0, some tools want this to be one.
176 Today, it seems that 0 is the most important setting (PR1927) */
177 N_SET_FLAGS (*execp, 0x0);
9e2dad8e
JG
178
179 WRITE_HEADERS(abfd, execp);
214f8f23 180
7ed4093a
SC
181 return true;
182}
183\f
184/* core files */
185
186#define CORE_MAGIC 0x080456
187#define CORE_NAMELEN 16
188
189/* The core structure is taken from the Sun documentation.
9e2dad8e
JG
190 Unfortunately, they don't document the FPA structure, or at least I
191 can't find it easily. Fortunately the core header contains its own
192 length. So this shouldn't cause problems, except for c_ucode, which
193 so far we don't use but is easy to find with a little arithmetic. */
7ed4093a
SC
194
195/* But the reg structure can be gotten from the SPARC processor handbook.
9e2dad8e
JG
196 This really should be in a GNU include file though so that gdb can use
197 the same info. */
7ed4093a
SC
198struct regs {
199 int r_psr;
200 int r_pc;
201 int r_npc;
202 int r_y;
203 int r_g1;
204 int r_g2;
205 int r_g3;
206 int r_g4;
207 int r_g5;
208 int r_g6;
209 int r_g7;
210 int r_o0;
211 int r_o1;
212 int r_o2;
213 int r_o3;
214 int r_o4;
215 int r_o5;
216 int r_o6;
217 int r_o7;
218};
219
220/* Taken from Sun documentation: */
221
222/* FIXME: It's worse than we expect. This struct contains TWO substructs
9e2dad8e
JG
223 neither of whose size we know, WITH STUFF IN BETWEEN THEM! We can't
224 even portably access the stuff in between! */
7ed4093a 225
4f8b8627 226struct external_sparc_core {
7ed4093a
SC
227 int c_magic; /* Corefile magic number */
228 int c_len; /* Sizeof (struct core) */
4f8b8627
JG
229#define SPARC_CORE_LEN 432
230 int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
9e2dad8e
JG
231 struct external_exec c_aouthdr; /* A.out header */
232 int c_signo; /* Killing signal, if any */
233 int c_tsize; /* Text size (bytes) */
234 int c_dsize; /* Data size (bytes) */
235 int c_ssize; /* Stack size (bytes) */
7ed4093a
SC
236 char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
237 double fp_stuff[1]; /* external FPU state (size unknown by us) */
238 /* The type "double" is critical here, for alignment.
239 SunOS declares a struct here, but the struct's alignment
240 is double since it contains doubles. */
241 int c_ucode; /* Exception no. from u_code */
242 /* (this member is not accessible by name since we don't
243 portably know the size of fp_stuff.) */
244};
245
4f8b8627
JG
246struct external_sun3_core {
247 int c_magic; /* Corefile magic number */
248 int c_len; /* Sizeof (struct core) */
249#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1 */
250 int c_regs[18]; /* General purpose registers -- MACHDEP SIZE */
251 struct external_exec c_aouthdr; /* A.out header */
252 int c_signo; /* Killing signal, if any */
253 int c_tsize; /* Text size (bytes) */
254 int c_dsize; /* Data size (bytes) */
255 int c_ssize; /* Stack size (bytes) */
256 char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
257 double fp_stuff[1]; /* external FPU state (size unknown by us) */
258 /* The type "double" is critical here, for alignment.
259 SunOS declares a struct here, but the struct's alignment
260 is double since it contains doubles. */
261 int c_ucode; /* Exception no. from u_code */
262 /* (this member is not accessible by name since we don't
263 portably know the size of fp_stuff.) */
264};
265
266struct internal_sunos_core {
267 int c_magic; /* Corefile magic number */
268 int c_len; /* Sizeof (struct core) */
269 long c_regs_pos; /* file offset of General purpose registers */
270 int c_regs_size; /* size of General purpose registers */
9e2dad8e
JG
271 struct internal_exec c_aouthdr; /* A.out header */
272 int c_signo; /* Killing signal, if any */
273 int c_tsize; /* Text size (bytes) */
274 int c_dsize; /* Data size (bytes) */
275 int c_ssize; /* Stack size (bytes) */
250351fc 276 bfd_vma c_stacktop; /* Stack top (address) */
4f8b8627
JG
277 char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
278 long fp_stuff_pos; /* file offset of external FPU state (regs) */
279 int fp_stuff_size; /* Size of it */
280 int c_ucode; /* Exception no. from u_code */
281};
7ed4093a 282
4f8b8627
JG
283/* byte-swap in the Sun-3 core structure */
284static void
285DEFUN(swapcore_sun3,(abfd, ext, intcore),
286 bfd *abfd AND
12e7087f 287 char *ext AND
4f8b8627
JG
288 struct internal_sunos_core *intcore)
289{
4f8b8627 290 struct external_sun3_core *extcore = (struct external_sun3_core *)ext;
9e2dad8e 291
4f8b8627
JG
292 intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_magic);
293 intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_len );
294 intcore->c_regs_pos = (long) (((struct external_sun3_core *)0)->c_regs);
295 intcore->c_regs_size = sizeof (extcore->c_regs);
296 NAME(aout,swap_exec_header_in)(abfd, &extcore->c_aouthdr,&intcore->c_aouthdr);
297 intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_signo);
298 intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_tsize);
299 intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_dsize);
300 intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_ssize);
214f8f23 301 memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
4f8b8627
JG
302 intcore->fp_stuff_pos = (long) (((struct external_sun3_core *)0)->fp_stuff);
303 /* FP stuff takes up whole rest of struct, except c_ucode. */
304 intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
305 (file_ptr)(((struct external_sun3_core *)0)->fp_stuff);
306 /* Ucode is the last thing in the struct -- just before the end */
9e2dad8e
JG
307 intcore->c_ucode =
308 bfd_h_get_32 (abfd,
309 intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore);
310 intcore->c_stacktop = 0x0E000000; /* By experimentation */
4f8b8627
JG
311}
312
313
fb3be09b 314/* byte-swap in the Sparc core structure */
4f8b8627
JG
315static void
316DEFUN(swapcore_sparc,(abfd, ext, intcore),
317 bfd *abfd AND
12e7087f 318 char *ext AND
4f8b8627
JG
319 struct internal_sunos_core *intcore)
320{
321 struct external_sparc_core *extcore = (struct external_sparc_core *)ext;
322
323 intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_magic);
324 intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_len );
325 intcore->c_regs_pos = (long) (((struct external_sparc_core *)0)->c_regs);
326 intcore->c_regs_size = sizeof (extcore->c_regs);
327 NAME(aout,swap_exec_header_in)(abfd, &extcore->c_aouthdr,&intcore->c_aouthdr);
328 intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_signo);
329 intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_tsize);
330 intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_dsize);
331 intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *)&extcore->c_ssize);
214f8f23 332 memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
4f8b8627
JG
333 intcore->fp_stuff_pos = (long) (((struct external_sparc_core *)0)->fp_stuff);
334 /* FP stuff takes up whole rest of struct, except c_ucode. */
335 intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
336 (file_ptr)(((struct external_sparc_core *)0)->fp_stuff);
337 /* Ucode is the last thing in the struct -- just before the end */
9e2dad8e
JG
338 intcore->c_ucode =
339 bfd_h_get_32 (abfd,
340 intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore);
250351fc 341
4f8b8627 342 /* Supposedly the user stack grows downward from the bottom of kernel memory.
250351fc
JK
343 Presuming that this remains true, this definition will work. */
344 /* Now sun has provided us with another challenge. The value is different
345 for sparc2 and sparc10 (both running SunOS 4.1.3). We pick one or
346 the other based on the current value of the stack pointer. This
347 loses (a) if the stack pointer has been clobbered, or (b) if the stack
348 is larger than 128 megabytes.
349
350 It's times like these you're glad they're switching to ELF.
351
352 Note that using include files or nlist on /vmunix would be wrong,
353 because we want the value for this core file, no matter what kind of
354 machine we were compiled on or are running on. */
355#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
356#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
357 {
358 bfd_vma sp = bfd_h_get_32
359 (abfd, (unsigned char *)&((struct regs *)&extcore->c_regs[0])->r_o6);
360 if (sp < SPARC_USRSTACK_SPARC10)
361 intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
362 else
363 intcore->c_stacktop = SPARC_USRSTACK_SPARC2;
364 }
4f8b8627 365}
7ed4093a 366
4f8b8627 367/* need this cast because ptr is really void * */
214f8f23
KR
368#define core_hdr(bfd) ((bfd)->tdata.sun_core_data)
369#define core_datasec(bfd) (core_hdr(bfd)->data_section)
370#define core_stacksec(bfd) (core_hdr(bfd)->stack_section)
371#define core_regsec(bfd) (core_hdr(bfd)->reg_section)
372#define core_reg2sec(bfd) (core_hdr(bfd)->reg2_section)
7ed4093a
SC
373
374/* These are stored in the bfd's tdata */
214f8f23 375struct sun_core_struct {
4f8b8627
JG
376 struct internal_sunos_core *hdr; /* core file header */
377 asection *data_section;
378 asection *stack_section;
379 asection *reg_section;
380 asection *reg2_section;
7ed4093a
SC
381};
382
383static bfd_target *
384DEFUN(sunos4_core_file_p,(abfd),
385 bfd *abfd)
386{
387 unsigned char longbuf[4]; /* Raw bytes of various header fields */
388 int core_size;
389 int core_mag;
4f8b8627
JG
390 struct internal_sunos_core *core;
391 char *extcore;
4f8b8627 392 struct mergem {
214f8f23 393 struct sun_core_struct suncoredata;
4f8b8627
JG
394 struct internal_sunos_core internal_sunos_core;
395 char external_core[1];
396 } *mergem;
7ed4093a
SC
397
398 bfd_error = system_call_error;
399
400 if (bfd_read ((PTR)longbuf, 1, sizeof (longbuf), abfd) !=
401 sizeof (longbuf))
402 return 0;
403 core_mag = bfd_h_get_32 (abfd, longbuf);
404
405 if (core_mag != CORE_MAGIC) return 0;
406
407 /* SunOS core headers can vary in length; second word is size; */
408 if (bfd_read ((PTR)longbuf, 1, sizeof (longbuf), abfd) !=
409 sizeof (longbuf))
410 return 0;
411 core_size = bfd_h_get_32 (abfd, longbuf);
412 /* Sanity check */
413 if (core_size > 20000)
414 return 0;
415
f8e01940 416 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0) return 0;
7ed4093a 417
4f8b8627
JG
418 mergem = (struct mergem *)bfd_zalloc (abfd, core_size + sizeof (struct mergem));
419 if (mergem == NULL) {
7ed4093a
SC
420 bfd_error = no_memory;
421 return 0;
422 }
423
4f8b8627 424 extcore = mergem->external_core;
7ed4093a 425
4f8b8627 426 if ((bfd_read ((PTR) extcore, 1, core_size, abfd)) != core_size) {
7ed4093a 427 bfd_error = system_call_error;
4f8b8627
JG
428 bfd_release (abfd, (char *)mergem);
429 return 0;
430 }
431
432 /* Validate that it's a core file we know how to handle, due to sun
433 botching the positioning of registers and other fields in a machine
434 dependent way. */
435 core = &mergem->internal_sunos_core;
436 switch (core_size) {
437 case SPARC_CORE_LEN:
438 swapcore_sparc (abfd, extcore, core);
439 break;
440 case SUN3_CORE_LEN:
441 swapcore_sun3 (abfd, extcore, core);
442 break;
443 default:
444 bfd_error = system_call_error; /* FIXME */
445 bfd_release (abfd, (char *)mergem);
7ed4093a
SC
446 return 0;
447 }
448
214f8f23
KR
449 abfd->tdata.sun_core_data = &mergem->suncoredata;
450 abfd->tdata.sun_core_data->hdr = core;
7ed4093a
SC
451
452 /* create the sections. This is raunchy, but bfd_close wants to reclaim
453 them */
454 core_stacksec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
455 if (core_stacksec (abfd) == NULL) {
456 loser:
457 bfd_error = no_memory;
fb3be09b 458 bfd_release (abfd, (char *)mergem);
7ed4093a
SC
459 return 0;
460 }
461 core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
462 if (core_datasec (abfd) == NULL) {
463 loser1:
464 bfd_release (abfd, core_stacksec (abfd));
465 goto loser;
466 }
467 core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
468 if (core_regsec (abfd) == NULL) {
469 loser2:
470 bfd_release (abfd, core_datasec (abfd));
471 goto loser1;
472 }
473 core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
474 if (core_reg2sec (abfd) == NULL) {
475 bfd_release (abfd, core_regsec (abfd));
476 goto loser2;
477 }
478
479 core_stacksec (abfd)->name = ".stack";
480 core_datasec (abfd)->name = ".data";
481 core_regsec (abfd)->name = ".reg";
482 core_reg2sec (abfd)->name = ".reg2";
483
12e7087f
JG
484 core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
485 core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
486 core_regsec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
487 core_reg2sec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
7ed4093a 488
214f8f23
KR
489 core_stacksec (abfd)->_raw_size = core->c_ssize;
490 core_datasec (abfd)->_raw_size = core->c_dsize;
491 core_regsec (abfd)->_raw_size = core->c_regs_size;
492 core_reg2sec (abfd)->_raw_size = core->fp_stuff_size;
7ed4093a 493
4f8b8627 494 core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize);
7ed4093a 495 core_datasec (abfd)->vma = N_DATADDR(core->c_aouthdr);
522e0ead
SC
496 core_regsec (abfd)->vma = 0;
497 core_reg2sec (abfd)->vma = 0;
7ed4093a
SC
498
499 core_stacksec (abfd)->filepos = core->c_len + core->c_dsize;
500 core_datasec (abfd)->filepos = core->c_len;
4f8b8627
JG
501 /* We'll access the regs afresh in the core file, like any section: */
502 core_regsec (abfd)->filepos = (file_ptr)core->c_regs_pos;
503 core_reg2sec (abfd)->filepos = (file_ptr)core->fp_stuff_pos;
7ed4093a
SC
504
505 /* Align to word at least */
506 core_stacksec (abfd)->alignment_power = 2;
507 core_datasec (abfd)->alignment_power = 2;
508 core_regsec (abfd)->alignment_power = 2;
509 core_reg2sec (abfd)->alignment_power = 2;
510
511 abfd->sections = core_stacksec (abfd);
512 core_stacksec (abfd)->next = core_datasec (abfd);
513 core_datasec (abfd)->next = core_regsec (abfd);
514 core_regsec (abfd)->next = core_reg2sec (abfd);
515
516 abfd->section_count = 4;
517
518 return abfd->xvec;
519}
520
521static char *sunos4_core_file_failing_command (abfd)
522bfd *abfd;
523 {
214f8f23 524 return core_hdr (abfd)->hdr->c_cmdname;
7ed4093a
SC
525}
526
527static int
528DEFUN(sunos4_core_file_failing_signal,(abfd),
529 bfd *abfd)
530{
214f8f23 531 return core_hdr (abfd)->hdr->c_signo;
7ed4093a
SC
532}
533
534static boolean
535DEFUN(sunos4_core_file_matches_executable_p, (core_bfd, exec_bfd),
536 bfd *core_bfd AND
537 bfd *exec_bfd)
538{
539 if (core_bfd->xvec != exec_bfd->xvec) {
540 bfd_error = system_call_error;
541 return false;
542 }
543
214f8f23
KR
544 return (memcmp ((char *)&((core_hdr (core_bfd)->hdr)->c_aouthdr),
545 (char *) exec_hdr (exec_bfd),
546 sizeof (struct internal_exec)) == 0) ? true : false;
547}
548
250351fc 549#define MY_set_sizes sunos4_set_sizes
214f8f23
KR
550static boolean
551DEFUN (sunos4_set_sizes, (abfd),
552 bfd *abfd)
553{
554 switch (bfd_get_arch (abfd))
555 {
556 default:
557 return false;
558 case bfd_arch_sparc:
559 adata(abfd).page_size = 0x2000;
560 adata(abfd).segment_size = 0x2000;
561 adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
562 return true;
563 case bfd_arch_m68k:
564 adata(abfd).page_size = 0x2000;
565 adata(abfd).segment_size = 0x20000;
566 adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
567 return true;
568 }
569}
570
571static CONST struct aout_backend_data sunos4_aout_backend = {
7f90aa8b 572 0, 1, 0, sunos4_set_sizes, 0,
214f8f23 573};
7ed4093a 574\f
c3eb25fc
SC
575#define MY_core_file_failing_command sunos4_core_file_failing_command
576#define MY_core_file_failing_signal sunos4_core_file_failing_signal
577#define MY_core_file_matches_executable_p sunos4_core_file_matches_executable_p
6f715d66 578
c3eb25fc
SC
579#define MY_bfd_debug_info_start bfd_void
580#define MY_bfd_debug_info_end bfd_void
250351fc
JK
581#define MY_bfd_debug_info_accumulate \
582 (void (*) PARAMS ((bfd *, struct sec *))) bfd_void
583#define MY_core_file_p sunos4_core_file_p
584#define MY_write_object_contents NAME(aout,sunos4_write_object_contents)
214f8f23 585#define MY_backend_data &sunos4_aout_backend
6f715d66 586
c3eb25fc 587#define TARGET_IS_BIG_ENDIAN_P
6f715d66 588
c3eb25fc 589#include "aout-target.h"
This page took 0.086002 seconds and 4 git commands to generate.