mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
15e1c58a0e
* 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.
123 lines
3.6 KiB
C
123 lines
3.6 KiB
C
/* Mach-O support for BFD.
|
|
Copyright 1999, 2000, 2001, 2002, 2007
|
|
Free Software Foundation, Inc.
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
MA 02110-1301, USA. */
|
|
|
|
#ifndef TARGET_NAME
|
|
#error TARGET_NAME must be defined
|
|
#endif /* TARGET_NAME */
|
|
|
|
#ifndef TARGET_STRING
|
|
#error TARGET_STRING must be defined
|
|
#endif /* TARGET_STRING */
|
|
|
|
#ifndef TARGET_BIG_ENDIAN
|
|
#error TARGET_BIG_ENDIAN must be defined
|
|
#endif /* TARGET_BIG_ENDIAN */
|
|
|
|
#ifndef TARGET_ARCHIVE
|
|
#error TARGET_ARCHIVE must be defined
|
|
#endif /* TARGET_ARCHIVE */
|
|
|
|
#if ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN))
|
|
#error Mach-O fat files must always be big-endian.
|
|
#endif /* ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) */
|
|
|
|
const bfd_target TARGET_NAME =
|
|
{
|
|
TARGET_STRING, /* Name. */
|
|
bfd_target_mach_o_flavour,
|
|
#if TARGET_BIG_ENDIAN
|
|
BFD_ENDIAN_BIG, /* Target byte order. */
|
|
BFD_ENDIAN_BIG, /* Target headers byte order. */
|
|
#else
|
|
BFD_ENDIAN_LITTLE, /* Target byte order. */
|
|
BFD_ENDIAN_LITTLE, /* Target headers byte order. */
|
|
#endif
|
|
(HAS_RELOC | EXEC_P | /* Object flags. */
|
|
HAS_LINENO | HAS_DEBUG |
|
|
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
|
(SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
|
|
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
|
|
'_', /* symbol_leading_char. */
|
|
' ', /* ar_pad_char. */
|
|
16, /* ar_max_namelen. */
|
|
|
|
#if TARGET_BIG_ENDIAN
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */
|
|
#else
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
|
#endif /* TARGET_BIG_ENDIAN */
|
|
|
|
{ /* bfd_check_format. */
|
|
#if TARGET_ARCHIVE
|
|
_bfd_dummy_target,
|
|
_bfd_dummy_target,
|
|
bfd_mach_o_archive_p,
|
|
_bfd_dummy_target,
|
|
#else
|
|
_bfd_dummy_target,
|
|
bfd_mach_o_object_p,
|
|
bfd_generic_archive_p,
|
|
bfd_mach_o_core_p
|
|
#endif
|
|
},
|
|
{ /* bfd_set_format. */
|
|
bfd_false,
|
|
bfd_mach_o_mkobject,
|
|
_bfd_generic_mkarchive,
|
|
bfd_mach_o_mkobject,
|
|
},
|
|
{ /* bfd_write_contents. */
|
|
bfd_false,
|
|
bfd_mach_o_write_contents,
|
|
_bfd_write_archive_contents,
|
|
bfd_mach_o_write_contents,
|
|
},
|
|
|
|
BFD_JUMP_TABLE_GENERIC (bfd_mach_o),
|
|
BFD_JUMP_TABLE_COPY (bfd_mach_o),
|
|
BFD_JUMP_TABLE_CORE (bfd_mach_o),
|
|
#if TARGET_ARCHIVE
|
|
BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o),
|
|
#else
|
|
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
|
|
#endif
|
|
BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o),
|
|
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
|
BFD_JUMP_TABLE_WRITE (bfd_mach_o),
|
|
BFD_JUMP_TABLE_LINK (bfd_mach_o),
|
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
};
|
|
|