2001-02-09 Bo Thorsen <bo@suse.de>
[binutils.git] / bfd / i386aout.c
blobd0b2cffef235621e6303c7ec87f5f4fe076887fd
1 /* BFD back-end for i386 a.out binaries.
2 Copyright 1990, 91, 92, 94, 95, 96, 1997 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21 /* The only 386 aout system we have here is GO32 from DJ.
22 These numbers make BFD work with that. If your aout 386 system
23 doesn't work with these, we'll have to split them into different
24 files. Send me (sac@cygnus.com) the runes to make it work on your
25 system, and I'll stick it in for the next release. */
27 #define N_HEADER_IN_TEXT(x) 0
28 #define BYTES_IN_WORD 4
30 #define N_TXTOFF(x) 0x20
31 #define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0)
33 #define N_TXTSIZE(x) ((x).a_text)
34 #if 0
35 #define N_DATADDR(x) (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) : (SEGMENT_SIZE + ((0x1020+(x).a_text-1) & ~(SEGMENT_SIZE-1))))
36 #define NOSUBEXECB
38 #endif
39 #define TARGET_PAGE_SIZE 4096
40 #define SEGMENT_SIZE 0x400000
41 #define DEFAULT_ARCH bfd_arch_i386
43 #define MY(OP) CAT(i386aout_,OP)
44 #define TARGETNAME "a.out-i386"
45 #define NO_WRITE_HEADER_KLUDGE 1
47 #include "bfd.h"
48 #include "sysdep.h"
49 #include "libbfd.h"
50 #include "aout/aout64.h"
51 #include "libaout.h"
53 /* Set the machine type correctly. */
55 static boolean
56 i386aout_write_object_contents (abfd)
57 bfd *abfd;
59 struct external_exec exec_bytes;
60 struct internal_exec *execp = exec_hdr (abfd);
62 N_SET_MACHTYPE (*execp, M_386);
64 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
66 WRITE_HEADERS (abfd, execp);
68 return true;
71 #define MY_write_object_contents i386aout_write_object_contents
73 static boolean MY(set_sizes)();
74 #define MY_backend_data &MY(backend_data)
75 static CONST struct aout_backend_data MY(backend_data) = {
76 0, /* zmagic contiguous */
77 1, /* text incl header */
78 0, /* entry is text address */
79 0, /* exec_hdr_flags */
80 0, /* text vma? */
81 MY(set_sizes),
82 1, /* exec header not counted */
83 0, /* add_dynamic_symbols */
84 0, /* add_one_symbol */
85 0, /* link_dynamic_object */
86 0, /* write_dynamic_symbol */
87 0, /* check_dynamic_reloc */
88 0 /* finish_dynamic_link */
91 #include "aout-target.h"