summaryrefslogtreecommitdiff
path: root/bfd/mach-o.c
Commit message (Collapse)AuthorAgeFilesLines
* * mach-o.c (mach_o_section_name_xlat dw): Add entry forNick Clifton2013-07-181-0/+3
| | | | .debug_gdb_scripts
* * coffcode.h: Added a cast to void when a bfd_set_section_*()Nick Clifton2013-04-171-4/+2
| | | | | | | | | | | | | | macro's return value is ignored. * elf32-hppa.c: Likewise. * elf32-tic6x.c: Likewise. * mach-o.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * peicode.h: Likewise. * elf32-m32r.c: Check return value of bfd_set_section_*(). * elfnn-ia64.c: Likewise. * elfxx-mips.c: Likewise. * vms-alpha.c: Likewise.
* 2013-02-04 Tristan Gingold <gingold@adacore.com>Tristan Gingold2013-02-041-1/+2
| | | | | * mach-o.c (bfd_mach_o_scan_start_address): Do not fail if no start address.
* 2013-01-31 Tristan Gingold <gingold@adacore.com>Tristan Gingold2013-01-311-2/+15
| | | | | | * mach-o.c (bfd_mach_o_scan): Call bfd_mach_o_flatten_sections earlier. Fix status checking of bfd_mach_o_scan_start_address. (bfd_mach_o_scan_start_address): Handle LC_MAIN.
* * bfd.c (struct bfd_preserve, bfd_preserve_save, bfd_preserve_restore,Alan Modra2013-01-261-10/+4
| | | | | | | | | | | | | | | | | bfd_preserve_finish): Move to.. * format.c: ..here, splitting out.. (bfd_reinit): ..this. New function. (bfd_check_format_matches): Use bfd_preserve_save/restore to keep bfd state for a match. * elfcode.h (elf_object_p): Don't use bfd_preserve_save/restore. * elfcore.h (elf_core_file_p): Likewise. * mach-o.c (bfd_mach_o_header_p): Likewise. * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise. * xsym.c (bfd_sym_object_p): Likewise. * mmo.c (mmo_scan): Clear abfd->symcount. * opncls.c (_bfd_new_bfd): Use a smaller section hash table. * section.c (bfd_section_list_clear): Clear section_htab.count. * bfd-in2.h: Regenerate.
* Remove trailing white spaces in bfdH.J. Lu2013-01-101-56/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* bfd/Tristan Gingold2012-11-141-0/+52
| | | | | | | | | | | | | | | | | | | | 2012-11-14 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_read_main) (bfd_mach_o_read_source_version): New functions. (bfd_mach_o_read_command): Handle BFD_MACH_O_LC_DATA_IN_CODE, BFD_MACH_O_LC_DYLIB_CODE_SIGN_DRS, BFD_MACH_O_LC_MAIN, BFD_MACH_O_LC_SOURCE_VERSION. * mach-o.h (bfd_mach_o_main_command) (bfd_mach_o_source_version_command): New types. (bfd_mach_o_load_command): Add fields for these new types. binutils/ 2012-11-14 Tristan Gingold <gingold@adacore.com> * od-macho.c (bfd_mach_o_load_command_name): Add new definitions. (dump_load_command): Handle BFD_MACH_O_LC_SOURCE_VERSION and BFD_MACH_O_LC_MAIN.
* 2012-11-14 Tristan Gingold <gingold@adacore.com>Tristan Gingold2012-11-141-20/+30
| | | | | * mach-o.c (bfd_mach_o_canonicalize_one_reloc): Add a special handling for non-scattered pairs. Update comments.
* * mach-o.c (bfd_mach_o_close_and_cleanup): Don't callAlan Modra2012-11-061-0/+3
| | | | _bfd_generic_close_and_cleanup for mach_o_fat archives.
* * vms-lib.c (_bfd_vms_lib_get_module): Use bfd_zmalloc forTom Tromey2012-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | areltdata. * opncls.c (_bfd_delete_bfd): Free arelt_data. * mach-o.c (bfd_mach_o_fat_member_init): Use bfd_zmalloc for areltdata. * ecoff.c (_bfd_ecoff_slurp_armap): Use free for mapdata. * coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Use bfd_zmalloc for areltdata. (xcoff_write_archive_contents_old): Likewise. (xcoff_write_archive_contents_big): Likewise. * archive64.c (bfd_elf64_archive_slurp_armap): Use free for areltdata. * archive.c (_bfd_generic_read_ar_hdr_mag): Use bfd_zmalloc and free for areltdata. (_bfd_get_elt_at_filepos): Likewise. Clear n_nfd->arelt_data on failure. (do_slurp_bsd_armap): Use bfd_zmalloc and free for areltdata. (do_slurp_coff_armap): Likewise. (_bfd_slurp_extended_name_table): Likewise. (bfd_slurp_bsd_armap_f2): Likewise. Don't leak 'mapdata'.
* 2012-07-24 Teresa Johnson <tejohnson@google.com>Cary Coutant2012-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfd/ * bfd.c (bfd_find_nearest_line_discriminator): New macro. * coff-rs6000.c: Init _bfd_find_nearest_line_discriminator. * coff64-rs6000.c: Likewise. * dwarf2.c (struct line_info): Add discriminator field. (add_line_info): Fill in new discriminator field. (decode_line_info): Record discriminator information instead of ignoring it. (lookup_address_in_line_info_table): Return discriminator field if requested. (comp_unit_find_nearest_line): Add discriminator argument. (find_line): Likewise. (_bfd_dwarf2_find_nearest_line): Likewise. (_bfd_dwarf2_find_line): Likewise. * elf-bfd.h (_bfd_elf_find_nearest_line_discriminator): New. (_bfd_elf_find_line_discriminator): Likewise. (_bfd_generic_find_nearest_line_discriminator): Likewise. Defined. * elf.c (_bfd_elf_find_nearest_line): Change to a wrapper that invokes _bfd_elf_find_nearest_line_discriminator with correct arguments. (_bfd_elf_find_nearest_line_discriminator): New. (_bfd_elf_find_line): Change to a wrapper that invokes _bfd_elf_find_line_discriminator with correct arguments. (_bfd_elf_find_line_discriminator): New. * coffgen.c (coff_find_nearest_line_with_names): Handle new discriminator argument. * elf32-arm.c (elf32_arm_find_nearest_line): Likewise. * elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise. * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise. * mach-o.c (bfd_mach_o_find_nearest_line): Likewise. * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Add discriminator argument. (_bfd_dwarf2_find_line): Likewise. (_bfd_generic_find_nearest_line_discriminator): New. * libbfd.c (_bfd_generic_find_nearest_line_discriminator): New. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Initialize _bfd_find_nearest_line_discriminator with _bfd_generic_find_nearest_line_discriminator. (bfd_target): Add _bfd_find_nearest_line_discriminator. binutils/ * addr2line.c (find_address_in_section): Invoke bfd_find_nearest_line_discriminator to get the discriminator. (find_offset_in_section): Likewise. (translate_addresses): Print discriminator if it is non-zero. * objdump.c (show_line): Invoke bfd_find_nearest_line_discriminator to get the discriminator, and keep track of prev_discriminator. Print discriminator if it is non-zero. (disassemble_data): Initialize prev_discriminator. (dump_reloc_set): Invoke bfd_find_nearest_line_discriminator to get the discriminator, and keep track of last_discriminator. Print discriminator if it is non-zero.
* deal with endian-ness in mach-o non-scattered relocs.iains2012-02-231-30/+116
| | | | | | | | | | | | | | | | | | BFD: * mach-o.c (bfd_mach_o_swap_in_non_scattered_reloc): New. (bfd_mach_o_canonicalize_one_reloc): Swap non-scattered reloc bit-fields when target and host differ in endian-ness. When PAIRs are non-scattered find the 'symbol' from the preceding reloc. Add FIXME re. reloc symbols on section boundaries. (bfd_mach_o_swap_out_non_scattered_reloc): New. (bfd_mach_o_write_relocs): Use bfd_mach_o_encode_non_scattered_reloc. include/mach-o: * external.h: Add comments about relocations fields. Add macros for non-scattered relocations. Move scattered relocation macros to here. * reloc.h: Remove macros related to external representation of reloc fields.
* bfd:iains2012-02-101-11/+52
| | | | | * mach-o.c (bfd_mach_o_build_seg_command): Count zerofill section vma additions in their logical, rather than physical order.
* correct some mach-o section specification nits.iains2012-02-101-2/+2
| | | | | | | | | | | bfd: * mach-o.c (mach_o_section_name_xlat): Correct eh-frame section parameters. * mach-o-x86-64.c (text_section_names_xlat): New. (mach_o_x86_64_segsec_names_xlat): New. (bfd_mach_o_tgt_seg_table): Define to mach_o_x86_64_segsec_names_xlat. * mach-o-i386.c (text_section_names_xlat): Correct section parameters.
* bfd/Tristan Gingold2012-02-021-0/+2
| | | | | | | | | | | | | 2012-02-02 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_read_header): Silent uninitialized variable warning. gas/ 2012-02-02 Tristan Gingold <gingold@adacore.com> * config/obj-macho.c (obj_mach_o_zerofill): Silent uninitialized variable warning.
* handle absolute indirect syms in mach-oiains2012-01-131-0/+4
| | | | | | | | | | | | | | | | bfd: * mach-o.c (bfd_mach_o_build_dysymtab_command): Handle absolute indirect symbols. gas: * config/obj-macho.c (obj_mach_o_set_indirect_symbols): Handle absolute indirect symbols. gas/testsuite: * gas/mach-o/dysymtab-3.d: New. * gas/mach-o/symbols-7.s: New.
* order relocs after segments for mach-oiains2012-01-131-8/+19
| | | | | | | bfd: * mach-o.c (bfd_mach_o_write_relocs): Move compuation of relocs file position from here... to (bfd_mach_o_build_seg_command): Here.
* add indirect_symbol to mach-o port.iains2012-01-121-4/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfd: * mach-o.c (bfd_mach_o_count_indirect_symbols): New. (bfd_mach_o_build_dysymtab_command): Populate indirect symbol table. * mach-o.h (bfd_mach_o_asymbol): Move declaration to start of the file. (bfd_mach_o_section): Add indirect_syms field. gas: * config/obj-macho.c (obj_mach_o_set_symbol_qualifier): Switch off lazy when the symbol is private_extern. (obj_mach_o_indirect_sym): New type. (obj_mach_o_indirect_symbol): New. (mach_o_pseudo_table): Use obj_mach_o_indirect_symbol. (obj_macho_frob_label): Adjust to avoid adding bsyms for locals. (obj_macho_frob_label): Likewise. Adjust external and comm symbol tests. (obj_mach_o_set_indirect_symbols): New. (obj_mach_o_frob_file_after_relocs): New. *config/obj-macho.h (obj_frob_file_after_relocs): Define. (obj_mach_o_frob_file_after_relocs): Declare. include/mach-o: * loader.h (BFD_MACH_O_INDIRECT_SYM_LOCAL): New. (BFD_MACH_O_INDIRECT_SYM_ABS): New gas/testsuite: * gas/mach-o/dysymtab-2.d: New. * gas/mach-o/err-syms-4.s: New. * gas/mach-o/err-syms-5.s: New. * gas/mach-o/err-syms-6.s: New. * gas/mach-o/symbols-6-64.d: New. * gas/mach-o/symbols-6-64.s: New. * gas/mach-o/symbols-6.d: New. * gas/mach-o/symbols-6.s: New.
* bfd:iains2012-01-111-4/+16
| | | | | | * mach-o.c (bfd_mach_o_build_seg_command): Separate computation of vmsize from filesize. Don't compute offsets or file sizes for zerofill sections.
* bfd:iains2012-01-111-50/+76
| | | | | * mach-o.c (bfd_mach_o_build_commands): Make the building of each command type independent.
* 2012-01-10 Tristan Gingold <gingold@adacore.com>Tristan Gingold2012-01-101-1/+1
| | | | | * mach-o.c (bfd_mach_o_build_commands): Avoid uninitialized false warning.
* add symbol qualifiers for mach-o to bfd/gasiains2012-01-091-173/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-04 Tristan Gingold <gingold@adacore.com>Tristan Gingold2012-01-041-1/+21
| | | | | * mach-o.c (bfd_mach_o_fat_stat_arch_elt): New function. (bfd_mach_o_generic_stat_arch_elt): Adjust.
* 2012-01-04 Tristan Gingold <gingold@adacore.com>Tristan Gingold2012-01-041-12/+49
| | | | | | | * mach-o.c (bfd_mach_o_fat_member_init): New function. (bfd_mach_o_openr_next_archived_file): Reindent. Adjust to call bfd_mach_o_fat_member_init. (bfd_mach_o_fat_extract): Adjust to call bfd_mach_o_fat_member_init.
* bfd/Tristan Gingold2012-01-041-0/+29
| | | | | | | | | | | | | | | | | | | | 2012-01-04 Tristan Gingold <gingold@adacore.com> * mach-o.h (bfd_mach_o_fvmlib_command): New structure. (bfd_mach_o_load_command): Add fvmlib field. * mach-o.c (bfd_mach_o_read_fvmlib): New function. (bfd_mach_o_read_command): Handle fvmlib. binutils/ 2012-01-04 Tristan Gingold <gingold@adacore.com> * od-macho.c (dump_load_command): Handle fvmlib. include/mach-o/ 2012-01-04 Tristan Gingold <gingold@adacore.com> * external.h (mach_o_fvmlib_command_external): New structure.
* bfd/Tristan Gingold2012-01-041-10/+49
| | | | | | | | | | | | | 2012-01-04 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_convert_architecture): Reindent. Decode msubtype for ARM. include/mach-o/ 2012-01-04 Tristan Gingold <gingold@adacore.com> * loader.h: Update copyright year. (bfd_mach_o_cpu_subtype): Add ARM subtypes.
* bfd/Tristan Gingold2012-01-041-1/+8
| | | | | | 2012-01-04 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_get_synthetic_symtab): Add comments.
* bfd/Tristan Gingold2012-01-041-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | 2012-01-04 Tristan Gingold <gingold@adacore.com> * mach-o.h: Reindent header. (bfd_mach_o_encryption_info_command): New structure. (bfd_mach_o_load_command): Add encryption_info field. * mach-o.c (bfd_mach_o_read_encryption_info): New function. (bfd_mach_o_read_command): Handle BFD_MACH_O_LC_ENCRYPTION_INFO. (bfd_mach_o_read_command): Adjust error message. binutils/ 2012-01-04 Tristan Gingold <gingold@adacore.com> * od-macho.c: Update copyright year. (dump_load_command): Handle BFD_MACH_O_LC_ENCRYPTION_INFO. include/mach-o/ 2012-01-04 Tristan Gingold <gingold@adacore.com> * external.h: Update copyright year. (mach_o_symtab_command_external): Add comments. (mach_o_encryption_info_command_external): New structure.
* 2012-01-04 Shinichiro Hamaji <shinichiro.hamaji@gmail.com>Tristan Gingold2012-01-041-2/+155
| | | | | | | | | | | | | | | | | | | | | | * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Factor out the part which reads DWARF2 and stores in stash from find_line. (find_line) Call _bfd_dwarf2_slurp_debug_info. * libbfd-in.h (_bfd_dwarf2_slurp_debug_info): Add declaration. * libbfd.h (_bfd_dwarf2_slurp_debug_info): Regenerate. * mach-o.c (dsym_subdir): The name of subdir where debug information may be stored. (bfd_mach_o_lookup_uuid_command): New. Lookup a load command whose type is UUID. (bfd_mach_o_dsym_for_uuid_p): New. Check if the specified BFD is corresponding to the executable. (bfd_mach_o_find_dsym): New. Find a debug information BFD in the specified binary file. (bfd_mach_o_follow_dsym): New. Find a debug information BFD for the original BFD. (bfd_mach_o_find_nearest_line): Check dSYM files for Mach-O executables, dylibs, and bundles. (bfd_mach_o_close_and_cleanup): Clean up BFDs for the dSYM file. * mach-o.h (dsym_bfd): The BFD of the dSYM file.
* support stabs on mach-o GAS.iains2012-01-031-15/+19
| | | | | | | | | | | | | | | bfd: * mach-o.c (bfd_mach_o_mangle_symbols): Put in the section index for stabd symbols. (bfd_mach_o_primary_symbol_sort_key): Adjust for stabs. (bfd_mach_o_cf_symbols): Likewise. gas: * config/obj-macho.c (obj_macho_process_stab): New. * config/obj-macho.h (OBJ_PROCESS_STAB): Define. (obj_macho_process_stab): Declare.
* correct typo in previous commit.iains2012-01-031-1/+1
| | | | | | bfd: * mach-o.c (bfd_mach_o_mangle_symbols): Correct typo.
* add dysymtab write support to bfd/mach-o.iains2012-01-031-101/+728
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfd: * mach-o.c (bfd_mach_o_write_symtab): Fill in the string table index as the value of an indirect symbol. Keep the string table index in non-indirect syms for reference. (bfd_mach_o_write_dysymtab): New. (bfd_mach_o_primary_symbol_sort_key): New. (bfd_mach_o_cf_symbols): New. (bfd_mach_o_sort_symbol_table): New. (bfd_mach_o_mangle_symbols): Return early if no symbols. Sort symbols. If we are emitting a dysymtab, process indirect symbols and count the number of each other kind. (bfd_mach_o_mangle_sections): New. (bfd_mach_o_write_contents): Split out some pre-requisite code into the command builder. Write dysymtab if the command is present. (bfd_mach_o_count_sections_for_seg): New. (bfd_mach_o_build_seg_command): New. (bfd_mach_o_build_dysymtab_command): New. (bfd_mach_o_build_commands): Reorganize to support the fact that some commands are optional and should not be emitted if there are no sections or symbols. (bfd_mach_o_set_section_contents): Amend comment. * mach-o.h: Amend and add to comments. (mach_o_data_struct): Add fields for dysymtab symbols counts and a pointer to the indirects, when present. (bfd_mach_o_should_emit_dysymtab): New macro. (IS_MACHO_INDIRECT): Likewise. gas/testsuite: * gas/mach-o/dysymtab-1-64.d: New. * gas/mach-o/dysymtab-1.d: New. * gas/mach-o/symbols-1-64.d: New. * gas/mach-o/symbols-1.d: New. * gas/mach-o/symbols-base-64.s: New. * gas/mach-o/symbols-base.s: New.
* bfd:iains2011-12-191-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | * mach-o-i386.c (bfd_mach_o_section_type_valid_for_tgt): Define NULL. * mach-o-target.c (bfd_mach_o_backend_data): Initialize bfd_mach_o_section_type_valid_for_tgt * mach-o-x86-64.c (bfd_mach_o_section_type_valid_for_x86_64): New. (bfd_mach_o_section_type_valid_for_tgt): Set to bfd_mach_o_section_type_valid_for_x86_64. * mach-o.c (bfd_mach_o_section_type_name): Reorder and eliminate dup. (bfd_mach_o_section_attribute_name): Reorder. (bfd_mach_o_get_section_type_from_name): If the target has defined a validator for section types, then use it. * mach-o.h (bfd_mach_o_get_section_type_from_name): Alter declaration to include the bfd. gas: * config/obj-macho.c (obj_mach_o_section): Account for target-dependent section types. Improve error handling when wrong section types/attributes are specified. gas/testsuite: * gas/mach-o/err-sections-1.s: New. * gas/mach-o/err-sections-2.s: New. * gas/mach-o/sections-3.d: New. * gas/mach-o/sections-3.s: New.
* 2011-12-16 Shinichiro Hamaji <shinichiro.hamaji@gmail.com>Tristan Gingold2011-12-161-11/+6
| | | | | | | | | | * mach-o-i386.c (TARGET_PRIORITY): Define as 0 (top priority) * mach-o-target.c (TARGET_NAME): Use TARGET_PRIORITY * mach-o-x86-64.c (TARGET_PRIORITY): Define as 0 (top priority) * mach-o.c (bfd_mach_o_header_p): Remove special handling for mach-o-i386. (TARGET_PRIORITY) Set 1 for mach-o-be and mach-o-le, and set 0 for mach-o-fat.
* 2011-12-15 Iain Sandoe <iains@gcc.gnu.org>Tristan Gingold2011-12-151-3/+5
| | | | | | * mach-o.c (bfd_mach_o_mkobject_init): Initialize dyn_reloc_cache. (bfd_mach_o_close_and_cleanup): Only cleanup Mach-O private data for object files.
* 2011-12-15 Shinichiro Hamaji <shinichiro.hamaji@gmail.com>Tristan Gingold2011-12-151-25/+53
| | | | | | | | | | | | | * mach-o.c (bfd_mach_o_canonicalize_reloc): Update relocation table only when there isn't the cahce. (bfd_mach_o_get_dynamic_reloc_upper_bound): Need one more space for a pointer for the watchdog. (bfd_mach_o_canonicalize_dynamic_reloc): Utilize cache like bfd_mach_o_canonicalize_reloc. (bfd_mach_o_close_and_cleanup): Call bfd_mach_o_free_cached_info. (bfd_mach_o_free_cached_info): Free up cache data. * mach-o.h (reloc_cache): A place to store cache of dynamic relocs. (bfd_mach_o_free_cached_info): Add declaration.
* bfd/Tristan Gingold2011-12-151-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | 2011-12-15 Iain Sandoe <iains@gcc.gnu.org> * mach-o-target.c (bfd_mach_o_bfd_set_private_flags): Use bfd_mach_o_bfd_set_private_flags. * mach-o.c (bfd_mach_o_bfd_set_private_flags): New. * mach-o.h (bfd_mach_o_bfd_set_private_flags): Declare. gas/ 2011-12-15 Iain Sandoe <iains@gcc.gnu.org> * config/obj-macho.c (obj_mach_o_subsections_by_symbols): New global. (obj_mach_o_file_properties): New enum. (obj_mach_o_subsections_via_symbols): Generalize name to... ... (obj_mach_o_fileprop) and use to set subsections_via_symbols. gas/testsuite/ 2011-12-15 Iain Sandoe <iains@gcc.gnu.org> * gas/mach-o/subsect-via-symbols-0.d: New. * gas/mach-o/subsect-via-symbols-1.d: New. * gas/mach-o/subsect-via-symbols.s: New.
* bfd/Tristan Gingold2011-12-141-128/+360
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-13 Shinichiro Hamaji <shinichiro.hamaji@gmail.com>Tristan Gingold2011-12-131-0/+32
| | | | | | | | | | | | | | | | | | | | * dwarf2.c (bfd_dwarf2_cleanup_debug_info): Accept stash as an argument like other functions to support formats other than ELF. * elf-bfd.h (bfd_dwarf2_cleanup_debug_info): Move to bfd-in.h. * elf.c (_bfd_elf_close_and_cleanup): Pass dwarf2_find_line_info in tdata as a parameter. * libbfd-in.h (bfd_dwarf2_cleanup_debug_info): Move from elf-bfd.h. * libbfd.h (bfd_dwarf2_cleanup_debug_info): Regenerate. * mach-o-target.c (bfd_mach_o_close_and_cleanup): Remove the fallback macro. (bfd_mach_o_find_nearest_line): Likewise. * mach-o.c (bfd_mach_o_find_nearest_line): Add the definition which calls _bfd_dwarf2_find_nearest_line. (bfd_mach_o_close_and_cleanup): Likewise. * mach-o.h (mach_o_data_struct): Add dwarf2_find_line_info. (bfd_mach_o_find_nearest_line): Add declaration. (bfd_mach_o_close_and_cleanup): Add declaration.
* bfd/Tristan Gingold2011-12-131-680/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-12 Iain Sandoe <iains@gcc.gnu.org>Tristan Gingold2011-12-121-2/+2
| | | | | * mach-o.c (bfd_mach_o_read_section_32): Null-terminate sectname. (bfd_mach_o_read_section_64): Likewise.
* 2011-12-07 Tristan Gingold <gingold@adacore.com>Tristan Gingold2011-12-071-87/+57
| | | | | | | | | | | | | | | | | | | | | | | | * mach-o.c (bfd_mach_o_canonicalize_symtab): Fix indentation. Adjust the condition. (bfd_mach_o_read_symtab_symbol): Now returns a bfd_boolean. Adjust return statements. (bfd_mach_o_read_symtab_strtab): Likewise. (bfd_mach_o_read_symtab_symbols): Likewise. (bfd_mach_o_scan_start_address): Likewise. Make it static. (bfd_mach_o_scan): Likewise. (bfd_mach_o_read_dysymtab_symbol): Remove unused function. (bfd_mach_o_header_p): Adjust call. (bfd_mach_o_cpu_name): Make it const. (bfd_mach_o_filetype_name): Likewise. (bfd_mach_o_header_flags_name): Likewise. (bfd_mach_o_section_type_name): Likewise. (bfd_mach_o_section_attribute_name): Likewise. (bfd_mach_o_load_command_name): Likewise. (bfd_mach_o_get_section_type_from_name): Add a const qualifier after above change. (bfd_mach_o_get_section_attribute_from_name): Likewise. * mach-o.h (bfd_mach_o_read_dysymtab_symbol) (bfd_mach_o_scan_start_address, bfd_mach_o_scan): Remove.
* 2011-12-05 Tristan Gingold <gingold@adacore.com>Tristan Gingold2011-12-051-4/+6
| | | | * mach-o.c (bfd_mach_o_read_symtab_symbol): Accept indirect symbols.
* 2011-12-05 Tristan Gingold <gingold@adacore.com>Tristan Gingold2011-12-051-0/+4
| | | | | | | * mach-o.c (bfd_mach_o_write_contents): Handle LC_LOAD_UPWARD_DYLIB. (bfd_mach_o_read_dylib): Likewise. (bfd_mach_o_read_command): Likewise. (bfd_mach_o_bfd_print_private_bfd_data): Likewise.
* 2011-12-05 Tristan Gingold <gingold@adacore.com>Tristan Gingold2011-12-051-18/+5
| | | | | | | * mach-o.c (bfd_mach_o_read_command): Add the bfd in the error message. (bfd_mach_o_openr_next_archived_file): Use arch name as member name. (bfd_mach_o_fat_extract): Ditto.
* 2011-11-22 Tristan Gingold <gingold@adacore.com>Tristan Gingold2011-11-221-2/+5
| | | | | * mach-o.c (bfd_mach_o_print_symbol): Display COM for common symbols. Print section name in brackets.
* 2011-09-21 Tristan Gingold <gingold@adacore.com>Tristan Gingold2011-09-211-2/+7
| | | | | | * mach-o.c (bfd_mach_o_convert_section_name_to_bfd): Add comment. Deals with size limited strings. (bfd_mach_o_build_commands): Initialize more fields.
* 2011-08-18 Tristan Gingold <gingold@adacore.com>Tristan Gingold2011-08-181-0/+2
| | | | * mach-o.c (bfd_mach_o_read_segment): Initialize list.
* 2011-08-17 Tristan Gingold <gingold@adacore.com>Tristan Gingold2011-08-171-1/+1
| | | | * mach-o.c (bfd_mach_o_write_section_32): Fix typo.
* 2011-08-08 Tristan Gingold <gingold@adacore.com>Tristan Gingold2011-08-081-3/+8
| | | | | | | * mach-o.c (struct mach_o_segment_name_xlat): Add comments. (segsec_names_xlat): Reorder elements. (bfd_mach_o_read_section_32): Fix typo. (bfd_mach_o_read_section_64): Fix typo.