binutils-gdb/bfd/mach-o-target.c

185 lines
7.3 KiB
C
Raw Normal View History

2002-11-06 14:26:29 +01:00
/* Mach-O support for BFD.
Copyright 1999, 2000, 2001, 2002, 2005, 2007, 2008, 2009, 2010
2002-11-06 14:26:29 +01:00
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
2002-11-06 14:26:29 +01:00
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
2002-11-06 14:26:29 +01:00
2009-06-05 Tristan Gingold <gingold@adacore.com> * mach-o.h: Update copyright year. (bfd_mach_o_mach_header_magic): New enum. (bfd_mach_o_cpu_subtype): Now an enum. (BFD_MACH_O_HEADER_SIZE, BFD_MACH_O_HEADER_64_SIZE): New macros. (BFD_MACH_O_SECTION_SIZE, BFD_MACH_O_SECTION_64_SIZE): Ditto. (BFD_MACH_O_LC_SEGMENT_SIZE, BFD_MACH_O_LC_SEGMENT_64_SIZE): Ditto. (bfd_mach_o_load_command): Field type_required is now a boolean. Reindent prototypes. (bfd_mach_o_object_p, bfd_mach_o_core_p): Remove. (bfd_mach_o_bfd_copy_private_symbol_data): Add a prototype. (bfd_mach_o_bfd_copy_private_section_data): Ditto. (bfd_mach_o_bfd_copy_private_bfd_data): Ditto. (bfd_mach_o_get_symtab_upper_bound): Ditto. (bfd_mach_o_canonicalize_symtab): Ditto. (bfd_mach_o_get_symbol_info): Ditto. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Ditto. (bfd_mach_o_make_empty_symbol): Ditto. (bfd_mach_o_write_contents): Ditto. * mach-o.c (bfd_mach_o_object_p, bfd_mach_o_core_p, bfd_mach_o_mkobject): Defines. (bfd_mach_o_valid): Returns FALSE/TRUE instead of 0/1. Do not check with target vector but with flavour. (struct mach_o_section_name_xlat): New declaration. (dwarf_section_names_xlat): Ditto. (text_section_names_xlat): Ditto. (data_section_names_xlat): Ditto. (struct mach_o_segment_name_xlat): Ditto. (segsec_names_xlat): Ditto. (bfd_mach_o_convert_section_name_to_bfd): New function. (bfd_mach_o_convert_section_name_to_mach_o): Ditto. (bfd_mach_o_bfd_copy_private_symbol_data): Make it public. (bfd_mach_o_bfd_copy_private_section_data): Ditto. (bfd_mach_o_bfd_copy_private_bfd_data): Ditto. Accept any input and output flavour. Do not share private data anymore. (bfd_mach_o_count_symbols): Add a comment. (bfd_mach_o_get_symtab_upper_bound): Make it public. (bfd_mach_o_canonicalize_symtab): Ditto. (bfd_mach_o_get_symbol_info): Ditto. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_write_header): Now returns a boolean instead of an int. Use constants instead of hard-coded values. (bfd_mach_o_scan_write_section_32): Use constants instead of hard-coded values. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment): Ditto. Do not copy sections anymore. (bfd_mach_o_write_contents): Make it public. Remove dead code. Rewrite typeflag assignment. (bfd_mach_o_build_commands): New function. (bfd_mach_o_set_section_contents): Ditto. (bfd_mach_o_make_empty_symbol): Make it public. (bfd_mach_o_read_header): Make it static. Convert to bfd_boolean. Use constants instead of hard-coded values. (bfd_mach_o_make_bfd_section): Call bfd_mach_o_convert_section_name_to_bfd to create name. (bfd_mach_o_scan_read_section_32): Use constants instead of hard-coded values. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_segment): Do not create a bfd section for a segment anymore. Use constants instead of hard-coded values. (bfd_mach_o_scan_read_command): Fix style. (bfd_mach_o_scan): Use constants instead of hard-coded values. Get rid of BFD_IO_FUNCS. (bfd_mach_o_mkobject_init): Renamed from bfd_mach_o_mkobject. (bfd_mach_o_header_p): Created from bfd_mach_o_object_p. (bfd_mach_o_gen_object_p): New function, replaces bfd_mach_o_object_p. (bfd_mach_o_object_p): Removed. (bfd_mach_o_gen_core_p): New function, replaces ... (bfd_mach_o_core_p): ... deleted. (bfd_mach_o_bfd_print_private_bfd_data): Make it public. * mach-o-i386.c: New file. * config.bfd: Use mach_o_i386_vec as targ_defvec for ix86-darwin. * configure.in (TDEFINES): Add mach_o_i386_vec. * configure: Regenerated. * targets.c: Add mach_o_i386_vec. * mach-o.c: Update copyright years. (BFD_IO_FUNCS): Remove (was not used). (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr, bfd_mach_o_slurp_armap bfd_mach_o_slurp_extended_name_table, bfd_mach_o_construct_extended_name_table, bfd_mach_o_truncate_arname, bfd_mach_o_write_armap, bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt, bfd_mach_o_update_armap_timestamp, bfd_mach_o_close_and_cleanup, bfd_mach_o_bfd_free_cached_info, bfd_mach_o_new_section_hook, bfd_mach_o_get_section_contents_in_window, bfd_mach_o_bfd_is_local_label_name, bfd_mach_o_bfd_is_target_special_symbol, bfd_mach_o_bfd_is_local_label_name, bfd_mach_o_get_lineno, bfd_mach_o_find_nearest_line, bfd_mach_o_find_inliner_info, bfd_mach_o_bfd_make_debug_symbol, bfd_mach_o_read_minisymbols, bfd_mach_o_minisymbol_to_symbol, bfd_mach_o_bfd_get_relocated_section_contents, bfd_mach_o_bfd_relax_section, bfd_mach_o_bfd_link_hash_table_create, bfd_mach_o_bfd_link_hash_table_free, bfd_mach_o_bfd_link_add_symbols, bfd_mach_o_bfd_link_just_syms, bfd_mach_o_bfd_final_link, bfd_mach_o_bfd_link_split_section, bfd_mach_o_set_arch_mach, bfd_mach_o_bfd_merge_private_bfd_data, bfd_mach_o_bfd_set_private_flags, bfd_mach_o_get_section_contents, bfd_mach_o_bfd_gc_sections, bfd_mach_o_bfd_merge_sections, bfd_mach_o_bfd_is_group_section, bfd_mach_o_bfd_discard_group, bfd_mach_o_section_already_linked, bfd_mach_o_bfd_define_common_symbol, bfd_mach_o_bfd_copy_private_header_data, bfd_mach_o_core_file_matches_executable_p): Move these defines ... * mach-o-target.c: ... here. Update copyright years.
2009-06-05 11:19:44 +02:00
/* Define generic entry points here so that we don't need to duplicate the
defines in every target. But define once as this file may be included
several times. */
#ifndef MACH_O_TARGET_COMMON_DEFINED
#define MACH_O_TARGET_COMMON_DEFINED
#define bfd_mach_o_close_and_cleanup _bfd_generic_close_and_cleanup
#define bfd_mach_o_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define bfd_mach_o_new_section_hook _bfd_generic_new_section_hook
#define bfd_mach_o_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define bfd_mach_o_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
2009-06-12 Tristan Gingold <gingold@adacore.com> * reloc.c: Add BFD_RELOC_MACH_O_SECTDIFF and BFD_RELOC_MACH_O_PAIR. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * mach-o.c (FILE_ALIGN): New macro. (bfd_mach_o_canonicalize_symtab): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_scan_write_thread): Adjust type of variable offset. (bfd_mach_o_get_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_scan_write_relocs): Ditto. (bfd_mach_o_scan_write_section_32): Remove offset argument. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment_32): Write relocs. Fix size of data written for load command. Do not compute section file offset. (bfd_mach_o_scan_write_segment_64): Ditto. (bfd_mach_o_scan_write_symtab): Compute file offset first. Adjust for bfd_mach_o_asymbol. Move code to convert from BFD to Mach-O to ... (bfd_mach_o_mangle_symbols): ... this new function. (bfd_mach_o_write_contents): Be sure to habe load commands built. Call bfd_mach_o_mangle_symbols. (bfd_mach_o_build_commands): Adjust for filelen field. Use FILE_ALIGN macro. Clear section file offset if section is empty. Do not set symtab file offset anymore here. (bfd_mach_o_make_empty_symbol): Allocate a bfd_mach_o_asymbol. (bfd_mach_o_make_bfd_section): Set SEC_RELOC if has reloc. Set reloc_count and rel_filepos section fields. (bfd_mach_o_scan_read_section_32): Type of argument offset is now unsigned int. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Typr of argument s is now bfd_mach_o_asymbol. Use unsigned int for file offset type. (bfd_mach_o_scan_read_symtab_symbol): Adjust for bfd_mach_o_asymbol. Handle weak-ref symbols. (bfd_mach_o_scan_read_symtab_symbols): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_scan): Remove assignment to removed field. (bfd_mach_o_mkobject_init): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Adjust printf formatter. (bfd_mach_o_bfd_reloc_type_lookup): New macro. (bfd_mach_o_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in): Ditto. (bfd_mach_o_swap_reloc_out): Ditto. * mach-o.h (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCE_FLAG_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCED_DYNAMICALLY, BFD_MACH_O_N_DESC_DISCARDED) (BFD_MACH_O_N_NO_DEAD_STRIP, BFD_MACH_O_N_WEAK_REF) (BFD_MACH_O_N_WEAK_DEF): New macros. Add comments. (bfd_mach_o_section_type): Add new enumeration values. (BFD_MACH_O_S_SELF_MODIFYING_CODE) (BFD_MACH_O_S_ATTR_LIVE_SUPPORT) (BFD_MACH_O_S_ATTR_NO_DEAD_STRIP) (BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS, BFD_MACH_O_S_ATTR_NO_TOC): New macros. (BFD_MACH_O_GENERIC_RELOC_VANILLA) (BFD_MACH_O_GENERIC_RELOC_PAIR) (BFD_MACH_O_GENERIC_RELOC_SECTDIFF) (BFD_MACH_O_GENERIC_RELOC_PB_LA_PTR) (BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF): Ditto. (BFD_MACH_O_RELENT_SIZE): Ditto. (BFD_MACH_O_R_PCREL, BFD_MACH_O_GET_R_LENGTH) (BFD_MACH_O_R_EXTERN, BFD_MACH_O_GET_R_TYPE) (BFD_MACH_O_GET_R_SYMBOLNUM, BFD_MACH_O_SET_R_LENGTH) (BFD_MACH_O_SET_R_TYPE, BFD_MACH_O_SET_R_SYMBOLNUM): Ditto. (BFD_MACH_O_SR_SCATTERED, BFD_MACH_O_SR_PCREL) (BFD_MACH_O_GET_SR_LENGTH, BFD_MACH_O_GET_SR_TYPE) (BFD_MACH_O_GET_SR_ADDRESS, BFD_MACH_O_SET_SR_LENGTH) (BFD_MACH_O_SET_SR_TYPE, BFD_MACH_O_SET_SR_ADDRESS): Ditto. (bfd_mach_o_reloc_info): New struct. (bfd_mach_o_asymbol): New struct. (bfd_mach_o_symtab_command): The symbols field is now of type bfd_mach_o_asymbol. (bfd_mach_o_load_command): The offset and len fields are now of type unsigned int. (mach_o_data_struct): Remove symbols, nsymbols and ibfd fields. Add a filelen field. Add comments. (bfd_mach_o_backend_data): New struct. (bfd_mach_o_get_backend_data): New macro. (bfd_mach_o_scan_read_symtab_symbol): Parameter symbol now of type bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_get_reloc_upper_bound): New prototype. (bfd_mach_o_canonicalize_reloc): Ditto. * mach-o-target.c (bfd_mach_o_bfd_is_local_label_name): Remove duplicated macro. Now defined to _bfd_generic_is_local_label. (TARGET_NAME_BACKEND): New macro... (TARGET_NAME_BACKEND): ... used to name a new variable. (TARGET_NAME): Define relocs table using bfd_mach_o, reference Mach-O backend data. * mach-o-i386.c (i386_howto_table): New variable. (bfd_mach_o_i386_swap_reloc_in): New function. (bfd_mach_o_i386_swap_reloc_out): Ditto. (bfd_mach_o_i386_bfd_reloc_type_lookup): Ditto. (bfd_mach_o_i386_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in, bfd_mach_o_swap_reloc_out): New macros. (bfd_mach_o_bfd_reloc_type_lookup) (bfd_mach_o_bfd_reloc_name_lookup): Ditto.
2009-06-12 11:15:46 +02:00
#define bfd_mach_o_bfd_is_local_label_name bfd_generic_is_local_label_name
2009-06-05 Tristan Gingold <gingold@adacore.com> * mach-o.h: Update copyright year. (bfd_mach_o_mach_header_magic): New enum. (bfd_mach_o_cpu_subtype): Now an enum. (BFD_MACH_O_HEADER_SIZE, BFD_MACH_O_HEADER_64_SIZE): New macros. (BFD_MACH_O_SECTION_SIZE, BFD_MACH_O_SECTION_64_SIZE): Ditto. (BFD_MACH_O_LC_SEGMENT_SIZE, BFD_MACH_O_LC_SEGMENT_64_SIZE): Ditto. (bfd_mach_o_load_command): Field type_required is now a boolean. Reindent prototypes. (bfd_mach_o_object_p, bfd_mach_o_core_p): Remove. (bfd_mach_o_bfd_copy_private_symbol_data): Add a prototype. (bfd_mach_o_bfd_copy_private_section_data): Ditto. (bfd_mach_o_bfd_copy_private_bfd_data): Ditto. (bfd_mach_o_get_symtab_upper_bound): Ditto. (bfd_mach_o_canonicalize_symtab): Ditto. (bfd_mach_o_get_symbol_info): Ditto. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Ditto. (bfd_mach_o_make_empty_symbol): Ditto. (bfd_mach_o_write_contents): Ditto. * mach-o.c (bfd_mach_o_object_p, bfd_mach_o_core_p, bfd_mach_o_mkobject): Defines. (bfd_mach_o_valid): Returns FALSE/TRUE instead of 0/1. Do not check with target vector but with flavour. (struct mach_o_section_name_xlat): New declaration. (dwarf_section_names_xlat): Ditto. (text_section_names_xlat): Ditto. (data_section_names_xlat): Ditto. (struct mach_o_segment_name_xlat): Ditto. (segsec_names_xlat): Ditto. (bfd_mach_o_convert_section_name_to_bfd): New function. (bfd_mach_o_convert_section_name_to_mach_o): Ditto. (bfd_mach_o_bfd_copy_private_symbol_data): Make it public. (bfd_mach_o_bfd_copy_private_section_data): Ditto. (bfd_mach_o_bfd_copy_private_bfd_data): Ditto. Accept any input and output flavour. Do not share private data anymore. (bfd_mach_o_count_symbols): Add a comment. (bfd_mach_o_get_symtab_upper_bound): Make it public. (bfd_mach_o_canonicalize_symtab): Ditto. (bfd_mach_o_get_symbol_info): Ditto. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_write_header): Now returns a boolean instead of an int. Use constants instead of hard-coded values. (bfd_mach_o_scan_write_section_32): Use constants instead of hard-coded values. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment): Ditto. Do not copy sections anymore. (bfd_mach_o_write_contents): Make it public. Remove dead code. Rewrite typeflag assignment. (bfd_mach_o_build_commands): New function. (bfd_mach_o_set_section_contents): Ditto. (bfd_mach_o_make_empty_symbol): Make it public. (bfd_mach_o_read_header): Make it static. Convert to bfd_boolean. Use constants instead of hard-coded values. (bfd_mach_o_make_bfd_section): Call bfd_mach_o_convert_section_name_to_bfd to create name. (bfd_mach_o_scan_read_section_32): Use constants instead of hard-coded values. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_segment): Do not create a bfd section for a segment anymore. Use constants instead of hard-coded values. (bfd_mach_o_scan_read_command): Fix style. (bfd_mach_o_scan): Use constants instead of hard-coded values. Get rid of BFD_IO_FUNCS. (bfd_mach_o_mkobject_init): Renamed from bfd_mach_o_mkobject. (bfd_mach_o_header_p): Created from bfd_mach_o_object_p. (bfd_mach_o_gen_object_p): New function, replaces bfd_mach_o_object_p. (bfd_mach_o_object_p): Removed. (bfd_mach_o_gen_core_p): New function, replaces ... (bfd_mach_o_core_p): ... deleted. (bfd_mach_o_bfd_print_private_bfd_data): Make it public. * mach-o-i386.c: New file. * config.bfd: Use mach_o_i386_vec as targ_defvec for ix86-darwin. * configure.in (TDEFINES): Add mach_o_i386_vec. * configure: Regenerated. * targets.c: Add mach_o_i386_vec. * mach-o.c: Update copyright years. (BFD_IO_FUNCS): Remove (was not used). (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr, bfd_mach_o_slurp_armap bfd_mach_o_slurp_extended_name_table, bfd_mach_o_construct_extended_name_table, bfd_mach_o_truncate_arname, bfd_mach_o_write_armap, bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt, bfd_mach_o_update_armap_timestamp, bfd_mach_o_close_and_cleanup, bfd_mach_o_bfd_free_cached_info, bfd_mach_o_new_section_hook, bfd_mach_o_get_section_contents_in_window, bfd_mach_o_bfd_is_local_label_name, bfd_mach_o_bfd_is_target_special_symbol, bfd_mach_o_bfd_is_local_label_name, bfd_mach_o_get_lineno, bfd_mach_o_find_nearest_line, bfd_mach_o_find_inliner_info, bfd_mach_o_bfd_make_debug_symbol, bfd_mach_o_read_minisymbols, bfd_mach_o_minisymbol_to_symbol, bfd_mach_o_bfd_get_relocated_section_contents, bfd_mach_o_bfd_relax_section, bfd_mach_o_bfd_link_hash_table_create, bfd_mach_o_bfd_link_hash_table_free, bfd_mach_o_bfd_link_add_symbols, bfd_mach_o_bfd_link_just_syms, bfd_mach_o_bfd_final_link, bfd_mach_o_bfd_link_split_section, bfd_mach_o_set_arch_mach, bfd_mach_o_bfd_merge_private_bfd_data, bfd_mach_o_bfd_set_private_flags, bfd_mach_o_get_section_contents, bfd_mach_o_bfd_gc_sections, bfd_mach_o_bfd_merge_sections, bfd_mach_o_bfd_is_group_section, bfd_mach_o_bfd_discard_group, bfd_mach_o_section_already_linked, bfd_mach_o_bfd_define_common_symbol, bfd_mach_o_bfd_copy_private_header_data, bfd_mach_o_core_file_matches_executable_p): Move these defines ... * mach-o-target.c: ... here. Update copyright years.
2009-06-05 11:19:44 +02:00
#define bfd_mach_o_get_lineno _bfd_nosymbols_get_lineno
#define bfd_mach_o_find_nearest_line _bfd_nosymbols_find_nearest_line
#define bfd_mach_o_find_inliner_info _bfd_nosymbols_find_inliner_info
#define bfd_mach_o_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define bfd_mach_o_read_minisymbols _bfd_generic_read_minisymbols
#define bfd_mach_o_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
#define bfd_mach_o_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define bfd_mach_o_bfd_relax_section bfd_generic_relax_section
#define bfd_mach_o_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define bfd_mach_o_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define bfd_mach_o_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define bfd_mach_o_bfd_link_just_syms _bfd_generic_link_just_syms
2009-11-23 Paul Brook <paul@codesourcery.com> ld/ * ldexp.c: Copy symbol type for simple assignments. bfd/ * libbfd-in.h (_bfd_generic_copy_link_hash_symbol_type): Add prototype. * elf-bfd.h (_bfd_elf_copy_link_hash_symbol_type): Add prototype. * linker.c (_bfd_generic_copy_link_hash_symbol_type): New function. * elflink.c (_bfd_elf_copy_link_hash_symbol_type): New function. * targets.c (BFD_JUMP_TABLE_LINK, struct bfd_target): Add _copy_link_hash_symbol_type. * bfd/coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Add _bfd_generic_copy_link_hash_symbol_type. * bfd/coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Add _bfd_generic_copy_link_hash_symbol_type. * aout-adobe.c (aout_32_bfd_copy_link_hash_symbol_type): Define. * aout-target.h (MY_bfd_copy_link_hash_symbol_type): Define. * aout-tic30.c (MY_bfd_copy_link_hash_symbol_type): Define. * binary.c (binary_bfd_copy_link_hash_symbol_type): Define. * bout.c (b_out_bfd_copy_link_hash_symbol_type): Define. * coffcode.h (coff_bfd_copy_link_hash_symbol_type): Define. * elfxx-target.h (bfd_elfNN_bfd_copy_link_hash_symbol_type): Define. * i386msdos.c (msdos_bfd_copy_link_hash_symbol_type): Define. * i386os9k.c (os9k_bfd_copy_link_hash_symbol_type): Define. * ieee.c (ieee_bfd_copy_link_hash_symbol_type): Define. * ihex.c (ihex_bfd_copy_link_hash_symbol_type): Define. * libecoff.h (_bfd_ecoff_bfd_copy_link_hash_symbol_type): Define. * mach-o.c (bfd_mach_o_bfd_copy_link_hash_symbol_type): Define. * mmo.c (mmo_bfd_copy_link_hash_symbol_type): Define. * nlm-target.h (nlm_bfd_copy_link_hash_symbol_type): Define. * oasys.c (oasys_bfd_copy_link_hash_symbol_type): Define. * pef.c (bfd_pef_bfd_copy_link_hash_symbol_type): Define. * ppcboot.c (ppcboot_bfd_copy_link_hash_symbol_type): Define. * som.c (som_bfd_copy_link_hash_symbol_type): Define. * srec.c (srec_bfd_copy_link_hash_symbol_type): Define. * tekhex.c (tekhex_bfd_copy_link_hash_symbol_type): Define. * versados.c (versados_bfd_copy_link_hash_symbol_type): Define. * vms.c (vms_bfd_copy_link_hash_symbol_type): Define. * xsym.c (bfd_sym_bfd_copy_link_hash_symbol_type): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. ld/testsuite * ld-arm/script-type.sym: New test. * ld-arm/script-type.s: New test. * ld-arm/script-type.s: New test.
2009-11-23 15:41:33 +01:00
#define bfd_mach_o_bfd_copy_link_hash_symbol_type \
_bfd_generic_copy_link_hash_symbol_type
2009-06-05 Tristan Gingold <gingold@adacore.com> * mach-o.h: Update copyright year. (bfd_mach_o_mach_header_magic): New enum. (bfd_mach_o_cpu_subtype): Now an enum. (BFD_MACH_O_HEADER_SIZE, BFD_MACH_O_HEADER_64_SIZE): New macros. (BFD_MACH_O_SECTION_SIZE, BFD_MACH_O_SECTION_64_SIZE): Ditto. (BFD_MACH_O_LC_SEGMENT_SIZE, BFD_MACH_O_LC_SEGMENT_64_SIZE): Ditto. (bfd_mach_o_load_command): Field type_required is now a boolean. Reindent prototypes. (bfd_mach_o_object_p, bfd_mach_o_core_p): Remove. (bfd_mach_o_bfd_copy_private_symbol_data): Add a prototype. (bfd_mach_o_bfd_copy_private_section_data): Ditto. (bfd_mach_o_bfd_copy_private_bfd_data): Ditto. (bfd_mach_o_get_symtab_upper_bound): Ditto. (bfd_mach_o_canonicalize_symtab): Ditto. (bfd_mach_o_get_symbol_info): Ditto. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Ditto. (bfd_mach_o_make_empty_symbol): Ditto. (bfd_mach_o_write_contents): Ditto. * mach-o.c (bfd_mach_o_object_p, bfd_mach_o_core_p, bfd_mach_o_mkobject): Defines. (bfd_mach_o_valid): Returns FALSE/TRUE instead of 0/1. Do not check with target vector but with flavour. (struct mach_o_section_name_xlat): New declaration. (dwarf_section_names_xlat): Ditto. (text_section_names_xlat): Ditto. (data_section_names_xlat): Ditto. (struct mach_o_segment_name_xlat): Ditto. (segsec_names_xlat): Ditto. (bfd_mach_o_convert_section_name_to_bfd): New function. (bfd_mach_o_convert_section_name_to_mach_o): Ditto. (bfd_mach_o_bfd_copy_private_symbol_data): Make it public. (bfd_mach_o_bfd_copy_private_section_data): Ditto. (bfd_mach_o_bfd_copy_private_bfd_data): Ditto. Accept any input and output flavour. Do not share private data anymore. (bfd_mach_o_count_symbols): Add a comment. (bfd_mach_o_get_symtab_upper_bound): Make it public. (bfd_mach_o_canonicalize_symtab): Ditto. (bfd_mach_o_get_symbol_info): Ditto. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_write_header): Now returns a boolean instead of an int. Use constants instead of hard-coded values. (bfd_mach_o_scan_write_section_32): Use constants instead of hard-coded values. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment): Ditto. Do not copy sections anymore. (bfd_mach_o_write_contents): Make it public. Remove dead code. Rewrite typeflag assignment. (bfd_mach_o_build_commands): New function. (bfd_mach_o_set_section_contents): Ditto. (bfd_mach_o_make_empty_symbol): Make it public. (bfd_mach_o_read_header): Make it static. Convert to bfd_boolean. Use constants instead of hard-coded values. (bfd_mach_o_make_bfd_section): Call bfd_mach_o_convert_section_name_to_bfd to create name. (bfd_mach_o_scan_read_section_32): Use constants instead of hard-coded values. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_segment): Do not create a bfd section for a segment anymore. Use constants instead of hard-coded values. (bfd_mach_o_scan_read_command): Fix style. (bfd_mach_o_scan): Use constants instead of hard-coded values. Get rid of BFD_IO_FUNCS. (bfd_mach_o_mkobject_init): Renamed from bfd_mach_o_mkobject. (bfd_mach_o_header_p): Created from bfd_mach_o_object_p. (bfd_mach_o_gen_object_p): New function, replaces bfd_mach_o_object_p. (bfd_mach_o_object_p): Removed. (bfd_mach_o_gen_core_p): New function, replaces ... (bfd_mach_o_core_p): ... deleted. (bfd_mach_o_bfd_print_private_bfd_data): Make it public. * mach-o-i386.c: New file. * config.bfd: Use mach_o_i386_vec as targ_defvec for ix86-darwin. * configure.in (TDEFINES): Add mach_o_i386_vec. * configure: Regenerated. * targets.c: Add mach_o_i386_vec. * mach-o.c: Update copyright years. (BFD_IO_FUNCS): Remove (was not used). (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr, bfd_mach_o_slurp_armap bfd_mach_o_slurp_extended_name_table, bfd_mach_o_construct_extended_name_table, bfd_mach_o_truncate_arname, bfd_mach_o_write_armap, bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt, bfd_mach_o_update_armap_timestamp, bfd_mach_o_close_and_cleanup, bfd_mach_o_bfd_free_cached_info, bfd_mach_o_new_section_hook, bfd_mach_o_get_section_contents_in_window, bfd_mach_o_bfd_is_local_label_name, bfd_mach_o_bfd_is_target_special_symbol, bfd_mach_o_bfd_is_local_label_name, bfd_mach_o_get_lineno, bfd_mach_o_find_nearest_line, bfd_mach_o_find_inliner_info, bfd_mach_o_bfd_make_debug_symbol, bfd_mach_o_read_minisymbols, bfd_mach_o_minisymbol_to_symbol, bfd_mach_o_bfd_get_relocated_section_contents, bfd_mach_o_bfd_relax_section, bfd_mach_o_bfd_link_hash_table_create, bfd_mach_o_bfd_link_hash_table_free, bfd_mach_o_bfd_link_add_symbols, bfd_mach_o_bfd_link_just_syms, bfd_mach_o_bfd_final_link, bfd_mach_o_bfd_link_split_section, bfd_mach_o_set_arch_mach, bfd_mach_o_bfd_merge_private_bfd_data, bfd_mach_o_bfd_set_private_flags, bfd_mach_o_get_section_contents, bfd_mach_o_bfd_gc_sections, bfd_mach_o_bfd_merge_sections, bfd_mach_o_bfd_is_group_section, bfd_mach_o_bfd_discard_group, bfd_mach_o_section_already_linked, bfd_mach_o_bfd_define_common_symbol, bfd_mach_o_bfd_copy_private_header_data, bfd_mach_o_core_file_matches_executable_p): Move these defines ... * mach-o-target.c: ... here. Update copyright years.
2009-06-05 11:19:44 +02:00
#define bfd_mach_o_bfd_final_link _bfd_generic_final_link
#define bfd_mach_o_bfd_link_split_section _bfd_generic_link_split_section
#define bfd_mach_o_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
#define bfd_mach_o_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
#define bfd_mach_o_get_section_contents _bfd_generic_get_section_contents
#define bfd_mach_o_bfd_gc_sections bfd_generic_gc_sections
#define bfd_mach_o_bfd_merge_sections bfd_generic_merge_sections
#define bfd_mach_o_bfd_is_group_section bfd_generic_is_group_section
#define bfd_mach_o_bfd_discard_group bfd_generic_discard_group
#define bfd_mach_o_section_already_linked _bfd_generic_section_already_linked
#define bfd_mach_o_bfd_define_common_symbol bfd_generic_define_common_symbol
#define bfd_mach_o_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#define bfd_mach_o_core_file_matches_executable_p generic_core_file_matches_executable_p
2010-08-18 Pedro Alves <pedro@codesourcery.com> PR corefile/8210 bfd/ * bfd-in2.h: Regenerate. * corefile.c (bfd_core_file_pid): New. * targets.c (BFD_JUMP_TABLE_CORE): Add NAME##_core_file_pid. (struct bfd_target) <_core_file_pid>: New. * libbfd-in.h (_bfd_nocore_core_file_pid): Declare. * libbfd.c (_bfd_nocore_core_file_pid): New. * elf-bfd.h (bfd_elf32_core_file_pid, bfd_elf64_core_file_pid): Declare. * elfcode.h (elf_core_file_pid): New define. * elfcore.h (elf_core_file_pid): New function. * elf.c (elfcore_make_pid): Rewrite. (elfcore_grok_prstatus): Only set core_pid if not set yet. (elfcore_grok_prstatus) [!HAVE_PRSTATUS_T_PR_WHO]: Fallback to getting the lwpid from prstat.pr_pid. * elf64-x86-64.c (elf64_x86_64_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. (elf64_x86_64_grok_psinfo): Extract the the main process's PID, and store it in elf_tdata's core_pid field. * elf32-i386.c (elf_i386_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. (elf_i386_grok_psinfo): Extract the the main process's PID, and store it in elf_tdata's core_pid field. * elf32-am33lin.c (elf32_am33lin_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-arm.c (elf32_arm_nabi_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-cris.c (cris_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-frv.c (elf32_frv_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-hppa.c (elf32_hppa_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-mips.c (elf32_mips_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-ppc.c (ppc_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-s390.c (elf_s390_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-score.c (s3_bfd_score_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-score7.c (s7_bfd_score_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-sh.c (elf32_shlin_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-xtensa.c (elf_xtensa_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf64-hppa.c (elf64_hppa_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf64-mips.c (elf64_mips_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf64-ppc.c (ppc64_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elfn32-mips.c (elf32_mips_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * plugin.c (bfd_plugin_core_file_pid): New function. * aout-target.h (MY_core_file_pid): Define. * aout-tic30.c (MY_core_file_pid, MY_core_file_p): New defines. * coff-rs6000.c (coff_core_file_pid): New define. (rs6000coff_vec, pmac_xcoff_vec): Use BFD_JUMP_TABLE_CORE. * coff64-rs6000.c (coff_core_file_pid): New define. (rs6000coff64_vec): Use BFD_JUMP_TABLE_CORE. (xcoff64_core_file_pid): New define. (aix5coff64_vec): Use BFD_JUMP_TABLE_CORE. * mach-o-target.c (bfd_mach_o_core_file_pid): New define. * aix386-core.c (aix386_core_file_pid): New define. * hppabsd-core.c (hppabsd_core_core_file_pid): New define. * hpux-core.c (hpux_core_core_file_pid): New define. * irix-core.c (irix_core_core_file_pid): New define. * lynx-core.c (lynx_core_file_pid): New define. * osf-core.c (osf_core_core_file_pid): New define. * ptrace-core.c (ptrace_unix_core_file_pid): New define. * sco5-core.c (sco5_core_file_pid): New define. * xcoff-target.h (coff_core_file_pid): New define. * netbsd-core.c (netbsd_core_core_file_pid): New define. gdb/ 2010-08-18 Pedro Alves <pedro@codesourcery.com> PR corefile/8210 gdb/ * corelow.c (add_to_thread_list): Don't use gdbarch_core_reg_section_encodes_pid. Use bfd_core_file_pid. (get_core_register_section): Don't use gdbarch_core_reg_section_encodes_pid. * gdbarch.sh (core_reg_section_encodes_pid): Delete. * gdbarch.h, gdbarch.c: Regenerate. * amd64-sol2-tdep.c (amd64_sol2_init_abi): Don't set gdbarch_core_reg_section_encodes_pid. * i386-sol2-tdep.c (i386_sol2_init_abi): Ditto. * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Ditto. * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Ditto.
2010-08-18 14:24:13 +02:00
#define bfd_mach_o_core_file_pid _bfd_nocore_core_file_pid
2009-06-05 Tristan Gingold <gingold@adacore.com> * mach-o.h: Update copyright year. (bfd_mach_o_mach_header_magic): New enum. (bfd_mach_o_cpu_subtype): Now an enum. (BFD_MACH_O_HEADER_SIZE, BFD_MACH_O_HEADER_64_SIZE): New macros. (BFD_MACH_O_SECTION_SIZE, BFD_MACH_O_SECTION_64_SIZE): Ditto. (BFD_MACH_O_LC_SEGMENT_SIZE, BFD_MACH_O_LC_SEGMENT_64_SIZE): Ditto. (bfd_mach_o_load_command): Field type_required is now a boolean. Reindent prototypes. (bfd_mach_o_object_p, bfd_mach_o_core_p): Remove. (bfd_mach_o_bfd_copy_private_symbol_data): Add a prototype. (bfd_mach_o_bfd_copy_private_section_data): Ditto. (bfd_mach_o_bfd_copy_private_bfd_data): Ditto. (bfd_mach_o_get_symtab_upper_bound): Ditto. (bfd_mach_o_canonicalize_symtab): Ditto. (bfd_mach_o_get_symbol_info): Ditto. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Ditto. (bfd_mach_o_make_empty_symbol): Ditto. (bfd_mach_o_write_contents): Ditto. * mach-o.c (bfd_mach_o_object_p, bfd_mach_o_core_p, bfd_mach_o_mkobject): Defines. (bfd_mach_o_valid): Returns FALSE/TRUE instead of 0/1. Do not check with target vector but with flavour. (struct mach_o_section_name_xlat): New declaration. (dwarf_section_names_xlat): Ditto. (text_section_names_xlat): Ditto. (data_section_names_xlat): Ditto. (struct mach_o_segment_name_xlat): Ditto. (segsec_names_xlat): Ditto. (bfd_mach_o_convert_section_name_to_bfd): New function. (bfd_mach_o_convert_section_name_to_mach_o): Ditto. (bfd_mach_o_bfd_copy_private_symbol_data): Make it public. (bfd_mach_o_bfd_copy_private_section_data): Ditto. (bfd_mach_o_bfd_copy_private_bfd_data): Ditto. Accept any input and output flavour. Do not share private data anymore. (bfd_mach_o_count_symbols): Add a comment. (bfd_mach_o_get_symtab_upper_bound): Make it public. (bfd_mach_o_canonicalize_symtab): Ditto. (bfd_mach_o_get_symbol_info): Ditto. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_write_header): Now returns a boolean instead of an int. Use constants instead of hard-coded values. (bfd_mach_o_scan_write_section_32): Use constants instead of hard-coded values. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment): Ditto. Do not copy sections anymore. (bfd_mach_o_write_contents): Make it public. Remove dead code. Rewrite typeflag assignment. (bfd_mach_o_build_commands): New function. (bfd_mach_o_set_section_contents): Ditto. (bfd_mach_o_make_empty_symbol): Make it public. (bfd_mach_o_read_header): Make it static. Convert to bfd_boolean. Use constants instead of hard-coded values. (bfd_mach_o_make_bfd_section): Call bfd_mach_o_convert_section_name_to_bfd to create name. (bfd_mach_o_scan_read_section_32): Use constants instead of hard-coded values. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_segment): Do not create a bfd section for a segment anymore. Use constants instead of hard-coded values. (bfd_mach_o_scan_read_command): Fix style. (bfd_mach_o_scan): Use constants instead of hard-coded values. Get rid of BFD_IO_FUNCS. (bfd_mach_o_mkobject_init): Renamed from bfd_mach_o_mkobject. (bfd_mach_o_header_p): Created from bfd_mach_o_object_p. (bfd_mach_o_gen_object_p): New function, replaces bfd_mach_o_object_p. (bfd_mach_o_object_p): Removed. (bfd_mach_o_gen_core_p): New function, replaces ... (bfd_mach_o_core_p): ... deleted. (bfd_mach_o_bfd_print_private_bfd_data): Make it public. * mach-o-i386.c: New file. * config.bfd: Use mach_o_i386_vec as targ_defvec for ix86-darwin. * configure.in (TDEFINES): Add mach_o_i386_vec. * configure: Regenerated. * targets.c: Add mach_o_i386_vec. * mach-o.c: Update copyright years. (BFD_IO_FUNCS): Remove (was not used). (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr, bfd_mach_o_slurp_armap bfd_mach_o_slurp_extended_name_table, bfd_mach_o_construct_extended_name_table, bfd_mach_o_truncate_arname, bfd_mach_o_write_armap, bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt, bfd_mach_o_update_armap_timestamp, bfd_mach_o_close_and_cleanup, bfd_mach_o_bfd_free_cached_info, bfd_mach_o_new_section_hook, bfd_mach_o_get_section_contents_in_window, bfd_mach_o_bfd_is_local_label_name, bfd_mach_o_bfd_is_target_special_symbol, bfd_mach_o_bfd_is_local_label_name, bfd_mach_o_get_lineno, bfd_mach_o_find_nearest_line, bfd_mach_o_find_inliner_info, bfd_mach_o_bfd_make_debug_symbol, bfd_mach_o_read_minisymbols, bfd_mach_o_minisymbol_to_symbol, bfd_mach_o_bfd_get_relocated_section_contents, bfd_mach_o_bfd_relax_section, bfd_mach_o_bfd_link_hash_table_create, bfd_mach_o_bfd_link_hash_table_free, bfd_mach_o_bfd_link_add_symbols, bfd_mach_o_bfd_link_just_syms, bfd_mach_o_bfd_final_link, bfd_mach_o_bfd_link_split_section, bfd_mach_o_set_arch_mach, bfd_mach_o_bfd_merge_private_bfd_data, bfd_mach_o_bfd_set_private_flags, bfd_mach_o_get_section_contents, bfd_mach_o_bfd_gc_sections, bfd_mach_o_bfd_merge_sections, bfd_mach_o_bfd_is_group_section, bfd_mach_o_bfd_discard_group, bfd_mach_o_section_already_linked, bfd_mach_o_bfd_define_common_symbol, bfd_mach_o_bfd_copy_private_header_data, bfd_mach_o_core_file_matches_executable_p): Move these defines ... * mach-o-target.c: ... here. Update copyright years.
2009-06-05 11:19:44 +02:00
2009-06-25 Tristan Gingold <gingold@adacore.com> * mach-o-target.c (bfd_mach_o_get_dynamic_symtab_upper_bound) (bfd_mach_o_canonicalize_dynamic_symtab) (bfd_mach_o_get_synthetic_symtab): Defines. (TARGET_NAME_BACKEND): Add bfd_mach_o_print_thread entry. (TARGET_NAME): Use Mach-O specific functions for dynamic. * mach-o-i386.c (bfd_mach_o_i386_swap_reloc_in): Fix howto indexes for scattered relocations. (bfd_mach_o_i386_print_thread): New function. (bfd_mach_o_print_thread): Define. * mach-o.c (text_section_names_xlat): Add an entry for __const. (bfd_mach_o_canonicalize_one_reloc, bfd_mach_o_canonicalize_relocs): New functions extracted from ... (bfd_mach_o_canonicalize_reloc): ... This. Simplified. (bfd_mach_o_get_dynamic_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_dynamic_reloc): New function. (bfd_mach_o_i386_flavour_string): Adjusted after enum renaming. (bfd_mach_o_ppc_flavour_string): Reindentation. Add 64 bits cases. (bfd_mach_o_scan_read_dylinker): Do not create a section anymore. Set name_str field. (bfd_mach_o_scan_read_dylib): Ditto. (bfd_mach_o_scan_read_thread): Set mdata at declaration. Add comments, reindent. (bfd_mach_o_scan_read_dysymtab): Set mdata at declaration. Correctly decode isym and flags on little endian targets. Set dysymtab field. (bfd_mach_o_scan_start_address): Adjust for enum names. (bfd_mach_o_lookup_section): Do not look for segments anymore. (bfd_mach_o_print_section): Display bfd section name. (bfd_mach_o_print_segment): Display none if no name. (bfd_mach_o_print_dysymtab): Display next index for local, external and undefined symbols. (bfd_mach_o_bfd_print_private_bfd_data): Adjust code by using name_str. Display dylinker name. Display thread and unixthread commands content. (bfd_mach_o_print_thread): New macro. * mach-o.h (bfd_mach_o_mach_header_magic): Align numbers. (bfd_mach_o_ppc_thread_flavour): Ditto. (bfd_mach_o_i386_thread_flavour): Ditto. (BFD_MACH_O_PPC_THREAD_STATE_NONE): New enum. (BFD_MACH_O_x86_THREAD_STATE_NONE): Replaces BFD_MACH_O_THREAD_STATE_NONE. (bfd_mach_o_segment_command): Remove segment field. (bfd_mach_o_thread_flavour): Field offset is now unsigned long. (bfd_mach_o_dylinker_command): Remove section field, add name_str. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Remove section field. (mach_o_data_struct): Add dysymtab field. (bfd_mach_o_backend_data): Add _bfd_mach_o_print_thread field. (bfd_mach_o_get_reloc_upper_bound, bfd_mach_o_canonicalize_reloc) (bfd_mach_o_build_commands): Remove parameter names and attributes. (bfd_mach_o_get_dynamic_reloc_upper_bound) (bfd_mach_o_canonicalize_dynamic_reloc): New prototypes.
2009-06-25 14:39:06 +02:00
#define bfd_mach_o_get_dynamic_symtab_upper_bound bfd_mach_o_get_symtab_upper_bound
#define bfd_mach_o_canonicalize_dynamic_symtab bfd_mach_o_canonicalize_symtab
2009-06-12 Tristan Gingold <gingold@adacore.com> * reloc.c: Add BFD_RELOC_MACH_O_SECTDIFF and BFD_RELOC_MACH_O_PAIR. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * mach-o.c (FILE_ALIGN): New macro. (bfd_mach_o_canonicalize_symtab): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_scan_write_thread): Adjust type of variable offset. (bfd_mach_o_get_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_scan_write_relocs): Ditto. (bfd_mach_o_scan_write_section_32): Remove offset argument. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment_32): Write relocs. Fix size of data written for load command. Do not compute section file offset. (bfd_mach_o_scan_write_segment_64): Ditto. (bfd_mach_o_scan_write_symtab): Compute file offset first. Adjust for bfd_mach_o_asymbol. Move code to convert from BFD to Mach-O to ... (bfd_mach_o_mangle_symbols): ... this new function. (bfd_mach_o_write_contents): Be sure to habe load commands built. Call bfd_mach_o_mangle_symbols. (bfd_mach_o_build_commands): Adjust for filelen field. Use FILE_ALIGN macro. Clear section file offset if section is empty. Do not set symtab file offset anymore here. (bfd_mach_o_make_empty_symbol): Allocate a bfd_mach_o_asymbol. (bfd_mach_o_make_bfd_section): Set SEC_RELOC if has reloc. Set reloc_count and rel_filepos section fields. (bfd_mach_o_scan_read_section_32): Type of argument offset is now unsigned int. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Typr of argument s is now bfd_mach_o_asymbol. Use unsigned int for file offset type. (bfd_mach_o_scan_read_symtab_symbol): Adjust for bfd_mach_o_asymbol. Handle weak-ref symbols. (bfd_mach_o_scan_read_symtab_symbols): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_scan): Remove assignment to removed field. (bfd_mach_o_mkobject_init): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Adjust printf formatter. (bfd_mach_o_bfd_reloc_type_lookup): New macro. (bfd_mach_o_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in): Ditto. (bfd_mach_o_swap_reloc_out): Ditto. * mach-o.h (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCE_FLAG_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCED_DYNAMICALLY, BFD_MACH_O_N_DESC_DISCARDED) (BFD_MACH_O_N_NO_DEAD_STRIP, BFD_MACH_O_N_WEAK_REF) (BFD_MACH_O_N_WEAK_DEF): New macros. Add comments. (bfd_mach_o_section_type): Add new enumeration values. (BFD_MACH_O_S_SELF_MODIFYING_CODE) (BFD_MACH_O_S_ATTR_LIVE_SUPPORT) (BFD_MACH_O_S_ATTR_NO_DEAD_STRIP) (BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS, BFD_MACH_O_S_ATTR_NO_TOC): New macros. (BFD_MACH_O_GENERIC_RELOC_VANILLA) (BFD_MACH_O_GENERIC_RELOC_PAIR) (BFD_MACH_O_GENERIC_RELOC_SECTDIFF) (BFD_MACH_O_GENERIC_RELOC_PB_LA_PTR) (BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF): Ditto. (BFD_MACH_O_RELENT_SIZE): Ditto. (BFD_MACH_O_R_PCREL, BFD_MACH_O_GET_R_LENGTH) (BFD_MACH_O_R_EXTERN, BFD_MACH_O_GET_R_TYPE) (BFD_MACH_O_GET_R_SYMBOLNUM, BFD_MACH_O_SET_R_LENGTH) (BFD_MACH_O_SET_R_TYPE, BFD_MACH_O_SET_R_SYMBOLNUM): Ditto. (BFD_MACH_O_SR_SCATTERED, BFD_MACH_O_SR_PCREL) (BFD_MACH_O_GET_SR_LENGTH, BFD_MACH_O_GET_SR_TYPE) (BFD_MACH_O_GET_SR_ADDRESS, BFD_MACH_O_SET_SR_LENGTH) (BFD_MACH_O_SET_SR_TYPE, BFD_MACH_O_SET_SR_ADDRESS): Ditto. (bfd_mach_o_reloc_info): New struct. (bfd_mach_o_asymbol): New struct. (bfd_mach_o_symtab_command): The symbols field is now of type bfd_mach_o_asymbol. (bfd_mach_o_load_command): The offset and len fields are now of type unsigned int. (mach_o_data_struct): Remove symbols, nsymbols and ibfd fields. Add a filelen field. Add comments. (bfd_mach_o_backend_data): New struct. (bfd_mach_o_get_backend_data): New macro. (bfd_mach_o_scan_read_symtab_symbol): Parameter symbol now of type bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_get_reloc_upper_bound): New prototype. (bfd_mach_o_canonicalize_reloc): Ditto. * mach-o-target.c (bfd_mach_o_bfd_is_local_label_name): Remove duplicated macro. Now defined to _bfd_generic_is_local_label. (TARGET_NAME_BACKEND): New macro... (TARGET_NAME_BACKEND): ... used to name a new variable. (TARGET_NAME): Define relocs table using bfd_mach_o, reference Mach-O backend data. * mach-o-i386.c (i386_howto_table): New variable. (bfd_mach_o_i386_swap_reloc_in): New function. (bfd_mach_o_i386_swap_reloc_out): Ditto. (bfd_mach_o_i386_bfd_reloc_type_lookup): Ditto. (bfd_mach_o_i386_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in, bfd_mach_o_swap_reloc_out): New macros. (bfd_mach_o_bfd_reloc_type_lookup) (bfd_mach_o_bfd_reloc_name_lookup): Ditto.
2009-06-12 11:15:46 +02:00
#define TARGET_NAME_BACKEND XCONCAT2(TARGET_NAME,_backend)
2009-06-05 Tristan Gingold <gingold@adacore.com> * mach-o.h: Update copyright year. (bfd_mach_o_mach_header_magic): New enum. (bfd_mach_o_cpu_subtype): Now an enum. (BFD_MACH_O_HEADER_SIZE, BFD_MACH_O_HEADER_64_SIZE): New macros. (BFD_MACH_O_SECTION_SIZE, BFD_MACH_O_SECTION_64_SIZE): Ditto. (BFD_MACH_O_LC_SEGMENT_SIZE, BFD_MACH_O_LC_SEGMENT_64_SIZE): Ditto. (bfd_mach_o_load_command): Field type_required is now a boolean. Reindent prototypes. (bfd_mach_o_object_p, bfd_mach_o_core_p): Remove. (bfd_mach_o_bfd_copy_private_symbol_data): Add a prototype. (bfd_mach_o_bfd_copy_private_section_data): Ditto. (bfd_mach_o_bfd_copy_private_bfd_data): Ditto. (bfd_mach_o_get_symtab_upper_bound): Ditto. (bfd_mach_o_canonicalize_symtab): Ditto. (bfd_mach_o_get_symbol_info): Ditto. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Ditto. (bfd_mach_o_make_empty_symbol): Ditto. (bfd_mach_o_write_contents): Ditto. * mach-o.c (bfd_mach_o_object_p, bfd_mach_o_core_p, bfd_mach_o_mkobject): Defines. (bfd_mach_o_valid): Returns FALSE/TRUE instead of 0/1. Do not check with target vector but with flavour. (struct mach_o_section_name_xlat): New declaration. (dwarf_section_names_xlat): Ditto. (text_section_names_xlat): Ditto. (data_section_names_xlat): Ditto. (struct mach_o_segment_name_xlat): Ditto. (segsec_names_xlat): Ditto. (bfd_mach_o_convert_section_name_to_bfd): New function. (bfd_mach_o_convert_section_name_to_mach_o): Ditto. (bfd_mach_o_bfd_copy_private_symbol_data): Make it public. (bfd_mach_o_bfd_copy_private_section_data): Ditto. (bfd_mach_o_bfd_copy_private_bfd_data): Ditto. Accept any input and output flavour. Do not share private data anymore. (bfd_mach_o_count_symbols): Add a comment. (bfd_mach_o_get_symtab_upper_bound): Make it public. (bfd_mach_o_canonicalize_symtab): Ditto. (bfd_mach_o_get_symbol_info): Ditto. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_write_header): Now returns a boolean instead of an int. Use constants instead of hard-coded values. (bfd_mach_o_scan_write_section_32): Use constants instead of hard-coded values. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment): Ditto. Do not copy sections anymore. (bfd_mach_o_write_contents): Make it public. Remove dead code. Rewrite typeflag assignment. (bfd_mach_o_build_commands): New function. (bfd_mach_o_set_section_contents): Ditto. (bfd_mach_o_make_empty_symbol): Make it public. (bfd_mach_o_read_header): Make it static. Convert to bfd_boolean. Use constants instead of hard-coded values. (bfd_mach_o_make_bfd_section): Call bfd_mach_o_convert_section_name_to_bfd to create name. (bfd_mach_o_scan_read_section_32): Use constants instead of hard-coded values. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_segment): Do not create a bfd section for a segment anymore. Use constants instead of hard-coded values. (bfd_mach_o_scan_read_command): Fix style. (bfd_mach_o_scan): Use constants instead of hard-coded values. Get rid of BFD_IO_FUNCS. (bfd_mach_o_mkobject_init): Renamed from bfd_mach_o_mkobject. (bfd_mach_o_header_p): Created from bfd_mach_o_object_p. (bfd_mach_o_gen_object_p): New function, replaces bfd_mach_o_object_p. (bfd_mach_o_object_p): Removed. (bfd_mach_o_gen_core_p): New function, replaces ... (bfd_mach_o_core_p): ... deleted. (bfd_mach_o_bfd_print_private_bfd_data): Make it public. * mach-o-i386.c: New file. * config.bfd: Use mach_o_i386_vec as targ_defvec for ix86-darwin. * configure.in (TDEFINES): Add mach_o_i386_vec. * configure: Regenerated. * targets.c: Add mach_o_i386_vec. * mach-o.c: Update copyright years. (BFD_IO_FUNCS): Remove (was not used). (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr, bfd_mach_o_slurp_armap bfd_mach_o_slurp_extended_name_table, bfd_mach_o_construct_extended_name_table, bfd_mach_o_truncate_arname, bfd_mach_o_write_armap, bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt, bfd_mach_o_update_armap_timestamp, bfd_mach_o_close_and_cleanup, bfd_mach_o_bfd_free_cached_info, bfd_mach_o_new_section_hook, bfd_mach_o_get_section_contents_in_window, bfd_mach_o_bfd_is_local_label_name, bfd_mach_o_bfd_is_target_special_symbol, bfd_mach_o_bfd_is_local_label_name, bfd_mach_o_get_lineno, bfd_mach_o_find_nearest_line, bfd_mach_o_find_inliner_info, bfd_mach_o_bfd_make_debug_symbol, bfd_mach_o_read_minisymbols, bfd_mach_o_minisymbol_to_symbol, bfd_mach_o_bfd_get_relocated_section_contents, bfd_mach_o_bfd_relax_section, bfd_mach_o_bfd_link_hash_table_create, bfd_mach_o_bfd_link_hash_table_free, bfd_mach_o_bfd_link_add_symbols, bfd_mach_o_bfd_link_just_syms, bfd_mach_o_bfd_final_link, bfd_mach_o_bfd_link_split_section, bfd_mach_o_set_arch_mach, bfd_mach_o_bfd_merge_private_bfd_data, bfd_mach_o_bfd_set_private_flags, bfd_mach_o_get_section_contents, bfd_mach_o_bfd_gc_sections, bfd_mach_o_bfd_merge_sections, bfd_mach_o_bfd_is_group_section, bfd_mach_o_bfd_discard_group, bfd_mach_o_section_already_linked, bfd_mach_o_bfd_define_common_symbol, bfd_mach_o_bfd_copy_private_header_data, bfd_mach_o_core_file_matches_executable_p): Move these defines ... * mach-o-target.c: ... here. Update copyright years.
2009-06-05 11:19:44 +02:00
#endif /* MACH_O_TARGET_COMMON_DEFINED */
2002-11-06 14:26:29 +01:00
#ifndef TARGET_NAME
#error TARGET_NAME must be defined
#endif /* TARGET_NAME */
#ifndef TARGET_STRING
#error TARGET_STRING must be defined
#endif /* TARGET_STRING */
#ifndef TARGET_ARCHITECTURE
#error TARGET_ARCHITECTURE must be defined
#endif /* TARGET_ARCHITECTURE */
2002-11-06 14:26:29 +01:00
#ifndef TARGET_BIG_ENDIAN
#error TARGET_BIG_ENDIAN must be defined
#endif /* TARGET_BIG_ENDIAN */
#ifndef TARGET_ARCHIVE
#error TARGET_ARCHIVE must be defined
#endif /* TARGET_ARCHIVE */
#if ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN))
#error Mach-O fat files must always be big-endian.
#endif /* ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) */
2009-06-12 Tristan Gingold <gingold@adacore.com> * reloc.c: Add BFD_RELOC_MACH_O_SECTDIFF and BFD_RELOC_MACH_O_PAIR. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * mach-o.c (FILE_ALIGN): New macro. (bfd_mach_o_canonicalize_symtab): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_scan_write_thread): Adjust type of variable offset. (bfd_mach_o_get_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_scan_write_relocs): Ditto. (bfd_mach_o_scan_write_section_32): Remove offset argument. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment_32): Write relocs. Fix size of data written for load command. Do not compute section file offset. (bfd_mach_o_scan_write_segment_64): Ditto. (bfd_mach_o_scan_write_symtab): Compute file offset first. Adjust for bfd_mach_o_asymbol. Move code to convert from BFD to Mach-O to ... (bfd_mach_o_mangle_symbols): ... this new function. (bfd_mach_o_write_contents): Be sure to habe load commands built. Call bfd_mach_o_mangle_symbols. (bfd_mach_o_build_commands): Adjust for filelen field. Use FILE_ALIGN macro. Clear section file offset if section is empty. Do not set symtab file offset anymore here. (bfd_mach_o_make_empty_symbol): Allocate a bfd_mach_o_asymbol. (bfd_mach_o_make_bfd_section): Set SEC_RELOC if has reloc. Set reloc_count and rel_filepos section fields. (bfd_mach_o_scan_read_section_32): Type of argument offset is now unsigned int. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Typr of argument s is now bfd_mach_o_asymbol. Use unsigned int for file offset type. (bfd_mach_o_scan_read_symtab_symbol): Adjust for bfd_mach_o_asymbol. Handle weak-ref symbols. (bfd_mach_o_scan_read_symtab_symbols): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_scan): Remove assignment to removed field. (bfd_mach_o_mkobject_init): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Adjust printf formatter. (bfd_mach_o_bfd_reloc_type_lookup): New macro. (bfd_mach_o_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in): Ditto. (bfd_mach_o_swap_reloc_out): Ditto. * mach-o.h (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCE_FLAG_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCED_DYNAMICALLY, BFD_MACH_O_N_DESC_DISCARDED) (BFD_MACH_O_N_NO_DEAD_STRIP, BFD_MACH_O_N_WEAK_REF) (BFD_MACH_O_N_WEAK_DEF): New macros. Add comments. (bfd_mach_o_section_type): Add new enumeration values. (BFD_MACH_O_S_SELF_MODIFYING_CODE) (BFD_MACH_O_S_ATTR_LIVE_SUPPORT) (BFD_MACH_O_S_ATTR_NO_DEAD_STRIP) (BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS, BFD_MACH_O_S_ATTR_NO_TOC): New macros. (BFD_MACH_O_GENERIC_RELOC_VANILLA) (BFD_MACH_O_GENERIC_RELOC_PAIR) (BFD_MACH_O_GENERIC_RELOC_SECTDIFF) (BFD_MACH_O_GENERIC_RELOC_PB_LA_PTR) (BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF): Ditto. (BFD_MACH_O_RELENT_SIZE): Ditto. (BFD_MACH_O_R_PCREL, BFD_MACH_O_GET_R_LENGTH) (BFD_MACH_O_R_EXTERN, BFD_MACH_O_GET_R_TYPE) (BFD_MACH_O_GET_R_SYMBOLNUM, BFD_MACH_O_SET_R_LENGTH) (BFD_MACH_O_SET_R_TYPE, BFD_MACH_O_SET_R_SYMBOLNUM): Ditto. (BFD_MACH_O_SR_SCATTERED, BFD_MACH_O_SR_PCREL) (BFD_MACH_O_GET_SR_LENGTH, BFD_MACH_O_GET_SR_TYPE) (BFD_MACH_O_GET_SR_ADDRESS, BFD_MACH_O_SET_SR_LENGTH) (BFD_MACH_O_SET_SR_TYPE, BFD_MACH_O_SET_SR_ADDRESS): Ditto. (bfd_mach_o_reloc_info): New struct. (bfd_mach_o_asymbol): New struct. (bfd_mach_o_symtab_command): The symbols field is now of type bfd_mach_o_asymbol. (bfd_mach_o_load_command): The offset and len fields are now of type unsigned int. (mach_o_data_struct): Remove symbols, nsymbols and ibfd fields. Add a filelen field. Add comments. (bfd_mach_o_backend_data): New struct. (bfd_mach_o_get_backend_data): New macro. (bfd_mach_o_scan_read_symtab_symbol): Parameter symbol now of type bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_get_reloc_upper_bound): New prototype. (bfd_mach_o_canonicalize_reloc): Ditto. * mach-o-target.c (bfd_mach_o_bfd_is_local_label_name): Remove duplicated macro. Now defined to _bfd_generic_is_local_label. (TARGET_NAME_BACKEND): New macro... (TARGET_NAME_BACKEND): ... used to name a new variable. (TARGET_NAME): Define relocs table using bfd_mach_o, reference Mach-O backend data. * mach-o-i386.c (i386_howto_table): New variable. (bfd_mach_o_i386_swap_reloc_in): New function. (bfd_mach_o_i386_swap_reloc_out): Ditto. (bfd_mach_o_i386_bfd_reloc_type_lookup): Ditto. (bfd_mach_o_i386_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in, bfd_mach_o_swap_reloc_out): New macros. (bfd_mach_o_bfd_reloc_type_lookup) (bfd_mach_o_bfd_reloc_name_lookup): Ditto.
2009-06-12 11:15:46 +02:00
static const bfd_mach_o_backend_data TARGET_NAME_BACKEND =
{
TARGET_ARCHITECTURE,
2009-06-12 Tristan Gingold <gingold@adacore.com> * reloc.c: Add BFD_RELOC_MACH_O_SECTDIFF and BFD_RELOC_MACH_O_PAIR. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * mach-o.c (FILE_ALIGN): New macro. (bfd_mach_o_canonicalize_symtab): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_scan_write_thread): Adjust type of variable offset. (bfd_mach_o_get_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_scan_write_relocs): Ditto. (bfd_mach_o_scan_write_section_32): Remove offset argument. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment_32): Write relocs. Fix size of data written for load command. Do not compute section file offset. (bfd_mach_o_scan_write_segment_64): Ditto. (bfd_mach_o_scan_write_symtab): Compute file offset first. Adjust for bfd_mach_o_asymbol. Move code to convert from BFD to Mach-O to ... (bfd_mach_o_mangle_symbols): ... this new function. (bfd_mach_o_write_contents): Be sure to habe load commands built. Call bfd_mach_o_mangle_symbols. (bfd_mach_o_build_commands): Adjust for filelen field. Use FILE_ALIGN macro. Clear section file offset if section is empty. Do not set symtab file offset anymore here. (bfd_mach_o_make_empty_symbol): Allocate a bfd_mach_o_asymbol. (bfd_mach_o_make_bfd_section): Set SEC_RELOC if has reloc. Set reloc_count and rel_filepos section fields. (bfd_mach_o_scan_read_section_32): Type of argument offset is now unsigned int. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Typr of argument s is now bfd_mach_o_asymbol. Use unsigned int for file offset type. (bfd_mach_o_scan_read_symtab_symbol): Adjust for bfd_mach_o_asymbol. Handle weak-ref symbols. (bfd_mach_o_scan_read_symtab_symbols): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_scan): Remove assignment to removed field. (bfd_mach_o_mkobject_init): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Adjust printf formatter. (bfd_mach_o_bfd_reloc_type_lookup): New macro. (bfd_mach_o_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in): Ditto. (bfd_mach_o_swap_reloc_out): Ditto. * mach-o.h (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCE_FLAG_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCED_DYNAMICALLY, BFD_MACH_O_N_DESC_DISCARDED) (BFD_MACH_O_N_NO_DEAD_STRIP, BFD_MACH_O_N_WEAK_REF) (BFD_MACH_O_N_WEAK_DEF): New macros. Add comments. (bfd_mach_o_section_type): Add new enumeration values. (BFD_MACH_O_S_SELF_MODIFYING_CODE) (BFD_MACH_O_S_ATTR_LIVE_SUPPORT) (BFD_MACH_O_S_ATTR_NO_DEAD_STRIP) (BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS, BFD_MACH_O_S_ATTR_NO_TOC): New macros. (BFD_MACH_O_GENERIC_RELOC_VANILLA) (BFD_MACH_O_GENERIC_RELOC_PAIR) (BFD_MACH_O_GENERIC_RELOC_SECTDIFF) (BFD_MACH_O_GENERIC_RELOC_PB_LA_PTR) (BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF): Ditto. (BFD_MACH_O_RELENT_SIZE): Ditto. (BFD_MACH_O_R_PCREL, BFD_MACH_O_GET_R_LENGTH) (BFD_MACH_O_R_EXTERN, BFD_MACH_O_GET_R_TYPE) (BFD_MACH_O_GET_R_SYMBOLNUM, BFD_MACH_O_SET_R_LENGTH) (BFD_MACH_O_SET_R_TYPE, BFD_MACH_O_SET_R_SYMBOLNUM): Ditto. (BFD_MACH_O_SR_SCATTERED, BFD_MACH_O_SR_PCREL) (BFD_MACH_O_GET_SR_LENGTH, BFD_MACH_O_GET_SR_TYPE) (BFD_MACH_O_GET_SR_ADDRESS, BFD_MACH_O_SET_SR_LENGTH) (BFD_MACH_O_SET_SR_TYPE, BFD_MACH_O_SET_SR_ADDRESS): Ditto. (bfd_mach_o_reloc_info): New struct. (bfd_mach_o_asymbol): New struct. (bfd_mach_o_symtab_command): The symbols field is now of type bfd_mach_o_asymbol. (bfd_mach_o_load_command): The offset and len fields are now of type unsigned int. (mach_o_data_struct): Remove symbols, nsymbols and ibfd fields. Add a filelen field. Add comments. (bfd_mach_o_backend_data): New struct. (bfd_mach_o_get_backend_data): New macro. (bfd_mach_o_scan_read_symtab_symbol): Parameter symbol now of type bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_get_reloc_upper_bound): New prototype. (bfd_mach_o_canonicalize_reloc): Ditto. * mach-o-target.c (bfd_mach_o_bfd_is_local_label_name): Remove duplicated macro. Now defined to _bfd_generic_is_local_label. (TARGET_NAME_BACKEND): New macro... (TARGET_NAME_BACKEND): ... used to name a new variable. (TARGET_NAME): Define relocs table using bfd_mach_o, reference Mach-O backend data. * mach-o-i386.c (i386_howto_table): New variable. (bfd_mach_o_i386_swap_reloc_in): New function. (bfd_mach_o_i386_swap_reloc_out): Ditto. (bfd_mach_o_i386_bfd_reloc_type_lookup): Ditto. (bfd_mach_o_i386_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in, bfd_mach_o_swap_reloc_out): New macros. (bfd_mach_o_bfd_reloc_type_lookup) (bfd_mach_o_bfd_reloc_name_lookup): Ditto.
2009-06-12 11:15:46 +02:00
bfd_mach_o_swap_reloc_in,
2009-06-25 Tristan Gingold <gingold@adacore.com> * mach-o-target.c (bfd_mach_o_get_dynamic_symtab_upper_bound) (bfd_mach_o_canonicalize_dynamic_symtab) (bfd_mach_o_get_synthetic_symtab): Defines. (TARGET_NAME_BACKEND): Add bfd_mach_o_print_thread entry. (TARGET_NAME): Use Mach-O specific functions for dynamic. * mach-o-i386.c (bfd_mach_o_i386_swap_reloc_in): Fix howto indexes for scattered relocations. (bfd_mach_o_i386_print_thread): New function. (bfd_mach_o_print_thread): Define. * mach-o.c (text_section_names_xlat): Add an entry for __const. (bfd_mach_o_canonicalize_one_reloc, bfd_mach_o_canonicalize_relocs): New functions extracted from ... (bfd_mach_o_canonicalize_reloc): ... This. Simplified. (bfd_mach_o_get_dynamic_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_dynamic_reloc): New function. (bfd_mach_o_i386_flavour_string): Adjusted after enum renaming. (bfd_mach_o_ppc_flavour_string): Reindentation. Add 64 bits cases. (bfd_mach_o_scan_read_dylinker): Do not create a section anymore. Set name_str field. (bfd_mach_o_scan_read_dylib): Ditto. (bfd_mach_o_scan_read_thread): Set mdata at declaration. Add comments, reindent. (bfd_mach_o_scan_read_dysymtab): Set mdata at declaration. Correctly decode isym and flags on little endian targets. Set dysymtab field. (bfd_mach_o_scan_start_address): Adjust for enum names. (bfd_mach_o_lookup_section): Do not look for segments anymore. (bfd_mach_o_print_section): Display bfd section name. (bfd_mach_o_print_segment): Display none if no name. (bfd_mach_o_print_dysymtab): Display next index for local, external and undefined symbols. (bfd_mach_o_bfd_print_private_bfd_data): Adjust code by using name_str. Display dylinker name. Display thread and unixthread commands content. (bfd_mach_o_print_thread): New macro. * mach-o.h (bfd_mach_o_mach_header_magic): Align numbers. (bfd_mach_o_ppc_thread_flavour): Ditto. (bfd_mach_o_i386_thread_flavour): Ditto. (BFD_MACH_O_PPC_THREAD_STATE_NONE): New enum. (BFD_MACH_O_x86_THREAD_STATE_NONE): Replaces BFD_MACH_O_THREAD_STATE_NONE. (bfd_mach_o_segment_command): Remove segment field. (bfd_mach_o_thread_flavour): Field offset is now unsigned long. (bfd_mach_o_dylinker_command): Remove section field, add name_str. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Remove section field. (mach_o_data_struct): Add dysymtab field. (bfd_mach_o_backend_data): Add _bfd_mach_o_print_thread field. (bfd_mach_o_get_reloc_upper_bound, bfd_mach_o_canonicalize_reloc) (bfd_mach_o_build_commands): Remove parameter names and attributes. (bfd_mach_o_get_dynamic_reloc_upper_bound) (bfd_mach_o_canonicalize_dynamic_reloc): New prototypes.
2009-06-25 14:39:06 +02:00
bfd_mach_o_swap_reloc_out,
bfd_mach_o_print_thread
2009-06-12 Tristan Gingold <gingold@adacore.com> * reloc.c: Add BFD_RELOC_MACH_O_SECTDIFF and BFD_RELOC_MACH_O_PAIR. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * mach-o.c (FILE_ALIGN): New macro. (bfd_mach_o_canonicalize_symtab): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_scan_write_thread): Adjust type of variable offset. (bfd_mach_o_get_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_scan_write_relocs): Ditto. (bfd_mach_o_scan_write_section_32): Remove offset argument. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment_32): Write relocs. Fix size of data written for load command. Do not compute section file offset. (bfd_mach_o_scan_write_segment_64): Ditto. (bfd_mach_o_scan_write_symtab): Compute file offset first. Adjust for bfd_mach_o_asymbol. Move code to convert from BFD to Mach-O to ... (bfd_mach_o_mangle_symbols): ... this new function. (bfd_mach_o_write_contents): Be sure to habe load commands built. Call bfd_mach_o_mangle_symbols. (bfd_mach_o_build_commands): Adjust for filelen field. Use FILE_ALIGN macro. Clear section file offset if section is empty. Do not set symtab file offset anymore here. (bfd_mach_o_make_empty_symbol): Allocate a bfd_mach_o_asymbol. (bfd_mach_o_make_bfd_section): Set SEC_RELOC if has reloc. Set reloc_count and rel_filepos section fields. (bfd_mach_o_scan_read_section_32): Type of argument offset is now unsigned int. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Typr of argument s is now bfd_mach_o_asymbol. Use unsigned int for file offset type. (bfd_mach_o_scan_read_symtab_symbol): Adjust for bfd_mach_o_asymbol. Handle weak-ref symbols. (bfd_mach_o_scan_read_symtab_symbols): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_scan): Remove assignment to removed field. (bfd_mach_o_mkobject_init): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Adjust printf formatter. (bfd_mach_o_bfd_reloc_type_lookup): New macro. (bfd_mach_o_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in): Ditto. (bfd_mach_o_swap_reloc_out): Ditto. * mach-o.h (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCE_FLAG_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCED_DYNAMICALLY, BFD_MACH_O_N_DESC_DISCARDED) (BFD_MACH_O_N_NO_DEAD_STRIP, BFD_MACH_O_N_WEAK_REF) (BFD_MACH_O_N_WEAK_DEF): New macros. Add comments. (bfd_mach_o_section_type): Add new enumeration values. (BFD_MACH_O_S_SELF_MODIFYING_CODE) (BFD_MACH_O_S_ATTR_LIVE_SUPPORT) (BFD_MACH_O_S_ATTR_NO_DEAD_STRIP) (BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS, BFD_MACH_O_S_ATTR_NO_TOC): New macros. (BFD_MACH_O_GENERIC_RELOC_VANILLA) (BFD_MACH_O_GENERIC_RELOC_PAIR) (BFD_MACH_O_GENERIC_RELOC_SECTDIFF) (BFD_MACH_O_GENERIC_RELOC_PB_LA_PTR) (BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF): Ditto. (BFD_MACH_O_RELENT_SIZE): Ditto. (BFD_MACH_O_R_PCREL, BFD_MACH_O_GET_R_LENGTH) (BFD_MACH_O_R_EXTERN, BFD_MACH_O_GET_R_TYPE) (BFD_MACH_O_GET_R_SYMBOLNUM, BFD_MACH_O_SET_R_LENGTH) (BFD_MACH_O_SET_R_TYPE, BFD_MACH_O_SET_R_SYMBOLNUM): Ditto. (BFD_MACH_O_SR_SCATTERED, BFD_MACH_O_SR_PCREL) (BFD_MACH_O_GET_SR_LENGTH, BFD_MACH_O_GET_SR_TYPE) (BFD_MACH_O_GET_SR_ADDRESS, BFD_MACH_O_SET_SR_LENGTH) (BFD_MACH_O_SET_SR_TYPE, BFD_MACH_O_SET_SR_ADDRESS): Ditto. (bfd_mach_o_reloc_info): New struct. (bfd_mach_o_asymbol): New struct. (bfd_mach_o_symtab_command): The symbols field is now of type bfd_mach_o_asymbol. (bfd_mach_o_load_command): The offset and len fields are now of type unsigned int. (mach_o_data_struct): Remove symbols, nsymbols and ibfd fields. Add a filelen field. Add comments. (bfd_mach_o_backend_data): New struct. (bfd_mach_o_get_backend_data): New macro. (bfd_mach_o_scan_read_symtab_symbol): Parameter symbol now of type bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_get_reloc_upper_bound): New prototype. (bfd_mach_o_canonicalize_reloc): Ditto. * mach-o-target.c (bfd_mach_o_bfd_is_local_label_name): Remove duplicated macro. Now defined to _bfd_generic_is_local_label. (TARGET_NAME_BACKEND): New macro... (TARGET_NAME_BACKEND): ... used to name a new variable. (TARGET_NAME): Define relocs table using bfd_mach_o, reference Mach-O backend data. * mach-o-i386.c (i386_howto_table): New variable. (bfd_mach_o_i386_swap_reloc_in): New function. (bfd_mach_o_i386_swap_reloc_out): Ditto. (bfd_mach_o_i386_bfd_reloc_type_lookup): Ditto. (bfd_mach_o_i386_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in, bfd_mach_o_swap_reloc_out): New macros. (bfd_mach_o_bfd_reloc_type_lookup) (bfd_mach_o_bfd_reloc_name_lookup): Ditto.
2009-06-12 11:15:46 +02:00
};
2002-11-06 14:26:29 +01:00
const bfd_target TARGET_NAME =
{
TARGET_STRING, /* Name. */
bfd_target_mach_o_flavour,
#if TARGET_BIG_ENDIAN
BFD_ENDIAN_BIG, /* Target byte order. */
BFD_ENDIAN_BIG, /* Target headers byte order. */
#else
BFD_ENDIAN_LITTLE, /* Target byte order. */
BFD_ENDIAN_LITTLE, /* Target headers byte order. */
#endif
(HAS_RELOC | EXEC_P | /* Object flags. */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
'_', /* symbol_leading_char. */
' ', /* ar_pad_char. */
16, /* ar_max_namelen. */
#if TARGET_BIG_ENDIAN
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */
#else
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
#endif /* TARGET_BIG_ENDIAN */
{ /* bfd_check_format. */
#if TARGET_ARCHIVE
_bfd_dummy_target,
_bfd_dummy_target,
bfd_mach_o_archive_p,
_bfd_dummy_target,
#else
_bfd_dummy_target,
bfd_mach_o_object_p,
2008-11-06 Tristan Gingold <gingold@adacore.com> * mach-o.h (BFD_MACH_O_NO_SECT): Add; reorders the macros. (BFD_MACH_O_SYM_NTYPE, BFD_MACH_O_SYM_NSECT, BFD_MACH_O_SYM_NDESC): New macros. (bfd_mach_o_i386_thread_flavour): Define according to the latest definition from system header. (bfd_mach_o_load_command_type): Add BFD_MACH_O_LC_RPATH, BFD_MACH_O_LC_CODE_SIGNATURE. (BFD_MACH_O_SECTION_TYPE_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_SYS, BFD_MACH_O_SECTION_ATTRIBUTES_USR, BFD_MACH_O_S_ATTR_LOC_RELOC, BFD_MACH_O_S_ATTR_EXT_RELOC, BFD_MACH_O_S_ATTR_SOME_INSTRUCTIONS, BFD_MACH_O_S_ATTR_DEBUG, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): Add. (bfd_mach_o_segment_command): Add room for a nul terminator in segname field. (BFD_MACH_O_PROT_READ, BFD_MACH_O_PROT_WRITE, BFD_MACH_O_PROT_EXECUTE): Add. (INDIRECT_SYMBOL_LOCAL): Renames to BFD_MACH_O_INDIRECT_SYMBOL_LOCAL. (INDIRECT_SYMBOL_ABS): Renames to BFD_MACH_O_INDIRECT_SYMBOL_ABS. (bfd_mach_o_uuid_command): Add the structure. (bfd_mach_o_load_command): Add uuid field. (bfd_get_mach_o_data): New macro. * mach-o.c (bfd_mach_o_bfd_print_private_bfd_data): New function which replaces the macro. (SECTION_TYPE, SECTION_ATTRIBUTES, SECTION_ATTRIBUTES_USR, S_ATTR_PURE_INSTRUCTIONS, SECTION_ATTRIBUTES_SYS, S_ATTR_SOME_INSTRUCTIONS, S_ATTR_EXT_RELOC, S_ATTR_LOC_RELOC): Renamed and moved to mach-o.h. (N_STAB, N_TYPE, N_EXT, N_UNDF, N_ABS, N_TEXT, N_DATA, N_BSS, N_SECT, N_INDR): Removed as they duplicated macros in mach-o.h. (bfd_mach_o_print_symbol): Print much more details. (bfd_mach_o_make_bfd_section): Add prot argument, use canonical dwarf name for dwarf sections. Precisely set section flags. (bfd_mach_o_scan_read_section_32): Add prot argument. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Set section for debugging stabs, set BSF_GLOBAL and LOCAL flags correctly. Fix section for N_SECT symbols. (bfd_mach_o_i386_flavour_string): Reindent and adjust for new names. (bfd_mach_o_scan_read_symtab): Set HAS_SYMS flags on bfd if there are symbols. (bfd_mach_o_scan_read_uuid): New function. (bfd_mach_o_scan_read_segment): Add a trailing nul. Segments flags are now simply HAS_CONTENTS. Pass protection to bfd_mach_o_scan_read_section. (bfd_mach_o_scan_read_command): Decode UUID command. (bfd_mach_o_flatten_sections): Add comments. Fix flavour names. (bfd_mach_o_scan): Set flags according to file type. (mach_o_fat_archentry): Remove abfd field. (bfd_mach_o_archive_p): Remove initialization of abfd field. (bfd_mach_o_openr_next_archived_file): Find previous archive by position and not by bfd (as former bfds may have been freed). Give architecture name to archived file. * mach-o-target.c (TARGET_NAME): Use generic archive for non fat targets.
2008-11-06 14:03:43 +01:00
bfd_generic_archive_p,
2002-11-06 14:26:29 +01:00
bfd_mach_o_core_p
#endif
},
{ /* bfd_set_format. */
bfd_false,
bfd_mach_o_mkobject,
2008-11-06 Tristan Gingold <gingold@adacore.com> * mach-o.h (BFD_MACH_O_NO_SECT): Add; reorders the macros. (BFD_MACH_O_SYM_NTYPE, BFD_MACH_O_SYM_NSECT, BFD_MACH_O_SYM_NDESC): New macros. (bfd_mach_o_i386_thread_flavour): Define according to the latest definition from system header. (bfd_mach_o_load_command_type): Add BFD_MACH_O_LC_RPATH, BFD_MACH_O_LC_CODE_SIGNATURE. (BFD_MACH_O_SECTION_TYPE_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_SYS, BFD_MACH_O_SECTION_ATTRIBUTES_USR, BFD_MACH_O_S_ATTR_LOC_RELOC, BFD_MACH_O_S_ATTR_EXT_RELOC, BFD_MACH_O_S_ATTR_SOME_INSTRUCTIONS, BFD_MACH_O_S_ATTR_DEBUG, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): Add. (bfd_mach_o_segment_command): Add room for a nul terminator in segname field. (BFD_MACH_O_PROT_READ, BFD_MACH_O_PROT_WRITE, BFD_MACH_O_PROT_EXECUTE): Add. (INDIRECT_SYMBOL_LOCAL): Renames to BFD_MACH_O_INDIRECT_SYMBOL_LOCAL. (INDIRECT_SYMBOL_ABS): Renames to BFD_MACH_O_INDIRECT_SYMBOL_ABS. (bfd_mach_o_uuid_command): Add the structure. (bfd_mach_o_load_command): Add uuid field. (bfd_get_mach_o_data): New macro. * mach-o.c (bfd_mach_o_bfd_print_private_bfd_data): New function which replaces the macro. (SECTION_TYPE, SECTION_ATTRIBUTES, SECTION_ATTRIBUTES_USR, S_ATTR_PURE_INSTRUCTIONS, SECTION_ATTRIBUTES_SYS, S_ATTR_SOME_INSTRUCTIONS, S_ATTR_EXT_RELOC, S_ATTR_LOC_RELOC): Renamed and moved to mach-o.h. (N_STAB, N_TYPE, N_EXT, N_UNDF, N_ABS, N_TEXT, N_DATA, N_BSS, N_SECT, N_INDR): Removed as they duplicated macros in mach-o.h. (bfd_mach_o_print_symbol): Print much more details. (bfd_mach_o_make_bfd_section): Add prot argument, use canonical dwarf name for dwarf sections. Precisely set section flags. (bfd_mach_o_scan_read_section_32): Add prot argument. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Set section for debugging stabs, set BSF_GLOBAL and LOCAL flags correctly. Fix section for N_SECT symbols. (bfd_mach_o_i386_flavour_string): Reindent and adjust for new names. (bfd_mach_o_scan_read_symtab): Set HAS_SYMS flags on bfd if there are symbols. (bfd_mach_o_scan_read_uuid): New function. (bfd_mach_o_scan_read_segment): Add a trailing nul. Segments flags are now simply HAS_CONTENTS. Pass protection to bfd_mach_o_scan_read_section. (bfd_mach_o_scan_read_command): Decode UUID command. (bfd_mach_o_flatten_sections): Add comments. Fix flavour names. (bfd_mach_o_scan): Set flags according to file type. (mach_o_fat_archentry): Remove abfd field. (bfd_mach_o_archive_p): Remove initialization of abfd field. (bfd_mach_o_openr_next_archived_file): Find previous archive by position and not by bfd (as former bfds may have been freed). Give architecture name to archived file. * mach-o-target.c (TARGET_NAME): Use generic archive for non fat targets.
2008-11-06 14:03:43 +01:00
_bfd_generic_mkarchive,
2002-11-06 14:26:29 +01:00
bfd_mach_o_mkobject,
},
{ /* bfd_write_contents. */
bfd_false,
bfd_mach_o_write_contents,
2008-11-06 Tristan Gingold <gingold@adacore.com> * mach-o.h (BFD_MACH_O_NO_SECT): Add; reorders the macros. (BFD_MACH_O_SYM_NTYPE, BFD_MACH_O_SYM_NSECT, BFD_MACH_O_SYM_NDESC): New macros. (bfd_mach_o_i386_thread_flavour): Define according to the latest definition from system header. (bfd_mach_o_load_command_type): Add BFD_MACH_O_LC_RPATH, BFD_MACH_O_LC_CODE_SIGNATURE. (BFD_MACH_O_SECTION_TYPE_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_SYS, BFD_MACH_O_SECTION_ATTRIBUTES_USR, BFD_MACH_O_S_ATTR_LOC_RELOC, BFD_MACH_O_S_ATTR_EXT_RELOC, BFD_MACH_O_S_ATTR_SOME_INSTRUCTIONS, BFD_MACH_O_S_ATTR_DEBUG, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): Add. (bfd_mach_o_segment_command): Add room for a nul terminator in segname field. (BFD_MACH_O_PROT_READ, BFD_MACH_O_PROT_WRITE, BFD_MACH_O_PROT_EXECUTE): Add. (INDIRECT_SYMBOL_LOCAL): Renames to BFD_MACH_O_INDIRECT_SYMBOL_LOCAL. (INDIRECT_SYMBOL_ABS): Renames to BFD_MACH_O_INDIRECT_SYMBOL_ABS. (bfd_mach_o_uuid_command): Add the structure. (bfd_mach_o_load_command): Add uuid field. (bfd_get_mach_o_data): New macro. * mach-o.c (bfd_mach_o_bfd_print_private_bfd_data): New function which replaces the macro. (SECTION_TYPE, SECTION_ATTRIBUTES, SECTION_ATTRIBUTES_USR, S_ATTR_PURE_INSTRUCTIONS, SECTION_ATTRIBUTES_SYS, S_ATTR_SOME_INSTRUCTIONS, S_ATTR_EXT_RELOC, S_ATTR_LOC_RELOC): Renamed and moved to mach-o.h. (N_STAB, N_TYPE, N_EXT, N_UNDF, N_ABS, N_TEXT, N_DATA, N_BSS, N_SECT, N_INDR): Removed as they duplicated macros in mach-o.h. (bfd_mach_o_print_symbol): Print much more details. (bfd_mach_o_make_bfd_section): Add prot argument, use canonical dwarf name for dwarf sections. Precisely set section flags. (bfd_mach_o_scan_read_section_32): Add prot argument. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Set section for debugging stabs, set BSF_GLOBAL and LOCAL flags correctly. Fix section for N_SECT symbols. (bfd_mach_o_i386_flavour_string): Reindent and adjust for new names. (bfd_mach_o_scan_read_symtab): Set HAS_SYMS flags on bfd if there are symbols. (bfd_mach_o_scan_read_uuid): New function. (bfd_mach_o_scan_read_segment): Add a trailing nul. Segments flags are now simply HAS_CONTENTS. Pass protection to bfd_mach_o_scan_read_section. (bfd_mach_o_scan_read_command): Decode UUID command. (bfd_mach_o_flatten_sections): Add comments. Fix flavour names. (bfd_mach_o_scan): Set flags according to file type. (mach_o_fat_archentry): Remove abfd field. (bfd_mach_o_archive_p): Remove initialization of abfd field. (bfd_mach_o_openr_next_archived_file): Find previous archive by position and not by bfd (as former bfds may have been freed). Give architecture name to archived file. * mach-o-target.c (TARGET_NAME): Use generic archive for non fat targets.
2008-11-06 14:03:43 +01:00
_bfd_write_archive_contents,
2002-11-06 14:26:29 +01:00
bfd_mach_o_write_contents,
},
BFD_JUMP_TABLE_GENERIC (bfd_mach_o),
BFD_JUMP_TABLE_COPY (bfd_mach_o),
BFD_JUMP_TABLE_CORE (bfd_mach_o),
2008-11-06 Tristan Gingold <gingold@adacore.com> * mach-o.h (BFD_MACH_O_NO_SECT): Add; reorders the macros. (BFD_MACH_O_SYM_NTYPE, BFD_MACH_O_SYM_NSECT, BFD_MACH_O_SYM_NDESC): New macros. (bfd_mach_o_i386_thread_flavour): Define according to the latest definition from system header. (bfd_mach_o_load_command_type): Add BFD_MACH_O_LC_RPATH, BFD_MACH_O_LC_CODE_SIGNATURE. (BFD_MACH_O_SECTION_TYPE_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_SYS, BFD_MACH_O_SECTION_ATTRIBUTES_USR, BFD_MACH_O_S_ATTR_LOC_RELOC, BFD_MACH_O_S_ATTR_EXT_RELOC, BFD_MACH_O_S_ATTR_SOME_INSTRUCTIONS, BFD_MACH_O_S_ATTR_DEBUG, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): Add. (bfd_mach_o_segment_command): Add room for a nul terminator in segname field. (BFD_MACH_O_PROT_READ, BFD_MACH_O_PROT_WRITE, BFD_MACH_O_PROT_EXECUTE): Add. (INDIRECT_SYMBOL_LOCAL): Renames to BFD_MACH_O_INDIRECT_SYMBOL_LOCAL. (INDIRECT_SYMBOL_ABS): Renames to BFD_MACH_O_INDIRECT_SYMBOL_ABS. (bfd_mach_o_uuid_command): Add the structure. (bfd_mach_o_load_command): Add uuid field. (bfd_get_mach_o_data): New macro. * mach-o.c (bfd_mach_o_bfd_print_private_bfd_data): New function which replaces the macro. (SECTION_TYPE, SECTION_ATTRIBUTES, SECTION_ATTRIBUTES_USR, S_ATTR_PURE_INSTRUCTIONS, SECTION_ATTRIBUTES_SYS, S_ATTR_SOME_INSTRUCTIONS, S_ATTR_EXT_RELOC, S_ATTR_LOC_RELOC): Renamed and moved to mach-o.h. (N_STAB, N_TYPE, N_EXT, N_UNDF, N_ABS, N_TEXT, N_DATA, N_BSS, N_SECT, N_INDR): Removed as they duplicated macros in mach-o.h. (bfd_mach_o_print_symbol): Print much more details. (bfd_mach_o_make_bfd_section): Add prot argument, use canonical dwarf name for dwarf sections. Precisely set section flags. (bfd_mach_o_scan_read_section_32): Add prot argument. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Set section for debugging stabs, set BSF_GLOBAL and LOCAL flags correctly. Fix section for N_SECT symbols. (bfd_mach_o_i386_flavour_string): Reindent and adjust for new names. (bfd_mach_o_scan_read_symtab): Set HAS_SYMS flags on bfd if there are symbols. (bfd_mach_o_scan_read_uuid): New function. (bfd_mach_o_scan_read_segment): Add a trailing nul. Segments flags are now simply HAS_CONTENTS. Pass protection to bfd_mach_o_scan_read_section. (bfd_mach_o_scan_read_command): Decode UUID command. (bfd_mach_o_flatten_sections): Add comments. Fix flavour names. (bfd_mach_o_scan): Set flags according to file type. (mach_o_fat_archentry): Remove abfd field. (bfd_mach_o_archive_p): Remove initialization of abfd field. (bfd_mach_o_openr_next_archived_file): Find previous archive by position and not by bfd (as former bfds may have been freed). Give architecture name to archived file. * mach-o-target.c (TARGET_NAME): Use generic archive for non fat targets.
2008-11-06 14:03:43 +01:00
#if TARGET_ARCHIVE
2002-11-06 14:26:29 +01:00
BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o),
2008-11-06 Tristan Gingold <gingold@adacore.com> * mach-o.h (BFD_MACH_O_NO_SECT): Add; reorders the macros. (BFD_MACH_O_SYM_NTYPE, BFD_MACH_O_SYM_NSECT, BFD_MACH_O_SYM_NDESC): New macros. (bfd_mach_o_i386_thread_flavour): Define according to the latest definition from system header. (bfd_mach_o_load_command_type): Add BFD_MACH_O_LC_RPATH, BFD_MACH_O_LC_CODE_SIGNATURE. (BFD_MACH_O_SECTION_TYPE_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_SYS, BFD_MACH_O_SECTION_ATTRIBUTES_USR, BFD_MACH_O_S_ATTR_LOC_RELOC, BFD_MACH_O_S_ATTR_EXT_RELOC, BFD_MACH_O_S_ATTR_SOME_INSTRUCTIONS, BFD_MACH_O_S_ATTR_DEBUG, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): Add. (bfd_mach_o_segment_command): Add room for a nul terminator in segname field. (BFD_MACH_O_PROT_READ, BFD_MACH_O_PROT_WRITE, BFD_MACH_O_PROT_EXECUTE): Add. (INDIRECT_SYMBOL_LOCAL): Renames to BFD_MACH_O_INDIRECT_SYMBOL_LOCAL. (INDIRECT_SYMBOL_ABS): Renames to BFD_MACH_O_INDIRECT_SYMBOL_ABS. (bfd_mach_o_uuid_command): Add the structure. (bfd_mach_o_load_command): Add uuid field. (bfd_get_mach_o_data): New macro. * mach-o.c (bfd_mach_o_bfd_print_private_bfd_data): New function which replaces the macro. (SECTION_TYPE, SECTION_ATTRIBUTES, SECTION_ATTRIBUTES_USR, S_ATTR_PURE_INSTRUCTIONS, SECTION_ATTRIBUTES_SYS, S_ATTR_SOME_INSTRUCTIONS, S_ATTR_EXT_RELOC, S_ATTR_LOC_RELOC): Renamed and moved to mach-o.h. (N_STAB, N_TYPE, N_EXT, N_UNDF, N_ABS, N_TEXT, N_DATA, N_BSS, N_SECT, N_INDR): Removed as they duplicated macros in mach-o.h. (bfd_mach_o_print_symbol): Print much more details. (bfd_mach_o_make_bfd_section): Add prot argument, use canonical dwarf name for dwarf sections. Precisely set section flags. (bfd_mach_o_scan_read_section_32): Add prot argument. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Set section for debugging stabs, set BSF_GLOBAL and LOCAL flags correctly. Fix section for N_SECT symbols. (bfd_mach_o_i386_flavour_string): Reindent and adjust for new names. (bfd_mach_o_scan_read_symtab): Set HAS_SYMS flags on bfd if there are symbols. (bfd_mach_o_scan_read_uuid): New function. (bfd_mach_o_scan_read_segment): Add a trailing nul. Segments flags are now simply HAS_CONTENTS. Pass protection to bfd_mach_o_scan_read_section. (bfd_mach_o_scan_read_command): Decode UUID command. (bfd_mach_o_flatten_sections): Add comments. Fix flavour names. (bfd_mach_o_scan): Set flags according to file type. (mach_o_fat_archentry): Remove abfd field. (bfd_mach_o_archive_p): Remove initialization of abfd field. (bfd_mach_o_openr_next_archived_file): Find previous archive by position and not by bfd (as former bfds may have been freed). Give architecture name to archived file. * mach-o-target.c (TARGET_NAME): Use generic archive for non fat targets.
2008-11-06 14:03:43 +01:00
#else
2010-01-26 Tristan Gingold <gingold@adacore.com> * targets.c (BFD_JUMP_TABLE_ARCHIVE): Add initializer for write_ar_hdr. (bfd_target): Add _bfd_write_ar_hdr_fn field. * archive.c (is_bsd44_extended_name): New macro. (_bfd_generic_read_ar_hdr_mag): Use it. Add extra_size. (bfd_slurp_armap): Also check for "__.SYMDEF" as a BSD4.4 extended name. (_bfd_archive_bsd44_construct_extended_name_table): New function. (_bfd_generic_write_ar_hdr): Ditto. (_bfd_bsd44_write_ar_hdr): Ditto. (_bfd_write_archive_contents): Call _bfd_write_ar_hdr. (bsd_write_armap): Adjust firstreal computation. * libbfd-in.h (struct areltdata): Add extra_size field. (_bfd_generic_write_ar_hdr): Add prototype. (_bfd_bsd44_write_ar_hdr): Ditto. (_bfd_write_ar_hdr): Define. (_bfd_noarchive_write_ar_hdr): Ditto. (_bfd_archive_bsd_write_ar_hdr): Ditto. (_bfd_archive_coff_write_ar_hdr): Ditto. (_bfd_archive_bsd44_slurp_armap): Ditto. (_bfd_archive_bsd44_slurp_extended_name_table): Ditto. (_bfd_archive_bsd44_construct_extended_name_table): New prototype. (_bfd_archive_bsd44_truncate_arname): Ditto. (_bfd_archive_bsd44_write_armap): Ditto. (_bfd_archive_bsd44_read_ar_hdr): Ditto. (_bfd_archive_bsd44_write_ar_hdr): Ditto. (_bfd_archive_bsd44_openr_next_archived_file): Ditto. (_bfd_archive_bsd44_get_elt_at_index): Ditto. (_bfd_archive_bsd44_generic_stat_arch_elt): Ditto. (_bfd_archive_bsd44_update_armap_timestamp): Ditto. * libbfd.h: Regenerate. * oasys.c (oasys_write_ar_hdr): Define. * libecoff.h (_bfd_ecoff_write_ar_hdr): Define. * ieee.c (ieee_write_ar_hdr): Define. * elf64-mips.c (bfd_elf64_archive_write_ar_hdr): Define. * coff-rs6000.c (rs6000coff_vec): Adjust for write_ar_hdr field. (bfd_pmac_xcoff_backend_data): Ditto. * coff64-rs6000.c (rs6000coff64_vec): Ditto. (bfd_xcoff_aix5_backend_data): Ditto. * coff-alpha.c (alpha_ecoff_write_ar_hdr): Define. * aout-target.h (MY_write_ar_hdr): Define it if not defined. * aout-tic30.c (MY_write_ar_hdr): Ditto. * mach-o-target.c (TARGET_NAME): Use _bfd_archive_bsd44 archive. (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr) (bfd_mach_o_slurp_armap, bfd_mach_o_slurp_extended_name_table) (bfd_mach_o_construct_extended_name_table) (bfd_mach_o_truncate_arname, bfd_mach_o_write_armap) (bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt) (bfd_mach_o_update_armap_timestamp): Moved to mach-o.c * mach-o.c (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr) (bfd_mach_o_slurp_armap, bfd_mach_o_slurp_extended_name_table) (bfd_mach_o_construct_extended_name_table) (bfd_mach_o_truncate_arname, bfd_mach_o_write_armap) (bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt) (bfd_mach_o_update_armap_timestamp): Moved from mach-o-target.c * bfd-in2.h: Regenerate.
2010-01-26 14:42:26 +01:00
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44),
2008-11-06 Tristan Gingold <gingold@adacore.com> * mach-o.h (BFD_MACH_O_NO_SECT): Add; reorders the macros. (BFD_MACH_O_SYM_NTYPE, BFD_MACH_O_SYM_NSECT, BFD_MACH_O_SYM_NDESC): New macros. (bfd_mach_o_i386_thread_flavour): Define according to the latest definition from system header. (bfd_mach_o_load_command_type): Add BFD_MACH_O_LC_RPATH, BFD_MACH_O_LC_CODE_SIGNATURE. (BFD_MACH_O_SECTION_TYPE_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_MASK, BFD_MACH_O_SECTION_ATTRIBUTES_SYS, BFD_MACH_O_SECTION_ATTRIBUTES_USR, BFD_MACH_O_S_ATTR_LOC_RELOC, BFD_MACH_O_S_ATTR_EXT_RELOC, BFD_MACH_O_S_ATTR_SOME_INSTRUCTIONS, BFD_MACH_O_S_ATTR_DEBUG, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): Add. (bfd_mach_o_segment_command): Add room for a nul terminator in segname field. (BFD_MACH_O_PROT_READ, BFD_MACH_O_PROT_WRITE, BFD_MACH_O_PROT_EXECUTE): Add. (INDIRECT_SYMBOL_LOCAL): Renames to BFD_MACH_O_INDIRECT_SYMBOL_LOCAL. (INDIRECT_SYMBOL_ABS): Renames to BFD_MACH_O_INDIRECT_SYMBOL_ABS. (bfd_mach_o_uuid_command): Add the structure. (bfd_mach_o_load_command): Add uuid field. (bfd_get_mach_o_data): New macro. * mach-o.c (bfd_mach_o_bfd_print_private_bfd_data): New function which replaces the macro. (SECTION_TYPE, SECTION_ATTRIBUTES, SECTION_ATTRIBUTES_USR, S_ATTR_PURE_INSTRUCTIONS, SECTION_ATTRIBUTES_SYS, S_ATTR_SOME_INSTRUCTIONS, S_ATTR_EXT_RELOC, S_ATTR_LOC_RELOC): Renamed and moved to mach-o.h. (N_STAB, N_TYPE, N_EXT, N_UNDF, N_ABS, N_TEXT, N_DATA, N_BSS, N_SECT, N_INDR): Removed as they duplicated macros in mach-o.h. (bfd_mach_o_print_symbol): Print much more details. (bfd_mach_o_make_bfd_section): Add prot argument, use canonical dwarf name for dwarf sections. Precisely set section flags. (bfd_mach_o_scan_read_section_32): Add prot argument. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Set section for debugging stabs, set BSF_GLOBAL and LOCAL flags correctly. Fix section for N_SECT symbols. (bfd_mach_o_i386_flavour_string): Reindent and adjust for new names. (bfd_mach_o_scan_read_symtab): Set HAS_SYMS flags on bfd if there are symbols. (bfd_mach_o_scan_read_uuid): New function. (bfd_mach_o_scan_read_segment): Add a trailing nul. Segments flags are now simply HAS_CONTENTS. Pass protection to bfd_mach_o_scan_read_section. (bfd_mach_o_scan_read_command): Decode UUID command. (bfd_mach_o_flatten_sections): Add comments. Fix flavour names. (bfd_mach_o_scan): Set flags according to file type. (mach_o_fat_archentry): Remove abfd field. (bfd_mach_o_archive_p): Remove initialization of abfd field. (bfd_mach_o_openr_next_archived_file): Find previous archive by position and not by bfd (as former bfds may have been freed). Give architecture name to archived file. * mach-o-target.c (TARGET_NAME): Use generic archive for non fat targets.
2008-11-06 14:03:43 +01:00
#endif
2002-11-06 14:26:29 +01:00
BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o),
2009-06-12 Tristan Gingold <gingold@adacore.com> * reloc.c: Add BFD_RELOC_MACH_O_SECTDIFF and BFD_RELOC_MACH_O_PAIR. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * mach-o.c (FILE_ALIGN): New macro. (bfd_mach_o_canonicalize_symtab): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_scan_write_thread): Adjust type of variable offset. (bfd_mach_o_get_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_scan_write_relocs): Ditto. (bfd_mach_o_scan_write_section_32): Remove offset argument. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment_32): Write relocs. Fix size of data written for load command. Do not compute section file offset. (bfd_mach_o_scan_write_segment_64): Ditto. (bfd_mach_o_scan_write_symtab): Compute file offset first. Adjust for bfd_mach_o_asymbol. Move code to convert from BFD to Mach-O to ... (bfd_mach_o_mangle_symbols): ... this new function. (bfd_mach_o_write_contents): Be sure to habe load commands built. Call bfd_mach_o_mangle_symbols. (bfd_mach_o_build_commands): Adjust for filelen field. Use FILE_ALIGN macro. Clear section file offset if section is empty. Do not set symtab file offset anymore here. (bfd_mach_o_make_empty_symbol): Allocate a bfd_mach_o_asymbol. (bfd_mach_o_make_bfd_section): Set SEC_RELOC if has reloc. Set reloc_count and rel_filepos section fields. (bfd_mach_o_scan_read_section_32): Type of argument offset is now unsigned int. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Typr of argument s is now bfd_mach_o_asymbol. Use unsigned int for file offset type. (bfd_mach_o_scan_read_symtab_symbol): Adjust for bfd_mach_o_asymbol. Handle weak-ref symbols. (bfd_mach_o_scan_read_symtab_symbols): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_scan): Remove assignment to removed field. (bfd_mach_o_mkobject_init): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Adjust printf formatter. (bfd_mach_o_bfd_reloc_type_lookup): New macro. (bfd_mach_o_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in): Ditto. (bfd_mach_o_swap_reloc_out): Ditto. * mach-o.h (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCE_FLAG_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCED_DYNAMICALLY, BFD_MACH_O_N_DESC_DISCARDED) (BFD_MACH_O_N_NO_DEAD_STRIP, BFD_MACH_O_N_WEAK_REF) (BFD_MACH_O_N_WEAK_DEF): New macros. Add comments. (bfd_mach_o_section_type): Add new enumeration values. (BFD_MACH_O_S_SELF_MODIFYING_CODE) (BFD_MACH_O_S_ATTR_LIVE_SUPPORT) (BFD_MACH_O_S_ATTR_NO_DEAD_STRIP) (BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS, BFD_MACH_O_S_ATTR_NO_TOC): New macros. (BFD_MACH_O_GENERIC_RELOC_VANILLA) (BFD_MACH_O_GENERIC_RELOC_PAIR) (BFD_MACH_O_GENERIC_RELOC_SECTDIFF) (BFD_MACH_O_GENERIC_RELOC_PB_LA_PTR) (BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF): Ditto. (BFD_MACH_O_RELENT_SIZE): Ditto. (BFD_MACH_O_R_PCREL, BFD_MACH_O_GET_R_LENGTH) (BFD_MACH_O_R_EXTERN, BFD_MACH_O_GET_R_TYPE) (BFD_MACH_O_GET_R_SYMBOLNUM, BFD_MACH_O_SET_R_LENGTH) (BFD_MACH_O_SET_R_TYPE, BFD_MACH_O_SET_R_SYMBOLNUM): Ditto. (BFD_MACH_O_SR_SCATTERED, BFD_MACH_O_SR_PCREL) (BFD_MACH_O_GET_SR_LENGTH, BFD_MACH_O_GET_SR_TYPE) (BFD_MACH_O_GET_SR_ADDRESS, BFD_MACH_O_SET_SR_LENGTH) (BFD_MACH_O_SET_SR_TYPE, BFD_MACH_O_SET_SR_ADDRESS): Ditto. (bfd_mach_o_reloc_info): New struct. (bfd_mach_o_asymbol): New struct. (bfd_mach_o_symtab_command): The symbols field is now of type bfd_mach_o_asymbol. (bfd_mach_o_load_command): The offset and len fields are now of type unsigned int. (mach_o_data_struct): Remove symbols, nsymbols and ibfd fields. Add a filelen field. Add comments. (bfd_mach_o_backend_data): New struct. (bfd_mach_o_get_backend_data): New macro. (bfd_mach_o_scan_read_symtab_symbol): Parameter symbol now of type bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_get_reloc_upper_bound): New prototype. (bfd_mach_o_canonicalize_reloc): Ditto. * mach-o-target.c (bfd_mach_o_bfd_is_local_label_name): Remove duplicated macro. Now defined to _bfd_generic_is_local_label. (TARGET_NAME_BACKEND): New macro... (TARGET_NAME_BACKEND): ... used to name a new variable. (TARGET_NAME): Define relocs table using bfd_mach_o, reference Mach-O backend data. * mach-o-i386.c (i386_howto_table): New variable. (bfd_mach_o_i386_swap_reloc_in): New function. (bfd_mach_o_i386_swap_reloc_out): Ditto. (bfd_mach_o_i386_bfd_reloc_type_lookup): Ditto. (bfd_mach_o_i386_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in, bfd_mach_o_swap_reloc_out): New macros. (bfd_mach_o_bfd_reloc_type_lookup) (bfd_mach_o_bfd_reloc_name_lookup): Ditto.
2009-06-12 11:15:46 +02:00
BFD_JUMP_TABLE_RELOCS (bfd_mach_o),
2002-11-06 14:26:29 +01:00
BFD_JUMP_TABLE_WRITE (bfd_mach_o),
BFD_JUMP_TABLE_LINK (bfd_mach_o),
2009-06-25 Tristan Gingold <gingold@adacore.com> * mach-o-target.c (bfd_mach_o_get_dynamic_symtab_upper_bound) (bfd_mach_o_canonicalize_dynamic_symtab) (bfd_mach_o_get_synthetic_symtab): Defines. (TARGET_NAME_BACKEND): Add bfd_mach_o_print_thread entry. (TARGET_NAME): Use Mach-O specific functions for dynamic. * mach-o-i386.c (bfd_mach_o_i386_swap_reloc_in): Fix howto indexes for scattered relocations. (bfd_mach_o_i386_print_thread): New function. (bfd_mach_o_print_thread): Define. * mach-o.c (text_section_names_xlat): Add an entry for __const. (bfd_mach_o_canonicalize_one_reloc, bfd_mach_o_canonicalize_relocs): New functions extracted from ... (bfd_mach_o_canonicalize_reloc): ... This. Simplified. (bfd_mach_o_get_dynamic_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_dynamic_reloc): New function. (bfd_mach_o_i386_flavour_string): Adjusted after enum renaming. (bfd_mach_o_ppc_flavour_string): Reindentation. Add 64 bits cases. (bfd_mach_o_scan_read_dylinker): Do not create a section anymore. Set name_str field. (bfd_mach_o_scan_read_dylib): Ditto. (bfd_mach_o_scan_read_thread): Set mdata at declaration. Add comments, reindent. (bfd_mach_o_scan_read_dysymtab): Set mdata at declaration. Correctly decode isym and flags on little endian targets. Set dysymtab field. (bfd_mach_o_scan_start_address): Adjust for enum names. (bfd_mach_o_lookup_section): Do not look for segments anymore. (bfd_mach_o_print_section): Display bfd section name. (bfd_mach_o_print_segment): Display none if no name. (bfd_mach_o_print_dysymtab): Display next index for local, external and undefined symbols. (bfd_mach_o_bfd_print_private_bfd_data): Adjust code by using name_str. Display dylinker name. Display thread and unixthread commands content. (bfd_mach_o_print_thread): New macro. * mach-o.h (bfd_mach_o_mach_header_magic): Align numbers. (bfd_mach_o_ppc_thread_flavour): Ditto. (bfd_mach_o_i386_thread_flavour): Ditto. (BFD_MACH_O_PPC_THREAD_STATE_NONE): New enum. (BFD_MACH_O_x86_THREAD_STATE_NONE): Replaces BFD_MACH_O_THREAD_STATE_NONE. (bfd_mach_o_segment_command): Remove segment field. (bfd_mach_o_thread_flavour): Field offset is now unsigned long. (bfd_mach_o_dylinker_command): Remove section field, add name_str. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Remove section field. (mach_o_data_struct): Add dysymtab field. (bfd_mach_o_backend_data): Add _bfd_mach_o_print_thread field. (bfd_mach_o_get_reloc_upper_bound, bfd_mach_o_canonicalize_reloc) (bfd_mach_o_build_commands): Remove parameter names and attributes. (bfd_mach_o_get_dynamic_reloc_upper_bound) (bfd_mach_o_canonicalize_dynamic_reloc): New prototypes.
2009-06-25 14:39:06 +02:00
BFD_JUMP_TABLE_DYNAMIC (bfd_mach_o),
2002-11-06 14:26:29 +01:00
2009-06-12 Tristan Gingold <gingold@adacore.com> * reloc.c: Add BFD_RELOC_MACH_O_SECTDIFF and BFD_RELOC_MACH_O_PAIR. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * mach-o.c (FILE_ALIGN): New macro. (bfd_mach_o_canonicalize_symtab): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_scan_write_thread): Adjust type of variable offset. (bfd_mach_o_get_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_scan_write_relocs): Ditto. (bfd_mach_o_scan_write_section_32): Remove offset argument. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment_32): Write relocs. Fix size of data written for load command. Do not compute section file offset. (bfd_mach_o_scan_write_segment_64): Ditto. (bfd_mach_o_scan_write_symtab): Compute file offset first. Adjust for bfd_mach_o_asymbol. Move code to convert from BFD to Mach-O to ... (bfd_mach_o_mangle_symbols): ... this new function. (bfd_mach_o_write_contents): Be sure to habe load commands built. Call bfd_mach_o_mangle_symbols. (bfd_mach_o_build_commands): Adjust for filelen field. Use FILE_ALIGN macro. Clear section file offset if section is empty. Do not set symtab file offset anymore here. (bfd_mach_o_make_empty_symbol): Allocate a bfd_mach_o_asymbol. (bfd_mach_o_make_bfd_section): Set SEC_RELOC if has reloc. Set reloc_count and rel_filepos section fields. (bfd_mach_o_scan_read_section_32): Type of argument offset is now unsigned int. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Typr of argument s is now bfd_mach_o_asymbol. Use unsigned int for file offset type. (bfd_mach_o_scan_read_symtab_symbol): Adjust for bfd_mach_o_asymbol. Handle weak-ref symbols. (bfd_mach_o_scan_read_symtab_symbols): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_scan): Remove assignment to removed field. (bfd_mach_o_mkobject_init): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Adjust printf formatter. (bfd_mach_o_bfd_reloc_type_lookup): New macro. (bfd_mach_o_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in): Ditto. (bfd_mach_o_swap_reloc_out): Ditto. * mach-o.h (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCE_FLAG_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCED_DYNAMICALLY, BFD_MACH_O_N_DESC_DISCARDED) (BFD_MACH_O_N_NO_DEAD_STRIP, BFD_MACH_O_N_WEAK_REF) (BFD_MACH_O_N_WEAK_DEF): New macros. Add comments. (bfd_mach_o_section_type): Add new enumeration values. (BFD_MACH_O_S_SELF_MODIFYING_CODE) (BFD_MACH_O_S_ATTR_LIVE_SUPPORT) (BFD_MACH_O_S_ATTR_NO_DEAD_STRIP) (BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS, BFD_MACH_O_S_ATTR_NO_TOC): New macros. (BFD_MACH_O_GENERIC_RELOC_VANILLA) (BFD_MACH_O_GENERIC_RELOC_PAIR) (BFD_MACH_O_GENERIC_RELOC_SECTDIFF) (BFD_MACH_O_GENERIC_RELOC_PB_LA_PTR) (BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF): Ditto. (BFD_MACH_O_RELENT_SIZE): Ditto. (BFD_MACH_O_R_PCREL, BFD_MACH_O_GET_R_LENGTH) (BFD_MACH_O_R_EXTERN, BFD_MACH_O_GET_R_TYPE) (BFD_MACH_O_GET_R_SYMBOLNUM, BFD_MACH_O_SET_R_LENGTH) (BFD_MACH_O_SET_R_TYPE, BFD_MACH_O_SET_R_SYMBOLNUM): Ditto. (BFD_MACH_O_SR_SCATTERED, BFD_MACH_O_SR_PCREL) (BFD_MACH_O_GET_SR_LENGTH, BFD_MACH_O_GET_SR_TYPE) (BFD_MACH_O_GET_SR_ADDRESS, BFD_MACH_O_SET_SR_LENGTH) (BFD_MACH_O_SET_SR_TYPE, BFD_MACH_O_SET_SR_ADDRESS): Ditto. (bfd_mach_o_reloc_info): New struct. (bfd_mach_o_asymbol): New struct. (bfd_mach_o_symtab_command): The symbols field is now of type bfd_mach_o_asymbol. (bfd_mach_o_load_command): The offset and len fields are now of type unsigned int. (mach_o_data_struct): Remove symbols, nsymbols and ibfd fields. Add a filelen field. Add comments. (bfd_mach_o_backend_data): New struct. (bfd_mach_o_get_backend_data): New macro. (bfd_mach_o_scan_read_symtab_symbol): Parameter symbol now of type bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_get_reloc_upper_bound): New prototype. (bfd_mach_o_canonicalize_reloc): Ditto. * mach-o-target.c (bfd_mach_o_bfd_is_local_label_name): Remove duplicated macro. Now defined to _bfd_generic_is_local_label. (TARGET_NAME_BACKEND): New macro... (TARGET_NAME_BACKEND): ... used to name a new variable. (TARGET_NAME): Define relocs table using bfd_mach_o, reference Mach-O backend data. * mach-o-i386.c (i386_howto_table): New variable. (bfd_mach_o_i386_swap_reloc_in): New function. (bfd_mach_o_i386_swap_reloc_out): Ditto. (bfd_mach_o_i386_bfd_reloc_type_lookup): Ditto. (bfd_mach_o_i386_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in, bfd_mach_o_swap_reloc_out): New macros. (bfd_mach_o_bfd_reloc_type_lookup) (bfd_mach_o_bfd_reloc_name_lookup): Ditto.
2009-06-12 11:15:46 +02:00
/* Alternative endian target. */
2002-11-06 14:26:29 +01:00
NULL,
2009-06-12 Tristan Gingold <gingold@adacore.com> * reloc.c: Add BFD_RELOC_MACH_O_SECTDIFF and BFD_RELOC_MACH_O_PAIR. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * mach-o.c (FILE_ALIGN): New macro. (bfd_mach_o_canonicalize_symtab): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_print_symbol): Ditto. (bfd_mach_o_scan_write_thread): Adjust type of variable offset. (bfd_mach_o_get_reloc_upper_bound): New function. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_scan_write_relocs): Ditto. (bfd_mach_o_scan_write_section_32): Remove offset argument. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_segment_32): Write relocs. Fix size of data written for load command. Do not compute section file offset. (bfd_mach_o_scan_write_segment_64): Ditto. (bfd_mach_o_scan_write_symtab): Compute file offset first. Adjust for bfd_mach_o_asymbol. Move code to convert from BFD to Mach-O to ... (bfd_mach_o_mangle_symbols): ... this new function. (bfd_mach_o_write_contents): Be sure to habe load commands built. Call bfd_mach_o_mangle_symbols. (bfd_mach_o_build_commands): Adjust for filelen field. Use FILE_ALIGN macro. Clear section file offset if section is empty. Do not set symtab file offset anymore here. (bfd_mach_o_make_empty_symbol): Allocate a bfd_mach_o_asymbol. (bfd_mach_o_make_bfd_section): Set SEC_RELOC if has reloc. Set reloc_count and rel_filepos section fields. (bfd_mach_o_scan_read_section_32): Type of argument offset is now unsigned int. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_section): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Typr of argument s is now bfd_mach_o_asymbol. Use unsigned int for file offset type. (bfd_mach_o_scan_read_symtab_symbol): Adjust for bfd_mach_o_asymbol. Handle weak-ref symbols. (bfd_mach_o_scan_read_symtab_symbols): Adjust for bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_scan): Remove assignment to removed field. (bfd_mach_o_mkobject_init): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Adjust printf formatter. (bfd_mach_o_bfd_reloc_type_lookup): New macro. (bfd_mach_o_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in): Ditto. (bfd_mach_o_swap_reloc_out): Ditto. * mach-o.h (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCE_FLAG_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_DEFINED) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) (BFD_MACH_O_REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) (BFD_MACH_O_REFERENCED_DYNAMICALLY, BFD_MACH_O_N_DESC_DISCARDED) (BFD_MACH_O_N_NO_DEAD_STRIP, BFD_MACH_O_N_WEAK_REF) (BFD_MACH_O_N_WEAK_DEF): New macros. Add comments. (bfd_mach_o_section_type): Add new enumeration values. (BFD_MACH_O_S_SELF_MODIFYING_CODE) (BFD_MACH_O_S_ATTR_LIVE_SUPPORT) (BFD_MACH_O_S_ATTR_NO_DEAD_STRIP) (BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS, BFD_MACH_O_S_ATTR_NO_TOC): New macros. (BFD_MACH_O_GENERIC_RELOC_VANILLA) (BFD_MACH_O_GENERIC_RELOC_PAIR) (BFD_MACH_O_GENERIC_RELOC_SECTDIFF) (BFD_MACH_O_GENERIC_RELOC_PB_LA_PTR) (BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF): Ditto. (BFD_MACH_O_RELENT_SIZE): Ditto. (BFD_MACH_O_R_PCREL, BFD_MACH_O_GET_R_LENGTH) (BFD_MACH_O_R_EXTERN, BFD_MACH_O_GET_R_TYPE) (BFD_MACH_O_GET_R_SYMBOLNUM, BFD_MACH_O_SET_R_LENGTH) (BFD_MACH_O_SET_R_TYPE, BFD_MACH_O_SET_R_SYMBOLNUM): Ditto. (BFD_MACH_O_SR_SCATTERED, BFD_MACH_O_SR_PCREL) (BFD_MACH_O_GET_SR_LENGTH, BFD_MACH_O_GET_SR_TYPE) (BFD_MACH_O_GET_SR_ADDRESS, BFD_MACH_O_SET_SR_LENGTH) (BFD_MACH_O_SET_SR_TYPE, BFD_MACH_O_SET_SR_ADDRESS): Ditto. (bfd_mach_o_reloc_info): New struct. (bfd_mach_o_asymbol): New struct. (bfd_mach_o_symtab_command): The symbols field is now of type bfd_mach_o_asymbol. (bfd_mach_o_load_command): The offset and len fields are now of type unsigned int. (mach_o_data_struct): Remove symbols, nsymbols and ibfd fields. Add a filelen field. Add comments. (bfd_mach_o_backend_data): New struct. (bfd_mach_o_get_backend_data): New macro. (bfd_mach_o_scan_read_symtab_symbol): Parameter symbol now of type bfd_mach_o_asymbol. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_get_reloc_upper_bound): New prototype. (bfd_mach_o_canonicalize_reloc): Ditto. * mach-o-target.c (bfd_mach_o_bfd_is_local_label_name): Remove duplicated macro. Now defined to _bfd_generic_is_local_label. (TARGET_NAME_BACKEND): New macro... (TARGET_NAME_BACKEND): ... used to name a new variable. (TARGET_NAME): Define relocs table using bfd_mach_o, reference Mach-O backend data. * mach-o-i386.c (i386_howto_table): New variable. (bfd_mach_o_i386_swap_reloc_in): New function. (bfd_mach_o_i386_swap_reloc_out): Ditto. (bfd_mach_o_i386_bfd_reloc_type_lookup): Ditto. (bfd_mach_o_i386_bfd_reloc_name_lookup): Ditto. (bfd_mach_o_swap_reloc_in, bfd_mach_o_swap_reloc_out): New macros. (bfd_mach_o_bfd_reloc_type_lookup) (bfd_mach_o_bfd_reloc_name_lookup): Ditto.
2009-06-12 11:15:46 +02:00
/* Back-end data. */
&TARGET_NAME_BACKEND
2002-11-06 14:26:29 +01:00
};