daily update
[binutils.git] / bfd / mach-o-target.c
bloba435e6ed328ff5a83f7f5e599b30047c1b35bd22
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. */
22 #ifndef TARGET_NAME
23 #error TARGET_NAME must be defined
24 #endif /* TARGET_NAME */
26 #ifndef TARGET_STRING
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,
46 #if TARGET_BIG_ENDIAN
47 BFD_ENDIAN_BIG, /* Target byte order. */
48 BFD_ENDIAN_BIG, /* Target headers byte order. */
49 #else
50 BFD_ENDIAN_LITTLE, /* Target byte order. */
51 BFD_ENDIAN_LITTLE, /* Target headers byte order. */
52 #endif
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. */
62 #if TARGET_BIG_ENDIAN
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. */
69 #else
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. */
79 #if TARGET_ARCHIVE
80 _bfd_dummy_target,
81 _bfd_dummy_target,
82 bfd_mach_o_archive_p,
83 _bfd_dummy_target,
84 #else
85 _bfd_dummy_target,
86 bfd_mach_o_object_p,
87 bfd_generic_archive_p,
88 bfd_mach_o_core_p
89 #endif
91 { /* bfd_set_format. */
92 bfd_false,
93 bfd_mach_o_mkobject,
94 _bfd_generic_mkarchive,
95 bfd_mach_o_mkobject,
97 { /* bfd_write_contents. */
98 bfd_false,
99 bfd_mach_o_write_contents,
100 _bfd_write_archive_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 #if TARGET_ARCHIVE
108 BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o),
109 #else
110 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
111 #endif
112 BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o),
113 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
114 BFD_JUMP_TABLE_WRITE (bfd_mach_o),
115 BFD_JUMP_TABLE_LINK (bfd_mach_o),
116 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
118 NULL,
120 NULL