Back to index

cell-binutils  2.17cvs20070401
i386dynix.c
Go to the documentation of this file.
00001 /* BFD back-end for i386 a.out binaries under dynix.
00002    Copyright 1994, 1995, 2001, 2003 Free Software Foundation, Inc.
00003 
00004 This file is part of BFD, the Binary File Descriptor library.
00005 
00006 This program is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00019 
00020 /* This BFD is currently only tested with gdb, writing object files
00021    may not work.  */
00022 
00023 #define TEXT_START_ADDR 4096
00024 #define TARGET_PAGE_SIZE    4096
00025 #define SEGMENT_SIZE TARGET_PAGE_SIZE
00026 
00027 #include "aout/dynix3.h"
00028 
00029 #define DEFAULT_ARCH bfd_arch_i386
00030 #define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN)
00031 
00032 /* Do not "beautify" the CONCAT* macro args.  Traditional C will not
00033    remove whitespace added here, and thus will fail to concatenate
00034    the tokens.  */
00035 #define MY(OP) CONCAT2 (i386dynix_,OP)
00036 #define TARGETNAME "a.out-i386-dynix"
00037 #define NAME(x,y) CONCAT3 (i386dynix,_32_,y)
00038 #define ARCH_SIZE 32
00039 #define NAME_swap_exec_header_in NAME(i386dynix_32_,swap_exec_header_in)
00040 #define MY_get_section_contents aout_32_get_section_contents
00041 
00042 /* aoutx.h requires definitions for NMAGIC, BMAGIC and QMAGIC.  */
00043 #define NMAGIC 0
00044 #define BMAGIC OMAGIC
00045 #define QMAGIC XMAGIC
00046 
00047 #include "aoutx.h"
00048 
00049 /* (Ab)use some fields in the internal exec header to be able to read
00050    executables that contain shared data.  */
00051 
00052 #define a_shdata a_tload
00053 #define a_shdrsize a_dload
00054 
00055 void
00056 i386dynix_32_swap_exec_header_in (abfd, raw_bytes, execp)
00057      bfd *abfd;
00058      struct external_exec *raw_bytes;
00059      struct internal_exec *execp;
00060 {
00061   struct external_exec *bytes = (struct external_exec *)raw_bytes;
00062 
00063   /* The internal_exec structure has some fields that are unused in this
00064      configuration (IE for i960), so ensure that all such uninitialized
00065      fields are zero'd out.  There are places where two of these structs
00066      are memcmp'd, and thus the contents do matter. */
00067   memset ((PTR) execp, 0, sizeof (struct internal_exec));
00068   /* Now fill in fields in the execp, from the bytes in the raw data.  */
00069   execp->a_info   = H_GET_32 (abfd, bytes->e_info);
00070   execp->a_text   = GET_WORD (abfd, bytes->e_text);
00071   execp->a_data   = GET_WORD (abfd, bytes->e_data);
00072   execp->a_bss    = GET_WORD (abfd, bytes->e_bss);
00073   execp->a_syms   = GET_WORD (abfd, bytes->e_syms);
00074   execp->a_entry  = GET_WORD (abfd, bytes->e_entry);
00075   execp->a_trsize = GET_WORD (abfd, bytes->e_trsize);
00076   execp->a_drsize = GET_WORD (abfd, bytes->e_drsize);
00077   execp->a_shdata = GET_WORD (abfd, bytes->e_shdata);
00078   execp->a_shdrsize = GET_WORD (abfd, bytes->e_shdrsize);
00079 }
00080 
00081 #include "aout-target.h"