| 1 | /* Mach-O support for BFD. |
| 2 | Copyright 1999, 2000, 2001, 2002 |
| 3 | Free Software Foundation, Inc. |
| 4 | |
| 5 | This file is part of BFD, the Binary File Descriptor library. |
| 6 | |
| 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 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 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. |
| 16 | |
| 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| 20 | |
| 21 | #ifndef TARGET_NAME |
| 22 | #error TARGET_NAME must be defined |
| 23 | #endif /* TARGET_NAME */ |
| 24 | |
| 25 | #ifndef TARGET_STRING |
| 26 | #error TARGET_STRING must be defined |
| 27 | #endif /* TARGET_STRING */ |
| 28 | |
| 29 | #ifndef TARGET_BIG_ENDIAN |
| 30 | #error TARGET_BIG_ENDIAN must be defined |
| 31 | #endif /* TARGET_BIG_ENDIAN */ |
| 32 | |
| 33 | #ifndef TARGET_ARCHIVE |
| 34 | #error TARGET_ARCHIVE must be defined |
| 35 | #endif /* TARGET_ARCHIVE */ |
| 36 | |
| 37 | #if ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) |
| 38 | #error Mach-O fat files must always be big-endian. |
| 39 | #endif /* ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) */ |
| 40 | |
| 41 | const bfd_target TARGET_NAME = |
| 42 | { |
| 43 | TARGET_STRING, /* Name. */ |
| 44 | bfd_target_mach_o_flavour, |
| 45 | #if TARGET_BIG_ENDIAN |
| 46 | BFD_ENDIAN_BIG, /* Target byte order. */ |
| 47 | BFD_ENDIAN_BIG, /* Target headers byte order. */ |
| 48 | #else |
| 49 | BFD_ENDIAN_LITTLE, /* Target byte order. */ |
| 50 | BFD_ENDIAN_LITTLE, /* Target headers byte order. */ |
| 51 | #endif |
| 52 | (HAS_RELOC | EXEC_P | /* Object flags. */ |
| 53 | HAS_LINENO | HAS_DEBUG | |
| 54 | HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), |
| 55 | (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS |
| 56 | | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ |
| 57 | '_', /* symbol_leading_char. */ |
| 58 | ' ', /* ar_pad_char. */ |
| 59 | 16, /* ar_max_namelen. */ |
| 60 | |
| 61 | #if TARGET_BIG_ENDIAN |
| 62 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
| 63 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, |
| 64 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */ |
| 65 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
| 66 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, |
| 67 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */ |
| 68 | #else |
| 69 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, |
| 70 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, |
| 71 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ |
| 72 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, |
| 73 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, |
| 74 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ |
| 75 | #endif /* TARGET_BIG_ENDIAN */ |
| 76 | |
| 77 | { /* bfd_check_format. */ |
| 78 | #if TARGET_ARCHIVE |
| 79 | _bfd_dummy_target, |
| 80 | _bfd_dummy_target, |
| 81 | bfd_mach_o_archive_p, |
| 82 | _bfd_dummy_target, |
| 83 | #else |
| 84 | _bfd_dummy_target, |
| 85 | bfd_mach_o_object_p, |
| 86 | _bfd_dummy_target, |
| 87 | bfd_mach_o_core_p |
| 88 | #endif |
| 89 | }, |
| 90 | { /* bfd_set_format. */ |
| 91 | bfd_false, |
| 92 | bfd_mach_o_mkobject, |
| 93 | bfd_false, |
| 94 | bfd_mach_o_mkobject, |
| 95 | }, |
| 96 | { /* bfd_write_contents. */ |
| 97 | bfd_false, |
| 98 | bfd_mach_o_write_contents, |
| 99 | bfd_false, |
| 100 | bfd_mach_o_write_contents, |
| 101 | }, |
| 102 | |
| 103 | BFD_JUMP_TABLE_GENERIC (bfd_mach_o), |
| 104 | BFD_JUMP_TABLE_COPY (bfd_mach_o), |
| 105 | BFD_JUMP_TABLE_CORE (bfd_mach_o), |
| 106 | BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o), |
| 107 | BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o), |
| 108 | BFD_JUMP_TABLE_RELOCS (bfd_mach_o), |
| 109 | BFD_JUMP_TABLE_WRITE (bfd_mach_o), |
| 110 | BFD_JUMP_TABLE_LINK (bfd_mach_o), |
| 111 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), |
| 112 | |
| 113 | NULL, |
| 114 | |
| 115 | NULL |
| 116 | }; |
| 117 | |