| OLD | NEW |
| 1 /* Mach-O support for BFD. | 1 /* Mach-O support for BFD. |
| 2 Copyright 1999, 2000, 2001, 2002, 2005, 2007, 2008, 2009, 2010, 2011 | 2 Copyright 1999, 2000, 2001, 2002, 2005, 2007, 2008, 2009, 2010, 2011 |
| 3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of BFD, the Binary File Descriptor library. | 5 This file is part of BFD, the Binary File Descriptor library. |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 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 | 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 | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| 11 | 11 |
| 12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
| 16 | 16 |
| 17 You should have received a copy of the GNU General Public License | 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 | 18 along with this program; if not, write to the Free Software |
| 19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | 19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
| 20 MA 02110-1301, USA. */ | 20 MA 02110-1301, USA. */ |
| 21 | 21 |
| 22 /* Define generic entry points here so that we don't need to duplicate the | 22 /* Define generic entry points here so that we don't need to duplicate the |
| 23 defines in every target. But define once as this file may be included | 23 defines in every target. But define once as this file may be included |
| 24 several times. */ | 24 several times. */ |
| 25 #ifndef MACH_O_TARGET_COMMON_DEFINED | 25 #ifndef MACH_O_TARGET_COMMON_DEFINED |
| 26 #define MACH_O_TARGET_COMMON_DEFINED | 26 #define MACH_O_TARGET_COMMON_DEFINED |
| 27 | 27 |
| 28 #define bfd_mach_o_close_and_cleanup _bfd_generic_close_and_cle
anup | |
| 29 #define bfd_mach_o_bfd_free_cached_info _bfd_generic_bfd_free_cach
ed_info | 28 #define bfd_mach_o_bfd_free_cached_info _bfd_generic_bfd_free_cach
ed_info |
| 30 #define bfd_mach_o_get_section_contents_in_window _bfd_generic_get_section_c
ontents_in_window | 29 #define bfd_mach_o_get_section_contents_in_window _bfd_generic_get_section_c
ontents_in_window |
| 31 #define bfd_mach_o_bfd_print_private_bfd_data _bfd_generic_bfd_print_pri
vate_bfd_data | 30 #define bfd_mach_o_bfd_print_private_bfd_data _bfd_generic_bfd_print_pri
vate_bfd_data |
| 32 #define bfd_mach_o_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *,
asymbol *)) bfd_false) | 31 #define bfd_mach_o_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *,
asymbol *)) bfd_false) |
| 33 #define bfd_mach_o_bfd_is_local_label_name bfd_generic_is_local_label
_name | 32 #define bfd_mach_o_bfd_is_local_label_name bfd_generic_is_local_label
_name |
| 34 #define bfd_mach_o_get_lineno _bfd_nosymbols_get_lineno | 33 #define bfd_mach_o_get_lineno _bfd_nosymbols_get_lineno |
| 35 #define bfd_mach_o_find_nearest_line _bfd_nosymbols_find_neares
t_line | |
| 36 #define bfd_mach_o_find_inliner_info _bfd_nosymbols_find_inline
r_info | 34 #define bfd_mach_o_find_inliner_info _bfd_nosymbols_find_inline
r_info |
| 37 #define bfd_mach_o_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_de
bug_symbol | 35 #define bfd_mach_o_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_de
bug_symbol |
| 38 #define bfd_mach_o_read_minisymbols _bfd_generic_read_minisymb
ols | 36 #define bfd_mach_o_read_minisymbols _bfd_generic_read_minisymb
ols |
| 39 #define bfd_mach_o_minisymbol_to_symbol _bfd_generic_minisymbol_to
_symbol | 37 #define bfd_mach_o_minisymbol_to_symbol _bfd_generic_minisymbol_to
_symbol |
| 40 #define bfd_mach_o_bfd_get_relocated_section_contents bfd_generic_get_relocated_
section_contents | 38 #define bfd_mach_o_bfd_get_relocated_section_contents bfd_generic_get_relocated_
section_contents |
| 41 #define bfd_mach_o_bfd_relax_section bfd_generic_relax_section | 39 #define bfd_mach_o_bfd_relax_section bfd_generic_relax_section |
| 42 #define bfd_mach_o_bfd_link_hash_table_create _bfd_generic_link_hash_tab
le_create | 40 #define bfd_mach_o_bfd_link_hash_table_create _bfd_generic_link_hash_tab
le_create |
| 43 #define bfd_mach_o_bfd_link_hash_table_free _bfd_generic_link_hash_tab
le_free | 41 #define bfd_mach_o_bfd_link_hash_table_free _bfd_generic_link_hash_tab
le_free |
| 44 #define bfd_mach_o_bfd_link_add_symbols _bfd_generic_link_add_symb
ols | 42 #define bfd_mach_o_bfd_link_add_symbols _bfd_generic_link_add_symb
ols |
| 45 #define bfd_mach_o_bfd_link_just_syms _bfd_generic_link_just_sym
s | 43 #define bfd_mach_o_bfd_link_just_syms _bfd_generic_link_just_sym
s |
| 46 #define bfd_mach_o_bfd_copy_link_hash_symbol_type \ | 44 #define bfd_mach_o_bfd_copy_link_hash_symbol_type \ |
| 47 _bfd_generic_copy_link_hash_symbol_type | 45 _bfd_generic_copy_link_hash_symbol_type |
| 48 #define bfd_mach_o_bfd_final_link _bfd_generic_final_link | 46 #define bfd_mach_o_bfd_final_link _bfd_generic_final_link |
| 49 #define bfd_mach_o_bfd_link_split_section _bfd_generic_link_split_se
ction | 47 #define bfd_mach_o_bfd_link_split_section _bfd_generic_link_split_se
ction |
| 50 #define bfd_mach_o_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_pri
vate_bfd_data | 48 #define bfd_mach_o_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_pri
vate_bfd_data |
| 51 #define bfd_mach_o_bfd_set_private_flags _bfd_generic_bfd_set_priva
te_flags | 49 #define bfd_mach_o_bfd_set_private_flags bfd_mach_o_bfd_set_private
_flags |
| 52 #define bfd_mach_o_get_section_contents _bfd_generic_get_section_c
ontents | 50 #define bfd_mach_o_get_section_contents _bfd_generic_get_section_c
ontents |
| 53 #define bfd_mach_o_bfd_gc_sections bfd_generic_gc_sections | 51 #define bfd_mach_o_bfd_gc_sections bfd_generic_gc_sections |
| 54 #define bfd_mach_o_bfd_lookup_section_flags bfd_generic_lookup_section
_flags | 52 #define bfd_mach_o_bfd_lookup_section_flags bfd_generic_lookup_section
_flags |
| 55 #define bfd_mach_o_bfd_merge_sections bfd_generic_merge_sections | 53 #define bfd_mach_o_bfd_merge_sections bfd_generic_merge_sections |
| 56 #define bfd_mach_o_bfd_is_group_section bfd_generic_is_group_secti
on | 54 #define bfd_mach_o_bfd_is_group_section bfd_generic_is_group_secti
on |
| 57 #define bfd_mach_o_bfd_discard_group bfd_generic_discard_group | 55 #define bfd_mach_o_bfd_discard_group bfd_generic_discard_group |
| 58 #define bfd_mach_o_section_already_linked _bfd_generic_section_alrea
dy_linked | 56 #define bfd_mach_o_section_already_linked _bfd_generic_section_alrea
dy_linked |
| 59 #define bfd_mach_o_bfd_define_common_symbol bfd_generic_define_common_
symbol | 57 #define bfd_mach_o_bfd_define_common_symbol bfd_generic_define_common_
symbol |
| 60 #define bfd_mach_o_bfd_copy_private_header_data _bfd_generic_bfd_copy_priv
ate_header_data | 58 #define bfd_mach_o_bfd_copy_private_header_data _bfd_generic_bfd_copy_priv
ate_header_data |
| 61 #define bfd_mach_o_core_file_matches_executable_p generic_core_file_matches_
executable_p | 59 #define bfd_mach_o_core_file_matches_executable_p generic_core_file_matches_
executable_p |
| (...skipping 28 matching lines...) Expand all Loading... |
| 90 | 88 |
| 91 #if ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) | 89 #if ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) |
| 92 #error Mach-O fat files must always be big-endian. | 90 #error Mach-O fat files must always be big-endian. |
| 93 #endif /* ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) */ | 91 #endif /* ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) */ |
| 94 | 92 |
| 95 static const bfd_mach_o_backend_data TARGET_NAME_BACKEND = | 93 static const bfd_mach_o_backend_data TARGET_NAME_BACKEND = |
| 96 { | 94 { |
| 97 TARGET_ARCHITECTURE, | 95 TARGET_ARCHITECTURE, |
| 98 bfd_mach_o_swap_reloc_in, | 96 bfd_mach_o_swap_reloc_in, |
| 99 bfd_mach_o_swap_reloc_out, | 97 bfd_mach_o_swap_reloc_out, |
| 100 bfd_mach_o_print_thread | 98 bfd_mach_o_print_thread, |
| 99 bfd_mach_o_tgt_seg_table, |
| 100 bfd_mach_o_section_type_valid_for_tgt |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 const bfd_target TARGET_NAME = | 103 const bfd_target TARGET_NAME = |
| 104 { | 104 { |
| 105 TARGET_STRING, /* Name. */ | 105 TARGET_STRING, /* Name. */ |
| 106 bfd_target_mach_o_flavour, | 106 bfd_target_mach_o_flavour, |
| 107 #if TARGET_BIG_ENDIAN | 107 #if TARGET_BIG_ENDIAN |
| 108 BFD_ENDIAN_BIG, /* Target byte order. */ | 108 BFD_ENDIAN_BIG, /* Target byte order. */ |
| 109 BFD_ENDIAN_BIG, /* Target headers byte order. */ | 109 BFD_ENDIAN_BIG, /* Target headers byte order. */ |
| 110 #else | 110 #else |
| 111 BFD_ENDIAN_LITTLE, /* Target byte order. */ | 111 BFD_ENDIAN_LITTLE, /* Target byte order. */ |
| 112 BFD_ENDIAN_LITTLE, /* Target headers byte order. */ | 112 BFD_ENDIAN_LITTLE, /* Target headers byte order. */ |
| 113 #endif | 113 #endif |
| 114 (HAS_RELOC | EXEC_P | /* Object flags. */ | 114 (HAS_RELOC | EXEC_P | /* Object flags. */ |
| 115 HAS_LINENO | HAS_DEBUG | | 115 HAS_LINENO | HAS_DEBUG | |
| 116 HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), | 116 HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), |
| 117 (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS | 117 (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS |
| 118 | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ | 118 | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ |
| 119 '_', /* symbol_leading_char. */ | 119 '_', /* symbol_leading_char. */ |
| 120 ' ', /* ar_pad_char. */ | 120 ' ', /* ar_pad_char. */ |
| 121 16, /* ar_max_namelen. */ | 121 16, /* ar_max_namelen. */ |
| 122 0,» » » » /* match priority. */ | 122 TARGET_PRIORITY,» /* match priority. */ |
| 123 | 123 |
| 124 #if TARGET_BIG_ENDIAN | 124 #if TARGET_BIG_ENDIAN |
| 125 bfd_getb64, bfd_getb_signed_64, bfd_putb64, | 125 bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
| 126 bfd_getb32, bfd_getb_signed_32, bfd_putb32, | 126 bfd_getb32, bfd_getb_signed_32, bfd_putb32, |
| 127 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */ | 127 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */ |
| 128 bfd_getb64, bfd_getb_signed_64, bfd_putb64, | 128 bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
| 129 bfd_getb32, bfd_getb_signed_32, bfd_putb32, | 129 bfd_getb32, bfd_getb_signed_32, bfd_putb32, |
| 130 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */ | 130 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */ |
| 131 #else | 131 #else |
| 132 bfd_getl64, bfd_getl_signed_64, bfd_putl64, | 132 bfd_getl64, bfd_getl_signed_64, bfd_putl64, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 BFD_JUMP_TABLE_LINK (bfd_mach_o), | 177 BFD_JUMP_TABLE_LINK (bfd_mach_o), |
| 178 BFD_JUMP_TABLE_DYNAMIC (bfd_mach_o), | 178 BFD_JUMP_TABLE_DYNAMIC (bfd_mach_o), |
| 179 | 179 |
| 180 /* Alternative endian target. */ | 180 /* Alternative endian target. */ |
| 181 NULL, | 181 NULL, |
| 182 | 182 |
| 183 /* Back-end data. */ | 183 /* Back-end data. */ |
| 184 &TARGET_NAME_BACKEND | 184 &TARGET_NAME_BACKEND |
| 185 }; | 185 }; |
| 186 | 186 |
| OLD | NEW |