1 /* Mach-O support for BFD.
2 Copyright 1999, 2000, 2001, 2002, 2007
3 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
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.
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.
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. */
23 #error TARGET_NAME must be defined
24 #endif /* TARGET_NAME */
27 #error TARGET_STRING must be defined
28 #endif /* TARGET_STRING */
30 #ifndef TARGET_BIG_ENDIAN
31 #error TARGET_BIG_ENDIAN must be defined
32 #endif /* TARGET_BIG_ENDIAN */
34 #ifndef TARGET_ARCHIVE
35 #error TARGET_ARCHIVE must be defined
36 #endif /* TARGET_ARCHIVE */
38 #if ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN))
39 #error Mach-O fat files must always be big-endian.
40 #endif /* ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) */
42 const bfd_target TARGET_NAME
=
44 TARGET_STRING
, /* Name. */
45 bfd_target_mach_o_flavour
,
47 BFD_ENDIAN_BIG
, /* Target byte order. */
48 BFD_ENDIAN_BIG
, /* Target headers byte order. */
50 BFD_ENDIAN_LITTLE
, /* Target byte order. */
51 BFD_ENDIAN_LITTLE
, /* Target headers byte order. */
53 (HAS_RELOC
| EXEC_P
| /* Object flags. */
54 HAS_LINENO
| HAS_DEBUG
|
55 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
56 (SEC_CODE
| SEC_DATA
| SEC_ROM
| SEC_HAS_CONTENTS
57 | SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* Section flags. */
58 '_', /* symbol_leading_char. */
59 ' ', /* ar_pad_char. */
60 16, /* ar_max_namelen. */
63 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
64 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
65 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Data. */
66 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
67 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
68 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Hdrs. */
70 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
71 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
72 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
, /* data */
73 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
74 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
75 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
, /* hdrs */
76 #endif /* TARGET_BIG_ENDIAN */
78 { /* bfd_check_format. */
91 { /* bfd_set_format. */
97 { /* bfd_write_contents. */
99 bfd_mach_o_write_contents
,
101 bfd_mach_o_write_contents
,
104 BFD_JUMP_TABLE_GENERIC (bfd_mach_o
),
105 BFD_JUMP_TABLE_COPY (bfd_mach_o
),
106 BFD_JUMP_TABLE_CORE (bfd_mach_o
),
107 BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o
),
108 BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o
),
109 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs
),
110 BFD_JUMP_TABLE_WRITE (bfd_mach_o
),
111 BFD_JUMP_TABLE_LINK (bfd_mach_o
),
112 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),