| 1 | /* BFD back-end for i386 a.out binaries under dynix. |
| 2 | Copyright (C) 1994 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of BFD, the Binary File Descriptor library. |
| 5 | |
| 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. |
| 10 | |
| 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. |
| 15 | |
| 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 19 | |
| 20 | /* This BFD is currently only tested with gdb, writing object files |
| 21 | may not work. */ |
| 22 | |
| 23 | #define BYTES_IN_WORD 4 |
| 24 | #define ARCH 32 |
| 25 | |
| 26 | #define TEXT_START_ADDR 4096 |
| 27 | #define PAGE_SIZE 4096 |
| 28 | #define SEGMENT_SIZE PAGE_SIZE |
| 29 | |
| 30 | #include "aout/dynix3.h" |
| 31 | |
| 32 | #define DEFAULT_ARCH bfd_arch_i386 |
| 33 | #define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) |
| 34 | |
| 35 | #define MY(OP) CAT(i386dynix_,OP) |
| 36 | #define TARGETNAME "a.out-i386-dynix" |
| 37 | |
| 38 | #include "bfd.h" |
| 39 | #include "sysdep.h" |
| 40 | #include "libbfd.h" |
| 41 | #include "libaout.h" |
| 42 | |
| 43 | /* (Ab)use some fields in the internal exec header to be able to read |
| 44 | executables that contain shared data. */ |
| 45 | |
| 46 | #define a_shdata a_tload |
| 47 | #define a_shdrsize a_dload |
| 48 | #define aout_32_swap_exec_header_in dynix_swap_exec_header_in |
| 49 | |
| 50 | void |
| 51 | dynix_swap_exec_header_in (abfd, raw_bytes, execp) |
| 52 | bfd *abfd; |
| 53 | struct external_exec *raw_bytes; |
| 54 | struct internal_exec *execp; |
| 55 | { |
| 56 | struct external_exec *bytes = (struct external_exec *)raw_bytes; |
| 57 | |
| 58 | /* The internal_exec structure has some fields that are unused in this |
| 59 | configuration (IE for i960), so ensure that all such uninitialized |
| 60 | fields are zero'd out. There are places where two of these structs |
| 61 | are memcmp'd, and thus the contents do matter. */ |
| 62 | memset ((PTR) execp, 0, sizeof (struct internal_exec)); |
| 63 | /* Now fill in fields in the execp, from the bytes in the raw data. */ |
| 64 | execp->a_info = bfd_h_get_32 (abfd, bytes->e_info); |
| 65 | execp->a_text = GET_WORD (abfd, bytes->e_text); |
| 66 | execp->a_data = GET_WORD (abfd, bytes->e_data); |
| 67 | execp->a_bss = GET_WORD (abfd, bytes->e_bss); |
| 68 | execp->a_syms = GET_WORD (abfd, bytes->e_syms); |
| 69 | execp->a_entry = GET_WORD (abfd, bytes->e_entry); |
| 70 | execp->a_trsize = GET_WORD (abfd, bytes->e_trsize); |
| 71 | execp->a_drsize = GET_WORD (abfd, bytes->e_drsize); |
| 72 | execp->a_shdata = GET_WORD (abfd, bytes->e_shdata); |
| 73 | execp->a_shdrsize = GET_WORD (abfd, bytes->e_shdrsize); |
| 74 | } |
| 75 | |
| 76 | #include "aout-target.h" |