1*3d8817e4Smiod /* BFD back-end for i386 a.out binaries.
2*3d8817e4Smiod Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003, 2005
3*3d8817e4Smiod Free Software Foundation, Inc.
4*3d8817e4Smiod
5*3d8817e4Smiod This file is part of BFD, the Binary File Descriptor library.
6*3d8817e4Smiod
7*3d8817e4Smiod This program is free software; you can redistribute it and/or modify
8*3d8817e4Smiod it under the terms of the GNU General Public License as published by
9*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or
10*3d8817e4Smiod (at your option) any later version.
11*3d8817e4Smiod
12*3d8817e4Smiod This program is distributed in the hope that it will be useful,
13*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of
14*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15*3d8817e4Smiod GNU General Public License for more details.
16*3d8817e4Smiod
17*3d8817e4Smiod You should have received a copy of the GNU General Public License
18*3d8817e4Smiod along with this program; if not, write to the Free Software
19*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
20*3d8817e4Smiod
21*3d8817e4Smiod /* The only 386 aout system we have here is GO32 from DJ.
22*3d8817e4Smiod These numbers make BFD work with that. If your aout 386 system
23*3d8817e4Smiod doesn't work with these, we'll have to split them into different
24*3d8817e4Smiod files. Send me (sac@cygnus.com) the runes to make it work on your
25*3d8817e4Smiod system, and I'll stick it in for the next release. */
26*3d8817e4Smiod
27*3d8817e4Smiod #define N_HEADER_IN_TEXT(x) 0
28*3d8817e4Smiod #define N_TXTOFF(x) 0x20
29*3d8817e4Smiod #define N_TXTADDR(x) (N_MAGIC (x) == ZMAGIC ? 0x1020 : 0)
30*3d8817e4Smiod #define N_TXTSIZE(x) ((x).a_text)
31*3d8817e4Smiod #define TARGET_PAGE_SIZE 4096
32*3d8817e4Smiod #define SEGMENT_SIZE 0x400000
33*3d8817e4Smiod #define DEFAULT_ARCH bfd_arch_i386
34*3d8817e4Smiod
35*3d8817e4Smiod /* Do not "beautify" the CONCAT* macro args. Traditional C will not
36*3d8817e4Smiod remove whitespace added here, and thus will fail to concatenate
37*3d8817e4Smiod the tokens. */
38*3d8817e4Smiod #define MY(OP) CONCAT2 (i386aout_,OP)
39*3d8817e4Smiod #define TARGETNAME "a.out-i386"
40*3d8817e4Smiod #define NO_WRITE_HEADER_KLUDGE 1
41*3d8817e4Smiod
42*3d8817e4Smiod #include "bfd.h"
43*3d8817e4Smiod #include "sysdep.h"
44*3d8817e4Smiod #include "libbfd.h"
45*3d8817e4Smiod #include "aout/aout64.h"
46*3d8817e4Smiod #include "libaout.h"
47*3d8817e4Smiod
48*3d8817e4Smiod /* Set the machine type correctly. */
49*3d8817e4Smiod
50*3d8817e4Smiod static bfd_boolean
i386aout_write_object_contents(bfd * abfd)51*3d8817e4Smiod i386aout_write_object_contents (bfd *abfd)
52*3d8817e4Smiod {
53*3d8817e4Smiod struct external_exec exec_bytes;
54*3d8817e4Smiod struct internal_exec *execp = exec_hdr (abfd);
55*3d8817e4Smiod
56*3d8817e4Smiod N_SET_MACHTYPE (*execp, M_386);
57*3d8817e4Smiod
58*3d8817e4Smiod obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
59*3d8817e4Smiod
60*3d8817e4Smiod WRITE_HEADERS (abfd, execp);
61*3d8817e4Smiod
62*3d8817e4Smiod return TRUE;
63*3d8817e4Smiod }
64*3d8817e4Smiod
65*3d8817e4Smiod #define MY_write_object_contents i386aout_write_object_contents
66*3d8817e4Smiod #define MY_backend_data & MY (backend_data)
67*3d8817e4Smiod
68*3d8817e4Smiod static const struct aout_backend_data MY (backend_data);
69*3d8817e4Smiod
70*3d8817e4Smiod #include "aout-target.h"
71*3d8817e4Smiod
72*3d8817e4Smiod static const struct aout_backend_data MY (backend_data) =
73*3d8817e4Smiod {
74*3d8817e4Smiod 0, /* Zmagic contiguous. */
75*3d8817e4Smiod 1, /* Text incl header. */
76*3d8817e4Smiod 0, /* Entry is text address. */
77*3d8817e4Smiod 0, /* Exec_hdr_flags. */
78*3d8817e4Smiod 0, /* Text vma? */
79*3d8817e4Smiod MY (set_sizes),
80*3d8817e4Smiod 1, /* Exec header not counted. */
81*3d8817e4Smiod 0, /* Add_dynamic_symbols. */
82*3d8817e4Smiod 0, /* Add_one_symbol. */
83*3d8817e4Smiod 0, /* Link_dynamic_object. */
84*3d8817e4Smiod 0, /* Write_dynamic_symbol. */
85*3d8817e4Smiod 0, /* Check_dynamic_reloc. */
86*3d8817e4Smiod 0 /* Finish_dynamic_link. */
87*3d8817e4Smiod };
88