175fd0b74Schristos /* BFD backend for local host's a.out binaries 2*e992f068Schristos Copyright (C) 1990-2022 Free Software Foundation, Inc. 375fd0b74Schristos Written by Cygnus Support. Probably John Gilmore's fault. 475fd0b74Schristos 575fd0b74Schristos This file is part of BFD, the Binary File Descriptor library. 675fd0b74Schristos 775fd0b74Schristos This program is free software; you can redistribute it and/or modify 875fd0b74Schristos it under the terms of the GNU General Public License as published by 975fd0b74Schristos the Free Software Foundation; either version 3 of the License, or 1075fd0b74Schristos (at your option) any later version. 1175fd0b74Schristos 1275fd0b74Schristos This program is distributed in the hope that it will be useful, 1375fd0b74Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 1475fd0b74Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1575fd0b74Schristos GNU General Public License for more details. 1675fd0b74Schristos 1775fd0b74Schristos You should have received a copy of the GNU General Public License 1875fd0b74Schristos along with this program; if not, write to the Free Software 1975fd0b74Schristos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 2075fd0b74Schristos MA 02110-1301, USA. */ 2175fd0b74Schristos 2275fd0b74Schristos #include "sysdep.h" 2375fd0b74Schristos #include "bfd.h" 2475fd0b74Schristos #include "libbfd.h" 2575fd0b74Schristos 2675fd0b74Schristos #define ARCH_SIZE 32 2775fd0b74Schristos 2875fd0b74Schristos /* When porting to a new system, you must supply: 2975fd0b74Schristos 3075fd0b74Schristos HOST_PAGE_SIZE (optional) 3175fd0b74Schristos HOST_SEGMENT_SIZE (optional -- defaults to page size) 3275fd0b74Schristos HOST_MACHINE_ARCH (optional) 3375fd0b74Schristos HOST_MACHINE_MACHINE (optional) 3475fd0b74Schristos HOST_TEXT_START_ADDR (optional) 3575fd0b74Schristos HOST_STACK_END_ADDR (not used, except by trad-core ???) 3675fd0b74Schristos HOST_BIG_ENDIAN_P (required -- define if big-endian) 3775fd0b74Schristos 3875fd0b74Schristos in the ./hosts/h-systemname.h file. */ 3975fd0b74Schristos 4075fd0b74Schristos #ifdef TRAD_HEADER 4175fd0b74Schristos #include TRAD_HEADER 4275fd0b74Schristos #endif 4375fd0b74Schristos 4475fd0b74Schristos #ifdef HOST_PAGE_SIZE 4575fd0b74Schristos #define TARGET_PAGE_SIZE HOST_PAGE_SIZE 4675fd0b74Schristos #endif 4775fd0b74Schristos 4875fd0b74Schristos #ifdef HOST_SEGMENT_SIZE 4975fd0b74Schristos #define SEGMENT_SIZE HOST_SEGMENT_SIZE 5075fd0b74Schristos #else 5175fd0b74Schristos #define SEGMENT_SIZE TARGET_PAGE_SIZE 5275fd0b74Schristos #endif 5375fd0b74Schristos 5475fd0b74Schristos #ifdef HOST_TEXT_START_ADDR 5575fd0b74Schristos #define TEXT_START_ADDR HOST_TEXT_START_ADDR 5675fd0b74Schristos #endif 5775fd0b74Schristos 5875fd0b74Schristos #ifdef HOST_STACK_END_ADDR 5975fd0b74Schristos #define STACK_END_ADDR HOST_STACK_END_ADDR 6075fd0b74Schristos #endif 6175fd0b74Schristos 6275fd0b74Schristos #ifdef HOST_BIG_ENDIAN_P 6375fd0b74Schristos #define TARGET_IS_BIG_ENDIAN_P 6475fd0b74Schristos #else 6575fd0b74Schristos #undef TARGET_IS_BIG_ENDIAN_P 6675fd0b74Schristos #endif 6775fd0b74Schristos 6875fd0b74Schristos #include "libaout.h" /* BFD a.out internal data structures */ 6975fd0b74Schristos #include "aout/aout64.h" 7075fd0b74Schristos 7175fd0b74Schristos #ifdef HOST_MACHINE_ARCH 7275fd0b74Schristos #ifdef HOST_MACHINE_MACHINE 7375fd0b74Schristos #define SET_ARCH_MACH(abfd, execp) \ 7475fd0b74Schristos bfd_default_set_arch_mach(abfd, HOST_MACHINE_ARCH, HOST_MACHINE_MACHINE) 7575fd0b74Schristos #else 7675fd0b74Schristos #define SET_ARCH_MACH(abfd, execp) \ 7775fd0b74Schristos bfd_default_set_arch_mach(abfd, HOST_MACHINE_ARCH, 0) 7875fd0b74Schristos #endif 7975fd0b74Schristos #endif /* HOST_MACHINE_ARCH */ 8075fd0b74Schristos 8175fd0b74Schristos /* Do not "beautify" the CONCAT* macro args. Traditional C will not 8275fd0b74Schristos remove whitespace added here, and thus will fail to concatenate 8375fd0b74Schristos the tokens. */ 8475fd0b74Schristos #define MY(OP) CONCAT2 (host_aout_,OP) 8575fd0b74Schristos #define TARGETNAME "a.out" 8675fd0b74Schristos 8775fd0b74Schristos #include "aout-target.h" 88