133965Sjdp/* BFD backend for local host's a.out binaries
2218822Sdim   Copyright 1990, 1991, 1992, 1994, 1995, 2001, 2007
389857Sobrien   Free Software Foundation, Inc.
433965Sjdp   Written by Cygnus Support.  Probably John Gilmore's fault.
533965Sjdp
633965SjdpThis file is part of BFD, the Binary File Descriptor library.
733965Sjdp
833965SjdpThis program is free software; you can redistribute it and/or modify
933965Sjdpit under the terms of the GNU General Public License as published by
1033965Sjdpthe Free Software Foundation; either version 2 of the License, or
1133965Sjdp(at your option) any later version.
1233965Sjdp
1333965SjdpThis program is distributed in the hope that it will be useful,
1433965Sjdpbut WITHOUT ANY WARRANTY; without even the implied warranty of
1533965SjdpMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1633965SjdpGNU General Public License for more details.
1733965Sjdp
1833965SjdpYou should have received a copy of the GNU General Public License
1933965Sjdpalong with this program; if not, write to the Free Software
20218822SdimFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
2133965Sjdp
22218822Sdim#include "sysdep.h"
2333965Sjdp#include "bfd.h"
2433965Sjdp#include "libbfd.h"
2533965Sjdp
2633965Sjdp#define	ARCH_SIZE	32
2733965Sjdp
2833965Sjdp/* When porting to a new system, you must supply:
2933965Sjdp
3033965Sjdp	HOST_PAGE_SIZE		(optional)
3133965Sjdp	HOST_SEGMENT_SIZE	(optional -- defaults to page size)
3233965Sjdp	HOST_MACHINE_ARCH	(optional)
3333965Sjdp	HOST_MACHINE_MACHINE	(optional)
3433965Sjdp	HOST_TEXT_START_ADDR	(optional)
3533965Sjdp	HOST_STACK_END_ADDR	(not used, except by trad-core ???)
3633965Sjdp	HOST_BIG_ENDIAN_P	(required -- define if big-endian)
3733965Sjdp
3833965Sjdp   in the ./hosts/h-systemname.h file.  */
3933965Sjdp
4033965Sjdp#ifdef TRAD_HEADER
4133965Sjdp#include TRAD_HEADER
4233965Sjdp#endif
4333965Sjdp
4433965Sjdp#ifdef			HOST_PAGE_SIZE
4533965Sjdp#define	TARGET_PAGE_SIZE	HOST_PAGE_SIZE
4633965Sjdp#endif
4733965Sjdp
4833965Sjdp#ifdef			HOST_SEGMENT_SIZE
4933965Sjdp#define	SEGMENT_SIZE	HOST_SEGMENT_SIZE
5033965Sjdp#else
5133965Sjdp#define	SEGMENT_SIZE	TARGET_PAGE_SIZE
5233965Sjdp#endif
5333965Sjdp
5433965Sjdp#ifdef			HOST_TEXT_START_ADDR
5533965Sjdp#define	TEXT_START_ADDR	HOST_TEXT_START_ADDR
5633965Sjdp#endif
5733965Sjdp
5833965Sjdp#ifdef			HOST_STACK_END_ADDR
5933965Sjdp#define	STACK_END_ADDR	HOST_STACK_END_ADDR
6033965Sjdp#endif
6133965Sjdp
6233965Sjdp#ifdef			HOST_BIG_ENDIAN_P
6333965Sjdp#define	TARGET_IS_BIG_ENDIAN_P
6433965Sjdp#else
6533965Sjdp#undef  TARGET_IS_BIG_ENDIAN_P
6633965Sjdp#endif
6733965Sjdp
6833965Sjdp#include "libaout.h"           /* BFD a.out internal data structures */
6933965Sjdp#include "aout/aout64.h"
7033965Sjdp
7133965Sjdp#ifdef HOST_MACHINE_ARCH
7233965Sjdp#ifdef HOST_MACHINE_MACHINE
7333965Sjdp#define SET_ARCH_MACH(abfd, execp) \
7433965Sjdp  bfd_default_set_arch_mach(abfd, HOST_MACHINE_ARCH, HOST_MACHINE_MACHINE)
7533965Sjdp#else
7633965Sjdp#define SET_ARCH_MACH(abfd, execp) \
7733965Sjdp  bfd_default_set_arch_mach(abfd, HOST_MACHINE_ARCH, 0)
7833965Sjdp#endif
7933965Sjdp#endif /* HOST_MACHINE_ARCH */
8033965Sjdp
8189857Sobrien/* Do not "beautify" the CONCAT* macro args.  Traditional C will not
8289857Sobrien   remove whitespace added here, and thus will fail to concatenate
8389857Sobrien   the tokens.  */
8489857Sobrien#define MY(OP) CONCAT2 (host_aout_,OP)
8533965Sjdp#define TARGETNAME "a.out"
8633965Sjdp
8733965Sjdp#include "aout-target.h"
88