1*d2201f2fSdrahn /* Mach-O support for BFD.
2*d2201f2fSdrahn    Copyright 1999, 2000, 2001, 2002
3*d2201f2fSdrahn    Free Software Foundation, Inc.
4*d2201f2fSdrahn 
5*d2201f2fSdrahn    This file is part of BFD, the Binary File Descriptor library.
6*d2201f2fSdrahn 
7*d2201f2fSdrahn    This program is free software; you can redistribute it and/or modify
8*d2201f2fSdrahn    it under the terms of the GNU General Public License as published by
9*d2201f2fSdrahn    the Free Software Foundation; either version 2 of the License, or
10*d2201f2fSdrahn    (at your option) any later version.
11*d2201f2fSdrahn 
12*d2201f2fSdrahn    This program is distributed in the hope that it will be useful,
13*d2201f2fSdrahn    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*d2201f2fSdrahn    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*d2201f2fSdrahn    GNU General Public License for more details.
16*d2201f2fSdrahn 
17*d2201f2fSdrahn    You should have received a copy of the GNU General Public License
18*d2201f2fSdrahn    along with this program; if not, write to the Free Software
19*d2201f2fSdrahn    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20*d2201f2fSdrahn 
21*d2201f2fSdrahn #ifndef TARGET_NAME
22*d2201f2fSdrahn #error TARGET_NAME must be defined
23*d2201f2fSdrahn #endif /* TARGET_NAME */
24*d2201f2fSdrahn 
25*d2201f2fSdrahn #ifndef TARGET_STRING
26*d2201f2fSdrahn #error TARGET_STRING must be defined
27*d2201f2fSdrahn #endif /* TARGET_STRING */
28*d2201f2fSdrahn 
29*d2201f2fSdrahn #ifndef TARGET_BIG_ENDIAN
30*d2201f2fSdrahn #error TARGET_BIG_ENDIAN must be defined
31*d2201f2fSdrahn #endif /* TARGET_BIG_ENDIAN */
32*d2201f2fSdrahn 
33*d2201f2fSdrahn #ifndef TARGET_ARCHIVE
34*d2201f2fSdrahn #error TARGET_ARCHIVE must be defined
35*d2201f2fSdrahn #endif /* TARGET_ARCHIVE */
36*d2201f2fSdrahn 
37*d2201f2fSdrahn #if ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN))
38*d2201f2fSdrahn #error Mach-O fat files must always be big-endian.
39*d2201f2fSdrahn #endif /* ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) */
40*d2201f2fSdrahn 
41*d2201f2fSdrahn const bfd_target TARGET_NAME =
42*d2201f2fSdrahn {
43*d2201f2fSdrahn   TARGET_STRING,		/* Name.  */
44*d2201f2fSdrahn   bfd_target_mach_o_flavour,
45*d2201f2fSdrahn #if TARGET_BIG_ENDIAN
46*d2201f2fSdrahn   BFD_ENDIAN_BIG,		/* Target byte order.  */
47*d2201f2fSdrahn   BFD_ENDIAN_BIG,		/* Target headers byte order.  */
48*d2201f2fSdrahn #else
49*d2201f2fSdrahn   BFD_ENDIAN_LITTLE,		/* Target byte order.  */
50*d2201f2fSdrahn   BFD_ENDIAN_LITTLE,		/* Target headers byte order.  */
51*d2201f2fSdrahn #endif
52*d2201f2fSdrahn   (HAS_RELOC | EXEC_P |		/* Object flags.  */
53*d2201f2fSdrahn    HAS_LINENO | HAS_DEBUG |
54*d2201f2fSdrahn    HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
55*d2201f2fSdrahn   (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
56*d2201f2fSdrahn    | SEC_ALLOC | SEC_LOAD | SEC_RELOC),	/* Section flags.  */
57*d2201f2fSdrahn   '_',				/* symbol_leading_char.  */
58*d2201f2fSdrahn   ' ',				/* ar_pad_char.  */
59*d2201f2fSdrahn   16,				/* ar_max_namelen.  */
60*d2201f2fSdrahn 
61*d2201f2fSdrahn #if TARGET_BIG_ENDIAN
62*d2201f2fSdrahn   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
63*d2201f2fSdrahn   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
64*d2201f2fSdrahn   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Data.  */
65*d2201f2fSdrahn   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
66*d2201f2fSdrahn   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
67*d2201f2fSdrahn   bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* Hdrs.  */
68*d2201f2fSdrahn #else
69*d2201f2fSdrahn   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
70*d2201f2fSdrahn   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
71*d2201f2fSdrahn   bfd_getl16, bfd_getl_signed_16, bfd_putl16,	/* data */
72*d2201f2fSdrahn   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
73*d2201f2fSdrahn   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
74*d2201f2fSdrahn   bfd_getl16, bfd_getl_signed_16, bfd_putl16,	/* hdrs */
75*d2201f2fSdrahn #endif /* TARGET_BIG_ENDIAN */
76*d2201f2fSdrahn 
77*d2201f2fSdrahn   {				/* bfd_check_format.  */
78*d2201f2fSdrahn #if TARGET_ARCHIVE
79*d2201f2fSdrahn     _bfd_dummy_target,
80*d2201f2fSdrahn     _bfd_dummy_target,
81*d2201f2fSdrahn     bfd_mach_o_archive_p,
82*d2201f2fSdrahn     _bfd_dummy_target,
83*d2201f2fSdrahn #else
84*d2201f2fSdrahn     _bfd_dummy_target,
85*d2201f2fSdrahn     bfd_mach_o_object_p,
86*d2201f2fSdrahn     _bfd_dummy_target,
87*d2201f2fSdrahn     bfd_mach_o_core_p
88*d2201f2fSdrahn #endif
89*d2201f2fSdrahn   },
90*d2201f2fSdrahn   {				/* bfd_set_format.  */
91*d2201f2fSdrahn     bfd_false,
92*d2201f2fSdrahn     bfd_mach_o_mkobject,
93*d2201f2fSdrahn     bfd_false,
94*d2201f2fSdrahn     bfd_mach_o_mkobject,
95*d2201f2fSdrahn   },
96*d2201f2fSdrahn   {				/* bfd_write_contents.  */
97*d2201f2fSdrahn     bfd_false,
98*d2201f2fSdrahn     bfd_mach_o_write_contents,
99*d2201f2fSdrahn     bfd_false,
100*d2201f2fSdrahn     bfd_mach_o_write_contents,
101*d2201f2fSdrahn   },
102*d2201f2fSdrahn 
103*d2201f2fSdrahn   BFD_JUMP_TABLE_GENERIC (bfd_mach_o),
104*d2201f2fSdrahn   BFD_JUMP_TABLE_COPY (bfd_mach_o),
105*d2201f2fSdrahn   BFD_JUMP_TABLE_CORE (bfd_mach_o),
106*d2201f2fSdrahn   BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o),
107*d2201f2fSdrahn   BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o),
108*d2201f2fSdrahn   BFD_JUMP_TABLE_RELOCS (bfd_mach_o),
109*d2201f2fSdrahn   BFD_JUMP_TABLE_WRITE (bfd_mach_o),
110*d2201f2fSdrahn   BFD_JUMP_TABLE_LINK (bfd_mach_o),
111*d2201f2fSdrahn   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
112*d2201f2fSdrahn 
113*d2201f2fSdrahn   NULL,
114*d2201f2fSdrahn 
115*d2201f2fSdrahn   NULL
116*d2201f2fSdrahn };
117*d2201f2fSdrahn 
118