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

231 lines
6.8 KiB
C
Raw Normal View History

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
/* Intel i386 Mach-O support for BFD.
Copyright 2009
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
(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. */
#include "sysdep.h"
#include "mach-o.h"
#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
#define bfd_mach_o_object_p bfd_mach_o_i386_object_p
#define bfd_mach_o_core_p bfd_mach_o_i386_core_p
#define bfd_mach_o_mkobject bfd_mach_o_i386_mkobject
static const bfd_target *
bfd_mach_o_i386_object_p (bfd *abfd)
{
return bfd_mach_o_header_p (abfd, 0, BFD_MACH_O_CPU_TYPE_I386);
}
static const bfd_target *
bfd_mach_o_i386_core_p (bfd *abfd)
{
return bfd_mach_o_header_p (abfd,
BFD_MACH_O_MH_CORE, BFD_MACH_O_CPU_TYPE_I386);
}
static bfd_boolean
bfd_mach_o_i386_mkobject (bfd *abfd)
{
bfd_mach_o_data_struct *mdata;
if (!bfd_mach_o_mkobject_init (abfd))
return FALSE;
mdata = abfd->tdata.mach_o_data;
mdata->header.magic = BFD_MACH_O_MH_MAGIC;
mdata->header.cputype = BFD_MACH_O_CPU_TYPE_I386;
mdata->header.cpusubtype = BFD_MACH_O_CPU_SUBTYPE_X86_ALL;
mdata->header.byteorder = BFD_ENDIAN_LITTLE;
mdata->header.version = 1;
return TRUE;
}
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 reloc_howto_type i386_howto_table[]=
{
HOWTO(BFD_RELOC_32, 0, 2, 32, FALSE, 0,
complain_overflow_bitfield,
NULL, "32",
FALSE, 0xffffffff, 0xffffffff, FALSE),
HOWTO(BFD_RELOC_16, 0, 1, 16, FALSE, 0,
complain_overflow_bitfield,
NULL, "16",
FALSE, 0xffff, 0xffff, FALSE),
HOWTO(BFD_RELOC_8, 0, 0, 8, FALSE, 0,
complain_overflow_bitfield,
NULL, "8",
FALSE, 0xff, 0xff, FALSE),
HOWTO(BFD_RELOC_32_PCREL, 0, 2, 32, TRUE, 0,
complain_overflow_bitfield,
NULL, "DISP32",
FALSE, 0xffffffff, 0xffffffff, TRUE),
HOWTO(BFD_RELOC_16_PCREL, 0, 1, 16, TRUE, 0,
complain_overflow_bitfield,
NULL, "DISP16",
FALSE, 0xffff, 0xffff, TRUE),
HOWTO(BFD_RELOC_MACH_O_SECTDIFF, 0, 2, 32, FALSE, 0,
complain_overflow_bitfield,
NULL, "SECTDIFF_32",
FALSE, 0xffffffff, 0xffffffff, FALSE),
HOWTO(BFD_RELOC_MACH_O_PAIR, 0, 2, 32, FALSE, 0,
complain_overflow_bitfield,
NULL, "PAIR_32",
FALSE, 0xffffffff, 0xffffffff, FALSE),
};
static bfd_boolean
bfd_mach_o_i386_swap_reloc_in (arelent *res, bfd_mach_o_reloc_info *reloc)
{
if (reloc->r_scattered)
{
switch (reloc->r_type)
{
case BFD_MACH_O_GENERIC_RELOC_PAIR:
if (reloc->r_length != 2)
return FALSE;
res->howto = &i386_howto_table[3];
res->address = res[-1].address;
return TRUE;
case BFD_MACH_O_GENERIC_RELOC_SECTDIFF:
case BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF:
if (reloc->r_length != 2)
return FALSE;
res->howto = &i386_howto_table[2];
return TRUE;
default:
return FALSE;
}
}
else
{
switch (reloc->r_type)
{
case BFD_MACH_O_GENERIC_RELOC_VANILLA:
switch ((reloc->r_length << 1) | reloc->r_pcrel)
{
case 0: /* len = 0, pcrel = 0 */
res->howto = &i386_howto_table[2];
return TRUE;
case 2: /* len = 1, pcrel = 0 */
res->howto = &i386_howto_table[1];
return TRUE;
case 3: /* len = 1, pcrel = 1 */
res->howto = &i386_howto_table[4];
return TRUE;
case 4: /* len = 2, pcrel = 0 */
res->howto = &i386_howto_table[0];
return TRUE;
case 5: /* len = 2, pcrel = 1 */
res->howto = &i386_howto_table[3];
return TRUE;
default:
return FALSE;
}
break;
default:
return FALSE;
}
}
}
static bfd_boolean
bfd_mach_o_i386_swap_reloc_out (arelent *rel, bfd_mach_o_reloc_info *rinfo)
{
rinfo->r_address = rel->address;
switch (rel->howto->type)
{
case BFD_RELOC_32:
case BFD_RELOC_32_PCREL:
case BFD_RELOC_16:
case BFD_RELOC_16_PCREL:
case BFD_RELOC_8:
rinfo->r_scattered = 0;
rinfo->r_type = BFD_MACH_O_GENERIC_RELOC_VANILLA;
rinfo->r_pcrel = rel->howto->pc_relative;
rinfo->r_length = rel->howto->size; /* Correct in practice. */
if ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM)
{
rinfo->r_extern = 0;
rinfo->r_value = (*rel->sym_ptr_ptr)->section->target_index;
}
else
{
rinfo->r_extern = 1;
rinfo->r_value = (*rel->sym_ptr_ptr)->udata.i;
}
break;
case BFD_RELOC_MACH_O_SECTDIFF:
rinfo->r_scattered = 1;
rinfo->r_type = BFD_MACH_O_GENERIC_RELOC_SECTDIFF;
rinfo->r_pcrel = 0;
rinfo->r_length = 2;
rinfo->r_extern = 0;
rinfo->r_value = (*rel->sym_ptr_ptr)->value
+ (*rel->sym_ptr_ptr)->section->vma;
break;
case BFD_RELOC_MACH_O_PAIR:
rinfo->r_address = 0;
rinfo->r_scattered = 1;
rinfo->r_type = BFD_MACH_O_GENERIC_RELOC_PAIR;
rinfo->r_pcrel = 0;
rinfo->r_length = 2;
rinfo->r_extern = 0;
rinfo->r_value = (*rel->sym_ptr_ptr)->value
+ (*rel->sym_ptr_ptr)->section->vma;
break;
default:
return FALSE;
}
return TRUE;
}
static reloc_howto_type *
bfd_mach_o_i386_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
bfd_reloc_code_real_type code)
{
unsigned int i;
for (i = 0; i < sizeof (i386_howto_table) / sizeof (*i386_howto_table); i++)
if (code == i386_howto_table[i].type)
return &i386_howto_table[i];
return NULL;
}
static reloc_howto_type *
bfd_mach_o_i386_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
const char *name ATTRIBUTE_UNUSED)
{
return NULL;
}
#define bfd_mach_o_swap_reloc_in bfd_mach_o_i386_swap_reloc_in
#define bfd_mach_o_swap_reloc_out bfd_mach_o_i386_swap_reloc_out
#define bfd_mach_o_bfd_reloc_type_lookup bfd_mach_o_i386_bfd_reloc_type_lookup
#define bfd_mach_o_bfd_reloc_name_lookup bfd_mach_o_i386_bfd_reloc_name_lookup
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 TARGET_NAME mach_o_i386_vec
#define TARGET_STRING "mach-o-i386"
#define TARGET_BIG_ENDIAN 0
#define TARGET_ARCHIVE 0
#include "mach-o-target.c"