binutils-gdb/bfd/mach-o.h

769 lines
26 KiB
C
Raw Normal View History

2002-11-06 14:26:29 +01:00
/* Mach-O support for BFD.
Copyright (C) 1999-2018 Free Software Foundation, Inc.
2002-11-06 14:26:29 +01:00
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
#ifndef _BFD_MACH_O_H_
#define _BFD_MACH_O_H_
#include "bfd.h"
#include "mach-o/loader.h"
mach-o cleanup: remove useless calls to bfd_seek. Also support new commands. bfd/ * mach-o.h (struct mach_o_data_struct): Add hdr_offset field. (bfd_mach_o_fat_archive_p): Renames prototype. (bfd_mach_o_fat_openr_next_archived_file): Renames. (bfd_mach_o_header_p): Add argument. * mach-o.c (bfd_mach_o_read_header): Add hdr_off argument and use it. (bfd_mach_o_read_section_32, bfd_mach_o_read_section_64) (bfd_mach_o_read_section): Remove offset argument. (bfd_mach_o_read_dylinker): Remove bfd_seek call. (bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib) (bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints) (bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab) (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid) (bfd_mach_o_read_linkedit, bfd_mach_o_read_str) (bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min) (bfd_mach_o_read_encryption_info): Likewise. (bfd_mach_o_read_encryption_info_64): New function. (bfd_mach_o_read_main, bfd_mach_o_read_source_version) (bfd_mach_o_read_segment): Remove call to bfd_seek. (bfd_mach_o_read_command): Use hdr_offset in bfd_seek. Handle BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT, BFD_MACH_O_LC_ENCRYPTION_INFO_64, BFD_MACH_O_LC_VERSION_MIN_WATCHOS. (bfd_mach_o_header_p): Add hdr_off argument. (bfd_mach_o_gen_object_p, bfd_mach_o_gen_core_p): Adjust calls. (bfd_mach_o_fat_archive_p): Renames. (bfd_mach_o_fat_openr_next_archived_file): Renames. (bfd_mach_o_close_and_cleanup): Remove useless code. (bfd_mach_o_close_and_cleanup): Define. * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p) (bfd_mach_o_x86_64_core_p): Adjust calls. * mach-o-target.c: Move defines for archive from mach-o.c. Remove check on TARGET_ARCHIVE. * mach-o-i386.c (bfd_mach_o_i386_object_p) (bfd_mach_o_i386_core_p): Adjust calls.
2015-11-18 10:33:11 +01:00
#include "mach-o/external.h"
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
#ifdef __cplusplus
extern "C" {
#endif
2002-11-06 14:26:29 +01:00
typedef struct bfd_mach_o_header
{
unsigned long magic;
unsigned long cputype;
unsigned long cpusubtype;
unsigned long filetype;
unsigned long ncmds;
unsigned long sizeofcmds;
unsigned long flags;
2008-09-05 Tristan Gingold <gingold@adacore.com> Add MacOSX 64 bits support. * mach-o.h (bfd_mach_o_ppc_thread_flavour): Add BFD_MACH_O_PPC_THREAD_STATE_64. (bfd_mach_o_i386_thread_flavour): Add BFD_MACH_O_x86_THREAD_STATE64, BFD_MACH_O_x86_FLOAT_STATE64, BFD_MACH_O_x86_EXCEPTION_STATE64, BFD_MACH_O_x86_THREAD_STATE, BFD_MACH_O_x86_FLOAT_STATE, BFD_MACH_O_x86_EXCEPTION_STATE. (bfd_mach_o_load_command_type): Add BFD_MACH_O_LC_SEGMENT_64, BFD_MACH_O_LC_ROUTINES_64, BFD_MACH_O_LC_UUID. (BFD_MACH_O_CPU_IS64BIT): Added. (bfd_mach_o_cpu_type): Add BFD_MACH_O_CPU_TYPE_POWERPC_64, BFD_MACH_O_CPU_TYPE_X86_64. (bfd_mach_o_header): Add version field. (bfd_mach_o_section) Add reserved3 field. (bfd_mach_o_segment_command): Add initprot and maxprot fields. * mach-o.c (N_TEXT, N_DATA, N_BSS): Added. (bfd_mach_o_version): New function. (bfd_mach_o_valid): Handle 64bits cpus. (bfd_mach_o_write_header): handler 64bits headers. (bfd_mach_o_scan_write_section_32, bfd_mach_o_scan_write_section_64): New functions (from bfd_mach_o_scan_write_section) to handle both flavors. (bfd_mach_o_scan_write_segment): Parameter wide added to support both flavors. (bfd_mach_o_write_contents): Support both flavors. (bfd_mach_o_read_header): Ditto. (bfd_mach_o_scan_read_section_32, bfd_mach_o_scan_read_section_64): New functions (from bfd_mach_o_scan_read_section) to support both flavors. (bfd_mach_o_scan_read_symtab_symbol): Support both flavors. (bfd_mach_o_scan_read_symtab): Ditto. (bfd_mach_o_scan_read_segment): Parameter wide added to support both flavors. (bfd_mach_o_scan_read_segment_32, bfd_mach_o_scan_read_segment_64): New functions to call bfd_mach_o_scan_read_segment. (bfd_mach_o_flatten_sections): Support both flavors. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_scan): Ditto. (bfd_mach_o_lookup_section): Ditto.
2008-09-05 10:07:54 +02:00
unsigned int reserved;
/* Version 1: 32 bits, version 2: 64 bits. */
unsigned int version;
2002-11-06 14:26:29 +01:00
enum bfd_endian byteorder;
}
bfd_mach_o_header;
typedef struct bfd_mach_o_asymbol
{
/* The actual symbol which the rest of BFD works with. */
asymbol symbol;
/* Mach-O symbol fields. */
unsigned char n_type;
unsigned char n_sect;
unsigned short n_desc;
}
bfd_mach_o_asymbol;
#define BFD_MACH_O_SEGNAME_SIZE 16
#define BFD_MACH_O_SECTNAME_SIZE 16
2002-11-06 14:26:29 +01:00
typedef struct bfd_mach_o_section
{
/* Fields present in the file. */
char sectname[BFD_MACH_O_SECTNAME_SIZE + 1]; /* Always NUL padded. */
char segname[BFD_MACH_O_SEGNAME_SIZE + 1];
2002-11-06 14:26:29 +01:00
bfd_vma addr;
bfd_vma size;
bfd_vma offset;
unsigned long align;
bfd_vma reloff;
unsigned long nreloc;
unsigned long flags;
unsigned long reserved1;
unsigned long reserved2;
2008-09-05 Tristan Gingold <gingold@adacore.com> Add MacOSX 64 bits support. * mach-o.h (bfd_mach_o_ppc_thread_flavour): Add BFD_MACH_O_PPC_THREAD_STATE_64. (bfd_mach_o_i386_thread_flavour): Add BFD_MACH_O_x86_THREAD_STATE64, BFD_MACH_O_x86_FLOAT_STATE64, BFD_MACH_O_x86_EXCEPTION_STATE64, BFD_MACH_O_x86_THREAD_STATE, BFD_MACH_O_x86_FLOAT_STATE, BFD_MACH_O_x86_EXCEPTION_STATE. (bfd_mach_o_load_command_type): Add BFD_MACH_O_LC_SEGMENT_64, BFD_MACH_O_LC_ROUTINES_64, BFD_MACH_O_LC_UUID. (BFD_MACH_O_CPU_IS64BIT): Added. (bfd_mach_o_cpu_type): Add BFD_MACH_O_CPU_TYPE_POWERPC_64, BFD_MACH_O_CPU_TYPE_X86_64. (bfd_mach_o_header): Add version field. (bfd_mach_o_section) Add reserved3 field. (bfd_mach_o_segment_command): Add initprot and maxprot fields. * mach-o.c (N_TEXT, N_DATA, N_BSS): Added. (bfd_mach_o_version): New function. (bfd_mach_o_valid): Handle 64bits cpus. (bfd_mach_o_write_header): handler 64bits headers. (bfd_mach_o_scan_write_section_32, bfd_mach_o_scan_write_section_64): New functions (from bfd_mach_o_scan_write_section) to handle both flavors. (bfd_mach_o_scan_write_segment): Parameter wide added to support both flavors. (bfd_mach_o_write_contents): Support both flavors. (bfd_mach_o_read_header): Ditto. (bfd_mach_o_scan_read_section_32, bfd_mach_o_scan_read_section_64): New functions (from bfd_mach_o_scan_read_section) to support both flavors. (bfd_mach_o_scan_read_symtab_symbol): Support both flavors. (bfd_mach_o_scan_read_symtab): Ditto. (bfd_mach_o_scan_read_segment): Parameter wide added to support both flavors. (bfd_mach_o_scan_read_segment_32, bfd_mach_o_scan_read_segment_64): New functions to call bfd_mach_o_scan_read_segment. (bfd_mach_o_flatten_sections): Support both flavors. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_scan): Ditto. (bfd_mach_o_lookup_section): Ditto.
2008-09-05 10:07:54 +02:00
unsigned long reserved3;
/* Corresponding bfd section. */
asection *bfdsection;
/* An array holding the indirect symbols for this section.
NULL values indicate local symbols.
The number of symbols is determined from the section size and type. */
bfd_mach_o_asymbol **indirect_syms;
/* Simply linked list. */
struct bfd_mach_o_section *next;
2002-11-06 14:26:29 +01:00
}
bfd_mach_o_section;
typedef struct bfd_mach_o_segment_command
{
bfd/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o-i386.c (text_section_names_xlat): New table. (data_section_names_xlat): Likewise. (import_section_names_xlat): Likewise. (mach_o_i386_segsec_names_xlat): Likewise. (bfd_mach_o_tgt_seg_table): Use new tables. * mach-o-x86-64.c (bfd_mach_o_tgt_seg_table): Set NULL. * mach-o.c (mach_o_section_name_xlat, mach_o_segment_name_xlat): Move to mach-o.h as typedefs. (text_section_names_xlat): Update for current GCC usage. (data_section_names_xlat): Likewise. (dwarf_section_names_xlat): Likewise. (objc_section_names_xlat): New table. (segsec_names_xlat): Add objc table. (bfd_mach_o_normalize_section_name): Replace with... (bfd_mach_o_section_data_for_mach_sect): New. (bfd_mach_o_section_data_for_bfd_name): New. (bfd_mach_o_section_data_for_bfd_name): Update to use additional data. (bfd_mach_o_convert_section_name_to_mach_o): Likewise. (bfd_mach_o_bfd_copy_private_section_data): Implement. (bfd_mach_o_write_symtab): Write a zero-length string as the first entry for compatibility with system tools. (bfd_mach_o_build_commands): Update section alignment info. (bfd_mach_o_new_section_hook): Use translation table data to define default section flags, type, attributes and alignment, when available. (bfd_mach_o_init_section_from_mach_o): Add TODO comment. (bfd_mach_o_section_type_name): Add 'symbol_stubs'. (bfd_mach_o_section_attribute_name): Add 'self_modifying_code'. (bfd_mach_o_get_section_type_from_name): Change "not-found" return value. (bfd_mach_o_tgt_seg_table): Set default NULL. * mach-o.h (bfd_mach_o_segment_command): Use define for name length. (bfd_mach_o_backend_data): Move until after contents are defined. (bfd_mach_o_normalize_section_name): Remove. (bfd_mach_o_convert_section_name_to_bfd): Declare. (mach_o_section_name_xlat): Declare. (mach_o_segment_name_xlat): Declare. (bfd_mach_o_section_data_for_mach_sect): Declare. (bfd_mach_o_section_data_for_bfd_name): Declare. include/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o/loader.h (bfd_mach_o_section_type): define BFD_MACH_O_S_ATTR_NONE to 0. gas/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * config/obj-macho.c: Add some more top-level comments. (collect_16char_name): New. (obj_mach_o_section): Amend to allow syntax compatible with existing system tools. Use section translation data when available. (obj_mach_o_segT_from_bfd_name): New. (known_sections): Update. (obj_mach_o_known_section): Use obj_mach_o_segT_from_bfd_name. (objc_sections): New. (obj_mach_o_objc_section): New. (debug_sections): New. (obj_mach_o_debug_section): New. (tgt_sections): New. (obj_mach_o_opt_tgt_section): New. (obj_mach_o_base_section): New. (obj_mach_o_common_parse): Update to create BSS on demand and to handle lcomm optional alignment param. (obj_mach_o_comm): Update parameter name. (obj_mach_o_placeholder): New. (mach_o_pseudo_table): Update for GCC section directives. * config/obj-macho.h (_OBJ_MACH_O_H): New. (USE_ALIGN_PTWO): Define. (S_SET_ALIGN) Define.
2011-12-14 11:30:09 +01:00
char segname[BFD_MACH_O_SEGNAME_SIZE + 1];
2002-11-06 14:26:29 +01:00
bfd_vma vmaddr;
bfd_vma vmsize;
bfd_vma fileoff;
unsigned long filesize;
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
unsigned long maxprot; /* Maximum permitted protection. */
unsigned long initprot; /* Initial protection. */
2002-11-06 14:26:29 +01:00
unsigned long nsects;
unsigned long flags;
/* Linked list of sections. */
bfd_mach_o_section *sect_head;
bfd_mach_o_section *sect_tail;
2002-11-06 14:26:29 +01:00
}
bfd_mach_o_segment_command;
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
/* Protection flags. */
#define BFD_MACH_O_PROT_READ 0x01
#define BFD_MACH_O_PROT_WRITE 0x02
#define BFD_MACH_O_PROT_EXECUTE 0x04
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
/* Expanded internal representation of a relocation entry. */
typedef struct bfd_mach_o_reloc_info
{
bfd_vma r_address;
bfd_vma r_value;
unsigned int r_scattered : 1;
unsigned int r_type : 4;
unsigned int r_pcrel : 1;
unsigned int r_length : 2;
unsigned int r_extern : 1;
}
bfd_mach_o_reloc_info;
/* The symbol table is sorted like this:
(1) local.
(otherwise in order of generation)
(2) external defined
(sorted by name)
(3) external undefined / common
(sorted by name)
*/
2002-11-06 14:26:29 +01:00
typedef struct bfd_mach_o_symtab_command
{
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
unsigned int symoff;
unsigned int nsyms;
unsigned int stroff;
unsigned int strsize;
bfd_mach_o_asymbol *symbols;
2002-11-06 14:26:29 +01:00
char *strtab;
}
bfd_mach_o_symtab_command;
/* This is the second set of the symbolic information which is used to support
the data structures for the dynamically link editor.
2002-11-06 14:26:29 +01:00
The original set of symbolic information in the symtab_command which contains
the symbol and string tables must also be present when this load command is
present. When this load command is present the symbol table is organized
into three groups of symbols:
local symbols (static and debugging symbols) - grouped by module
defined external symbols - grouped by module (sorted by name if not lib)
undefined external symbols (sorted by name)
In this load command there are offsets and counts to each of the three groups
of symbols.
2002-11-06 14:26:29 +01:00
This load command contains a the offsets and sizes of the following new
symbolic information tables:
table of contents
module table
reference symbol table
indirect symbol table
The first three tables above (the table of contents, module table and
reference symbol table) are only present if the file is a dynamically linked
2002-11-06 14:26:29 +01:00
shared library. For executable and object modules, which are files
containing only one module, the information that would be in these three
tables is determined as follows:
table of contents - the defined external symbols are sorted by name
module table - the file contains only one module so everything in the
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
file is part of the module.
2002-11-06 14:26:29 +01:00
reference symbol table - is the defined and undefined external symbols
For dynamically linked shared library files this load command also contains
2002-11-06 14:26:29 +01:00
offsets and sizes to the pool of relocation entries for all sections
separated into two groups:
external relocation entries
local relocation entries
For executable and object modules the relocation entries continue to hang
off the section structures. */
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
typedef struct bfd_mach_o_dylib_module
{
/* Index into the string table indicating the name of the module. */
unsigned long module_name_idx;
char *module_name;
/* Index into the symbol table of the first defined external symbol provided
by the module. */
unsigned long iextdefsym;
/* Number of external symbols provided by this module. */
unsigned long nextdefsym;
/* Index into the external reference table of the first entry
provided by this module. */
unsigned long irefsym;
/* Number of external reference entries provided by this module. */
unsigned long nrefsym;
/* Index into the symbol table of the first local symbol provided by this
module. */
unsigned long ilocalsym;
/* Number of local symbols provided by this module. */
unsigned long nlocalsym;
/* Index into the external relocation table of the first entry provided
by this module. */
unsigned long iextrel;
/* Number of external relocation entries provided by this module. */
unsigned long nextrel;
/* Index in the module initialization section to the pointers for this
module. */
unsigned short iinit;
/* Index in the module termination section to the pointers for this
module. */
unsigned short iterm;
/* Number of pointers in the module initialization for this module. */
unsigned short ninit;
/* Number of pointers in the module termination for this module. */
unsigned short nterm;
/* Number of data byte for this module that are used in the __module_info
section of the __OBJC segment. */
unsigned long objc_module_info_size;
/* Statically linked address of the start of the data for this module
in the __module_info section of the __OBJC_segment. */
bfd_vma objc_module_info_addr;
}
bfd_mach_o_dylib_module;
typedef struct bfd_mach_o_dylib_table_of_content
{
/* Index into the symbol table to the defined external symbol. */
unsigned long symbol_index;
/* Index into the module table to the module for this entry. */
unsigned long module_index;
}
bfd_mach_o_dylib_table_of_content;
typedef struct bfd_mach_o_dylib_reference
{
/* Index into the symbol table for the symbol being referenced. */
unsigned long isym;
/* Type of the reference being made (use REFERENCE_FLAGS constants). */
unsigned long flags;
}
bfd_mach_o_dylib_reference;
#define BFD_MACH_O_REFERENCE_SIZE 4
2002-11-06 14:26:29 +01:00
typedef struct bfd_mach_o_dysymtab_command
{
/* The symbols indicated by symoff and nsyms of the LC_SYMTAB load command
are grouped into the following three groups:
local symbols (further grouped by the module they are from)
defined external symbols (further grouped by the module they are from)
undefined symbols
2002-11-06 14:26:29 +01:00
The local symbols are used only for debugging. The dynamic binding
process may have to use them to indicate to the debugger the local
symbols for a module that is being bound.
2002-11-06 14:26:29 +01:00
The last two groups are used by the dynamic binding process to do the
binding (indirectly through the module table and the reference symbol
table when this is a dynamically linked shared library file). */
2002-11-06 14:26:29 +01:00
unsigned long ilocalsym; /* Index to local symbols. */
unsigned long nlocalsym; /* Number of local symbols. */
unsigned long iextdefsym; /* Index to externally defined symbols. */
unsigned long nextdefsym; /* Number of externally defined symbols. */
unsigned long iundefsym; /* Index to undefined symbols. */
unsigned long nundefsym; /* Number of undefined symbols. */
/* For the for the dynamic binding process to find which module a symbol
is defined in the table of contents is used (analogous to the ranlib
structure in an archive) which maps defined external symbols to modules
they are defined in. This exists only in a dynamically linked shared
2002-11-06 14:26:29 +01:00
library file. For executable and object modules the defined external
symbols are sorted by name and is use as the table of contents. */
unsigned long tocoff; /* File offset to table of contents. */
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
unsigned long ntoc; /* Number of entries in table of contents. */
2002-11-06 14:26:29 +01:00
/* To support dynamic binding of "modules" (whole object files) the symbol
table must reflect the modules that the file was created from. This is
done by having a module table that has indexes and counts into the merged
tables for each module. The module structure that these two entries
refer to is described below. This exists only in a dynamically linked
2002-11-06 14:26:29 +01:00
shared library file. For executable and object modules the file only
contains one module so everything in the file belongs to the module. */
unsigned long modtaboff; /* File offset to module table. */
unsigned long nmodtab; /* Number of module table entries. */
/* To support dynamic module binding the module structure for each module
indicates the external references (defined and undefined) each module
makes. For each module there is an offset and a count into the
reference symbol table for the symbols that the module references.
This exists only in a dynamically linked shared library file. For
2002-11-06 14:26:29 +01:00
executable and object modules the defined external symbols and the
undefined external symbols indicates the external references. */
unsigned long extrefsymoff; /* Offset to referenced symbol table. */
unsigned long nextrefsyms; /* Number of referenced symbol table entries. */
/* The sections that contain "symbol pointers" and "routine stubs" have
indexes and (implied counts based on the size of the section and fixed
size of the entry) into the "indirect symbol" table for each pointer
and stub. For every section of these two types the index into the
indirect symbol table is stored in the section header in the field
reserved1. An indirect symbol table entry is simply a 32bit index into
the symbol table to the symbol that the pointer or stub is referring to.
The indirect symbol table is ordered to match the entries in the section. */
unsigned long indirectsymoff; /* File offset to the indirect symbol table. */
unsigned long nindirectsyms; /* Number of indirect symbol table entries. */
/* To support relocating an individual module in a library file quickly the
external relocation entries for each module in the library need to be
accessed efficiently. Since the relocation entries can't be accessed
through the section headers for a library file they are separated into
groups of local and external entries further grouped by module. In this
case the presents of this load command who's extreloff, nextrel,
locreloff and nlocrel fields are non-zero indicates that the relocation
entries of non-merged sections are not referenced through the section
structures (and the reloff and nreloc fields in the section headers are
set to zero).
Since the relocation entries are not accessed through the section headers
this requires the r_address field to be something other than a section
offset to identify the item to be relocated. In this case r_address is
set to the offset from the vmaddr of the first LC_SEGMENT command.
The relocation entries are grouped by module and the module table
entries have indexes and counts into them for the group of external
relocation entries for that the module.
For sections that are merged across modules there must not be any
remaining external relocation entries for them (for merged sections
remaining relocation entries must be local). */
unsigned long extreloff; /* Offset to external relocation entries. */
unsigned long nextrel; /* Number of external relocation entries. */
/* All the local relocation entries are grouped together (they are not
grouped by their module since they are only used if the object is moved
from it statically link edited address). */
2002-11-06 14:26:29 +01:00
unsigned long locreloff; /* Offset to local relocation entries. */
unsigned long nlocrel; /* Number of local relocation entries. */
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
bfd_mach_o_dylib_module *dylib_module;
bfd_mach_o_dylib_table_of_content *dylib_toc;
unsigned int *indirect_syms;
bfd_mach_o_dylib_reference *ext_refs;
2002-11-06 14:26:29 +01:00
}
bfd_mach_o_dysymtab_command;
2002-11-06 14:26:29 +01:00
/* An indirect symbol table entry is simply a 32bit index into the symbol table
2002-11-06 14:26:29 +01:00
to the symbol that the pointer or stub is refering to. Unless it is for a
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
non-lazy symbol pointer section for a defined symbol which strip(1) has
2002-11-06 14:26:29 +01:00
removed. In which case it has the value INDIRECT_SYMBOL_LOCAL. If the
symbol was also absolute INDIRECT_SYMBOL_ABS is or'ed with that. */
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
#define BFD_MACH_O_INDIRECT_SYMBOL_LOCAL 0x80000000
#define BFD_MACH_O_INDIRECT_SYMBOL_ABS 0x40000000
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
#define BFD_MACH_O_INDIRECT_SYMBOL_SIZE 4
2002-11-06 14:26:29 +01:00
/* For LC_TWOLEVEL_HINTS. */
typedef struct bfd_mach_o_twolevel_hints_command
{
/* Offset to the hint table. */
unsigned int offset;
/* Number of entries in the table. */
unsigned int nhints;
}
bfd_mach_o_twolevel_hints_command;
/* For LC_PREBIND_CKSUM. */
typedef struct bfd_mach_o_prebind_cksum_command
{
/* Checksum or zero. */
unsigned int cksum;
}
bfd_mach_o_prebind_cksum_command;
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
/* For LC_THREAD or LC_UNIXTHREAD. */
2002-11-06 14:26:29 +01:00
typedef struct bfd_mach_o_thread_flavour
{
unsigned long flavour;
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
unsigned long offset;
2002-11-06 14:26:29 +01:00
unsigned long size;
}
bfd_mach_o_thread_flavour;
typedef struct bfd_mach_o_thread_command
{
unsigned long nflavours;
bfd_mach_o_thread_flavour *flavours;
2002-11-06 14:26:29 +01:00
asection *section;
}
bfd_mach_o_thread_command;
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
/* For LC_LOAD_DYLINKER and LC_ID_DYLINKER. */
2002-11-06 14:26:29 +01:00
typedef struct bfd_mach_o_dylinker_command
{
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
unsigned int name_offset; /* Offset to library's path name. */
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
char *name_str;
2002-11-06 14:26:29 +01:00
}
bfd_mach_o_dylinker_command;
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
/* For LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, LC_ID_DYLIB
or LC_REEXPORT_DYLIB. */
2002-11-06 14:26:29 +01:00
typedef struct bfd_mach_o_dylib_command
{
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
unsigned int name_offset; /* Offset to library's path name. */
2002-11-06 14:26:29 +01:00
unsigned long timestamp; /* Library's build time stamp. */
unsigned long current_version; /* Library's current version number. */
unsigned long compatibility_version; /* Library's compatibility vers number. */
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
char *name_str;
2002-11-06 14:26:29 +01:00
}
bfd_mach_o_dylib_command;
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
/* For LC_PREBOUND_DYLIB. */
2002-11-06 14:26:29 +01:00
typedef struct bfd_mach_o_prebound_dylib_command
{
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
unsigned int name_offset; /* Library's path name. */
unsigned int nmodules; /* Number of modules in library. */
unsigned int linked_modules_offset; /* Bit vector of linked modules. */
char *name_str;
unsigned char *linked_modules;
2002-11-06 14:26:29 +01:00
}
bfd_mach_o_prebound_dylib_command;
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
/* For LC_UUID. */
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
typedef struct bfd_mach_o_uuid_command
{
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
unsigned char uuid[16];
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_mach_o_uuid_command;
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
/* For LC_CODE_SIGNATURE or LC_SEGMENT_SPLIT_INFO. */
typedef struct bfd_mach_o_linkedit_command
{
unsigned long dataoff;
unsigned long datasize;
}
bfd_mach_o_linkedit_command;
typedef struct bfd_mach_o_str_command
{
unsigned long stroff;
unsigned long str_len;
char *str;
}
bfd_mach_o_str_command;
typedef struct bfd_mach_o_fvmlib_command
{
unsigned int name_offset;
char *name_str;
unsigned int minor_version;
unsigned int header_addr;
}
bfd_mach_o_fvmlib_command;
typedef struct bfd_mach_o_dyld_info_command
{
/* File offset and size to rebase info. */
unsigned int rebase_off;
unsigned int rebase_size;
mach-o: layout executables bfd/ * mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content, bind_content, weak_bind_content, lazy_bind_content, export_content. (bfd_mach_o_load_command): Add comments, add next field. (mach_o_data_struct): Replace commands field by first_command and last_command. * mach-o.c (bfd_mach_o_append_command): New function. (bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines. (bfd_mach_o_bfd_copy_private_section_data): Check flavour, copy fields. (bfd_mach_o_bfd_copy_private_header_data): Copy load commands. (bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions. (bfd_mach_o_write_thread): Use macro instead of literal. (bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib) (bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New functions. (bfd_mach_o_write_symtab_content): New function (extracted from bfd_mach_o_write_symtab). (bfd_mach_o_write_symtab): Split. (bfd_mach_o_count_indirect_symbols): Move (bfd_mach_o_build_dysymtab): Remove layout code. (bfd_mach_o_write_contents): Rewritten to build commands in order. (bfd_mach_o_count_sections_for_seg): Remove. (bfd_mach_o_build_obj_seg_command): New function (extracted from bfd_mach_o_build_seg_command). (bfd_mach_o_build_exec_seg_command): New function. (bfd_mach_o_build_dysymtab_command): Remove. (bfd_mach_o_layout_commands): New function. (bfd_mach_o_init_segment): New function. (bfd_mach_o_build_commands): Major rework to handle non-object files. (bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New function. (bfd_mach_o_read_dyld_info): Clear content fields. (bfd_mach_o_read_segment): Adjust call. (bfd_mach_o_flatten_sections): Adjust as now load commands are chained. (bfd_mach_o_scan_start_address, bfd_mach_o_scan) (bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address) (bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment): Likewise. binutils/ * od-macho.c (dump_section_map): Adjust as load commands are now chained. (dump_load_command, dump_section_content): Likewise.
2014-04-03 14:45:31 +02:00
unsigned char *rebase_content;
/* File offset and size of binding info. */
unsigned int bind_off;
unsigned int bind_size;
mach-o: layout executables bfd/ * mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content, bind_content, weak_bind_content, lazy_bind_content, export_content. (bfd_mach_o_load_command): Add comments, add next field. (mach_o_data_struct): Replace commands field by first_command and last_command. * mach-o.c (bfd_mach_o_append_command): New function. (bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines. (bfd_mach_o_bfd_copy_private_section_data): Check flavour, copy fields. (bfd_mach_o_bfd_copy_private_header_data): Copy load commands. (bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions. (bfd_mach_o_write_thread): Use macro instead of literal. (bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib) (bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New functions. (bfd_mach_o_write_symtab_content): New function (extracted from bfd_mach_o_write_symtab). (bfd_mach_o_write_symtab): Split. (bfd_mach_o_count_indirect_symbols): Move (bfd_mach_o_build_dysymtab): Remove layout code. (bfd_mach_o_write_contents): Rewritten to build commands in order. (bfd_mach_o_count_sections_for_seg): Remove. (bfd_mach_o_build_obj_seg_command): New function (extracted from bfd_mach_o_build_seg_command). (bfd_mach_o_build_exec_seg_command): New function. (bfd_mach_o_build_dysymtab_command): Remove. (bfd_mach_o_layout_commands): New function. (bfd_mach_o_init_segment): New function. (bfd_mach_o_build_commands): Major rework to handle non-object files. (bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New function. (bfd_mach_o_read_dyld_info): Clear content fields. (bfd_mach_o_read_segment): Adjust call. (bfd_mach_o_flatten_sections): Adjust as now load commands are chained. (bfd_mach_o_scan_start_address, bfd_mach_o_scan) (bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address) (bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment): Likewise. binutils/ * od-macho.c (dump_section_map): Adjust as load commands are now chained. (dump_load_command, dump_section_content): Likewise.
2014-04-03 14:45:31 +02:00
unsigned char *bind_content;
/* File offset and size of weak binding info. */
unsigned int weak_bind_off;
unsigned int weak_bind_size;
mach-o: layout executables bfd/ * mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content, bind_content, weak_bind_content, lazy_bind_content, export_content. (bfd_mach_o_load_command): Add comments, add next field. (mach_o_data_struct): Replace commands field by first_command and last_command. * mach-o.c (bfd_mach_o_append_command): New function. (bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines. (bfd_mach_o_bfd_copy_private_section_data): Check flavour, copy fields. (bfd_mach_o_bfd_copy_private_header_data): Copy load commands. (bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions. (bfd_mach_o_write_thread): Use macro instead of literal. (bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib) (bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New functions. (bfd_mach_o_write_symtab_content): New function (extracted from bfd_mach_o_write_symtab). (bfd_mach_o_write_symtab): Split. (bfd_mach_o_count_indirect_symbols): Move (bfd_mach_o_build_dysymtab): Remove layout code. (bfd_mach_o_write_contents): Rewritten to build commands in order. (bfd_mach_o_count_sections_for_seg): Remove. (bfd_mach_o_build_obj_seg_command): New function (extracted from bfd_mach_o_build_seg_command). (bfd_mach_o_build_exec_seg_command): New function. (bfd_mach_o_build_dysymtab_command): Remove. (bfd_mach_o_layout_commands): New function. (bfd_mach_o_init_segment): New function. (bfd_mach_o_build_commands): Major rework to handle non-object files. (bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New function. (bfd_mach_o_read_dyld_info): Clear content fields. (bfd_mach_o_read_segment): Adjust call. (bfd_mach_o_flatten_sections): Adjust as now load commands are chained. (bfd_mach_o_scan_start_address, bfd_mach_o_scan) (bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address) (bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment): Likewise. binutils/ * od-macho.c (dump_section_map): Adjust as load commands are now chained. (dump_load_command, dump_section_content): Likewise.
2014-04-03 14:45:31 +02:00
unsigned char *weak_bind_content;
/* File offset and size of lazy binding info. */
unsigned int lazy_bind_off;
unsigned int lazy_bind_size;
mach-o: layout executables bfd/ * mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content, bind_content, weak_bind_content, lazy_bind_content, export_content. (bfd_mach_o_load_command): Add comments, add next field. (mach_o_data_struct): Replace commands field by first_command and last_command. * mach-o.c (bfd_mach_o_append_command): New function. (bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines. (bfd_mach_o_bfd_copy_private_section_data): Check flavour, copy fields. (bfd_mach_o_bfd_copy_private_header_data): Copy load commands. (bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions. (bfd_mach_o_write_thread): Use macro instead of literal. (bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib) (bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New functions. (bfd_mach_o_write_symtab_content): New function (extracted from bfd_mach_o_write_symtab). (bfd_mach_o_write_symtab): Split. (bfd_mach_o_count_indirect_symbols): Move (bfd_mach_o_build_dysymtab): Remove layout code. (bfd_mach_o_write_contents): Rewritten to build commands in order. (bfd_mach_o_count_sections_for_seg): Remove. (bfd_mach_o_build_obj_seg_command): New function (extracted from bfd_mach_o_build_seg_command). (bfd_mach_o_build_exec_seg_command): New function. (bfd_mach_o_build_dysymtab_command): Remove. (bfd_mach_o_layout_commands): New function. (bfd_mach_o_init_segment): New function. (bfd_mach_o_build_commands): Major rework to handle non-object files. (bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New function. (bfd_mach_o_read_dyld_info): Clear content fields. (bfd_mach_o_read_segment): Adjust call. (bfd_mach_o_flatten_sections): Adjust as now load commands are chained. (bfd_mach_o_scan_start_address, bfd_mach_o_scan) (bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address) (bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment): Likewise. binutils/ * od-macho.c (dump_section_map): Adjust as load commands are now chained. (dump_load_command, dump_section_content): Likewise.
2014-04-03 14:45:31 +02:00
unsigned char *lazy_bind_content;
/* File offset and size of export info. */
unsigned int export_off;
unsigned int export_size;
mach-o: layout executables bfd/ * mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content, bind_content, weak_bind_content, lazy_bind_content, export_content. (bfd_mach_o_load_command): Add comments, add next field. (mach_o_data_struct): Replace commands field by first_command and last_command. * mach-o.c (bfd_mach_o_append_command): New function. (bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines. (bfd_mach_o_bfd_copy_private_section_data): Check flavour, copy fields. (bfd_mach_o_bfd_copy_private_header_data): Copy load commands. (bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions. (bfd_mach_o_write_thread): Use macro instead of literal. (bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib) (bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New functions. (bfd_mach_o_write_symtab_content): New function (extracted from bfd_mach_o_write_symtab). (bfd_mach_o_write_symtab): Split. (bfd_mach_o_count_indirect_symbols): Move (bfd_mach_o_build_dysymtab): Remove layout code. (bfd_mach_o_write_contents): Rewritten to build commands in order. (bfd_mach_o_count_sections_for_seg): Remove. (bfd_mach_o_build_obj_seg_command): New function (extracted from bfd_mach_o_build_seg_command). (bfd_mach_o_build_exec_seg_command): New function. (bfd_mach_o_build_dysymtab_command): Remove. (bfd_mach_o_layout_commands): New function. (bfd_mach_o_init_segment): New function. (bfd_mach_o_build_commands): Major rework to handle non-object files. (bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New function. (bfd_mach_o_read_dyld_info): Clear content fields. (bfd_mach_o_read_segment): Adjust call. (bfd_mach_o_flatten_sections): Adjust as now load commands are chained. (bfd_mach_o_scan_start_address, bfd_mach_o_scan) (bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address) (bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment): Likewise. binutils/ * od-macho.c (dump_section_map): Adjust as load commands are now chained. (dump_load_command, dump_section_content): Likewise.
2014-04-03 14:45:31 +02:00
unsigned char *export_content;
}
bfd_mach_o_dyld_info_command;
typedef struct bfd_mach_o_version_min_command
{
unsigned char rel;
unsigned char maj;
unsigned char min;
unsigned int reserved;
}
bfd_mach_o_version_min_command;
typedef struct bfd_mach_o_encryption_info_command
{
unsigned int cryptoff;
unsigned int cryptsize;
unsigned int cryptid;
}
bfd_mach_o_encryption_info_command;
typedef struct bfd_mach_o_main_command
{
bfd_uint64_t entryoff;
bfd_uint64_t stacksize;
}
bfd_mach_o_main_command;
typedef struct bfd_mach_o_source_version_command
{
unsigned int a;
unsigned short b;
unsigned short c;
unsigned short d;
unsigned short e;
}
bfd_mach_o_source_version_command;
2002-11-06 14:26:29 +01:00
typedef struct bfd_mach_o_load_command
{
mach-o: layout executables bfd/ * mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content, bind_content, weak_bind_content, lazy_bind_content, export_content. (bfd_mach_o_load_command): Add comments, add next field. (mach_o_data_struct): Replace commands field by first_command and last_command. * mach-o.c (bfd_mach_o_append_command): New function. (bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines. (bfd_mach_o_bfd_copy_private_section_data): Check flavour, copy fields. (bfd_mach_o_bfd_copy_private_header_data): Copy load commands. (bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions. (bfd_mach_o_write_thread): Use macro instead of literal. (bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib) (bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New functions. (bfd_mach_o_write_symtab_content): New function (extracted from bfd_mach_o_write_symtab). (bfd_mach_o_write_symtab): Split. (bfd_mach_o_count_indirect_symbols): Move (bfd_mach_o_build_dysymtab): Remove layout code. (bfd_mach_o_write_contents): Rewritten to build commands in order. (bfd_mach_o_count_sections_for_seg): Remove. (bfd_mach_o_build_obj_seg_command): New function (extracted from bfd_mach_o_build_seg_command). (bfd_mach_o_build_exec_seg_command): New function. (bfd_mach_o_build_dysymtab_command): Remove. (bfd_mach_o_layout_commands): New function. (bfd_mach_o_init_segment): New function. (bfd_mach_o_build_commands): Major rework to handle non-object files. (bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New function. (bfd_mach_o_read_dyld_info): Clear content fields. (bfd_mach_o_read_segment): Adjust call. (bfd_mach_o_flatten_sections): Adjust as now load commands are chained. (bfd_mach_o_scan_start_address, bfd_mach_o_scan) (bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address) (bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment): Likewise. binutils/ * od-macho.c (dump_section_map): Adjust as load commands are now chained. (dump_load_command, dump_section_content): Likewise.
2014-04-03 14:45:31 +02:00
/* Next command in the single linked list. */
struct bfd_mach_o_load_command *next;
/* Type and required flag. */
2002-11-06 14:26:29 +01:00
bfd_mach_o_load_command_type 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
bfd_boolean type_required;
mach-o: layout executables bfd/ * mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content, bind_content, weak_bind_content, lazy_bind_content, export_content. (bfd_mach_o_load_command): Add comments, add next field. (mach_o_data_struct): Replace commands field by first_command and last_command. * mach-o.c (bfd_mach_o_append_command): New function. (bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines. (bfd_mach_o_bfd_copy_private_section_data): Check flavour, copy fields. (bfd_mach_o_bfd_copy_private_header_data): Copy load commands. (bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions. (bfd_mach_o_write_thread): Use macro instead of literal. (bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib) (bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New functions. (bfd_mach_o_write_symtab_content): New function (extracted from bfd_mach_o_write_symtab). (bfd_mach_o_write_symtab): Split. (bfd_mach_o_count_indirect_symbols): Move (bfd_mach_o_build_dysymtab): Remove layout code. (bfd_mach_o_write_contents): Rewritten to build commands in order. (bfd_mach_o_count_sections_for_seg): Remove. (bfd_mach_o_build_obj_seg_command): New function (extracted from bfd_mach_o_build_seg_command). (bfd_mach_o_build_exec_seg_command): New function. (bfd_mach_o_build_dysymtab_command): Remove. (bfd_mach_o_layout_commands): New function. (bfd_mach_o_init_segment): New function. (bfd_mach_o_build_commands): Major rework to handle non-object files. (bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New function. (bfd_mach_o_read_dyld_info): Clear content fields. (bfd_mach_o_read_segment): Adjust call. (bfd_mach_o_flatten_sections): Adjust as now load commands are chained. (bfd_mach_o_scan_start_address, bfd_mach_o_scan) (bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address) (bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment): Likewise. binutils/ * od-macho.c (dump_section_map): Adjust as load commands are now chained. (dump_load_command, dump_section_content): Likewise.
2014-04-03 14:45:31 +02:00
/* Offset and length in the file. */
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
unsigned int offset;
unsigned int len;
mach-o: layout executables bfd/ * mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content, bind_content, weak_bind_content, lazy_bind_content, export_content. (bfd_mach_o_load_command): Add comments, add next field. (mach_o_data_struct): Replace commands field by first_command and last_command. * mach-o.c (bfd_mach_o_append_command): New function. (bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines. (bfd_mach_o_bfd_copy_private_section_data): Check flavour, copy fields. (bfd_mach_o_bfd_copy_private_header_data): Copy load commands. (bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions. (bfd_mach_o_write_thread): Use macro instead of literal. (bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib) (bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New functions. (bfd_mach_o_write_symtab_content): New function (extracted from bfd_mach_o_write_symtab). (bfd_mach_o_write_symtab): Split. (bfd_mach_o_count_indirect_symbols): Move (bfd_mach_o_build_dysymtab): Remove layout code. (bfd_mach_o_write_contents): Rewritten to build commands in order. (bfd_mach_o_count_sections_for_seg): Remove. (bfd_mach_o_build_obj_seg_command): New function (extracted from bfd_mach_o_build_seg_command). (bfd_mach_o_build_exec_seg_command): New function. (bfd_mach_o_build_dysymtab_command): Remove. (bfd_mach_o_layout_commands): New function. (bfd_mach_o_init_segment): New function. (bfd_mach_o_build_commands): Major rework to handle non-object files. (bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New function. (bfd_mach_o_read_dyld_info): Clear content fields. (bfd_mach_o_read_segment): Adjust call. (bfd_mach_o_flatten_sections): Adjust as now load commands are chained. (bfd_mach_o_scan_start_address, bfd_mach_o_scan) (bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address) (bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment): Likewise. binutils/ * od-macho.c (dump_section_map): Adjust as load commands are now chained. (dump_load_command, dump_section_content): Likewise.
2014-04-03 14:45:31 +02:00
2002-11-06 14:26:29 +01:00
union
{
bfd_mach_o_segment_command segment;
bfd_mach_o_symtab_command symtab;
bfd_mach_o_dysymtab_command dysymtab;
bfd_mach_o_thread_command thread;
bfd_mach_o_dylib_command dylib;
bfd_mach_o_dylinker_command dylinker;
bfd_mach_o_prebound_dylib_command prebound_dylib;
bfd_mach_o_prebind_cksum_command prebind_cksum;
bfd_mach_o_twolevel_hints_command twolevel_hints;
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_mach_o_uuid_command uuid;
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
bfd_mach_o_linkedit_command linkedit;
bfd_mach_o_str_command str;
bfd_mach_o_dyld_info_command dyld_info;
bfd_mach_o_version_min_command version_min;
bfd_mach_o_encryption_info_command encryption_info;
bfd_mach_o_fvmlib_command fvmlib;
bfd_mach_o_main_command main;
bfd_mach_o_source_version_command source_version;
mach-o: layout executables bfd/ * mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content, bind_content, weak_bind_content, lazy_bind_content, export_content. (bfd_mach_o_load_command): Add comments, add next field. (mach_o_data_struct): Replace commands field by first_command and last_command. * mach-o.c (bfd_mach_o_append_command): New function. (bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines. (bfd_mach_o_bfd_copy_private_section_data): Check flavour, copy fields. (bfd_mach_o_bfd_copy_private_header_data): Copy load commands. (bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions. (bfd_mach_o_write_thread): Use macro instead of literal. (bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib) (bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New functions. (bfd_mach_o_write_symtab_content): New function (extracted from bfd_mach_o_write_symtab). (bfd_mach_o_write_symtab): Split. (bfd_mach_o_count_indirect_symbols): Move (bfd_mach_o_build_dysymtab): Remove layout code. (bfd_mach_o_write_contents): Rewritten to build commands in order. (bfd_mach_o_count_sections_for_seg): Remove. (bfd_mach_o_build_obj_seg_command): New function (extracted from bfd_mach_o_build_seg_command). (bfd_mach_o_build_exec_seg_command): New function. (bfd_mach_o_build_dysymtab_command): Remove. (bfd_mach_o_layout_commands): New function. (bfd_mach_o_init_segment): New function. (bfd_mach_o_build_commands): Major rework to handle non-object files. (bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New function. (bfd_mach_o_read_dyld_info): Clear content fields. (bfd_mach_o_read_segment): Adjust call. (bfd_mach_o_flatten_sections): Adjust as now load commands are chained. (bfd_mach_o_scan_start_address, bfd_mach_o_scan) (bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address) (bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment): Likewise. binutils/ * od-macho.c (dump_section_map): Adjust as load commands are now chained. (dump_load_command, dump_section_content): Likewise.
2014-04-03 14:45:31 +02:00
} command;
2002-11-06 14:26:29 +01:00
}
bfd_mach_o_load_command;
typedef struct mach_o_data_struct
{
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
/* Mach-O header. */
2002-11-06 14:26:29 +01:00
bfd_mach_o_header header;
mach-o cleanup: remove useless calls to bfd_seek. Also support new commands. bfd/ * mach-o.h (struct mach_o_data_struct): Add hdr_offset field. (bfd_mach_o_fat_archive_p): Renames prototype. (bfd_mach_o_fat_openr_next_archived_file): Renames. (bfd_mach_o_header_p): Add argument. * mach-o.c (bfd_mach_o_read_header): Add hdr_off argument and use it. (bfd_mach_o_read_section_32, bfd_mach_o_read_section_64) (bfd_mach_o_read_section): Remove offset argument. (bfd_mach_o_read_dylinker): Remove bfd_seek call. (bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib) (bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints) (bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab) (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid) (bfd_mach_o_read_linkedit, bfd_mach_o_read_str) (bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min) (bfd_mach_o_read_encryption_info): Likewise. (bfd_mach_o_read_encryption_info_64): New function. (bfd_mach_o_read_main, bfd_mach_o_read_source_version) (bfd_mach_o_read_segment): Remove call to bfd_seek. (bfd_mach_o_read_command): Use hdr_offset in bfd_seek. Handle BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT, BFD_MACH_O_LC_ENCRYPTION_INFO_64, BFD_MACH_O_LC_VERSION_MIN_WATCHOS. (bfd_mach_o_header_p): Add hdr_off argument. (bfd_mach_o_gen_object_p, bfd_mach_o_gen_core_p): Adjust calls. (bfd_mach_o_fat_archive_p): Renames. (bfd_mach_o_fat_openr_next_archived_file): Renames. (bfd_mach_o_close_and_cleanup): Remove useless code. (bfd_mach_o_close_and_cleanup): Define. * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p) (bfd_mach_o_x86_64_core_p): Adjust calls. * mach-o-target.c: Move defines for archive from mach-o.c. Remove check on TARGET_ARCHIVE. * mach-o-i386.c (bfd_mach_o_i386_object_p) (bfd_mach_o_i386_core_p): Adjust calls.
2015-11-18 10:33:11 +01:00
/* File offset of the header. Usually this is 0. */
file_ptr hdr_offset;
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
/* Array of load commands (length is given by header.ncmds). */
mach-o: layout executables bfd/ * mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content, bind_content, weak_bind_content, lazy_bind_content, export_content. (bfd_mach_o_load_command): Add comments, add next field. (mach_o_data_struct): Replace commands field by first_command and last_command. * mach-o.c (bfd_mach_o_append_command): New function. (bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines. (bfd_mach_o_bfd_copy_private_section_data): Check flavour, copy fields. (bfd_mach_o_bfd_copy_private_header_data): Copy load commands. (bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions. (bfd_mach_o_write_thread): Use macro instead of literal. (bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib) (bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New functions. (bfd_mach_o_write_symtab_content): New function (extracted from bfd_mach_o_write_symtab). (bfd_mach_o_write_symtab): Split. (bfd_mach_o_count_indirect_symbols): Move (bfd_mach_o_build_dysymtab): Remove layout code. (bfd_mach_o_write_contents): Rewritten to build commands in order. (bfd_mach_o_count_sections_for_seg): Remove. (bfd_mach_o_build_obj_seg_command): New function (extracted from bfd_mach_o_build_seg_command). (bfd_mach_o_build_exec_seg_command): New function. (bfd_mach_o_build_dysymtab_command): Remove. (bfd_mach_o_layout_commands): New function. (bfd_mach_o_init_segment): New function. (bfd_mach_o_build_commands): Major rework to handle non-object files. (bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New function. (bfd_mach_o_read_dyld_info): Clear content fields. (bfd_mach_o_read_segment): Adjust call. (bfd_mach_o_flatten_sections): Adjust as now load commands are chained. (bfd_mach_o_scan_start_address, bfd_mach_o_scan) (bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address) (bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment): Likewise. binutils/ * od-macho.c (dump_section_map): Adjust as load commands are now chained. (dump_load_command, dump_section_content): Likewise.
2014-04-03 14:45:31 +02:00
bfd_mach_o_load_command *first_command;
bfd_mach_o_load_command *last_command;
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
/* Flatten array of sections. The array is 0-based. */
2002-11-06 14:26:29 +01:00
unsigned long nsects;
bfd_mach_o_section **sections;
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
/* Used while writing: current length of the output file. This is used
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
to allocate space in the file. */
ufile_ptr filelen;
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
/* As symtab is referenced by other load command, it is handy to have
a direct access to it. Although it is not clearly stated, only one symtab
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
is expected. */
bfd_mach_o_symtab_command *symtab;
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_dysymtab_command *dysymtab;
/* A place to stash dwarf2 info for this bfd. */
void *dwarf2_find_line_info;
/* BFD of .dSYM file. */
bfd *dsym_bfd;
/* Cache of dynamic relocs. */
arelent *dyn_reloc_cache;
2002-11-06 14:26:29 +01:00
}
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
bfd_mach_o_data_struct;
2002-11-06 14:26:29 +01:00
bfd/ 2011-12-13 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_read_symtab_symbols): Make global. Remove prototype. (bfd_mach_o_section_get_entry_size): Make global. (bfd_mach_o_section_get_nbr_indirect): Likewise. (bfd_mach_o_read_symtab_strtab): Likewise. (struct bfd_mach_o_xlat_name): Move to mach-o.h (bfd_mach_o_print_flags): Move to binutils/od-macho.c (bfd_mach_o_get_name_of_null, bfd_mach_o_get_name): Likewise. (bfd_mach_o_cpu_name, bfd_mach_o_filetype_name): Likewise. (bfd_mach_o_header_flags_name): Likewise. (bfd_mach_o_load_command_name): Likewise. (bfd_mach_o_print_private_header): Likewise. (bfd_mach_o_print_section_map, bfd_mach_o_print_section): Likwise. (bfd_mach_o_print_segment, bfd_mach_o_print_dysymtab): Likewise. (bfd_mach_o_print_dyld_info): Likewise. (bfd_mach_o_print_private_bfd_data): Remove. (bfd_mach_o_type_name): Make global. (bfd_mach_o_section_attribute_name): Likewise. * mach-o.h (bfd_mach_o_xlat_name): Added. (bfd_mach_o_section_get_nbr_indirect) (bfd_mach_o_section_get_entry_size) (bfd_mach_o_read_symtab_symbols) (bfd_mach_o_read_symtab_strtab) (bfd_mach_o_section_attribute_name) (bfd_mach_o_section_type_name): Likewise. * mach-o-target.c (bfd_mach_o_bfd_print_private_bfd_data): Define. binutils/ 2011-12-13 Tristan Gingold <gingold@adacore.com> * od-macho.c: New file. * objdump.h (objdump_private_desc_mach_o): Add. * configure.in: Add Mach-O od_vectors. * Makefile.am (CFILES): Add od-macho.c * configure: Regenerate. * Makefile.in: Regenerate.
2011-12-13 10:13:15 +01:00
typedef struct bfd_mach_o_xlat_name
{
const char *name;
unsigned long val;
}
bfd_mach_o_xlat_name;
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
/* Target specific routines. */
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
2009-06-19 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_scan_read_symtab_symbols): Add prototype. (bfd_mach_o_version): Use bfd_mach_o_get_data instead of direct access. (bfd_mach_o_valid): Ditto. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_canonicalize_reloc): Ditto. (bfd_mach_o_build_commands): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_flatten_sections): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_lookup_section): Ditto. (bfd_mach_o_core_fetch_environment): Ditto. (bfd_mach_o_write_contents): Ditto. Handle reexport_dylib. (bfd_mach_o_scan_write_relocs): Adjust for bfd_mach_o_get_data. (bfd_mach_o_scan_write_symtab): Ditto. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_symbol): Make the function static. Use bfd_mach_o_get_data instead of direct access. Use macros instead of hard-coded values. (bfd_mach_o_scan_read_symtab_strtab): Make the function static. Remove sym argument and get section from mdata. Move code into the else branch. (bfd_mach_o_scan_read_symtab_symbols): Make the function static. Remove sym argument and get section from mdata. Adjust code. (bfd_mach_o_scan_read_dylib): Move assertion into the created switch (which replaces consecutive if statements). (bfd_mach_o_scan_read_dysymtab): Rename seg to cmd. Load module table, table of content, indirect symbols and external referenced symbols. (bfd_mach_o_scan_read_symtab): Renames seg to symtab. Set symtab field. (bfd_mach_o_scan_read_linkedit): New function. (bfd_mach_o_scan_read_str): Ditto. (bfd_mach_o_count_symbols): Simplify the code by using the symtab field of mdata. (bfd_mach_o_get_symtab_upper_bound): Remove check as bfd_mach_o_count_symbols never returns an error. (bfd_mach_o_canonicalize_symtab): Simplify the code by using the symtab field (there might be only one symtab). (bfd_mach_o_scan_read_command): Handle reexported dylib. Handle sub frameworks, sub umbrella, sub library and sub client. Read code signature and segment split info commands. (bfd_mach_o_scan): Reindent. (bfd_mach_o_xlat_name): New type. (bfd_mach_o_print_flags): New function. (bfd_mach_o_get_name): Ditto. (bfd_mach_o_cpu_name): New variable. (bfd_mach_o_filetype_name, bfd_mach_o_header_flags_name) (bfd_mach_o_section_type_name) (bfd_mach_o_section_attribute_name) (bfd_mach_o_load_command_name): New variables. (bfd_mach_o_print_private_header): New function. (bfd_mach_o_print_section_map): New function extracted from bfd_mach_o_print_private_bfd_data. (bfd_mach_o_print_section): Ditto. Print more infos. (bfd_mach_o_print_segment): Ditto. (bfd_mach_o_print_dysymtab): Ditto. (bfd_mach_o_bfd_print_private_bfd_data): Reworked. Handle load weak dylib, reexport dylib and id dylib. Handle code signature and segment_split info. Handle sub frameworks, sub umbrella, sub library and sub client. (bfd_mach_o_section_get_nbr_indirect): New function. * mach-o.h (BFD_MACH_O_REFERENCE_MASK): New macro. Add comment. (bfd_mach_o_header_flags): New enum to define header flags. (bfd_mach_o_section_attribute): New enum to replace ... (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_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, BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS): ... these removed macros. (BFD_MACH_O_NLIST_SIZE, BFD_MACH_O_NLIST_64_SIZE): New macros. (bfd_mach_o_dylib_module): New type. (BFD_MACH_O_DYLIB_MODULE_SIZE, BFD_MACH_O_DYLIB_MODULE_64_SIZE): New macros. (bfd_mach_o_dylib_table_of_content): New type. (BFD_MACH_O_TABLE_OF_CONTENT_SIZE): New macro. (bfd_mach_o_dylib_reference): New type. (BFD_MACH_O_REFERENCE_SIZE): New macro. (bfd_mach_o_dysymtab_command): Add fields for loaded and decoded modules, toc, references and indirect syms. (BFD_MACH_O_INDIRECT_SYMBOL_SIZE): New macro. (bfd_mach_o_dylinker_command): Remove cmd and cmdsize fields (were unused). Add comment. (bfd_mach_o_dylib_command): Ditto. (bfd_mach_o_prebound_dylib_command): Ditto. (bfd_mach_o_linkedit_command): New type. (bfd_mach_o_str_command): New type. (bfd_mach_o_load_command): Add linkedit and str fields. (mach_o_data_struct): Add symtab field. (bfd_get_mach_o_data): Renamed to ... (bfd_mach_o_get_data): ... this new macro. (bfd_mach_o_scan_read_symtab_symbol, bfd_mach_o_scan_read_symtab_strtab, bfd_mach_o_scan_read_symtab_symbols): Prototypes removed. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Use bfd_mach_o_get_data instead of direct access.
2009-06-19 11:12:41 +02:00
#define bfd_mach_o_get_data(abfd) ((abfd)->tdata.mach_o_data)
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_get_backend_data(abfd) \
((bfd_mach_o_backend_data*)(abfd)->xvec->backend_data)
2002-11-06 14:26:29 +01:00
/* Get the Mach-O header for section SEC. */
#define bfd_mach_o_get_mach_o_section(sec) \
((bfd_mach_o_section *)(sec)->used_by_bfd)
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
bfd_boolean bfd_mach_o_valid (bfd *);
bfd_boolean bfd_mach_o_mkobject_init (bfd *);
const bfd_target *bfd_mach_o_object_p (bfd *);
const bfd_target *bfd_mach_o_core_p (bfd *);
mach-o cleanup: remove useless calls to bfd_seek. Also support new commands. bfd/ * mach-o.h (struct mach_o_data_struct): Add hdr_offset field. (bfd_mach_o_fat_archive_p): Renames prototype. (bfd_mach_o_fat_openr_next_archived_file): Renames. (bfd_mach_o_header_p): Add argument. * mach-o.c (bfd_mach_o_read_header): Add hdr_off argument and use it. (bfd_mach_o_read_section_32, bfd_mach_o_read_section_64) (bfd_mach_o_read_section): Remove offset argument. (bfd_mach_o_read_dylinker): Remove bfd_seek call. (bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib) (bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints) (bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab) (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid) (bfd_mach_o_read_linkedit, bfd_mach_o_read_str) (bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min) (bfd_mach_o_read_encryption_info): Likewise. (bfd_mach_o_read_encryption_info_64): New function. (bfd_mach_o_read_main, bfd_mach_o_read_source_version) (bfd_mach_o_read_segment): Remove call to bfd_seek. (bfd_mach_o_read_command): Use hdr_offset in bfd_seek. Handle BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT, BFD_MACH_O_LC_ENCRYPTION_INFO_64, BFD_MACH_O_LC_VERSION_MIN_WATCHOS. (bfd_mach_o_header_p): Add hdr_off argument. (bfd_mach_o_gen_object_p, bfd_mach_o_gen_core_p): Adjust calls. (bfd_mach_o_fat_archive_p): Renames. (bfd_mach_o_fat_openr_next_archived_file): Renames. (bfd_mach_o_close_and_cleanup): Remove useless code. (bfd_mach_o_close_and_cleanup): Define. * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p) (bfd_mach_o_x86_64_core_p): Adjust calls. * mach-o-target.c: Move defines for archive from mach-o.c. Remove check on TARGET_ARCHIVE. * mach-o-i386.c (bfd_mach_o_i386_object_p) (bfd_mach_o_i386_core_p): Adjust calls.
2015-11-18 10:33:11 +01:00
const bfd_target *bfd_mach_o_fat_archive_p (bfd *);
bfd *bfd_mach_o_fat_openr_next_archived_file (bfd *, bfd *);
bfd_boolean bfd_mach_o_set_arch_mach (bfd *, enum bfd_architecture,
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
unsigned long);
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
int bfd_mach_o_lookup_command (bfd *, bfd_mach_o_load_command_type, bfd_mach_o_load_command **);
bfd_boolean bfd_mach_o_new_section_hook (bfd *, asection *);
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
bfd_boolean bfd_mach_o_write_contents (bfd *);
bfd_boolean bfd_mach_o_bfd_copy_private_symbol_data (bfd *, asymbol *,
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
bfd *, asymbol *);
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
bfd_boolean bfd_mach_o_bfd_copy_private_section_data (bfd *, asection *,
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
bfd *, asection *);
bfd_boolean bfd_mach_o_bfd_copy_private_header_data (bfd *, bfd *);
bfd_boolean bfd_mach_o_bfd_set_private_flags (bfd *, flagword);
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
long bfd_mach_o_get_symtab_upper_bound (bfd *);
long bfd_mach_o_canonicalize_symtab (bfd *, asymbol **);
Remove trailing white spaces in bfd * aout0.c: Remove trailing white spaces. * archive.c: Likewise. * archures.c: Likewise. * bfd-in.h: Likewise. * bfd-in2.h: Likewise. * coff-alpha.c: Likewise. * coff-i860.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-tic80.c: Likewise. * coff-x86_64.c: Likewise. * coff-z80.c: Likewise. * coffcode.h: Likewise. * coffgen.c: Likewise. * cofflink.c: Likewise. * compress.c: Likewise. * corefile.c: Likewise. * cpu-arm.c: Likewise. * cpu-avr.c: Likewise. * cpu-bfin.c: Likewise. * cpu-cr16.c: Likewise. * cpu-cr16c.c: Likewise. * cpu-crx.c: Likewise. * cpu-h8300.c: Likewise. * cpu-i386.c: Likewise. * cpu-lm32.c: Likewise. * cpu-m68k.c: Likewise. * cpu-moxie.c: Likewise. * cpu-msp430.c: Likewise. * cpu-sh.c: Likewise. * cpu-xc16x.c: Likewise. * dwarf2.c: Likewise. * ecofflink.c: Likewise. * ecoffswap.h: Likewise. * elf-ifunc.c: Likewise. * elf-m10300.c: Likewise. * elf-vxworks.c: Likewise. * elf32-avr.c: Likewise. * elf32-avr.h: Likewise. * elf32-cr16.c: Likewise. * elf32-cr16c.c: Likewise. * elf32-cris.c: Likewise. * elf32-crx.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i860.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-iq2000.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-msp430.c: Likewise. * elf32-mt.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-s390.c: Likewise. * elf32-score.h: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Likewise. * elf32-spu.c: Likewise. * elf32-tic6x.c: Likewise. * elf32-v850.c: Likewise. * elf32-xc16x.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elfcore.h: Likewise. * elflink.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c: Likewise. * ieee.c: Likewise. * libcoff.h: Likewise. * libpei.h: Likewise. * libxcoff.h: Likewise. * linker.c: Likewise. * mach-o-i386.c: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mach-o.h: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * pe-x86_64.c: Likewise. * peXXigen.c: Likewise. * pef-traceback.h: Likewise. * pei-x86_64.c: Likewise. * peicode.h: Likewise. * plugin.c: Likewise. * reloc.c: Likewise. * riscix.c: Likewise. * section.c: Likewise. * som.c: Likewise. * syms.c: Likewise. * tekhex.c: Likewise. * ticoff.h: Likewise. * vaxbsd.c: Likewise. * xcofflink.c: Likewise. * xtensa-isa.c: Likewise.
2013-01-10 21:03:55 +01:00
long bfd_mach_o_get_synthetic_symtab (bfd *, long, asymbol **, long,
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
asymbol **, asymbol **ret);
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
long bfd_mach_o_get_reloc_upper_bound (bfd *, asection *);
long bfd_mach_o_canonicalize_reloc (bfd *, asection *, arelent **, asymbol **);
long bfd_mach_o_get_dynamic_reloc_upper_bound (bfd *);
long bfd_mach_o_canonicalize_dynamic_reloc (bfd *, arelent **, asymbol **);
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
asymbol *bfd_mach_o_make_empty_symbol (bfd *);
void bfd_mach_o_get_symbol_info (bfd *, asymbol *, symbol_info *);
* aix386-core.c: Remove use of PTR and PARAMS macros. * archive.c: Likewise. * cache.c: Likewise. * cisco-core.c: Likewise. * coff-alpha.c: Likewise. * coff-apollo.c: Likewise. * coff-aux.c: Likewise. * coff-h8300.c: Likewise. * coff-h8500.c: Likewise. * coff-i386.c: Likewise. * coff-i960.c: Likewise. * coff-ia64.c: Likewise. * coff-m68k.c: Likewise. * coff-m88k.c: Likewise. * coff-mcore.c: Likewise. * coff-mips.c: Likewise. * coff-or32.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-sparc.c: Likewise. * coff-stgo32.c: Likewise. * coff-tic30.c: Likewise. * coff-tic4x.c: Likewise. * coff-tic54x.c: Likewise. * coff-tic80.c: Likewise. * coff-w65.c: Likewise. * cofflink.c: Likewise. * cpu-arc.c: Likewise. * cpu-cris.c: Likewise. * cpu-h8500.c: Likewise. * cpu-i960.c: Likewise. * cpu-msp430.c: Likewise. * cpu-ns32k.c: Likewise. * cpu-powerpc.c: Likewise. * cpu-rs6000.c: Likewise. * cpu-tic4x.c: Likewise. * cpu-w65.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10200.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-crx.c: Likewise. * elf32-fr30.c: Likewise. * elf32-frv.c: Likewise. * elf32-h8300.c: Likewise. * elf32-i960.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc12.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mcore.c: Likewise. * elf32-rl78.c: Likewise. * elf32-rx.c: Likewise. * elf32-s390.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-mmix.c: Likewise. * elf64-s390.c: Likewise. * elf64-sparc.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * hash.c: Likewise. * hp300hpux.c: Likewise. * hppabsd-core.c: Likewise. * hpux-core.c: Likewise. * i386dynix.c: Likewise. * i386linux.c: Likewise. * i386lynx.c: Likewise. * i386mach3.c: Likewise. * i386msdos.c: Likewise. * i386os9k.c: Likewise. * irix-core.c: Likewise. * lynx-core.c: Likewise. * m68klinux.c: Likewise. * mach-o.h: Likewise. * mipsbsd.c: Likewise. * netbsd-core.c: Likewise. * nlm32-i386.c: Likewise. * osf-core.c: Likewise. * pc532-mach.c: Likewise. * pef.c: Likewise. * ppcboot.c: Likewise. * ptrace-core.c: Likewise. * reloc16.c: Likewise. * sco5-core.c: Likewise. * som.h: Likewise. * sparclinux.c: Likewise. * sparclynx.c: Likewise. * ticoff.h: Likewise. * trad-core.c: Likewise. * vms-lib.c: Likewise. * xsym.h: Likewise.
2012-07-13 16:22:50 +02:00
void bfd_mach_o_print_symbol (bfd *, void *, asymbol *, bfd_print_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
int bfd_mach_o_sizeof_headers (bfd *, struct bfd_link_info *);
unsigned long bfd_mach_o_stack_addr (enum bfd_mach_o_cpu_type);
int bfd_mach_o_core_fetch_environment (bfd *, unsigned char **, unsigned int *);
char *bfd_mach_o_core_file_failing_command (bfd *);
int bfd_mach_o_core_file_failing_signal (bfd *);
bfd_boolean bfd_mach_o_core_file_matches_executable_p (bfd *, bfd *);
bfd *bfd_mach_o_fat_extract (bfd *, bfd_format , const bfd_arch_info_type *);
mach-o cleanup: remove useless calls to bfd_seek. Also support new commands. bfd/ * mach-o.h (struct mach_o_data_struct): Add hdr_offset field. (bfd_mach_o_fat_archive_p): Renames prototype. (bfd_mach_o_fat_openr_next_archived_file): Renames. (bfd_mach_o_header_p): Add argument. * mach-o.c (bfd_mach_o_read_header): Add hdr_off argument and use it. (bfd_mach_o_read_section_32, bfd_mach_o_read_section_64) (bfd_mach_o_read_section): Remove offset argument. (bfd_mach_o_read_dylinker): Remove bfd_seek call. (bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib) (bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints) (bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab) (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid) (bfd_mach_o_read_linkedit, bfd_mach_o_read_str) (bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min) (bfd_mach_o_read_encryption_info): Likewise. (bfd_mach_o_read_encryption_info_64): New function. (bfd_mach_o_read_main, bfd_mach_o_read_source_version) (bfd_mach_o_read_segment): Remove call to bfd_seek. (bfd_mach_o_read_command): Use hdr_offset in bfd_seek. Handle BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT, BFD_MACH_O_LC_ENCRYPTION_INFO_64, BFD_MACH_O_LC_VERSION_MIN_WATCHOS. (bfd_mach_o_header_p): Add hdr_off argument. (bfd_mach_o_gen_object_p, bfd_mach_o_gen_core_p): Adjust calls. (bfd_mach_o_fat_archive_p): Renames. (bfd_mach_o_fat_openr_next_archived_file): Renames. (bfd_mach_o_close_and_cleanup): Remove useless code. (bfd_mach_o_close_and_cleanup): Define. * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p) (bfd_mach_o_x86_64_core_p): Adjust calls. * mach-o-target.c: Move defines for archive from mach-o.c. Remove check on TARGET_ARCHIVE. * mach-o-i386.c (bfd_mach_o_i386_object_p) (bfd_mach_o_i386_core_p): Adjust calls.
2015-11-18 10:33:11 +01:00
const bfd_target *bfd_mach_o_header_p (bfd *, file_ptr, bfd_mach_o_filetype,
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
bfd_mach_o_cpu_type);
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_boolean bfd_mach_o_build_commands (bfd *);
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
bfd_boolean bfd_mach_o_set_section_contents (bfd *, asection *, const void *,
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
file_ptr, bfd_size_type);
2009-06-09 Tristan Gingold <gingold@adacore.com> * mach-o.h (bfd_mach_o_symtab_command): Remove stabs_segment and stabstr_segment fields. (mach_o_be_vec, mach_o_le_vec): Removed (bfd_mach_o_version): New prototype. * mach-o.c (bfd_mach_o_version): Make this function public. (mach_o_wide_p): New function. (bfd_mach_o_wide_p): Ditto. (bfd_mach_o_convert_section_name_to_bfd): Add prefix only for weird names. (bfd_mach_o_convert_section_name_to_mach_o): Fix typo in comment. Search in the list only if the name starts with a dot. (bfd_mach_o_write_header): Use mach_o_wide_p instead of hard-coded test. Check bfd_seek status. (bfd_mach_o_scan_write_thread): Check bfd_seek status. (bfd_mach_o_scan_write_section_32): Ditto. (bfd_mach_o_scan_write_section_64): Ditto. (bfd_mach_o_scan_write_section): Removed. (bfd_mach_o_scan_write_segment): Split into ... (bfd_mach_o_scan_write_segment_32): ... this and ... (bfd_mach_o_scan_write_segment_64): ... this. Check bfd_seek status. (bfd_mach_o_scan_write_symtab_symbols): Moved into ... (bfd_mach_o_scan_write_symtab): ... this. Write symtab from BFD symbol table. Now returns a boolean. (bfd_mach_o_write_contents): Set filetype. Check bfd_seek status. Adjust for status type. (bfd_mach_o_build_commands): Use mach_o_wide_p instead of hard-coded test. Write symbol table. Numbers the sections. (bfd_mach_o_read_header): Check bfd_seek status. Use mach_o_wide_p instead of hard-coded test. (bfd_mach_o_scan_read_section_32): Check bfd_seek status. (bfd_mach_o_scan_read_section_64): Ditto. (bfd_mach_o_scan_read_symtab_symbol): Ditto. Check bfd_seek status. Use BFD_MACH_O_N_TYPE instead of hard-coded value. Correctly handled common symbols. (bfd_mach_o_scan_read_symtab_strtab): Check bfd_seek status. (bfd_mach_o_scan_read_dysymtab_symbol): Ditto. (bfd_mach_o_scan_read_dylinker): Ditto. (bfd_mach_o_scan_read_dylib): Ditto. (bfd_mach_o_scan_read_thread): Ditto. (bfd_mach_o_scan_read_symtab): Ditto. Do not create a section for the stabs. (bfd_mach_o_scan_read_uuid): Check bfd_seek status. (bfd_mach_o_scan_read_segment): Ditto. (bfd_mach_o_scan_read_command): Ditto. (bfd_mach_o_scan_start_address): Ditto. (bfd_mach_o_scan): Use mach_o_wide_p instead of hard-coded test. (bfd_mach_o_archive_p): Check bfd_seek status. (bfd_mach_o_core_fetch_environment): Ditto. * mach-o-i386.c (bfd_mach_o_i386_mkobject): Don't set filetype.
2009-06-09 09:37:19 +02:00
unsigned int bfd_mach_o_version (bfd *);
2002-11-06 14:26:29 +01:00
unsigned int bfd_mach_o_get_section_type_from_name (bfd *, const char *);
unsigned int bfd_mach_o_get_section_attribute_from_name (const char *);
bfd/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o-i386.c (text_section_names_xlat): New table. (data_section_names_xlat): Likewise. (import_section_names_xlat): Likewise. (mach_o_i386_segsec_names_xlat): Likewise. (bfd_mach_o_tgt_seg_table): Use new tables. * mach-o-x86-64.c (bfd_mach_o_tgt_seg_table): Set NULL. * mach-o.c (mach_o_section_name_xlat, mach_o_segment_name_xlat): Move to mach-o.h as typedefs. (text_section_names_xlat): Update for current GCC usage. (data_section_names_xlat): Likewise. (dwarf_section_names_xlat): Likewise. (objc_section_names_xlat): New table. (segsec_names_xlat): Add objc table. (bfd_mach_o_normalize_section_name): Replace with... (bfd_mach_o_section_data_for_mach_sect): New. (bfd_mach_o_section_data_for_bfd_name): New. (bfd_mach_o_section_data_for_bfd_name): Update to use additional data. (bfd_mach_o_convert_section_name_to_mach_o): Likewise. (bfd_mach_o_bfd_copy_private_section_data): Implement. (bfd_mach_o_write_symtab): Write a zero-length string as the first entry for compatibility with system tools. (bfd_mach_o_build_commands): Update section alignment info. (bfd_mach_o_new_section_hook): Use translation table data to define default section flags, type, attributes and alignment, when available. (bfd_mach_o_init_section_from_mach_o): Add TODO comment. (bfd_mach_o_section_type_name): Add 'symbol_stubs'. (bfd_mach_o_section_attribute_name): Add 'self_modifying_code'. (bfd_mach_o_get_section_type_from_name): Change "not-found" return value. (bfd_mach_o_tgt_seg_table): Set default NULL. * mach-o.h (bfd_mach_o_segment_command): Use define for name length. (bfd_mach_o_backend_data): Move until after contents are defined. (bfd_mach_o_normalize_section_name): Remove. (bfd_mach_o_convert_section_name_to_bfd): Declare. (mach_o_section_name_xlat): Declare. (mach_o_segment_name_xlat): Declare. (bfd_mach_o_section_data_for_mach_sect): Declare. (bfd_mach_o_section_data_for_bfd_name): Declare. include/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o/loader.h (bfd_mach_o_section_type): define BFD_MACH_O_S_ATTR_NONE to 0. gas/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * config/obj-macho.c: Add some more top-level comments. (collect_16char_name): New. (obj_mach_o_section): Amend to allow syntax compatible with existing system tools. Use section translation data when available. (obj_mach_o_segT_from_bfd_name): New. (known_sections): Update. (obj_mach_o_known_section): Use obj_mach_o_segT_from_bfd_name. (objc_sections): New. (obj_mach_o_objc_section): New. (debug_sections): New. (obj_mach_o_debug_section): New. (tgt_sections): New. (obj_mach_o_opt_tgt_section): New. (obj_mach_o_base_section): New. (obj_mach_o_common_parse): Update to create BSS on demand and to handle lcomm optional alignment param. (obj_mach_o_comm): Update parameter name. (obj_mach_o_placeholder): New. (mach_o_pseudo_table): Update for GCC section directives. * config/obj-macho.h (_OBJ_MACH_O_H): New. (USE_ALIGN_PTWO): Define. (S_SET_ALIGN) Define.
2011-12-14 11:30:09 +01:00
void bfd_mach_o_convert_section_name_to_bfd (bfd *, const char *, const char *,
const char **, flagword *);
Merge bfd_find_nearest_line variants When bfd_find_nearest_line_discriminator was added, not enough care was taken to ensure all targets had a proper definition of the function. This patch cures that by merging bfd_find_nearest_line_discriminator and bfd_find_nearest_line target implementations. PR 17481 * aoutx.h (NAME (aout, find_nearest_line)): Add "discriminator_ptr" param, group "section" and "offset" params. Zero discriminator. * bfd.c (bfd_find_nearest_line): Implement with new _bfd_find_nearest_line. (bfd_find_nearest_line_discriminator): Likewise. * coff-i386.c (_bfd_generic_find_nearest_line_discriminator): Don't define. * coff-rs6000.c (xcoff_find_nearest_line, xcoff_find_nearest_line_discriminator): Delete. (_bfd_xcoff_find_nearest_line): Don't define. (_bfd_xcoff_find_nearest_line): Define as coff_find_nearest_line. * coff-x86_64.c (_bfd_generic_find_nearest_line_discriminator): Don't define. * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Adjust. * coffgen.c (coff_find_nearest_line_with_names): Reorder params, adjust _bfd_dwarf2_find_nearest_line call. (coff_find_nearest_line): Add "discriminator_ptr" param, reorder others. Set discriminator. Adjust call. (coff_find_nearest_line_discriminator): Delete. * dwarf1.c (_bfd_dwarf1_find_nearest_line): Reorder params. * dwarf2.c (find_line): Rename to.. (_bfd_dwarf2_find_nearest_line): ..this, reordering params. Simplify setting of do_line. Delete old function. (_bfd_dwarf2_find_line): Delete. * ecoff.c (_bfd_ecoff_find_nearest_line): Reorder params, add discriminator_ptr and set it. * elf-bfd.h (_bfd_elf_find_nearest_line): Update prototype. (_bfd_elf_find_nearest_line_discriminator): Delete. (_bfd_elf_find_line_discriminator): Delete. (_bfd_generic_find_nearest_line_discriminator): Don't define. * elf.c (elf_find_function): Reorder params. (_bfd_elf_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. (_bfd_elf_find_nearest_line_discriminator): Delete. (_bfd_elf_find_line): Adjust call. * elf32-arm.c (arm_elf_find_function): Reorder params. (elf32_arm_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. * elf64-alpha.c (elf64_alpha_find_nearest_line): Similarly. * elfnn-aarch64.c (aarch64_elf_find_function): Reorder params. (elfNN_aarch64_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Similarly. * elfxx-mips.h (_bfd_mips_elf_find_nearest_line): Update prototype. * libaout.h (NAME (aout, find_nearest_line)): Update prototype. * libbfd-in.h (_bfd_nosymbols_find_nearest_line): Update. (_bfd_dwarf1_find_nearest_line): Likewise. (_bfd_dwarf2_find_nearest_line): Likewise. (_bfd_dwarf2_find_line): Delete. (_bfd_generic_find_nearest_line_discriminator): Delete. * libbfd.c (_bfd_generic_find_nearest_line_discriminator): Delete. * libcoff-in.h (coff_find_nearest_line): Update prototype. (coff_find_nearest_line_discriminator): Delete. (coff_find_nearest_line_with_names): Update prototype. * libecoff.h (_bfd_ecoff_find_nearest_line): Update prototype. * mach-o.c (bfd_mach_o_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. * mach-o.h (bfd_mach_o_find_nearest_line): Update prototype. * pdp11.c (NAME (aout, find_nearest_line)): Reorder params, add discriminator_ptr and set. * som.c (som_find_nearest_line): Similarly. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Delete entry for _bfd_find_nearest_line_discriminator. (struct bfd_target <_bfd_find_nearest_line>): Adjust prototype. (struct bfd_target <_bfd_find_nearest_line_discriminator>): Delete. * vms-alpha.c (_bfd_vms_find_nearest_dst_line): Rename to.. (_bfd_vms_find_nearest_line): ..this. Reorder params, add "discriminator" and set. (_bfd_vms_find_nearest_line_discriminator): Delete. (_bfd_generic_find_nearest_line_discriminator): Don't define. (alpha_vms_find_nearest_line): Update define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2014-10-15 13:22:20 +02:00
bfd_boolean bfd_mach_o_find_nearest_line (bfd *, asymbol **,
asection *, bfd_vma,
const char **, const char **,
unsigned int *, unsigned int *);
Define bfd_find_line entry of BFD_JUMP_TABLE_SYMBOLS using NAME. In https://www.sourceware.org/ml/binutils/2005-06/msg00082.html HJ implemented bfd_find_line for DWARF2, but cheated a little in not using the usual NAME##_find_line, saving quite a lot of boring editing. However that shortcut probably contributed to bfd_find_nearest_line_discriminator being implemented the same way, and missing support for some targets. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Use NAME##_find_line. * aout-adobe.c (aout_32_find_line): Define. (aout_32_bfd_make_debug_symbol, aout_32_bfd_reloc_type_lookup, aout_32_bfd_reloc_name_lookup): Define using _bfd_nosymbols define. * aout-target.h (MY_find_line): Define. * aout-tic30.c (MY_find_line): Define. * binary.c (binary_find_line): Define. * bout.c (aout_32_find_line): Define. * coff-rs6000.c (_bfd_xcoff_find_line): Define. * coff64-rs6000.c (rs6000_xcoff64_vec): Use coff_find_line. (rs6000_xcoff64_aix_vec): Likewise. * elf-bfd.h (_bfd_generic_find_line): Don't define. * elfxx-target.h (bfd_elfNN_find_line): Define. * i386msdos.c (msdos_find_line): Define. * i386os9k.c (aout_32_find_line): Define. * ieee.c (ieee_find_nearest_line, ieee_find_inliner_info): Delete func. (ieee_find_nearest_line, ieee_find_line, ieee_find_inliner_info): Define. * ihex.c (ihex_find_line): Define. * libbfd-in.h (_bfd_nosymbols_find_line): Define. (_bfd_generic_find_line): Don't define. * libbfd.c (_bfd_generic_find_line): Delete. * libcoff-in.h (coff_find_line): Define. * libecoff.h (_bfd_ecoff_find_line): Define. * mach-o.h (bfd_mach_o_find_line): Define. * mmo.c (mmo_find_line): Define. * nlm-target.h (nlm_find_line): Define. * oasys.c (oasys_find_nearest_line, oasys_find_inliner_info): Delete. (oasys_find_nearest_line, oasys_find_line, oasys_find_inliner_info): Define. * pef.c (bfd_pef_find_line): Define. * plugin.c (bfd_plugin_find_line): Define. * ppcboot.c (ppcboot_find_line): Define. * som.c (som_find_line): Define. * srec.c (srec_find_line): Define. * tekhex.c (tekhex_find_line): Define. * versados.c (versados_find_line): Define. * vms-alpha.c (alpha_vms_find_line): Define. * xsym.c (bfd_sym_find_line): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2014-10-15 07:10:45 +02:00
#define bfd_mach_o_find_line _bfd_nosymbols_find_line
bfd_boolean bfd_mach_o_close_and_cleanup (bfd *);
bfd_boolean bfd_mach_o_free_cached_info (bfd *);
bfd/ 2011-12-13 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_read_symtab_symbols): Make global. Remove prototype. (bfd_mach_o_section_get_entry_size): Make global. (bfd_mach_o_section_get_nbr_indirect): Likewise. (bfd_mach_o_read_symtab_strtab): Likewise. (struct bfd_mach_o_xlat_name): Move to mach-o.h (bfd_mach_o_print_flags): Move to binutils/od-macho.c (bfd_mach_o_get_name_of_null, bfd_mach_o_get_name): Likewise. (bfd_mach_o_cpu_name, bfd_mach_o_filetype_name): Likewise. (bfd_mach_o_header_flags_name): Likewise. (bfd_mach_o_load_command_name): Likewise. (bfd_mach_o_print_private_header): Likewise. (bfd_mach_o_print_section_map, bfd_mach_o_print_section): Likwise. (bfd_mach_o_print_segment, bfd_mach_o_print_dysymtab): Likewise. (bfd_mach_o_print_dyld_info): Likewise. (bfd_mach_o_print_private_bfd_data): Remove. (bfd_mach_o_type_name): Make global. (bfd_mach_o_section_attribute_name): Likewise. * mach-o.h (bfd_mach_o_xlat_name): Added. (bfd_mach_o_section_get_nbr_indirect) (bfd_mach_o_section_get_entry_size) (bfd_mach_o_read_symtab_symbols) (bfd_mach_o_read_symtab_strtab) (bfd_mach_o_section_attribute_name) (bfd_mach_o_section_type_name): Likewise. * mach-o-target.c (bfd_mach_o_bfd_print_private_bfd_data): Define. binutils/ 2011-12-13 Tristan Gingold <gingold@adacore.com> * od-macho.c: New file. * objdump.h (objdump_private_desc_mach_o): Add. * configure.in: Add Mach-O od_vectors. * Makefile.am (CFILES): Add od-macho.c * configure: Regenerate. * Makefile.in: Regenerate.
2011-12-13 10:13:15 +01:00
unsigned int bfd_mach_o_section_get_nbr_indirect (bfd *, bfd_mach_o_section *);
unsigned int bfd_mach_o_section_get_entry_size (bfd *, bfd_mach_o_section *);
bfd_boolean bfd_mach_o_read_symtab_symbols (bfd *);
bfd_boolean bfd_mach_o_read_symtab_strtab (bfd *abfd);
bfd_vma bfd_mach_o_get_base_address (bfd *);
void bfd_mach_o_swap_in_non_scattered_reloc (bfd *, bfd_mach_o_reloc_info *,
unsigned char *);
bfd_boolean bfd_mach_o_canonicalize_non_scattered_reloc (bfd *, bfd_mach_o_reloc_info *, arelent *, asymbol **);
bfd_boolean bfd_mach_o_pre_canonicalize_one_reloc (bfd *, struct mach_o_reloc_info_external *, bfd_mach_o_reloc_info *, arelent *, asymbol **);
/* A placeholder in case we need to suppress emitting the dysymtab for some
reason (e.g. compatibility with older system versions). */
#define bfd_mach_o_should_emit_dysymtab(x) TRUE
bfd/ 2011-12-13 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_read_symtab_symbols): Make global. Remove prototype. (bfd_mach_o_section_get_entry_size): Make global. (bfd_mach_o_section_get_nbr_indirect): Likewise. (bfd_mach_o_read_symtab_strtab): Likewise. (struct bfd_mach_o_xlat_name): Move to mach-o.h (bfd_mach_o_print_flags): Move to binutils/od-macho.c (bfd_mach_o_get_name_of_null, bfd_mach_o_get_name): Likewise. (bfd_mach_o_cpu_name, bfd_mach_o_filetype_name): Likewise. (bfd_mach_o_header_flags_name): Likewise. (bfd_mach_o_load_command_name): Likewise. (bfd_mach_o_print_private_header): Likewise. (bfd_mach_o_print_section_map, bfd_mach_o_print_section): Likwise. (bfd_mach_o_print_segment, bfd_mach_o_print_dysymtab): Likewise. (bfd_mach_o_print_dyld_info): Likewise. (bfd_mach_o_print_private_bfd_data): Remove. (bfd_mach_o_type_name): Make global. (bfd_mach_o_section_attribute_name): Likewise. * mach-o.h (bfd_mach_o_xlat_name): Added. (bfd_mach_o_section_get_nbr_indirect) (bfd_mach_o_section_get_entry_size) (bfd_mach_o_read_symtab_symbols) (bfd_mach_o_read_symtab_strtab) (bfd_mach_o_section_attribute_name) (bfd_mach_o_section_type_name): Likewise. * mach-o-target.c (bfd_mach_o_bfd_print_private_bfd_data): Define. binutils/ 2011-12-13 Tristan Gingold <gingold@adacore.com> * od-macho.c: New file. * objdump.h (objdump_private_desc_mach_o): Add. * configure.in: Add Mach-O od_vectors. * Makefile.am (CFILES): Add od-macho.c * configure: Regenerate. * Makefile.in: Regenerate.
2011-12-13 10:13:15 +01:00
extern const bfd_mach_o_xlat_name bfd_mach_o_section_attribute_name[];
extern const bfd_mach_o_xlat_name bfd_mach_o_section_type_name[];
2002-11-06 14:26:29 +01:00
extern const bfd_target mach_o_fat_vec;
bfd/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o-i386.c (text_section_names_xlat): New table. (data_section_names_xlat): Likewise. (import_section_names_xlat): Likewise. (mach_o_i386_segsec_names_xlat): Likewise. (bfd_mach_o_tgt_seg_table): Use new tables. * mach-o-x86-64.c (bfd_mach_o_tgt_seg_table): Set NULL. * mach-o.c (mach_o_section_name_xlat, mach_o_segment_name_xlat): Move to mach-o.h as typedefs. (text_section_names_xlat): Update for current GCC usage. (data_section_names_xlat): Likewise. (dwarf_section_names_xlat): Likewise. (objc_section_names_xlat): New table. (segsec_names_xlat): Add objc table. (bfd_mach_o_normalize_section_name): Replace with... (bfd_mach_o_section_data_for_mach_sect): New. (bfd_mach_o_section_data_for_bfd_name): New. (bfd_mach_o_section_data_for_bfd_name): Update to use additional data. (bfd_mach_o_convert_section_name_to_mach_o): Likewise. (bfd_mach_o_bfd_copy_private_section_data): Implement. (bfd_mach_o_write_symtab): Write a zero-length string as the first entry for compatibility with system tools. (bfd_mach_o_build_commands): Update section alignment info. (bfd_mach_o_new_section_hook): Use translation table data to define default section flags, type, attributes and alignment, when available. (bfd_mach_o_init_section_from_mach_o): Add TODO comment. (bfd_mach_o_section_type_name): Add 'symbol_stubs'. (bfd_mach_o_section_attribute_name): Add 'self_modifying_code'. (bfd_mach_o_get_section_type_from_name): Change "not-found" return value. (bfd_mach_o_tgt_seg_table): Set default NULL. * mach-o.h (bfd_mach_o_segment_command): Use define for name length. (bfd_mach_o_backend_data): Move until after contents are defined. (bfd_mach_o_normalize_section_name): Remove. (bfd_mach_o_convert_section_name_to_bfd): Declare. (mach_o_section_name_xlat): Declare. (mach_o_segment_name_xlat): Declare. (bfd_mach_o_section_data_for_mach_sect): Declare. (bfd_mach_o_section_data_for_bfd_name): Declare. include/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o/loader.h (bfd_mach_o_section_type): define BFD_MACH_O_S_ATTR_NONE to 0. gas/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * config/obj-macho.c: Add some more top-level comments. (collect_16char_name): New. (obj_mach_o_section): Amend to allow syntax compatible with existing system tools. Use section translation data when available. (obj_mach_o_segT_from_bfd_name): New. (known_sections): Update. (obj_mach_o_known_section): Use obj_mach_o_segT_from_bfd_name. (objc_sections): New. (obj_mach_o_objc_section): New. (debug_sections): New. (obj_mach_o_debug_section): New. (tgt_sections): New. (obj_mach_o_opt_tgt_section): New. (obj_mach_o_base_section): New. (obj_mach_o_common_parse): Update to create BSS on demand and to handle lcomm optional alignment param. (obj_mach_o_comm): Update parameter name. (obj_mach_o_placeholder): New. (mach_o_pseudo_table): Update for GCC section directives. * config/obj-macho.h (_OBJ_MACH_O_H): New. (USE_ALIGN_PTWO): Define. (S_SET_ALIGN) Define.
2011-12-14 11:30:09 +01:00
/* Interfaces between BFD names and Mach-O names. */
typedef struct mach_o_section_name_xlat
{
const char *bfd_name;
const char *mach_o_name;
flagword bfd_flags;
unsigned int macho_sectype;
unsigned int macho_secattr;
unsigned int sectalign;
} mach_o_section_name_xlat;
typedef struct mach_o_segment_name_xlat
{
const char *segname;
const mach_o_section_name_xlat *sections;
} mach_o_segment_name_xlat;
const mach_o_section_name_xlat *
bfd_mach_o_section_data_for_mach_sect (bfd *, const char *, const char *);
const mach_o_section_name_xlat *
bfd_mach_o_section_data_for_bfd_name (bfd *, const char *, const char **);
typedef struct bfd_mach_o_backend_data
{
enum bfd_architecture arch;
bfd_vma page_size;
bfd_boolean (*_bfd_mach_o_canonicalize_one_reloc)
(bfd *, struct mach_o_reloc_info_external *, arelent *, asymbol **, arelent *);
bfd/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o-i386.c (text_section_names_xlat): New table. (data_section_names_xlat): Likewise. (import_section_names_xlat): Likewise. (mach_o_i386_segsec_names_xlat): Likewise. (bfd_mach_o_tgt_seg_table): Use new tables. * mach-o-x86-64.c (bfd_mach_o_tgt_seg_table): Set NULL. * mach-o.c (mach_o_section_name_xlat, mach_o_segment_name_xlat): Move to mach-o.h as typedefs. (text_section_names_xlat): Update for current GCC usage. (data_section_names_xlat): Likewise. (dwarf_section_names_xlat): Likewise. (objc_section_names_xlat): New table. (segsec_names_xlat): Add objc table. (bfd_mach_o_normalize_section_name): Replace with... (bfd_mach_o_section_data_for_mach_sect): New. (bfd_mach_o_section_data_for_bfd_name): New. (bfd_mach_o_section_data_for_bfd_name): Update to use additional data. (bfd_mach_o_convert_section_name_to_mach_o): Likewise. (bfd_mach_o_bfd_copy_private_section_data): Implement. (bfd_mach_o_write_symtab): Write a zero-length string as the first entry for compatibility with system tools. (bfd_mach_o_build_commands): Update section alignment info. (bfd_mach_o_new_section_hook): Use translation table data to define default section flags, type, attributes and alignment, when available. (bfd_mach_o_init_section_from_mach_o): Add TODO comment. (bfd_mach_o_section_type_name): Add 'symbol_stubs'. (bfd_mach_o_section_attribute_name): Add 'self_modifying_code'. (bfd_mach_o_get_section_type_from_name): Change "not-found" return value. (bfd_mach_o_tgt_seg_table): Set default NULL. * mach-o.h (bfd_mach_o_segment_command): Use define for name length. (bfd_mach_o_backend_data): Move until after contents are defined. (bfd_mach_o_normalize_section_name): Remove. (bfd_mach_o_convert_section_name_to_bfd): Declare. (mach_o_section_name_xlat): Declare. (mach_o_segment_name_xlat): Declare. (bfd_mach_o_section_data_for_mach_sect): Declare. (bfd_mach_o_section_data_for_bfd_name): Declare. include/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o/loader.h (bfd_mach_o_section_type): define BFD_MACH_O_S_ATTR_NONE to 0. gas/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * config/obj-macho.c: Add some more top-level comments. (collect_16char_name): New. (obj_mach_o_section): Amend to allow syntax compatible with existing system tools. Use section translation data when available. (obj_mach_o_segT_from_bfd_name): New. (known_sections): Update. (obj_mach_o_known_section): Use obj_mach_o_segT_from_bfd_name. (objc_sections): New. (obj_mach_o_objc_section): New. (debug_sections): New. (obj_mach_o_debug_section): New. (tgt_sections): New. (obj_mach_o_opt_tgt_section): New. (obj_mach_o_base_section): New. (obj_mach_o_common_parse): Update to create BSS on demand and to handle lcomm optional alignment param. (obj_mach_o_comm): Update parameter name. (obj_mach_o_placeholder): New. (mach_o_pseudo_table): Update for GCC section directives. * config/obj-macho.h (_OBJ_MACH_O_H): New. (USE_ALIGN_PTWO): Define. (S_SET_ALIGN) Define.
2011-12-14 11:30:09 +01:00
bfd_boolean (*_bfd_mach_o_swap_reloc_out)(arelent *, bfd_mach_o_reloc_info *);
bfd_boolean (*_bfd_mach_o_print_thread)(bfd *, bfd_mach_o_thread_flavour *,
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
void *, char *);
bfd/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o-i386.c (text_section_names_xlat): New table. (data_section_names_xlat): Likewise. (import_section_names_xlat): Likewise. (mach_o_i386_segsec_names_xlat): Likewise. (bfd_mach_o_tgt_seg_table): Use new tables. * mach-o-x86-64.c (bfd_mach_o_tgt_seg_table): Set NULL. * mach-o.c (mach_o_section_name_xlat, mach_o_segment_name_xlat): Move to mach-o.h as typedefs. (text_section_names_xlat): Update for current GCC usage. (data_section_names_xlat): Likewise. (dwarf_section_names_xlat): Likewise. (objc_section_names_xlat): New table. (segsec_names_xlat): Add objc table. (bfd_mach_o_normalize_section_name): Replace with... (bfd_mach_o_section_data_for_mach_sect): New. (bfd_mach_o_section_data_for_bfd_name): New. (bfd_mach_o_section_data_for_bfd_name): Update to use additional data. (bfd_mach_o_convert_section_name_to_mach_o): Likewise. (bfd_mach_o_bfd_copy_private_section_data): Implement. (bfd_mach_o_write_symtab): Write a zero-length string as the first entry for compatibility with system tools. (bfd_mach_o_build_commands): Update section alignment info. (bfd_mach_o_new_section_hook): Use translation table data to define default section flags, type, attributes and alignment, when available. (bfd_mach_o_init_section_from_mach_o): Add TODO comment. (bfd_mach_o_section_type_name): Add 'symbol_stubs'. (bfd_mach_o_section_attribute_name): Add 'self_modifying_code'. (bfd_mach_o_get_section_type_from_name): Change "not-found" return value. (bfd_mach_o_tgt_seg_table): Set default NULL. * mach-o.h (bfd_mach_o_segment_command): Use define for name length. (bfd_mach_o_backend_data): Move until after contents are defined. (bfd_mach_o_normalize_section_name): Remove. (bfd_mach_o_convert_section_name_to_bfd): Declare. (mach_o_section_name_xlat): Declare. (mach_o_segment_name_xlat): Declare. (bfd_mach_o_section_data_for_mach_sect): Declare. (bfd_mach_o_section_data_for_bfd_name): Declare. include/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o/loader.h (bfd_mach_o_section_type): define BFD_MACH_O_S_ATTR_NONE to 0. gas/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * config/obj-macho.c: Add some more top-level comments. (collect_16char_name): New. (obj_mach_o_section): Amend to allow syntax compatible with existing system tools. Use section translation data when available. (obj_mach_o_segT_from_bfd_name): New. (known_sections): Update. (obj_mach_o_known_section): Use obj_mach_o_segT_from_bfd_name. (objc_sections): New. (obj_mach_o_objc_section): New. (debug_sections): New. (obj_mach_o_debug_section): New. (tgt_sections): New. (obj_mach_o_opt_tgt_section): New. (obj_mach_o_base_section): New. (obj_mach_o_common_parse): Update to create BSS on demand and to handle lcomm optional alignment param. (obj_mach_o_comm): Update parameter name. (obj_mach_o_placeholder): New. (mach_o_pseudo_table): Update for GCC section directives. * config/obj-macho.h (_OBJ_MACH_O_H): New. (USE_ALIGN_PTWO): Define. (S_SET_ALIGN) Define.
2011-12-14 11:30:09 +01:00
const mach_o_segment_name_xlat *segsec_names_xlat;
bfd_boolean (*bfd_mach_o_section_type_valid_for_target) (unsigned long);
bfd/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o-i386.c (text_section_names_xlat): New table. (data_section_names_xlat): Likewise. (import_section_names_xlat): Likewise. (mach_o_i386_segsec_names_xlat): Likewise. (bfd_mach_o_tgt_seg_table): Use new tables. * mach-o-x86-64.c (bfd_mach_o_tgt_seg_table): Set NULL. * mach-o.c (mach_o_section_name_xlat, mach_o_segment_name_xlat): Move to mach-o.h as typedefs. (text_section_names_xlat): Update for current GCC usage. (data_section_names_xlat): Likewise. (dwarf_section_names_xlat): Likewise. (objc_section_names_xlat): New table. (segsec_names_xlat): Add objc table. (bfd_mach_o_normalize_section_name): Replace with... (bfd_mach_o_section_data_for_mach_sect): New. (bfd_mach_o_section_data_for_bfd_name): New. (bfd_mach_o_section_data_for_bfd_name): Update to use additional data. (bfd_mach_o_convert_section_name_to_mach_o): Likewise. (bfd_mach_o_bfd_copy_private_section_data): Implement. (bfd_mach_o_write_symtab): Write a zero-length string as the first entry for compatibility with system tools. (bfd_mach_o_build_commands): Update section alignment info. (bfd_mach_o_new_section_hook): Use translation table data to define default section flags, type, attributes and alignment, when available. (bfd_mach_o_init_section_from_mach_o): Add TODO comment. (bfd_mach_o_section_type_name): Add 'symbol_stubs'. (bfd_mach_o_section_attribute_name): Add 'self_modifying_code'. (bfd_mach_o_get_section_type_from_name): Change "not-found" return value. (bfd_mach_o_tgt_seg_table): Set default NULL. * mach-o.h (bfd_mach_o_segment_command): Use define for name length. (bfd_mach_o_backend_data): Move until after contents are defined. (bfd_mach_o_normalize_section_name): Remove. (bfd_mach_o_convert_section_name_to_bfd): Declare. (mach_o_section_name_xlat): Declare. (mach_o_segment_name_xlat): Declare. (bfd_mach_o_section_data_for_mach_sect): Declare. (bfd_mach_o_section_data_for_bfd_name): Declare. include/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o/loader.h (bfd_mach_o_section_type): define BFD_MACH_O_S_ATTR_NONE to 0. gas/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * config/obj-macho.c: Add some more top-level comments. (collect_16char_name): New. (obj_mach_o_section): Amend to allow syntax compatible with existing system tools. Use section translation data when available. (obj_mach_o_segT_from_bfd_name): New. (known_sections): Update. (obj_mach_o_known_section): Use obj_mach_o_segT_from_bfd_name. (objc_sections): New. (obj_mach_o_objc_section): New. (debug_sections): New. (obj_mach_o_debug_section): New. (tgt_sections): New. (obj_mach_o_opt_tgt_section): New. (obj_mach_o_base_section): New. (obj_mach_o_common_parse): Update to create BSS on demand and to handle lcomm optional alignment param. (obj_mach_o_comm): Update parameter name. (obj_mach_o_placeholder): New. (mach_o_pseudo_table): Update for GCC section directives. * config/obj-macho.h (_OBJ_MACH_O_H): New. (USE_ALIGN_PTWO): Define. (S_SET_ALIGN) Define.
2011-12-14 11:30:09 +01:00
}
bfd_mach_o_backend_data;
add symbol qualifiers for mach-o to bfd/gas bfd: * mach-o.c (bfd_mach_o_bfd_copy_private_symbol_data): Implement. (bfd_mach_o_write_symtab): Remove handling for indirect syms. (bfd_mach_o_primary_symbol_sort_key): Likewise. (bfd_mach_o_cf_symbols): Likewise. (bfd_mach_o_sort_symbol_table): Remove. (bfd_mach_o_mangle_symbols): Adjust arguments, remove handling for indirect and dysymtab counts. Do the symbol sorting here. (bfd_mach_o_build_dysymtab_command): Count the symbol types here. Make the indirect symbols a TODO. (bfd_mach_o_build_commands): Adjust call to bfd_mach_o_mangle_symbols. (bfd_mach_o_make_empty_symbol): Specifically flag unset symbols with a non-zero value. (bfd_mach_o_read_symtab_symbol): Record the symbol index. (bfd_mach_o_read_symtab_symbol): Adjust recording of global status. * mach-o.h (mach_o_data_struct): Remove indirect and dysymtab entries. (IS_MACHO_INDIRECT): Remove. (SYM_MACHO_FIELDS_UNSET, SYM_MACHO_FIELDS_NOT_VALIDATED): New. gas: * config/obj-macho.c (obj_mach_o_weak): Remove. (obj_mach_o_common_parse): Set symbol qualifiers. (LAZY, REFE): New macros. (obj_mach_o_symbol_type): New enum. (obj_mach_o_set_symbol_qualifier): New. (obj_mach_o_sym_qual): New. (mach_o_pseudo_table): Add symbol qualifiers, set indirect_symbol to a dummy function. (obj_mach_o_type_for_symbol): New. (obj_macho_frob_label): New. (obj_macho_frob_symbol): New. * config/obj-macho.h (S_SET_ALIGN): Amend temorary var name. (obj_frob_label, obj_macho_frob_label): Declare. (obj_frob_symbol, obj_macho_frob_symbol): Declare. gas/testsuite: * gas/mach-o/err-syms-1.s: New. * gas/mach-o/err-syms-2.s: New. * gas/mach-o/err-syms-3.s: New. * gas/mach-o/symbols-2.d: New. * gas/mach-o/symbols-2.s: New. * gas/mach-o/symbols-3.s: New. * gas/mach-o/symbols-4.s: New. * gas/mach-o/symbols-5.d: New. * gas/mach-o/symbols-5.s: New.
2012-01-09 11:47:50 +01:00
/* Values used in symbol.udata.i, to signal that the mach-o-specific data in the
symbol are not yet set, or need validation (where this is possible). */
add symbol qualifiers for mach-o to bfd/gas bfd: * mach-o.c (bfd_mach_o_bfd_copy_private_symbol_data): Implement. (bfd_mach_o_write_symtab): Remove handling for indirect syms. (bfd_mach_o_primary_symbol_sort_key): Likewise. (bfd_mach_o_cf_symbols): Likewise. (bfd_mach_o_sort_symbol_table): Remove. (bfd_mach_o_mangle_symbols): Adjust arguments, remove handling for indirect and dysymtab counts. Do the symbol sorting here. (bfd_mach_o_build_dysymtab_command): Count the symbol types here. Make the indirect symbols a TODO. (bfd_mach_o_build_commands): Adjust call to bfd_mach_o_mangle_symbols. (bfd_mach_o_make_empty_symbol): Specifically flag unset symbols with a non-zero value. (bfd_mach_o_read_symtab_symbol): Record the symbol index. (bfd_mach_o_read_symtab_symbol): Adjust recording of global status. * mach-o.h (mach_o_data_struct): Remove indirect and dysymtab entries. (IS_MACHO_INDIRECT): Remove. (SYM_MACHO_FIELDS_UNSET, SYM_MACHO_FIELDS_NOT_VALIDATED): New. gas: * config/obj-macho.c (obj_mach_o_weak): Remove. (obj_mach_o_common_parse): Set symbol qualifiers. (LAZY, REFE): New macros. (obj_mach_o_symbol_type): New enum. (obj_mach_o_set_symbol_qualifier): New. (obj_mach_o_sym_qual): New. (mach_o_pseudo_table): Add symbol qualifiers, set indirect_symbol to a dummy function. (obj_mach_o_type_for_symbol): New. (obj_macho_frob_label): New. (obj_macho_frob_symbol): New. * config/obj-macho.h (S_SET_ALIGN): Amend temorary var name. (obj_frob_label, obj_macho_frob_label): Declare. (obj_frob_symbol, obj_macho_frob_symbol): Declare. gas/testsuite: * gas/mach-o/err-syms-1.s: New. * gas/mach-o/err-syms-2.s: New. * gas/mach-o/err-syms-3.s: New. * gas/mach-o/symbols-2.d: New. * gas/mach-o/symbols-2.s: New. * gas/mach-o/symbols-3.s: New. * gas/mach-o/symbols-4.s: New. * gas/mach-o/symbols-5.d: New. * gas/mach-o/symbols-5.s: New.
2012-01-09 11:47:50 +01:00
#define SYM_MACHO_FIELDS_UNSET ((bfd_vma) -1)
#define SYM_MACHO_FIELDS_NOT_VALIDATED ((bfd_vma) -2)
#ifdef __cplusplus
}
#endif
2002-11-06 14:26:29 +01:00
#endif /* _BFD_MACH_O_H_ */