xref: /openbsd-src/gnu/usr.bin/binutils/bfd/host-aout.c (revision c074d1c999f3e07019cd5e9a2f190b057ef3b935)
12159047fSniklas /* BFD backend for local host's a.out binaries
2*c074d1c9Sdrahn    Copyright 1990, 1991, 1992, 1994, 1995, 2001
3*c074d1c9Sdrahn    Free Software Foundation, Inc.
42159047fSniklas    Written by Cygnus Support.  Probably John Gilmore's fault.
52159047fSniklas 
62159047fSniklas This file is part of BFD, the Binary File Descriptor library.
72159047fSniklas 
82159047fSniklas This program is free software; you can redistribute it and/or modify
92159047fSniklas it under the terms of the GNU General Public License as published by
102159047fSniklas the Free Software Foundation; either version 2 of the License, or
112159047fSniklas (at your option) any later version.
122159047fSniklas 
132159047fSniklas This program is distributed in the hope that it will be useful,
142159047fSniklas but WITHOUT ANY WARRANTY; without even the implied warranty of
152159047fSniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
162159047fSniklas GNU General Public License for more details.
172159047fSniklas 
182159047fSniklas You should have received a copy of the GNU General Public License
192159047fSniklas along with this program; if not, write to the Free Software
202159047fSniklas Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
212159047fSniklas 
222159047fSniklas #include "bfd.h"
232159047fSniklas #include "sysdep.h"
242159047fSniklas #include "libbfd.h"
252159047fSniklas 
262159047fSniklas #define	ARCH_SIZE	32
272159047fSniklas 
282159047fSniklas /* When porting to a new system, you must supply:
292159047fSniklas 
302159047fSniklas 	HOST_PAGE_SIZE		(optional)
312159047fSniklas 	HOST_SEGMENT_SIZE	(optional -- defaults to page size)
322159047fSniklas 	HOST_MACHINE_ARCH	(optional)
332159047fSniklas 	HOST_MACHINE_MACHINE	(optional)
342159047fSniklas 	HOST_TEXT_START_ADDR	(optional)
352159047fSniklas 	HOST_STACK_END_ADDR	(not used, except by trad-core ???)
362159047fSniklas 	HOST_BIG_ENDIAN_P	(required -- define if big-endian)
372159047fSniklas 
382159047fSniklas    in the ./hosts/h-systemname.h file.  */
392159047fSniklas 
40c88b1d6cSniklas #ifdef TRAD_HEADER
41c88b1d6cSniklas #include TRAD_HEADER
42c88b1d6cSniklas #endif
43c88b1d6cSniklas 
442159047fSniklas #ifdef			HOST_PAGE_SIZE
452159047fSniklas #define	TARGET_PAGE_SIZE	HOST_PAGE_SIZE
462159047fSniklas #endif
472159047fSniklas 
482159047fSniklas #ifdef			HOST_SEGMENT_SIZE
492159047fSniklas #define	SEGMENT_SIZE	HOST_SEGMENT_SIZE
502159047fSniklas #else
512159047fSniklas #define	SEGMENT_SIZE	TARGET_PAGE_SIZE
522159047fSniklas #endif
532159047fSniklas 
542159047fSniklas #ifdef			HOST_TEXT_START_ADDR
552159047fSniklas #define	TEXT_START_ADDR	HOST_TEXT_START_ADDR
562159047fSniklas #endif
572159047fSniklas 
582159047fSniklas #ifdef			HOST_STACK_END_ADDR
592159047fSniklas #define	STACK_END_ADDR	HOST_STACK_END_ADDR
602159047fSniklas #endif
612159047fSniklas 
622159047fSniklas #ifdef			HOST_BIG_ENDIAN_P
632159047fSniklas #define	TARGET_IS_BIG_ENDIAN_P
642159047fSniklas #else
652159047fSniklas #undef  TARGET_IS_BIG_ENDIAN_P
662159047fSniklas #endif
672159047fSniklas 
682159047fSniklas #include "libaout.h"           /* BFD a.out internal data structures */
692159047fSniklas #include "aout/aout64.h"
702159047fSniklas 
712159047fSniklas #ifdef HOST_MACHINE_ARCH
722159047fSniklas #ifdef HOST_MACHINE_MACHINE
732159047fSniklas #define SET_ARCH_MACH(abfd, execp) \
742159047fSniklas   bfd_default_set_arch_mach(abfd, HOST_MACHINE_ARCH, HOST_MACHINE_MACHINE)
752159047fSniklas #else
762159047fSniklas #define SET_ARCH_MACH(abfd, execp) \
772159047fSniklas   bfd_default_set_arch_mach(abfd, HOST_MACHINE_ARCH, 0)
782159047fSniklas #endif
792159047fSniklas #endif /* HOST_MACHINE_ARCH */
802159047fSniklas 
81*c074d1c9Sdrahn /* Do not "beautify" the CONCAT* macro args.  Traditional C will not
82*c074d1c9Sdrahn    remove whitespace added here, and thus will fail to concatenate
83*c074d1c9Sdrahn    the tokens.  */
84*c074d1c9Sdrahn #define MY(OP) CONCAT2 (host_aout_,OP)
852159047fSniklas #define TARGETNAME "a.out"
862159047fSniklas 
872159047fSniklas #include "aout-target.h"
88