Back to index

cell-binutils  2.17cvs20070401
i386aout.c
Go to the documentation of this file.
00001 /* BFD back-end for i386 a.out binaries.
00002    Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003, 2005
00003    Free Software Foundation, Inc.
00004 
00005    This file is part of BFD, the Binary File Descriptor library.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 /* The only 386 aout system we have here is GO32 from DJ.
00022    These numbers make BFD work with that. If your aout 386 system
00023    doesn't work with these, we'll have to split them into different
00024    files.  Send me (sac@cygnus.com) the runes to make it work on your
00025    system, and I'll stick it in for the next release.  */
00026 
00027 #define N_HEADER_IN_TEXT(x) 0
00028 #define N_TXTOFF(x)                0x20
00029 #define N_TXTADDR(x)               (N_MAGIC (x) == ZMAGIC ? 0x1020 : 0)
00030 #define N_TXTSIZE(x)               ((x).a_text)
00031 #define TARGET_PAGE_SIZE    4096
00032 #define SEGMENT_SIZE               0x400000
00033 #define DEFAULT_ARCH               bfd_arch_i386
00034 
00035 /* Do not "beautify" the CONCAT* macro args.  Traditional C will not
00036    remove whitespace added here, and thus will fail to concatenate
00037    the tokens.  */
00038 #define MY(OP) CONCAT2 (i386aout_,OP)
00039 #define TARGETNAME "a.out-i386"
00040 #define NO_WRITE_HEADER_KLUDGE 1
00041 
00042 #include "bfd.h"
00043 #include "sysdep.h"
00044 #include "libbfd.h"
00045 #include "aout/aout64.h"
00046 #include "libaout.h"
00047 
00048 /* Set the machine type correctly.  */
00049 
00050 static bfd_boolean
00051 i386aout_write_object_contents (bfd *abfd)
00052 {
00053   struct external_exec exec_bytes;
00054   struct internal_exec *execp = exec_hdr (abfd);
00055 
00056   N_SET_MACHTYPE (*execp, M_386);
00057 
00058   obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
00059 
00060   WRITE_HEADERS (abfd, execp);
00061 
00062   return TRUE;
00063 }
00064 
00065 #define MY_write_object_contents  i386aout_write_object_contents
00066 #define MY_backend_data           & MY (backend_data)
00067 
00068 static const struct aout_backend_data MY (backend_data);
00069 
00070 #include "aout-target.h"
00071 
00072 static const struct aout_backend_data MY (backend_data) =
00073 {
00074   0,                        /* Zmagic contiguous.  */
00075   1,                        /* Text incl header.  */
00076   0,                        /* Entry is text address.  */
00077   0,                        /* Exec_hdr_flags.  */
00078   0,                        /* Text vma?  */
00079   MY (set_sizes),
00080   1,                        /* Exec header not counted.  */
00081   0,                        /* Add_dynamic_symbols.  */
00082   0,                        /* Add_one_symbol.  */
00083   0,                        /* Link_dynamic_object.  */
00084   0,                        /* Write_dynamic_symbol.  */
00085   0,                        /* Check_dynamic_reloc.  */
00086   0                         /* Finish_dynamic_link.  */
00087 };