| 1 | /* BFD backend for local host's a.out binaries |
| 2 | Copyright (C) 1990-2017 Free Software Foundation, Inc. |
| 3 | Written by Cygnus Support. Probably John Gilmore's fault. |
| 4 | |
| 5 | This file is part of BFD, the Binary File Descriptor library. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
| 20 | MA 02110-1301, USA. */ |
| 21 | |
| 22 | #include "sysdep.h" |
| 23 | #include "bfd.h" |
| 24 | #include "libbfd.h" |
| 25 | |
| 26 | #define ARCH_SIZE 32 |
| 27 | |
| 28 | /* When porting to a new system, you must supply: |
| 29 | |
| 30 | HOST_PAGE_SIZE (optional) |
| 31 | HOST_SEGMENT_SIZE (optional -- defaults to page size) |
| 32 | HOST_MACHINE_ARCH (optional) |
| 33 | HOST_MACHINE_MACHINE (optional) |
| 34 | HOST_TEXT_START_ADDR (optional) |
| 35 | HOST_STACK_END_ADDR (not used, except by trad-core ???) |
| 36 | HOST_BIG_ENDIAN_P (required -- define if big-endian) |
| 37 | |
| 38 | in the ./hosts/h-systemname.h file. */ |
| 39 | |
| 40 | #ifdef TRAD_HEADER |
| 41 | #include TRAD_HEADER |
| 42 | #endif |
| 43 | |
| 44 | #ifdef HOST_PAGE_SIZE |
| 45 | #define TARGET_PAGE_SIZE HOST_PAGE_SIZE |
| 46 | #endif |
| 47 | |
| 48 | #ifdef HOST_SEGMENT_SIZE |
| 49 | #define SEGMENT_SIZE HOST_SEGMENT_SIZE |
| 50 | #else |
| 51 | #define SEGMENT_SIZE TARGET_PAGE_SIZE |
| 52 | #endif |
| 53 | |
| 54 | #ifdef HOST_TEXT_START_ADDR |
| 55 | #define TEXT_START_ADDR HOST_TEXT_START_ADDR |
| 56 | #endif |
| 57 | |
| 58 | #ifdef HOST_STACK_END_ADDR |
| 59 | #define STACK_END_ADDR HOST_STACK_END_ADDR |
| 60 | #endif |
| 61 | |
| 62 | #ifdef HOST_BIG_ENDIAN_P |
| 63 | #define TARGET_IS_BIG_ENDIAN_P |
| 64 | #else |
| 65 | #undef TARGET_IS_BIG_ENDIAN_P |
| 66 | #endif |
| 67 | |
| 68 | #include "libaout.h" /* BFD a.out internal data structures */ |
| 69 | #include "aout/aout64.h" |
| 70 | |
| 71 | #ifdef HOST_MACHINE_ARCH |
| 72 | #ifdef HOST_MACHINE_MACHINE |
| 73 | #define SET_ARCH_MACH(abfd, execp) \ |
| 74 | bfd_default_set_arch_mach(abfd, HOST_MACHINE_ARCH, HOST_MACHINE_MACHINE) |
| 75 | #else |
| 76 | #define SET_ARCH_MACH(abfd, execp) \ |
| 77 | bfd_default_set_arch_mach(abfd, HOST_MACHINE_ARCH, 0) |
| 78 | #endif |
| 79 | #endif /* HOST_MACHINE_ARCH */ |
| 80 | |
| 81 | /* Do not "beautify" the CONCAT* macro args. Traditional C will not |
| 82 | remove whitespace added here, and thus will fail to concatenate |
| 83 | the tokens. */ |
| 84 | #define MY(OP) CONCAT2 (host_aout_,OP) |
| 85 | #define TARGETNAME "a.out" |
| 86 | |
| 87 | #include "aout-target.h" |