Commit Graph

25 Commits

Author SHA1 Message Date
H.J. Lu 3739860c11 Remove trailing spaces in gas 2015-08-12 04:40:42 -07:00
Alan Modra b90efa5b79 ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
Alan Modra a03f9b1acf Avoid cascading errors due to write_object_file change
* config/obj-macho.c (obj_mach_o_set_symbol_qualifier): Don't set
	SYM_MACHO_FIELDS_NOT_VALIDATED after reporting an error.
	(obj_mach_o_frob_label): Avoid cascading errors.
	(obj_mach_o_frob_symbol): Don't set SYM_MACHO_FIELDS_NOT_VALIDATED.
2014-06-28 00:20:14 +09:30
Alan Modra 4b95cf5c0c Update copyright years 2014-03-05 22:16:15 +10:30
Iain Sandoe 16a8742098 provide a hook to allow checking errors just before we output the file.
gas:

	* write.c (write_object_file): Add md_pre_output_hook.
	* config/obj-macho.c (obj_mach_o_check_before_writing): New.
	(obj_mach_o_pre_output_hook): New.
	* config/obj-macho.h (md_pre_output_hook): Define.
	(obj_mach_o_pre_output_hook): Declare.
2012-02-21 13:39:37 +00:00
Iain Sandoe cdaa5616cb 2012-02-21 Tristan Gingold <gingold@adacore.com>
* config/tc-i386.h (OBJ_MACH_O): New section.
	(TC_FORCE_RELOCATION): Use obj_mach_o_force_reloc.
	(TC_FORCE_RELOCATION_SUB_SAME): New
	(TC_FORCE_RELOCATION_SUB_LOCAL): New.
	(TC_VALIDATE_FIX_SUB): New.
	* frags.h (struct frag): OBJ_FRAG_TYPE, new field.
	* symbols.c (colon): obj_frob_colon: New hook.
	* write.c (write_object_file): md_pre_relax_hook, new
	hook.
	* config/obj-macho.c (obj_mach_o_frob_colon): New.
	(obj_mach_o_frob_label): Record sub-section labels.
	(obj_mach_o_frob_symbol): Rename from obj_macho_frob_symbol.
	(obj_mach_o_set_subsections): New.
	(obj_mach_o_pre_relax_hook): New.
	(obj_mach_o_in_different_subsection): New.
	(obj_mach_o_force_reloc_sub_same): New.
	(obj_mach_o_force_reloc_sub_local): New.
	(obj_mach_o_force_reloc): New.
	* config/obj-macho.h (OBJ_SYMFIELD_TYPE): New.
	(obj_frob_colon): New Define.
	(obj_mach_o_frob_label): Renamed.
	(obj_mach_o_frob_symbol): Renamed.
	(OBJ_FRAG_TYPE): New.
	(obj_mach_o_in_different_subsection, obj_mach_o_force_reloc,
	 obj_mach_o_force_reloc_sub_same,
	 obj_mach_o_force_reloc_sub_local): New declarations.
2012-02-21 09:13:02 +00:00
Iain Sandoe 854ac8ba3b gas:
* config/obj-macho.c (obj_mach_o_is_frame_section): New.
	(obj_mach_o_allow_local_subtract): New.
	* config/obj-macho.h (md_allow_local_subtract): Define.
	(obj_mach_o_allow_local_subtract): Declare.
2012-02-20 20:11:32 +00:00
Iain Sandoe a5759139f8 gas:
* config/obj-macho.c (obj_mach_o_make_or_get_sect): In the absence of
	canonical information, try to determine CODE and DEBUG section flags
	from the mach-o section data.
2012-02-20 19:44:40 +00:00
Iain Sandoe 8e43fc024d gas:
* config/obj-macho.c (obj_mach_o_indirect_symbol): Force promotion of
	any local symbol used as an indirect.
2012-02-12 15:47:17 +00:00
Iain Sandoe fb4914b0e6 gas:
* config/obj-macho.c (obj_mach_o_make_or_get_sect): Always fill in
	stub size when provided.  (obj_mach_o_section): Flag that stub-size
	has been provided.
2012-02-10 13:12:55 +00:00
Tristan Gingold facf03f2c3 bfd/
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.
2012-02-02 11:55:43 +00:00
Iain Sandoe 34dd18bca5 reverse the order of relocs in mach-o gas output.
gas:

	* config/obj-macho.c (obj_mach_o_reorder_section_relocs): New.
	* config/obj-macho.h (SET_SECTION_RELOCS): Define.
	(obj_mach_o_reorder_section_relocs): Declare.

gas/testsuite:

	* gas/all/redef2.d: Skip for Darwin.
	* gas/all/redef3.d: Likewise.
	* gas/all/weakref1.d: Likewise.
	* gas/macros/irp.d: Likewise.
	* gas/macros/repeat.d: Likewise.
	* gas/macros/rept.d: Likewise.
	* gas/macros/test2.d: Likewise.
	* gas/macros/vararg.d: Likewise.
	* gas/mach-o/macro-irp.d: New.
	* gas/mach-o/macro-repeat.d: New.
	* gas/mach-o/macro-rept.d: New.
	* gas/mach-o/macro-test2.d: New.
	* gas/mach-o/macro-vararg.d: New.
	* gas/mach-o/redef2.d: New.
	* gas/mach-o/redef3.d: New.
2012-01-13 15:19:13 +00:00
Iain Sandoe 687be931eb handle absolute indirect syms in mach-o
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.
2012-01-13 12:59:30 +00:00
Iain Sandoe c3402d2056 set vma on mach-o sections.
gas:

	* config/obj-macho.c (obj_mach_o_set_vma_data): New type.
	(obj_mach_o_set_section_vma): New.
	(obj_mach_o_post_relax_hook): New.
	* config/obj-macho.h (md_post_relax_hook): Define.
	(obj_mach_o_post_relax_hook): Declare.

gas/testsuite:

	* gas/mach-o/dysymtab-2.d: Update to include the set VMA.
	* gas/mach-o/symbols-1-64.d: Likewise.
	* gas/mach-o/symbols-1.d: Likewise.
	* gas/mach-o/symbols-6.d: Likewise.
	* gas/mach-o/zerofill-1.d: Likewise.
	* gas/mach-o/zerofill-2.d: Likewise.
2012-01-13 11:55:02 +00:00
Iain Sandoe 50d10658ee add indirect_symbol to mach-o port.
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.
2012-01-12 14:03:12 +00:00
Iain Sandoe b22161d698 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 10:47:50 +00:00
Iain Sandoe 8cf6e08400 add .zerofill to mach-o GAS.
gas:

	* config/obj-macho.c (obj_mach_o_segT_from_bfd_name): Tidy definition.
	(obj_mach_o_get_section_names): New (split from obj_mach_o_section).
	(obj_mach_o_make_or_get_sect): Likewise.
	(obj_mach_o_section): Split out the functionality shared with zerofill.
	(obj_mach_o_zerofill): New.
	(obj_mach_o_common_parse): Ensure whitespace is skipped.
	(mach_o_pseudo_table): Add .zerofill.

gas/testsuite:

	* gas/mach-o/zerofill-1.d: New.
	* gas/mach-o/zerofill-1.s: New.
2012-01-04 10:59:54 +00:00
Iain Sandoe 68588f9540 support stabs on mach-o GAS.
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.
2012-01-03 13:18:48 +00:00
Iain Sandoe bcf0aac6f6 adjust mach-o default GAS sections.
gas:

	* as.c (perform_an_assembly_pass): Do not create text, data and bss
	sections for MACH-O.  Do not switch to the text section.
	* config/obj-macho.c (obj_mach_o_segT_from_bfd_name): Forward decl.
	(mach_o_begin): Startup with only text section unless suppressed.
	* config/obj-macho.h (obj_begin): define to mach_o_begin ().

gas/testsuite:

	* gas/mach-o/sections-1.d: Amend to recognize that bss is not emitted
	by default.
	* gas/mach-o/sections-2.d: New.
2011-12-29 10:53:10 +00:00
Iain Sandoe ab76eeafa5 bfd:
* 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-19 15:42:37 +00:00
Tristan Gingold 499963bcf1 2011-12-15 Tristan Gingold <gingold@adacore.com>
* config/obj-macho.c (obj_mach_o_fileprop): Fix typo.
2011-12-15 11:43:52 +00:00
Tristan Gingold 0c9ef0f001 bfd/
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.
2011-12-15 10:56:48 +00:00
Tristan Gingold a455111938 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 10:30:09 +00:00
Tristan Gingold 74a6005fea 2011-08-08 Tristan Gingold <gingold@adacore.com>
* config/obj-macho.c (obj_mach_o_section): New function.
	(struct known_section): New type.
	(known_sections): Declare.
	(obj_mach_o_known_section): New function.
	(obj_mach_o_common_parse): Ditto.
	(obj_mach_o_comm): Ditto.
	(obj_mach_o_subsections_via_symbols): Ditto.
	(mach_o_pseudo_table): Add new pseudos.
2011-08-08 12:20:01 +00:00
Tristan Gingold e57f8c655c 2009-07-02 Tristan Gingold <gingold@adacore.com>
* Makefile.am (OBJ_FORMATS): Add macho.
	(CPU_OBJ_VALID): Ditto.
	(OBJ_FORMAT_CFILES): Add config/obj-macho.c
	(OBJ_FORMAT_HFILES): Add config/obj-macho.h
	(obj-macho.o): New rule.
	* Makefile.in: Regenerated.
	* configure.tgt (generic_target): Add i386-*-darwin*.
	* config/tc-i386.h: Use i386_target_format for Mach-O.
	* config/tc-i386.c (i386_target_format): Define it for Mach-O.
	(i386_target_format): Add a case for bfd_target_mach_o_flavour.
	* config/obj-macho.h: New file.
	* config/obj-macho.c: New file.
2009-07-02 08:09:35 +00:00