alpha.c (alpha_start_function): Use switch_to_section.

* config/alpha/alpha.c (alpha_start_function): Use switch_to_section.
	(alpha_elf_select_rtx_section): Return the selected section rather
	than emitting assembly code.
	(alpha_write_linkage): Emit a ".link" directive directly and then
	set in_section to NULL.
	(vms_asm_out_constructor): Use switch_to_section.
	(vms_asm_out_destructor): Likewise.
	(unicosmk_output_common): Set in_section to NULL instead of calling
	the dummy common_section function.
	(unicosmk_text_section): Delete in favor of...
	(unicosmk_output_text_section_asm_op): ...this new function.
	(unicosmk_data_section): Delete in favor of...
	(unicosmk_output_data_section_asm_op): ...this new function.
	(unicosmk_init_sections): New function.
	(unicosmk_output_deferred_case_vectors): Use switch_to_section.
	(unicosmk_output_ssib): Set in_section to NULL instead of calling
	the dummy ssib_section function.
	(unicosmk_section_buf): Delete.
	* config/alpha/alpha-protos.h (unicosmk_text_section): Delete.
	(unicosmk_data_section): Delete.
	* config/alpha/elf.h (ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
	(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, sbss_section, sdata_section)
	(SECTION_FUNCTION_TEMPLATE): Delete.
	* config/alpha/unicosmk.h (TEXT_SECTION_ASM_OP, DATA_SECTION_ASM_OP)
	(READONLY_DATA_SECTION, EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
	(common_section, COMMON_SECTION, ssib_section, SSIB_SECTION): Delete.
	(ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
	(TARGET_ASM_INIT_SECTIONS): Define.
	* config/alpha/vms.h (LINK_SECTION_ASM_OP, LITERALS_SECTION_ASM_OP)
	(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
	(link_section, literals_section): Delete.
	(ASM_OUTPUT_DEF): Emit the ".literal" directive directly and then
	set in_section to NULL.

	* config/arm/aof.h (TEXT_SECTION_ASM_OP, DATA_SECTION_ASM_OP): Delete.
	(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, ZERO_INIT_SECTION): Delete.
	(COMMON_SECTION): Delete.
	(TARGET_ASM_INIT_SECTIONS): Define.
	(ASM_OUTPUT_COMMON): Set in_section to NULL rather than calling
	the dummy common_section function.
	* config/arm/aout.h (ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
	* config/arm/arm.c (get_jump_table_size): Use pointer comparison
	between readonly_data_section and text_section to check whether
	read-only data is being put in the text section.
	(arm_output_function_epilogue): Use switch_to_section.
	(arm_elf_asm_constructor): Likewise.
	(thumb_call_via_reg): Replace call to in_text_section with
	a comparison between in_section and text_section.
	(arm_file_end): Use switch_to_section.
	(aof_text_section): Delete in favor of...
	(aof_output_text_section_asm_op): ...this new function.
	(aof_data_section): Delete in favor of...
	(aof_output_data_section_asm_op): ...this new function.
	(aof_asm_init_sections): New function.
	(zero_init_section): Moved from config/arm/aof.h.
	(aof_dump_imports, aof_file_start): Use switch_to_section.
	* config/arm/arm.h (thumb_call_via_label): Update comment.
	* config/arm/arm-protos.h (aof_text_section, aof_data_section): Delete.
	(common_section): Delete.
	* config/arm/pe.h (ASM_DECLARE_FUNCTION_NAME): Use switch_to_section.
	(ASM_DECLARE_OBJECT_NAME): Update the type of save_section.  Use the
	global switch_to_section function instead of the old port-local one.
	(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, DRECTVE_SECTION_FUNCTION)
	(SWITCH_TO_SECTION_FUNCTION): Delete.
	(drectve_section): Redefine as a macro.
	* config/arm/unknown-elf.h (ASM_OUTPUT_ALIGNED_BSS):
	(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use get_named_section and
	switch_to_section.

	* config/avr/avr.c (progmem_section): New variable.
	(avr_output_progmem_section_asm_op): New function.
	(avr_asm_init_sections): New function.
	(avr_output_addr_vec_elt): Use switch_to_section.
	* config/avr/avr.h (progmem_section): Declare.
	(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
	(READONLY_DATA_SECTION): Delete.
	(TARGET_ASM_INIT_SECTIONS): Define.
	(ASM_OUTPUT_CASE_LABEL): Use switch_to_section.
	* config/avr/avr-protos.h (progmem_section): Delete.

	* config/bfin/bfin.h (ASM_OUTPUT_LOCAL): Use switch_to_section.

	* config/c4x/c4x.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
	(INIT_SECTION_FUNCTION, FINI_SECTION_FUNCTION): Delete.

	* config/darwin-sections.def: New file.
	* config/darwin.c: Define all sections in darwin-sections.def.
	(output_objc_section_asm_op, darwin_init_sections): New functions.
	(machopic_output_indirection): Use switch_to_section.
	(machopic_select_section): Return the selected section rather than
	emitting assembly code.  Replace the static function table with
	inline conditional expressions.  Update the tests of last_text_section
	and move them into the FUNCTION_DECL block.
	(machopic_select_rtx_section): Return the selected section rather than
	emitting assembly code.
	(machopic_asm_out_constructor, machopic_asm_out_destructor)
	(darwin_file_end): Use switch_to_section.
	* config/darwin.h: Use darwin-sections.def to declare sections.
	(INIT_SECTION_ASM_OP): Remove empty definition.
	(HAS_INIT_SECTION): Define this instead.
	(SECTION_FUNCTION, EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
	(READONLY_DATA_SECTION, TARGET_ASM_EXCEPTION_SECTION): Delete.
	(TARGET_ASM_EH_FRAME_SECTION): Delete.
	(TARGET_ASM_INIT_SECTIONS): Define.
	* config/darwin-protos.h (darwin_init_sections): Declare.
	(machopic_picsymbol_stub_section, machopic_picsymbol_stub1_section)
	(machopic_symbol_stub_section, machopic_symbol_stub1_section): Delete.
	(machopic_lazy_symbol_ptr_section, machopic_nl_symbol_ptr_section)
	(constructor_section, destructor_section, mod_init_section): Delete.
	(mod_term_section): Delete.
	(darwin_exception_section, darwin_eh_frame_section): Delete.
	(machopic_select_section): Return a section.
	(machopic_select_rtx_section): Likewise.
	(text_coal_section, text_unlikely_section, text_unlikely_coal_section)
	(const_section, const_coal_section, const_data_section): Delete.
	(const_data_coal_section, data_coal_section, cstring_section): Delete.
	(literal4_section, literal8_section, constructor_section): Delete.
	(mod_init_section, mod_term_section, destructor_section): Delete.
	(objc_class_section, objc_meta_class_section, objc_category_section)
	(objc_class_vars_section, objc_instance_vars_section): Delete.
	(objc_cls_meth_section, objc_inst_meth_section): Delete.
	(objc_cat_cls_meth_section, objc_cat_inst_meth_section): Delete.
	(objc_selector_refs_section, objc_selector_fixup_section): Delete.
	(objc_symbols_section, objc_module_info_section): Delete.
	(objc_image_info_section, objc_protocol_section): Delete.
	(objc_string_object_section, objc_constant_string_object_section)
	(objc_class_names_section, objc_meth_var_names_section): Delete.
	(objc_meth_var_types_section, objc_cls_refs_section): Delete.
	(machopic_lazy_symbol_ptr_section, machopic_nl_symbol_ptr_section)
	(machopic_symbol_stub_section, machopic_picsymbol_stub_section)
	(darwin_exception_section, darwin_eh_frame_section): Delete.
	* config/t-darwin (darwin.o): Depend on config/darwin-sections.def.

	* config/frv/frv.c (frv_asm_out_constructor): Use switch_to_section.
	(frv_asm_out_destructor): Likewise.
	* config/frv/frv.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
	(SDATA_SECTION_FUNCTION, FIXUP_SECTION_FUNCTION): Delete.
	(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use switch_to_section and
	get_named_section.
	(ASM_OUTPUT_CASE_LABEL): Use switch_to_section.
	* config/frv/frv-protos.h (fixup_section, sdata_section, sbss_section)
	(data_section): Delete.

	* config/i386/cygming.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
	(DRECTVE_SECTION_FUNCTION): Delete.
	(drectve_section): Redefine as a macro that sets in_section after
	emitting the directive.
	(SWITCH_TO_SECTION_FUNCTION): Delete.
	* config/i386/darwin.h (ASM_OUTPUT_ALIGN): Replace call to
	in_text_section with comparison between in_section and text_section.
	* config/i386/i386.c (x86_64_elf_select_section): Return the section
	rather than emitting assembly code.  Use get_named_section.
	(x86_output_aligned_bss, ix86_file_end): Use switch_to_section and
	get_named_section.
	(machopic_output_stub): Use switch_to_section.
	* config/i386/nwld.c (nwld_named_section_asm_out_constructor)
	(nwld_named_section_asm_out_destructor): Use get_section and
	switch_to_section.

	* config/ia64/ia64.c (ia64_select_rtx_section): Return the section
	rather than emitting assembly code.
	(ia64_rwreloc_select_section): Likewise.
	(ia64_rwreloc_select_rtx_section): Likewise.
	* config/ia64/ia64-protos.h (sdata_section, sbss_section): Delete.
	* config/ia64/sysv4.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use
	switch_to_section.
	(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
	(SDATA_SECTION_FUNCTION, SBSS_SECTION_FUNCTION): Delete.

	* config/iq2000/iq2000.c (iq2000_select_rtx_section): Return the
	section rather than emitting assembly code.
	(iq2000_select_section): Likewise.
	* config/iq2000/iq2000.h (rdata_section, sdata_section): Delete.
	(sbss_section): Delete.

	* config/m32r/m32r.h (ASM_OUTPUT_ALIGNED_BSS): Use switch_to_section
	and get_named_section.
	* config/m32r/m32r-protos.h (sbss_section, sdata_section): Delete.

	* config/mcore/mcore-elf.h (EXPORTS_SECTION_ASM_OP): Delete.
	(SUBTARGET_EXTRA_SECTIONS, SUBTARGET_EXTRA_SECTION_FUNCTIONS): Delete.
	(EXPORT_SECTION_FUNCTION, SUBTARGET_SWITCH_SECTIONS): Delete.
	(MCORE_EXPORT_NAME): Emit the exports directive directly, then set
	in_section to NULL.
	(ASM_DECLARE_FUNCTION_NAME): Use switch_to_section.
	(ASM_DECLARE_OBJECT_NAME): Update the type of save_section.  Use the
	global switch_to_section function instead of the old port-local one.
	* config/mcore/mcore.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
	(SWITCH_SECTION_FUNCTION): Delete.
	* config/mcore/mcore-pe.h (SUBTARGET_SWITCH_SECTIONS): Delete.
	(DRECTVE_SECTION_ASM_OP, SUBTARGET_EXTRA_SECTIONS): Delete.
	(SUBTARGET_EXTRA_SECTION_FUNCTIONS, DRECTVE_SECTION_FUNCTION): Delete.
	(MCORE_EXPORT_NAME): Emit ".section .drectve" directly, then set
	in_section to NULL.
	(ASM_DECLARE_OBJECT_NAME): Update the type of save_section.  Use the
	global switch_to_section function instead of the old port-local one.
	(ASM_DECLARE_FUNCTION_NAME): Use switch_to_section.

	* config/mips/mips.c (mips_file_start): Update comment.
	(mips_output_aligned_bss): Use switch_to_section and get_named_section.
	(mips_output_aligned_decl_common): Use switch_to_section.
	(mips_select_rtx_section): Return the section rather than emitting
	assembly code.  Use get_named_section.
	(mips_function_rodata_section: Likewise get_section.
	(build_mips16_function_stub): Use switch_to_section.
	* config/mips/mips.h (ASM_OUTPUT_IDENT): Use switch_to_section.
	(SDATA_SECTION_ASM_OP): Delete.
	* config/mips/vxworks.h (EXTRA_SECTIONS): Delete.
	(EXTRA_SECTION_FUNCTIONS): Delete.

	* config/mmix/mmix.c (mmix_file_start, mmix_file_end)
	(mmix_asm_output_aligned_local): Use switch_to_section.

	* config/pa/pa.c (som_readonly_data_section, som_one_only_data_section)
	(som_one_only_readonly_data_section): New variables.
	(pa_output_function_epilogue): Set in_section to NULL instead of
	calling forget_section.
	(output_deferred_plabels): Use select_section.
	(pa_asm_output_mi_thunk): Likewise.  Set in_section to NULL instead
	of calling forget_section.
	(pa_asm_output_aligned_bss, pa_asm_output_aligned_common)
	(pa_asm_output_aligned_local): Use select_section.
	(som_text_section_asm_op): Delete in favor of...
	(som_output_text_section_asm_op): ...this new function.
	(pa_som_asm_init_sections): New function.
	(pa_select_section): Return the section rather than emitting
	assembly code.
	* config/pa/pa.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
	(SOM_READONLY_DATA_SECTION_FUNCTION): Delete.
	(SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION): Delete.
	(SOM_ONE_ONLY_DATA_SECTION_FUNCTION, FORGET_SECTION_FUNCTION): Delete.
	* config/pa/pa-protos.h (som_text_section_asm_op): Delete.
	(som_readonly_data_section, som_one_only_readonly_data_section)
	(som_one_only_data_section, forget_section): Delete.
	* config/pa/som.h (TEXT_SECTION_ASM_OP): Delete.
	(TARGET_ASM_INIT_SECTIONS): Define.
	(READONLY_DATA_SECTION, TARGET_ASM_EXCEPTION_SECTION): Delete.

	* config/rs6000/rs6000.c (read_only_data_section): New variable.
	(private_data_section, read_only_private_data_section): New variables.
	(sdata2_section, toc_section): New variables.
	(rs6000_file_start): Use switch_to_section.
	(rs6000_assemble_integer): Use comparisons against in_section
	instead of calling in_toc_section and in_text_section.  Use
	unlikely_text_section_p.
	(rs6000_elf_output_toc_section_asm_op): New function, derived
	from the old rs6000/sysv4.h toc_section function.
	(rs6000_elf_asm_init_sections): New function.
	(rs6000_elf_select_rtx_section, rs6000_elf_select_section): Return
	the section rather than emitting assembly code.
	(machopic_output_stub): Use switch_to_section.
	(toc_section): Delete dummy function.
	(rs6000_elf_asm_out_constructor, rs6000_elf_asm_out_destructor): Use
	switch_to_section and get_section.
	(rs6000_xcoff_output_readonly_section_asm_op): New function.
	(rs6000_xcoff_output_readwrite_section_asm_op): New function.
	(rs6000_xcoff_output_toc_section_asm_op): New function, derived from
	the old rs6000/xcoff.h toc_section function.
	(rs6000_xcoff_asm_init_sections): New function.
	(rs6000_xcoff_select_section, rs6000_xcoff_select_rtx_section): Return
	the section rather than emitting assembly code.
	(rs6000_xcoff_file_start): Use switch_to_section.
	(rs6000_xcoff_file_end): Likewise.
	* config/rs6000/rs6000-protos.h (toc_section, sdata_section): Delete.
	(sdata2_section, sbss_section, private_data_section): Delete.
	(read_only_data_section, read_only_private_data_section): Delete.
	* config/rs6000/sysv4.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
	(TOC_SECTION_FUNCTION, SDATA_SECTION_FUNCTION, SDATA2_SECTION_FUNCTION)
	(SBSS_SECTION_FUNCTION, INIT_SECTION_FUNCTION): Delete.
	(FINI_SECTION_FUNCTION): Delete.
	(TARGET_ASM_INIT_SECTIONS): Define.
	(ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
	* config/rs6000/xcoff.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
	(READ_ONLY_DATA_SECTION_FUNCTION, PRIVATE_DATA_SECTION_FUNCTION)
	(READ_ONLY_PRIVATE_DATA_SECTION_FUNCTION, TOC_SECTION_FUNCTION)
	(READONLY_DATA_SECTION): Delete.
	(TARGET_ASM_INIT_SECTIONS): Define.
	(ASM_DECLARE_FUNCTION_NAME): Use switch_to_section.  Set in_section
	to NULL rather than no_section.
	(TARGET_ASM_EXCEPTION_SECTION): Delete.

	* config/sh/sh.c (sh_file_start): Use switch_to_section.

	* config/sparc/sparc.c (emit_pic_helper): Use switch_to_section.
	(sparc_output_deferred_case_vectors): Likewise.  Remove argument
	from call to current_function_section.

	* config/stormy16/stormy16.c: Include ggc.h and gt-storm16.h.
	(bss100_section): New variable.
	(xstormy16_asm_output_aligned_common): Use switch_to_section.
	(xstormy16_asm_init_sections): New function.
	(xstormy16_asm_out_destructor, xstormy16_asm_out_constructor): Use
	switch_to_section and get_section.
	(xstormy16_output_addr_vec): Use switch_to_section.  Remove argument
	from calls to current_function_section.
	* config/stormy16/stormy16.h (EXTRA_SECTIONS): Delete.
	(XSTORMY16_SECTION_FUNCTION, EXTRA_SECTION_FUNCTIONS): Delete.
	(TARGET_ASM_INIT_SECTIONS): Define.
	* config/stormy16/stormy16-protos.h (bss100_section): Delete.

	* config/svr3.h (ASM_OUTPUT_LOCAL): Use switch_to_section.
	(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, INIT_SECTION_FUNCTION)
	(FINI_SECTION_FUNCTION): Delete.

	* config/v850/v850.c: Include gt-v850.h.
	(rosdata_section, rozdata_section, tdata_section, zdata_section)
	(zbss_section): New variables.
	(v850_output_aligned_bss): Use switch_to_section.
	(v850_asm_init_sections): New function.
	(v850_select_section): Return the section rather than emitting
	assembly code.
	* config/v850/v850.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
	(ZDATA_SECTION_ASM_OP, ZBSS_SECTION_ASM_OP, TDATA_SECTION_ASM_OP)
	(ROSDATA_SECTION_ASM_OP, ROZDATA_SECTION_ASM_OP): Delete.
	(TARGET_ASM_INIT_SECTIONS): Define.
	* config/v850/v850-protos.h (sdata_section, rosdata_section): Delete.
	(sbss_section, tdata_section, zdata_section, rozdata_section): Delete.
	(zbss_section): Delete.

	* config/vax/vaxv.h (ASM_OUTPUT_LOCAL): Use switch_to_section.

	* config/vx-common.h (vxworks_exception_section): Delete.
	(TARGET_ASM_EXCEPTION_SECTION): Delete.

	* config/xtensa/xtensa.c (xtensa_select_rtx_section): Return the
	section rather than emitting assembly code.
	* config/xtensa/xtensa.h (ASM_OUTPUT_POOL_PROLOGUE): Use
	switch_to_section.

	* Makefile.in (GTFILES): Add $(srcdir)/output.h.
	* coretypes.h (section): New union and typedef.
	* dbxout.c (FORCE_TEXT): Use switch_to_section.  Remove argument
	from call to current_function_section.
	(dbxout_function_end, dbxout_init, dbxout_source_file, dbxout_finish)
	(dbxout_symbol_location): Use switch_to_section.
	* dwarf2out.c (named_section_eh_frame_section): Delete, moving
	most of the code into...
	(default_eh_frame_section): ...here.  Return a section.
	(collect2_eh_frame_section): Delete, moving most of the code into..
	(switch_to_eh_frame_section): ...this new function.
	(debug_info_section, debug_abbrev_section, debug_aranges_section)
	(debug_macinfo_section, debug_line_section, debug_loc_section)
	(debug_pubnames_section, debug_str_section, debug_ranges_section): New
	variables.
	(output_call_frame_info): Call switch_to_eh_frame_section instead of
	eh_frame_section.  Use switch_to_section and get_section.
	(dwarf2out_begin_prologue): Use switch_to_section.
	(AT_string_form): Check the flags in debug_str_section instead of
	DEBUG_STR_SECTION_FLAGS.
	(output_comp_unit): Use switch_to_section, get_section, and
	debug_info_section.
	(output_line_info, secname_for_decl): Use unlikely_text_section_p.
	(dwarf2out_begin_block): Use switch_to_section.  Remove argument
	from call to current_function_section.
	(dwarf2out_var_location): Use unlikely_text_section_p.
	(dwarf2out_source_line): Use switch_to_section.  Remove argument
	from call to current_function_section.
	(dwarf2out_start_source_file, dwarf2out_end_source_file)
	(dwarf2out_define, dwarf2out_undef: Use switch_to_section and
	debug_macinfo_section.
	(dwarf2out_init): Initialize the new section variables.  Use them
	instead of calls to named_section_flags.  Use switch_to_section.
	(output_indirect_string): Use switch_to_section and debug_str_section.
	(dwarf2out_finish): Use switch_to_section and the new section
	variables.
	* except.c (default_exception_section): Return the section instead
	of emitting assembly code.
	(output_function_exception_table): Use the global exception_section
	variable instead of the target hook.  Use switch_to_section.  Remove
	argument from call to current_function_section.
	* final.c (HAVE_READONLY_DATA_SECTION): Delete.
	(shorten_branches): Use pointer comparisons to detect whether the
	text section is the same as readonly_data_section.
	(profile_function): Use switch_to_section.  Remove argument from
	call to current_function_section.
	(final_scan_insn): Likewise.  Update use of last_text_section.
	* gengtype.c (open_base_files): Add an include of output.h.
	* output.h (text_section, data_section, readonly_data_section)
	(ctors_section, dtors_section, bss_section, init_section)
	(fini_section, sdata_section): Turn into section pointers.
	(in_text_section, in_unlikely_text_section, exports_section)
	(drectve_section, named_section, mergeable_string_section)
	(last_text_section_name): Delete.
	(default_exception_section, default_eh_frame_section): Return sections.
	(SECTION_DECLARED, SECTION_NAMED): New macros.
	(SECTION_MACH_DEP): Bump value.
	(section_common, named_section, unnamed_section): New structures.
	(unnamed_section_callback): New typedef.
	(section): New union.
	(sbss_section, exception_section, eh_frame_section): New variables.
	(in_section, last_text_section): Turn into section pointers.
	(get_unnamed_section, get_section, get_named_section): New functions.
	(mergeable_constant_section, function_section): Return a section.
	(unlikely_text_section): Likewise.
	(current_function_section): Likewise.  Remove the decl argument.
	(unlikely_text_section_p, switch_to_section): New functions.
	(output_section_asm_op): New function.
	(set_named_section_flags, named_section_flags, named_section_real)
	(named_section_first_declaration): Delete.
	(default_select_section, default_elf_select_section): Return a section.
	(default_elf_select_section_1, default_function_rodata_section)
	(default_no_function_rodata_section, default_select_rtx_section)
	(default_elf_select_rtx_section): Likewise.
	* rtl.h (in_data_section): Delete.
	* sdbout.c (sdbout_one_type): Use switch_to_section.
	* system.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Poison.
	(READONLY_DATA_SECTION, TARGET_ASM_EXCEPTION_SECTION): Poison.
	(TARGET_ASM_EH_FRAME_SECTION): Poison.
	* target-def.h (TARGET_ASM_INIT_SECTIONS): New macro.
	(TARGET_ASM_EXCEPTION_SECTION, TARGET_ASM_EH_FRAME_SECTION): Delete.
	(TARGET_ASM_OUT): Update after above changes.
	* target.h (init_sections): New hook.
	(exception_section, eh_frame_section): Delete.
	(select_section, select_rtx_section, function_rodata_section): Return
	a section rather than emitting assembly code.
	* varasm.c (text_section, data_section, readonly_data_section)
	(ctors_section, dtors_section, bss_section, init_section)
	(fini_section): Turn into section pointers.
	(sdata_section, sbss_section, exception_section): New variables.
	(eh_frame_section): New variable.
	(in_section): Make global and turn into a section pointer.
	(last_text_section): Turn into a section pointer.
	(unnamed_sections): New variable.
	(in_named_name, last_text_section_name): Delete.
	(EXTRA_SECTION_FUNCTIONS): Delete.
	(in_named_entry): Delete.
	(section_htab): New variable, replacing...
	(in_named_htab): ...this deleted variable.
	(section_entry_eq, section_entry_hash): New functions, based on...
	(in_named_entry_eq, in_named_entry_hash): ...these deleted functions.
	(get_unnamed_section, get_section): New functions.
	(unlikely_text_section): Return a section instead of emitting
	assembly code.
	(in_text_section, in_unlikely_text_section, in_data_section): Delete.
	(get_named_section_flags, named_section_first_declaration): Delete.
	(unlikely_text_section_p): New function.
	(named_section_real, named_section): Delete.
	(get_named_section): New function.
	(asm_output_bss, asm_output_aligned_bss): Use switch_to_section.
	(function_section): Return a section rather than emitting
	assembly code.
	(current_function_section): Likewise.  Remove argument.  Use
	last_text_section if nonnull, otherwise use function_section.
	(default_function_rodata_section): Return a section rather than
	emitting assembly code.  Use get_section.
	(default_no_function_rodata_section): Return a section rather than
	emitting assembly code.
	(variable_section): Use switch_to_section and get_named_section.
	(mergeable_string_section): Return a section rather than emitting
	assembly code.  Use get_section.  Make static.  Don't take special
	countermeasures for empty strings.
	(mergeable_constant_section): Return a section rather than emitting
	assembly code.  Use get_section.
	(default_named_section_asm_out_destructor): Use switch_to_section
	and get_section.
	(default_dtor_section_asm_out_destructor): Use switch_to_section.
	(default_named_section_asm_out_constructor): Use switch_to_section
	and get_section.
	(default_ctor_section_asm_out_constructor): Use switch_to_section.
	(assemble_start_function): Likewise.  Set last_text_section to
	NULL rather than no_section.  Change the type of save_section.
	(assemble_zeros, assemble_variable): Use the section flags to detect
	whether or not a section is text.
	(assemble_static_space): Use switch_to_section.
	(assemble_trampoline_template): Likewise.
	(output_constant_def_contents): Use switch_to_section and
	get_named_section.
	(output_constant_pool_1): Use switch_to_section.  Use the section
	flags to see whether sections contain mergeable data.
	(init_varasm_once): Initialize section_htab instead of in_named_htab.
	Initialize new section variables.  Call TARGET_ASM_INIT_SECTIONS.
	(default_elf_asm_named_section): Use SECTION_DECLARED to detect
	whether a section has already been declared.
	(default_select_section, default_elf_select_section): Return a
	section rather than emitting assembly code.
	(default_elf_select_section_1): Likewise.  Use bss_section for
	SECCAT_BSS if nonnull.  Use get_named_section.
	(default_select_rtx_section): Return a section rather than
	emitting assembly code.
	(default_elf_select_rtx_section): Likewise.  Use get_named_section.
	(file_end_indicate_exec_stack): Use switch_to_section and get_section.
	(output_section_asm_op, switch_to_section): New functions.
	* vmsdbgout.c (vmsdbgout_finish): Use switch_to_section and
	get_named_section.

	* doc/tm.texi: Expand the introduction to the sections documentation.
	(TRAMPOLINE_SECTION): Document new interface.
	(SDATA_SECTION_ASM_OP): Document new macro.
	(READONLY_DATA_SECTION): Delete.
	(SDATA_SECTION_ASM_OP): Document new macro.
	(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
	(TARGET_ASM_INIT_SECTIONS): Document new hook.
	(TARGET_ASM_SELECT_SECTION, TARGET_ASM_FUNCTION_RODATA_SECTION)
	(TARGET_ASM_SELECT_RTX_SECTION): Adjust for new interface.
	(TARGET_EXCEPTION_SECTION, TARGET_EH_FRAME_SECTION): Delete.

gcc/java/
	* class.c (build_utf8_ref, emit_register_classes): Use
	switch_to_section and get_section.

From-SVN: r108152
This commit is contained in:
Richard Sandiford 2005-12-07 07:53:14 +00:00 committed by Richard Sandiford
parent 5e4f1974e4
commit d6b5193bfc
83 changed files with 1910 additions and 2337 deletions

View File

@ -1,3 +1,501 @@
2005-12-07 Richard Sandiford <richard@codesourcery.com>
* config/alpha/alpha.c (alpha_start_function): Use switch_to_section.
(alpha_elf_select_rtx_section): Return the selected section rather
than emitting assembly code.
(alpha_write_linkage): Emit a ".link" directive directly and then
set in_section to NULL.
(vms_asm_out_constructor): Use switch_to_section.
(vms_asm_out_destructor): Likewise.
(unicosmk_output_common): Set in_section to NULL instead of calling
the dummy common_section function.
(unicosmk_text_section): Delete in favor of...
(unicosmk_output_text_section_asm_op): ...this new function.
(unicosmk_data_section): Delete in favor of...
(unicosmk_output_data_section_asm_op): ...this new function.
(unicosmk_init_sections): New function.
(unicosmk_output_deferred_case_vectors): Use switch_to_section.
(unicosmk_output_ssib): Set in_section to NULL instead of calling
the dummy ssib_section function.
(unicosmk_section_buf): Delete.
* config/alpha/alpha-protos.h (unicosmk_text_section): Delete.
(unicosmk_data_section): Delete.
* config/alpha/elf.h (ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, sbss_section, sdata_section)
(SECTION_FUNCTION_TEMPLATE): Delete.
* config/alpha/unicosmk.h (TEXT_SECTION_ASM_OP, DATA_SECTION_ASM_OP)
(READONLY_DATA_SECTION, EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
(common_section, COMMON_SECTION, ssib_section, SSIB_SECTION): Delete.
(ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
(TARGET_ASM_INIT_SECTIONS): Define.
* config/alpha/vms.h (LINK_SECTION_ASM_OP, LITERALS_SECTION_ASM_OP)
(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
(link_section, literals_section): Delete.
(ASM_OUTPUT_DEF): Emit the ".literal" directive directly and then
set in_section to NULL.
* config/arm/aof.h (TEXT_SECTION_ASM_OP, DATA_SECTION_ASM_OP): Delete.
(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, ZERO_INIT_SECTION): Delete.
(COMMON_SECTION): Delete.
(TARGET_ASM_INIT_SECTIONS): Define.
(ASM_OUTPUT_COMMON): Set in_section to NULL rather than calling
the dummy common_section function.
* config/arm/aout.h (ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
* config/arm/arm.c (get_jump_table_size): Use pointer comparison
between readonly_data_section and text_section to check whether
read-only data is being put in the text section.
(arm_output_function_epilogue): Use switch_to_section.
(arm_elf_asm_constructor): Likewise.
(thumb_call_via_reg): Replace call to in_text_section with
a comparison between in_section and text_section.
(arm_file_end): Use switch_to_section.
(aof_text_section): Delete in favor of...
(aof_output_text_section_asm_op): ...this new function.
(aof_data_section): Delete in favor of...
(aof_output_data_section_asm_op): ...this new function.
(aof_asm_init_sections): New function.
(zero_init_section): Moved from config/arm/aof.h.
(aof_dump_imports, aof_file_start): Use switch_to_section.
* config/arm/arm.h (thumb_call_via_label): Update comment.
* config/arm/arm-protos.h (aof_text_section, aof_data_section): Delete.
(common_section): Delete.
* config/arm/pe.h (ASM_DECLARE_FUNCTION_NAME): Use switch_to_section.
(ASM_DECLARE_OBJECT_NAME): Update the type of save_section. Use the
global switch_to_section function instead of the old port-local one.
(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, DRECTVE_SECTION_FUNCTION)
(SWITCH_TO_SECTION_FUNCTION): Delete.
(drectve_section): Redefine as a macro.
* config/arm/unknown-elf.h (ASM_OUTPUT_ALIGNED_BSS):
(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use get_named_section and
switch_to_section.
* config/avr/avr.c (progmem_section): New variable.
(avr_output_progmem_section_asm_op): New function.
(avr_asm_init_sections): New function.
(avr_output_addr_vec_elt): Use switch_to_section.
* config/avr/avr.h (progmem_section): Declare.
(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
(READONLY_DATA_SECTION): Delete.
(TARGET_ASM_INIT_SECTIONS): Define.
(ASM_OUTPUT_CASE_LABEL): Use switch_to_section.
* config/avr/avr-protos.h (progmem_section): Delete.
* config/bfin/bfin.h (ASM_OUTPUT_LOCAL): Use switch_to_section.
* config/c4x/c4x.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
(INIT_SECTION_FUNCTION, FINI_SECTION_FUNCTION): Delete.
* config/darwin-sections.def: New file.
* config/darwin.c: Define all sections in darwin-sections.def.
(output_objc_section_asm_op, darwin_init_sections): New functions.
(machopic_output_indirection): Use switch_to_section.
(machopic_select_section): Return the selected section rather than
emitting assembly code. Replace the static function table with
inline conditional expressions. Update the tests of last_text_section
and move them into the FUNCTION_DECL block.
(machopic_select_rtx_section): Return the selected section rather than
emitting assembly code.
(machopic_asm_out_constructor, machopic_asm_out_destructor)
(darwin_file_end): Use switch_to_section.
* config/darwin.h: Use darwin-sections.def to declare sections.
(INIT_SECTION_ASM_OP): Remove empty definition.
(HAS_INIT_SECTION): Define this instead.
(SECTION_FUNCTION, EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
(READONLY_DATA_SECTION, TARGET_ASM_EXCEPTION_SECTION): Delete.
(TARGET_ASM_EH_FRAME_SECTION): Delete.
(TARGET_ASM_INIT_SECTIONS): Define.
* config/darwin-protos.h (darwin_init_sections): Declare.
(machopic_picsymbol_stub_section, machopic_picsymbol_stub1_section)
(machopic_symbol_stub_section, machopic_symbol_stub1_section): Delete.
(machopic_lazy_symbol_ptr_section, machopic_nl_symbol_ptr_section)
(constructor_section, destructor_section, mod_init_section): Delete.
(mod_term_section): Delete.
(darwin_exception_section, darwin_eh_frame_section): Delete.
(machopic_select_section): Return a section.
(machopic_select_rtx_section): Likewise.
(text_coal_section, text_unlikely_section, text_unlikely_coal_section)
(const_section, const_coal_section, const_data_section): Delete.
(const_data_coal_section, data_coal_section, cstring_section): Delete.
(literal4_section, literal8_section, constructor_section): Delete.
(mod_init_section, mod_term_section, destructor_section): Delete.
(objc_class_section, objc_meta_class_section, objc_category_section)
(objc_class_vars_section, objc_instance_vars_section): Delete.
(objc_cls_meth_section, objc_inst_meth_section): Delete.
(objc_cat_cls_meth_section, objc_cat_inst_meth_section): Delete.
(objc_selector_refs_section, objc_selector_fixup_section): Delete.
(objc_symbols_section, objc_module_info_section): Delete.
(objc_image_info_section, objc_protocol_section): Delete.
(objc_string_object_section, objc_constant_string_object_section)
(objc_class_names_section, objc_meth_var_names_section): Delete.
(objc_meth_var_types_section, objc_cls_refs_section): Delete.
(machopic_lazy_symbol_ptr_section, machopic_nl_symbol_ptr_section)
(machopic_symbol_stub_section, machopic_picsymbol_stub_section)
(darwin_exception_section, darwin_eh_frame_section): Delete.
* config/t-darwin (darwin.o): Depend on config/darwin-sections.def.
* config/frv/frv.c (frv_asm_out_constructor): Use switch_to_section.
(frv_asm_out_destructor): Likewise.
* config/frv/frv.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
(SDATA_SECTION_FUNCTION, FIXUP_SECTION_FUNCTION): Delete.
(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use switch_to_section and
get_named_section.
(ASM_OUTPUT_CASE_LABEL): Use switch_to_section.
* config/frv/frv-protos.h (fixup_section, sdata_section, sbss_section)
(data_section): Delete.
* config/i386/cygming.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
(DRECTVE_SECTION_FUNCTION): Delete.
(drectve_section): Redefine as a macro that sets in_section after
emitting the directive.
(SWITCH_TO_SECTION_FUNCTION): Delete.
* config/i386/darwin.h (ASM_OUTPUT_ALIGN): Replace call to
in_text_section with comparison between in_section and text_section.
* config/i386/i386.c (x86_64_elf_select_section): Return the section
rather than emitting assembly code. Use get_named_section.
(x86_output_aligned_bss, ix86_file_end): Use switch_to_section and
get_named_section.
(machopic_output_stub): Use switch_to_section.
* config/i386/nwld.c (nwld_named_section_asm_out_constructor)
(nwld_named_section_asm_out_destructor): Use get_section and
switch_to_section.
* config/ia64/ia64.c (ia64_select_rtx_section): Return the section
rather than emitting assembly code.
(ia64_rwreloc_select_section): Likewise.
(ia64_rwreloc_select_rtx_section): Likewise.
* config/ia64/ia64-protos.h (sdata_section, sbss_section): Delete.
* config/ia64/sysv4.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use
switch_to_section.
(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
(SDATA_SECTION_FUNCTION, SBSS_SECTION_FUNCTION): Delete.
* config/iq2000/iq2000.c (iq2000_select_rtx_section): Return the
section rather than emitting assembly code.
(iq2000_select_section): Likewise.
* config/iq2000/iq2000.h (rdata_section, sdata_section): Delete.
(sbss_section): Delete.
* config/m32r/m32r.h (ASM_OUTPUT_ALIGNED_BSS): Use switch_to_section
and get_named_section.
* config/m32r/m32r-protos.h (sbss_section, sdata_section): Delete.
* config/mcore/mcore-elf.h (EXPORTS_SECTION_ASM_OP): Delete.
(SUBTARGET_EXTRA_SECTIONS, SUBTARGET_EXTRA_SECTION_FUNCTIONS): Delete.
(EXPORT_SECTION_FUNCTION, SUBTARGET_SWITCH_SECTIONS): Delete.
(MCORE_EXPORT_NAME): Emit the exports directive directly, then set
in_section to NULL.
(ASM_DECLARE_FUNCTION_NAME): Use switch_to_section.
(ASM_DECLARE_OBJECT_NAME): Update the type of save_section. Use the
global switch_to_section function instead of the old port-local one.
* config/mcore/mcore.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
(SWITCH_SECTION_FUNCTION): Delete.
* config/mcore/mcore-pe.h (SUBTARGET_SWITCH_SECTIONS): Delete.
(DRECTVE_SECTION_ASM_OP, SUBTARGET_EXTRA_SECTIONS): Delete.
(SUBTARGET_EXTRA_SECTION_FUNCTIONS, DRECTVE_SECTION_FUNCTION): Delete.
(MCORE_EXPORT_NAME): Emit ".section .drectve" directly, then set
in_section to NULL.
(ASM_DECLARE_OBJECT_NAME): Update the type of save_section. Use the
global switch_to_section function instead of the old port-local one.
(ASM_DECLARE_FUNCTION_NAME): Use switch_to_section.
* config/mips/mips.c (mips_file_start): Update comment.
(mips_output_aligned_bss): Use switch_to_section and get_named_section.
(mips_output_aligned_decl_common): Use switch_to_section.
(mips_select_rtx_section): Return the section rather than emitting
assembly code. Use get_named_section.
(mips_function_rodata_section: Likewise get_section.
(build_mips16_function_stub): Use switch_to_section.
* config/mips/mips.h (ASM_OUTPUT_IDENT): Use switch_to_section.
(SDATA_SECTION_ASM_OP): Delete.
* config/mips/vxworks.h (EXTRA_SECTIONS): Delete.
(EXTRA_SECTION_FUNCTIONS): Delete.
* config/mmix/mmix.c (mmix_file_start, mmix_file_end)
(mmix_asm_output_aligned_local): Use switch_to_section.
* config/pa/pa.c (som_readonly_data_section, som_one_only_data_section)
(som_one_only_readonly_data_section): New variables.
(pa_output_function_epilogue): Set in_section to NULL instead of
calling forget_section.
(output_deferred_plabels): Use select_section.
(pa_asm_output_mi_thunk): Likewise. Set in_section to NULL instead
of calling forget_section.
(pa_asm_output_aligned_bss, pa_asm_output_aligned_common)
(pa_asm_output_aligned_local): Use select_section.
(som_text_section_asm_op): Delete in favor of...
(som_output_text_section_asm_op): ...this new function.
(pa_som_asm_init_sections): New function.
(pa_select_section): Return the section rather than emitting
assembly code.
* config/pa/pa.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
(SOM_READONLY_DATA_SECTION_FUNCTION): Delete.
(SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION): Delete.
(SOM_ONE_ONLY_DATA_SECTION_FUNCTION, FORGET_SECTION_FUNCTION): Delete.
* config/pa/pa-protos.h (som_text_section_asm_op): Delete.
(som_readonly_data_section, som_one_only_readonly_data_section)
(som_one_only_data_section, forget_section): Delete.
* config/pa/som.h (TEXT_SECTION_ASM_OP): Delete.
(TARGET_ASM_INIT_SECTIONS): Define.
(READONLY_DATA_SECTION, TARGET_ASM_EXCEPTION_SECTION): Delete.
* config/rs6000/rs6000.c (read_only_data_section): New variable.
(private_data_section, read_only_private_data_section): New variables.
(sdata2_section, toc_section): New variables.
(rs6000_file_start): Use switch_to_section.
(rs6000_assemble_integer): Use comparisons against in_section
instead of calling in_toc_section and in_text_section. Use
unlikely_text_section_p.
(rs6000_elf_output_toc_section_asm_op): New function, derived
from the old rs6000/sysv4.h toc_section function.
(rs6000_elf_asm_init_sections): New function.
(rs6000_elf_select_rtx_section, rs6000_elf_select_section): Return
the section rather than emitting assembly code.
(machopic_output_stub): Use switch_to_section.
(toc_section): Delete dummy function.
(rs6000_elf_asm_out_constructor, rs6000_elf_asm_out_destructor): Use
switch_to_section and get_section.
(rs6000_xcoff_output_readonly_section_asm_op): New function.
(rs6000_xcoff_output_readwrite_section_asm_op): New function.
(rs6000_xcoff_output_toc_section_asm_op): New function, derived from
the old rs6000/xcoff.h toc_section function.
(rs6000_xcoff_asm_init_sections): New function.
(rs6000_xcoff_select_section, rs6000_xcoff_select_rtx_section): Return
the section rather than emitting assembly code.
(rs6000_xcoff_file_start): Use switch_to_section.
(rs6000_xcoff_file_end): Likewise.
* config/rs6000/rs6000-protos.h (toc_section, sdata_section): Delete.
(sdata2_section, sbss_section, private_data_section): Delete.
(read_only_data_section, read_only_private_data_section): Delete.
* config/rs6000/sysv4.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
(TOC_SECTION_FUNCTION, SDATA_SECTION_FUNCTION, SDATA2_SECTION_FUNCTION)
(SBSS_SECTION_FUNCTION, INIT_SECTION_FUNCTION): Delete.
(FINI_SECTION_FUNCTION): Delete.
(TARGET_ASM_INIT_SECTIONS): Define.
(ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
* config/rs6000/xcoff.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
(READ_ONLY_DATA_SECTION_FUNCTION, PRIVATE_DATA_SECTION_FUNCTION)
(READ_ONLY_PRIVATE_DATA_SECTION_FUNCTION, TOC_SECTION_FUNCTION)
(READONLY_DATA_SECTION): Delete.
(TARGET_ASM_INIT_SECTIONS): Define.
(ASM_DECLARE_FUNCTION_NAME): Use switch_to_section. Set in_section
to NULL rather than no_section.
(TARGET_ASM_EXCEPTION_SECTION): Delete.
* config/sh/sh.c (sh_file_start): Use switch_to_section.
* config/sparc/sparc.c (emit_pic_helper): Use switch_to_section.
(sparc_output_deferred_case_vectors): Likewise. Remove argument
from call to current_function_section.
* config/stormy16/stormy16.c: Include ggc.h and gt-storm16.h.
(bss100_section): New variable.
(xstormy16_asm_output_aligned_common): Use switch_to_section.
(xstormy16_asm_init_sections): New function.
(xstormy16_asm_out_destructor, xstormy16_asm_out_constructor): Use
switch_to_section and get_section.
(xstormy16_output_addr_vec): Use switch_to_section. Remove argument
from calls to current_function_section.
* config/stormy16/stormy16.h (EXTRA_SECTIONS): Delete.
(XSTORMY16_SECTION_FUNCTION, EXTRA_SECTION_FUNCTIONS): Delete.
(TARGET_ASM_INIT_SECTIONS): Define.
* config/stormy16/stormy16-protos.h (bss100_section): Delete.
* config/svr3.h (ASM_OUTPUT_LOCAL): Use switch_to_section.
(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, INIT_SECTION_FUNCTION)
(FINI_SECTION_FUNCTION): Delete.
* config/v850/v850.c: Include gt-v850.h.
(rosdata_section, rozdata_section, tdata_section, zdata_section)
(zbss_section): New variables.
(v850_output_aligned_bss): Use switch_to_section.
(v850_asm_init_sections): New function.
(v850_select_section): Return the section rather than emitting
assembly code.
* config/v850/v850.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
(ZDATA_SECTION_ASM_OP, ZBSS_SECTION_ASM_OP, TDATA_SECTION_ASM_OP)
(ROSDATA_SECTION_ASM_OP, ROZDATA_SECTION_ASM_OP): Delete.
(TARGET_ASM_INIT_SECTIONS): Define.
* config/v850/v850-protos.h (sdata_section, rosdata_section): Delete.
(sbss_section, tdata_section, zdata_section, rozdata_section): Delete.
(zbss_section): Delete.
* config/vax/vaxv.h (ASM_OUTPUT_LOCAL): Use switch_to_section.
* config/vx-common.h (vxworks_exception_section): Delete.
(TARGET_ASM_EXCEPTION_SECTION): Delete.
* config/xtensa/xtensa.c (xtensa_select_rtx_section): Return the
section rather than emitting assembly code.
* config/xtensa/xtensa.h (ASM_OUTPUT_POOL_PROLOGUE): Use
switch_to_section.
* Makefile.in (GTFILES): Add $(srcdir)/output.h.
* coretypes.h (section): New union and typedef.
* dbxout.c (FORCE_TEXT): Use switch_to_section. Remove argument
from call to current_function_section.
(dbxout_function_end, dbxout_init, dbxout_source_file, dbxout_finish)
(dbxout_symbol_location): Use switch_to_section.
* dwarf2out.c (named_section_eh_frame_section): Delete, moving
most of the code into...
(default_eh_frame_section): ...here. Return a section.
(collect2_eh_frame_section): Delete, moving most of the code into..
(switch_to_eh_frame_section): ...this new function.
(debug_info_section, debug_abbrev_section, debug_aranges_section)
(debug_macinfo_section, debug_line_section, debug_loc_section)
(debug_pubnames_section, debug_str_section, debug_ranges_section): New
variables.
(output_call_frame_info): Call switch_to_eh_frame_section instead of
eh_frame_section. Use switch_to_section and get_section.
(dwarf2out_begin_prologue): Use switch_to_section.
(AT_string_form): Check the flags in debug_str_section instead of
DEBUG_STR_SECTION_FLAGS.
(output_comp_unit): Use switch_to_section, get_section, and
debug_info_section.
(output_line_info, secname_for_decl): Use unlikely_text_section_p.
(dwarf2out_begin_block): Use switch_to_section. Remove argument
from call to current_function_section.
(dwarf2out_var_location): Use unlikely_text_section_p.
(dwarf2out_source_line): Use switch_to_section. Remove argument
from call to current_function_section.
(dwarf2out_start_source_file, dwarf2out_end_source_file)
(dwarf2out_define, dwarf2out_undef: Use switch_to_section and
debug_macinfo_section.
(dwarf2out_init): Initialize the new section variables. Use them
instead of calls to named_section_flags. Use switch_to_section.
(output_indirect_string): Use switch_to_section and debug_str_section.
(dwarf2out_finish): Use switch_to_section and the new section
variables.
* except.c (default_exception_section): Return the section instead
of emitting assembly code.
(output_function_exception_table): Use the global exception_section
variable instead of the target hook. Use switch_to_section. Remove
argument from call to current_function_section.
* final.c (HAVE_READONLY_DATA_SECTION): Delete.
(shorten_branches): Use pointer comparisons to detect whether the
text section is the same as readonly_data_section.
(profile_function): Use switch_to_section. Remove argument from
call to current_function_section.
(final_scan_insn): Likewise. Update use of last_text_section.
* gengtype.c (open_base_files): Add an include of output.h.
* output.h (text_section, data_section, readonly_data_section)
(ctors_section, dtors_section, bss_section, init_section)
(fini_section, sdata_section): Turn into section pointers.
(in_text_section, in_unlikely_text_section, exports_section)
(drectve_section, named_section, mergeable_string_section)
(last_text_section_name): Delete.
(default_exception_section, default_eh_frame_section): Return sections.
(SECTION_DECLARED, SECTION_NAMED): New macros.
(SECTION_MACH_DEP): Bump value.
(section_common, named_section, unnamed_section): New structures.
(unnamed_section_callback): New typedef.
(section): New union.
(sbss_section, exception_section, eh_frame_section): New variables.
(in_section, last_text_section): Turn into section pointers.
(get_unnamed_section, get_section, get_named_section): New functions.
(mergeable_constant_section, function_section): Return a section.
(unlikely_text_section): Likewise.
(current_function_section): Likewise. Remove the decl argument.
(unlikely_text_section_p, switch_to_section): New functions.
(output_section_asm_op): New function.
(set_named_section_flags, named_section_flags, named_section_real)
(named_section_first_declaration): Delete.
(default_select_section, default_elf_select_section): Return a section.
(default_elf_select_section_1, default_function_rodata_section)
(default_no_function_rodata_section, default_select_rtx_section)
(default_elf_select_rtx_section): Likewise.
* rtl.h (in_data_section): Delete.
* sdbout.c (sdbout_one_type): Use switch_to_section.
* system.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Poison.
(READONLY_DATA_SECTION, TARGET_ASM_EXCEPTION_SECTION): Poison.
(TARGET_ASM_EH_FRAME_SECTION): Poison.
* target-def.h (TARGET_ASM_INIT_SECTIONS): New macro.
(TARGET_ASM_EXCEPTION_SECTION, TARGET_ASM_EH_FRAME_SECTION): Delete.
(TARGET_ASM_OUT): Update after above changes.
* target.h (init_sections): New hook.
(exception_section, eh_frame_section): Delete.
(select_section, select_rtx_section, function_rodata_section): Return
a section rather than emitting assembly code.
* varasm.c (text_section, data_section, readonly_data_section)
(ctors_section, dtors_section, bss_section, init_section)
(fini_section): Turn into section pointers.
(sdata_section, sbss_section, exception_section): New variables.
(eh_frame_section): New variable.
(in_section): Make global and turn into a section pointer.
(last_text_section): Turn into a section pointer.
(unnamed_sections): New variable.
(in_named_name, last_text_section_name): Delete.
(EXTRA_SECTION_FUNCTIONS): Delete.
(in_named_entry): Delete.
(section_htab): New variable, replacing...
(in_named_htab): ...this deleted variable.
(section_entry_eq, section_entry_hash): New functions, based on...
(in_named_entry_eq, in_named_entry_hash): ...these deleted functions.
(get_unnamed_section, get_section): New functions.
(unlikely_text_section): Return a section instead of emitting
assembly code.
(in_text_section, in_unlikely_text_section, in_data_section): Delete.
(get_named_section_flags, named_section_first_declaration): Delete.
(unlikely_text_section_p): New function.
(named_section_real, named_section): Delete.
(get_named_section): New function.
(asm_output_bss, asm_output_aligned_bss): Use switch_to_section.
(function_section): Return a section rather than emitting
assembly code.
(current_function_section): Likewise. Remove argument. Use
last_text_section if nonnull, otherwise use function_section.
(default_function_rodata_section): Return a section rather than
emitting assembly code. Use get_section.
(default_no_function_rodata_section): Return a section rather than
emitting assembly code.
(variable_section): Use switch_to_section and get_named_section.
(mergeable_string_section): Return a section rather than emitting
assembly code. Use get_section. Make static. Don't take special
countermeasures for empty strings.
(mergeable_constant_section): Return a section rather than emitting
assembly code. Use get_section.
(default_named_section_asm_out_destructor): Use switch_to_section
and get_section.
(default_dtor_section_asm_out_destructor): Use switch_to_section.
(default_named_section_asm_out_constructor): Use switch_to_section
and get_section.
(default_ctor_section_asm_out_constructor): Use switch_to_section.
(assemble_start_function): Likewise. Set last_text_section to
NULL rather than no_section. Change the type of save_section.
(assemble_zeros, assemble_variable): Use the section flags to detect
whether or not a section is text.
(assemble_static_space): Use switch_to_section.
(assemble_trampoline_template): Likewise.
(output_constant_def_contents): Use switch_to_section and
get_named_section.
(output_constant_pool_1): Use switch_to_section. Use the section
flags to see whether sections contain mergeable data.
(init_varasm_once): Initialize section_htab instead of in_named_htab.
Initialize new section variables. Call TARGET_ASM_INIT_SECTIONS.
(default_elf_asm_named_section): Use SECTION_DECLARED to detect
whether a section has already been declared.
(default_select_section, default_elf_select_section): Return a
section rather than emitting assembly code.
(default_elf_select_section_1): Likewise. Use bss_section for
SECCAT_BSS if nonnull. Use get_named_section.
(default_select_rtx_section): Return a section rather than
emitting assembly code.
(default_elf_select_rtx_section): Likewise. Use get_named_section.
(file_end_indicate_exec_stack): Use switch_to_section and get_section.
(output_section_asm_op, switch_to_section): New functions.
* vmsdbgout.c (vmsdbgout_finish): Use switch_to_section and
get_named_section.
* doc/tm.texi: Expand the introduction to the sections documentation.
(TRAMPOLINE_SECTION): Document new interface.
(SDATA_SECTION_ASM_OP): Document new macro.
(READONLY_DATA_SECTION): Delete.
(SDATA_SECTION_ASM_OP): Document new macro.
(EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
(TARGET_ASM_INIT_SECTIONS): Document new hook.
(TARGET_ASM_SELECT_SECTION, TARGET_ASM_FUNCTION_RODATA_SECTION)
(TARGET_ASM_SELECT_RTX_SECTION): Adjust for new interface.
(TARGET_EXCEPTION_SECTION, TARGET_EH_FRAME_SECTION): Delete.
2005-12-07 Alan Modra <amodra@bigpond.net.au>
* gcc.c (init_gcc_specs): Match braces inside conditionally

View File

@ -2743,7 +2743,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/coverage.c $(srcdir)/function.h $(srcdir)/rtl.h \
$(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(SYMTAB_H) \
$(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/insn-addr.h $(srcdir)/hwint.h \
$(srcdir)/ipa-reference.h \
$(srcdir)/ipa-reference.h $(srcdir)/output.h \
$(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/cgraph.h \
$(srcdir)/c-common.h $(srcdir)/c-tree.h $(srcdir)/reload.h \
$(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \

View File

@ -127,8 +127,6 @@ extern rtx unicosmk_add_call_info_word (rtx);
extern void unicosmk_defer_case_vector (rtx, rtx);
extern void unicosmk_add_extern (const char *);
extern void unicosmk_output_align (FILE *, int);
extern char * unicosmk_text_section (void);
extern char * unicosmk_data_section (void);
extern void unicosmk_output_common (FILE *, const char *, int, int);
extern int unicosmk_initial_elimination_offset (int, int);
#endif

View File

@ -7959,14 +7959,14 @@ alpha_start_function (FILE *file, const char *fnname,
#if TARGET_ABI_OPEN_VMS
/* Ifdef'ed cause link_section are only available then. */
readonly_data_section ();
switch_to_section (readonly_data_section);
fprintf (file, "\t.align 3\n");
assemble_name (file, fnname); fputs ("..na:\n", file);
fputs ("\t.ascii \"", file);
assemble_name (file, fnname);
fputs ("\\0\"\n", file);
alpha_need_linkage (fnname, 1);
text_section ();
switch_to_section (text_section);
#endif
}
@ -9355,18 +9355,18 @@ alpha_file_start (void)
#ifdef OBJECT_FORMAT_ELF
/* Switch to the section to which we should output X. The only thing
special we do here is to honor small data. */
/* Return a section for X. The only special thing we do here is to
honor small data. */
static void
static section *
alpha_elf_select_rtx_section (enum machine_mode mode, rtx x,
unsigned HOST_WIDE_INT align)
{
if (TARGET_SMALL_DATA && GET_MODE_SIZE (mode) <= g_switch_value)
/* ??? Consider using mergeable sdata sections. */
sdata_section ();
return sdata_section;
else
default_elf_select_rtx_section (mode, x, align);
return default_elf_select_rtx_section (mode, x, align);
}
#endif /* OBJECT_FORMAT_ELF */
@ -9636,8 +9636,10 @@ alpha_write_linkage (FILE *stream, const char *funname, tree fundecl)
splay_tree_node node;
struct alpha_funcs *func;
link_section ();
fprintf (stream, "\t.link\n");
fprintf (stream, "\t.align 3\n");
in_section = NULL;
node = splay_tree_lookup (alpha_funcs_tree, (splay_tree_key) fundecl);
func = (struct alpha_funcs *) node->value;
@ -9717,7 +9719,7 @@ vms_asm_named_section (const char *name, unsigned int flags,
static void
vms_asm_out_constructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
{
ctors_section ();
switch_to_section (ctors_section);
assemble_align (BITS_PER_WORD);
assemble_integer (symbol, UNITS_PER_WORD, BITS_PER_WORD, 1);
}
@ -9725,7 +9727,7 @@ vms_asm_out_constructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
static void
vms_asm_out_destructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
{
dtors_section ();
switch_to_section (dtors_section);
assemble_align (BITS_PER_WORD);
assemble_integer (symbol, UNITS_PER_WORD, BITS_PER_WORD, 1);
}
@ -9826,7 +9828,7 @@ unicosmk_output_common (FILE *file, const char *name, int size, int align)
tree name_tree;
printf ("T3E__: common %s\n", name);
common_section ();
in_section = NULL;
fputs("\t.endp\n\n\t.psect ", file);
assemble_name(file, name);
fprintf(file, ",%d,common\n", floor_log2 (align / BITS_PER_UNIT));
@ -9841,6 +9843,43 @@ unicosmk_output_common (FILE *file, const char *name, int size, int align)
#define SECTION_MAIN (SECTION_PUBLIC << 1)
static int current_section_align;
/* A get_unnamed_section callback for switching to the text section. */
static void
unicosmk_output_text_section_asm_op (const void *data ATTRIBUTE_UNUSED)
{
static int count = 0;
fprintf (asm_out_file, "\t.endp\n\n\t.psect\tgcc@text___%d,code\n", count++);
}
/* A get_unnamed_section callback for switching to the data section. */
static void
unicosmk_output_data_section_asm_op (const void *data ATTRIBUTE_UNUSED)
{
static int count = 1;
fprintf (asm_out_file, "\t.endp\n\n\t.psect\tgcc@data___%d,data\n", count++);
}
/* Implement TARGET_ASM_INIT_SECTIONS.
The Cray assembler is really weird with respect to sections. It has only
named sections and you can't reopen a section once it has been closed.
This means that we have to generate unique names whenever we want to
reenter the text or the data section. */
static void
unicosmk_init_sections (void)
{
text_section = get_unnamed_section (SECTION_CODE,
unicosmk_output_text_section_asm_op,
NULL);
data_section = get_unnamed_section (SECTION_WRITE,
unicosmk_output_data_section_asm_op,
NULL);
readonly_data_section = data_section;
}
static unsigned int
unicosmk_section_type_flags (tree decl, const char *name,
int reloc ATTRIBUTE_UNUSED)
@ -10004,7 +10043,7 @@ unicosmk_output_deferred_case_vectors (FILE *file)
if (machine->addr_list == NULL_RTX)
return;
data_section ();
switch_to_section (data_section);
for (t = machine->addr_list; t; t = XEXP (t, 1))
unicosmk_output_addr_vec (file, XEXP (t, 0));
}
@ -10123,7 +10162,7 @@ unicosmk_output_ssib (FILE *file, const char *fnname)
rtx ciw;
struct machine_function *machine = cfun->machine;
ssib_section ();
in_section = NULL;
fprintf (file, "\t.endp\n\n\t.psect\t%s%s,data\n", user_label_prefix,
unicosmk_ssib_name ());
@ -10195,26 +10234,6 @@ unicosmk_add_call_info_word (rtx x)
+ strlen (current_function_name ())/8 + 5);
}
static char unicosmk_section_buf[100];
char *
unicosmk_text_section (void)
{
static int count = 0;
sprintf (unicosmk_section_buf, "\t.endp\n\n\t.psect\tgcc@text___%d,code",
count++);
return unicosmk_section_buf;
}
char *
unicosmk_data_section (void)
{
static int count = 1;
sprintf (unicosmk_section_buf, "\t.endp\n\n\t.psect\tgcc@data___%d,data",
count++);
return unicosmk_section_buf;
}
/* The Cray assembler doesn't accept extern declarations for symbols which
are defined in the same file. We have to keep track of all global
symbols which are referenced and/or defined in a source file and output

View File

@ -123,9 +123,9 @@ do { \
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
do { \
if ((SIZE) <= g_switch_value) \
sbss_section(); \
switch_to_section (sbss_section); \
else \
bss_section(); \
switch_to_section (bss_section); \
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
if (!flag_inhibit_size_directive) \
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
@ -193,37 +193,6 @@ do { \
#endif
/* A default list of other sections which we might be "in" at any given
time. For targets that use additional sections (e.g. .tdesc) you
should override this definition in the target-specific file which
includes this file. */
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_sbss, in_sdata
/* A default list of extra section function definitions. For targets
that use additional sections (e.g. .tdesc) you should override this
definition in the target-specific file which includes this file. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \
SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP)
extern void sbss_section (void);
extern void sdata_section (void);
#undef SECTION_FUNCTION_TEMPLATE
#define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
void FN (void) \
{ \
if (in_section != ENUM) \
{ \
fprintf (asm_out_file, "%s\n", OP); \
in_section = ENUM; \
} \
}
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
#define TARGET_ASM_SELECT_SECTION default_elf_select_section

View File

@ -244,51 +244,9 @@ do { fprintf (FILE, "\tbr $1,0\n"); \
/* Define this as 1 if `char' should by default be signed; else as 0. */
/* #define DEFAULT_SIGNED_CHAR 1 */
/* The Cray assembler is really weird with respect to sections. It has only
named sections and you can't reopen a section once it has been closed.
This means that we have to generate unique names whenever we want to
reenter the text or the data section. The following is a rather bad hack
as TEXT_SECTION_ASM_OP and DATA_SECTION_ASM_OP are supposed to be
constants. */
#undef TEXT_SECTION_ASM_OP
#define TEXT_SECTION_ASM_OP unicosmk_text_section ()
#undef DATA_SECTION_ASM_OP
#define DATA_SECTION_ASM_OP unicosmk_data_section ()
/* There are no read-only sections on Unicos/Mk. */
#undef READONLY_DATA_SECTION_ASM_OP
#define READONLY_DATA_SECTION data_section
/* Define extra sections for common data and SSIBs (static subroutine
information blocks). The actual section header is output by the callers
of these functions. */
#undef EXTRA_SECTIONS
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTIONS in_common, in_ssib
#define EXTRA_SECTION_FUNCTIONS \
COMMON_SECTION \
SSIB_SECTION
extern void common_section (void);
#define COMMON_SECTION \
void \
common_section (void) \
{ \
in_section = in_common; \
}
extern void ssib_section (void);
#define SSIB_SECTION \
void \
ssib_section (void) \
{ \
in_section = in_ssib; \
}
/* We take care of this in unicosmk_file_start. */
@ -413,7 +371,7 @@ ssib_section (void) \
#undef ASM_OUTPUT_LOCAL
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
do { data_section (); \
do { switch_to_section (data_section); \
fprintf (FILE, "\t.align\t%d\n", floor_log2 ((ALIGN) / BITS_PER_UNIT));\
ASM_OUTPUT_LABEL ((FILE), (NAME)); \
fprintf (FILE, "\t.byte 0:"HOST_WIDE_INT_PRINT_UNSIGNED"\n",(SIZE));\
@ -449,6 +407,7 @@ ssib_section (void) \
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION unicosmk_asm_named_section
#define TARGET_ASM_INIT_SECTIONS unicosmk_init_sections
#undef ASM_OUTPUT_MAX_SKIP_ALIGN
#define ASM_OUTPUT_MAX_SKIP_ALIGN(STREAM,POWER,MAXSKIP)

View File

@ -198,39 +198,10 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
#undef STACK_CHECK_BUILTIN
#define STACK_CHECK_BUILTIN 0
#define LINK_SECTION_ASM_OP "\t.link"
#define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
#define LITERALS_SECTION_ASM_OP "\t.literals"
#define CTORS_SECTION_ASM_OP "\t.ctors"
#define DTORS_SECTION_ASM_OP "\t.dtors"
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_link, in_literals
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
void \
link_section (void) \
{ \
if (in_section != in_link) \
{ \
fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \
in_section = in_link; \
} \
} \
void \
literals_section (void) \
{ \
if (in_section != in_literals) \
{ \
fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); \
in_section = in_literals; \
} \
}
extern void link_section (void);
extern void literals_section (void);
#undef ASM_OUTPUT_ADDR_DIFF_ELT
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) gcc_unreachable ()
@ -327,7 +298,8 @@ do { \
#define TARGET_ASM_NAMED_SECTION vms_asm_named_section
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
do { literals_section(); \
do { fprintf ((FILE), "\t.literals\n"); \
in_section = NULL; \
fprintf ((FILE), "\t"); \
assemble_name (FILE, LABEL1); \
fprintf (FILE, " = "); \

View File

@ -44,48 +44,6 @@
#define LIBGCC_SPEC "libgcc.a%s"
/* Dividing the Output into Sections (Text, Data, ...) */
/* AOF Assembler syntax is a nightmare when it comes to areas, since once
we change from one area to another, we can't go back again. Instead,
we must create a new area with the same attributes and add the new output
to that. Unfortunately, there is nothing we can do here to guarantee that
two areas with the same attributes will be linked adjacently in the
resulting executable, so we have to be careful not to do pc-relative
addressing across such boundaries. */
#define TEXT_SECTION_ASM_OP aof_text_section ()
#define DATA_SECTION_ASM_OP aof_data_section ()
#define EXTRA_SECTIONS in_zero_init, in_common
#define EXTRA_SECTION_FUNCTIONS \
ZERO_INIT_SECTION \
COMMON_SECTION
#define ZERO_INIT_SECTION \
void \
zero_init_section () \
{ \
static int zero_init_count = 1; \
\
if (in_section != in_zero_init) \
{ \
fprintf (asm_out_file, "\tAREA |C$$zidata%d|,NOINIT\n", \
zero_init_count++); \
in_section = in_zero_init; \
} \
}
/* Used by ASM_OUTPUT_COMMON (below) to tell varasm.c that we've
changed areas. */
#define COMMON_SECTION \
void \
common_section () \
{ \
if (in_section != in_common) \
in_section = in_common; \
}
#define CTOR_LIST_BEGIN \
asm (CTORS_SECTION_ASM_OP); \
extern func_ptr __CTOR_END__[1]; \
@ -130,6 +88,8 @@
whole table generation until the end of the function. */
#define JUMP_TABLES_IN_TEXT_SECTION 1
#define TARGET_ASM_INIT_SECTIONS aof_asm_init_sections
/* Some systems use __main in a way incompatible with its use in gcc, in these
cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
give the same symbol without quotes for an alternative entry point. You
@ -159,7 +119,7 @@
/* Output of Uninitialized Variables. */
#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
(common_section (), \
(in_section = NULL, \
fprintf ((STREAM), "\tAREA "), \
assemble_name ((STREAM), (NAME)), \
fprintf ((STREAM), ", DATA, COMMON\n\t%% %d\t%s size=%d\n", \

View File

@ -273,7 +273,7 @@
#define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \
do \
{ \
bss_section (); \
switch_to_section (bss_section); \
ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
ASM_OUTPUT_LABEL (STREAM, NAME); \
fprintf (STREAM, "\t.space\t%d\n", (int)(SIZE)); \

View File

@ -139,12 +139,9 @@ extern int arm_apply_result_size (void);
#if defined AOF_ASSEMBLER
extern rtx aof_pic_entry (rtx);
extern char *aof_text_section (void);
extern char *aof_data_section (void);
extern void aof_add_import (const char *);
extern void aof_delete_import (const char *);
extern void zero_init_section (void);
extern void common_section (void);
#endif /* AOF_ASSEMBLER */
#endif /* RTX_CODE */

View File

@ -161,6 +161,7 @@ static void aof_dump_imports (FILE *);
static void aof_dump_pic_table (FILE *);
static void aof_file_start (void);
static void aof_file_end (void);
static void aof_asm_init_sections (void);
#endif
static rtx arm_struct_value_rtx (tree, int);
static void arm_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
@ -7297,11 +7298,7 @@ get_jump_table_size (rtx insn)
{
/* ADDR_VECs only take room if read-only data does into the text
section. */
if (JUMP_TABLES_IN_TEXT_SECTION
#if !defined(READONLY_DATA_SECTION) && !defined(READONLY_DATA_SECTION_ASM_OP)
|| 1
#endif
)
if (JUMP_TABLES_IN_TEXT_SECTION || readonly_data_section == text_section)
{
rtx body = PATTERN (insn);
int elt = GET_CODE (body) == ADDR_DIFF_VEC ? 1 : 0;
@ -10064,7 +10061,7 @@ arm_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
if (label != NULL)
{
function_section (current_function_decl);
switch_to_section (function_section (current_function_decl));
targetm.asm_out.internal_label (asm_out_file, "L",
CODE_LABEL_NUMBER (label));
asm_fprintf (asm_out_file, "\tbx\t%r\n", regno);
@ -11281,7 +11278,7 @@ arm_elf_asm_constructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
}
/* Put these in the .init_array section, using a special relocation. */
ctors_section ();
switch_to_section (ctors_section);
assemble_align (POINTER_SIZE);
fputs ("\t.word\t", asm_out_file);
output_addr_const (asm_out_file, symbol);
@ -14195,7 +14192,7 @@ thumb_call_via_reg (rtx reg)
/* If we are in the normal text section we can use a single instance
per compilation unit. If we are doing function sections, then we need
an entry per section, since we can't rely on reachability. */
if (in_text_section ())
if (in_section == text_section)
{
thumb_call_reg_needed = 1;
@ -14332,7 +14329,7 @@ arm_file_end (void)
if (! thumb_call_reg_needed)
return;
text_section ();
switch_to_section (text_section);
asm_fprintf (asm_out_file, "\t.code 16\n");
ASM_OUTPUT_ALIGN (asm_out_file, 1);
@ -14407,25 +14404,56 @@ aof_dump_pic_table (FILE *f)
int arm_text_section_count = 1;
char *
aof_text_section (void )
/* A get_unnamed_section callback for switching to the text section. */
static void
aof_output_text_section_asm_op (const void *data ATTRIBUTE_UNUSED)
{
static char buf[100];
sprintf (buf, "\tAREA |C$$code%d|, CODE, READONLY",
fprintf (asm_out_file, "\tAREA |C$$code%d|, CODE, READONLY",
arm_text_section_count++);
if (flag_pic)
strcat (buf, ", PIC, REENTRANT");
return buf;
fprintf (asm_out_file, ", PIC, REENTRANT");
fprintf (asm_out_file, "\n");
}
static int arm_data_section_count = 1;
char *
aof_data_section (void)
/* A get_unnamed_section callback for switching to the data section. */
static void
aof_output_data_section_asm_op (const void *data ATTRIBUTE_UNUSED)
{
static char buf[100];
sprintf (buf, "\tAREA |C$$data%d|, DATA", arm_data_section_count++);
return buf;
fprintf (asm_out_file, "\tAREA |C$$data%d|, DATA\n",
arm_data_section_count++);
}
/* Implement TARGET_ASM_INIT_SECTIONS.
AOF Assembler syntax is a nightmare when it comes to areas, since once
we change from one area to another, we can't go back again. Instead,
we must create a new area with the same attributes and add the new output
to that. Unfortunately, there is nothing we can do here to guarantee that
two areas with the same attributes will be linked adjacently in the
resulting executable, so we have to be careful not to do pc-relative
addressing across such boundaries. */
static void
aof_asm_init_sections (void)
{
text_section = get_unnamed_section (SECTION_CODE,
aof_output_text_section_asm_op, NULL);
data_section = get_unnamed_section (SECTION_WRITE,
aof_output_data_section_asm_op, NULL);
readonly_data_section = text_section;
}
void
zero_init_section (void)
{
static int zero_init_count = 1;
fprintf (asm_out_file, "\tAREA |C$$zidata%d|,NOINIT\n", zero_init_count++);
in_section = NULL;
}
/* The AOF assembler is religiously strict about declarations of
@ -14486,7 +14514,7 @@ aof_dump_imports (FILE *f)
automagically. */
if (arm_main_function)
{
text_section ();
switch_to_section (text_section);
fputs ("\tIMPORT __main\n", f);
fputs ("\tDCD __main\n", f);
}
@ -14537,7 +14565,7 @@ aof_file_start (void)
fputs ("__f5\tFN\t5\n", asm_out_file);
fputs ("__f6\tFN\t6\n", asm_out_file);
fputs ("__f7\tFN\t7\n", asm_out_file);
text_section ();
switch_to_section (text_section);
}
static void

View File

@ -1527,7 +1527,7 @@ typedef struct machine_function GTY(())
machine_function;
/* As in the machine_function, a global set of call-via labels, for code
that is in text_section(). */
that is in text_section. */
extern GTY(()) rtx thumb_call_via_label[14];
/* A C type for declaring a variable that is used as the first argument of

View File

@ -93,7 +93,7 @@
drectve_section (); \
fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
arm_strip_name_encoding (NAME)); \
function_section (DECL); \
switch_to_section (function_section (DECL)); \
} \
ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \
if (TARGET_THUMB) \
@ -130,11 +130,11 @@
{ \
if (arm_dllexport_name_p (NAME)) \
{ \
enum in_section save_section = in_section; \
section *save_section = in_section; \
drectve_section (); \
fprintf (STREAM, "\t.ascii \" -export:%s\"\n",\
arm_strip_name_encoding (NAME)); \
switch_to_section (save_section, (DECL)); \
switch_to_section (save_section); \
} \
ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
} \
@ -144,51 +144,6 @@
#define DRECTVE_SECTION_ASM_OP "\t.section .drectve"
/* A list of other sections which the compiler might be "in" at any
given time. */
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_drectve
/* A list of extra section function definitions. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
DRECTVE_SECTION_FUNCTION \
SWITCH_TO_SECTION_FUNCTION
#define DRECTVE_SECTION_FUNCTION \
void \
drectve_section (void) \
{ \
if (in_section != in_drectve) \
{ \
fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP); \
in_section = in_drectve; \
} \
}
/* Switch to SECTION (an `enum in_section').
??? This facility should be provided by GCC proper.
The problem is that we want to temporarily switch sections in
ASM_DECLARE_OBJECT_NAME and then switch back to the original section
afterwards. */
#define SWITCH_TO_SECTION_FUNCTION \
static void \
switch_to_section (enum in_section section, tree decl) \
{ \
switch (section) \
{ \
case in_text: text_section (); break; \
case in_unlikely_executed_text: unlikely_text_section (); break; \
case in_data: data_section (); break; \
case in_named: named_section (decl, NULL, 0); break; \
case in_readonly_data: readonly_data_section (); break; \
case in_ctors: ctors_section (); break; \
case in_dtors: dtors_section (); break; \
case in_drectve: drectve_section (); break; \
default: abort (); break; \
} \
}
#define drectve_section() \
(fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP), \
in_section = NULL)

View File

@ -58,9 +58,9 @@
do \
{ \
if (IN_NAMED_SECTION (DECL)) \
named_section (DECL, NULL, 0); \
switch_to_section (get_named_section (DECL, NULL, 0)); \
else \
bss_section (); \
switch_to_section (bss_section); \
\
ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
\
@ -75,9 +75,9 @@
do \
{ \
if ((DECL) != NULL && IN_NAMED_SECTION (DECL)) \
named_section (DECL, NULL, 0); \
switch_to_section (get_named_section (DECL, NULL, 0)); \
else \
bss_section (); \
switch_to_section (bss_section); \
\
ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
ASM_OUTPUT_LABEL (FILE, NAME); \

View File

@ -35,7 +35,6 @@ extern void asm_globalize_label (FILE *file, const char *name);
extern void order_regs_for_local_alloc (void);
extern int initial_elimination_offset (int from, int to);
extern int avr_simple_epilogue (void);
extern void progmem_section (void);
extern int mask_one_bit_p (HOST_WIDE_INT mask);
extern void gas_output_limited_string (FILE *file, const char *str);
extern void gas_output_ascii (FILE *file, const char *str, size_t length);

View File

@ -69,6 +69,7 @@ static void avr_file_end (void);
static void avr_output_function_prologue (FILE *, HOST_WIDE_INT);
static void avr_output_function_epilogue (FILE *, HOST_WIDE_INT);
static void avr_insert_attributes (tree, tree *);
static void avr_asm_init_sections (void);
static unsigned int avr_section_type_flags (tree, const char *, int);
static void avr_reorg (void);
@ -114,6 +115,8 @@ static int jump_tables_size;
const char *avr_base_arch_macro;
const char *avr_extra_arch_macro;
section *progmem_section;
/* More than 8K of program memory: use "call" and "jmp". */
int avr_mega_p = 0;
@ -4756,6 +4759,29 @@ avr_insert_attributes (tree node, tree *attributes)
}
}
/* A get_unnamed_section callback for switching to progmem_section. */
static void
avr_output_progmem_section_asm_op (const void *arg ATTRIBUTE_UNUSED)
{
fprintf (asm_out_file,
"\t.section .progmem.gcc_sw_table, \"%s\", @progbits\n",
AVR_MEGA ? "a" : "ax");
/* Should already be aligned, this is just to be safe if it isn't. */
fprintf (asm_out_file, "\t.p2align 1\n");
}
/* Implement TARGET_ASM_INIT_SECTIONS. */
static void
avr_asm_init_sections (void)
{
progmem_section = get_unnamed_section (AVR_MEGA ? 0 : SECTION_CODE,
avr_output_progmem_section_asm_op,
NULL);
readonly_data_section = data_section;
}
static unsigned int
avr_section_type_flags (tree decl, const char *name, int reloc)
{
@ -5847,7 +5873,7 @@ avr_output_bld (rtx operands[], int bit_nr)
void
avr_output_addr_vec_elt (FILE *stream, int value)
{
progmem_section ();
switch_to_section (progmem_section);
if (AVR_MEGA)
fprintf (stream, "\t.word pm(.L%d)\n", value);
else

View File

@ -47,6 +47,7 @@ extern const char *avr_extra_arch_macro;
extern int avr_mega_p;
extern int avr_enhanced_p;
extern int avr_asm_only_p;
extern GTY(()) section *progmem_section;
#define AVR_MEGA (avr_mega_p && !TARGET_SHORT_CALLS)
#define AVR_ENHANCED (avr_enhanced_p)
@ -476,26 +477,6 @@ do { \
#define TARGET_ASM_DESTRUCTOR avr_asm_out_dtor
#define EXTRA_SECTIONS in_progmem
#define EXTRA_SECTION_FUNCTIONS \
\
void \
progmem_section (void) \
{ \
if (in_section != in_progmem) \
{ \
fprintf (asm_out_file, \
"\t.section .progmem.gcc_sw_table, \"%s\", @progbits\n", \
AVR_MEGA ? "a" : "ax"); \
/* Should already be aligned, this is just to be safe if it isn't. */ \
fprintf (asm_out_file, "\t.p2align 1\n"); \
in_section = in_progmem; \
} \
}
#define READONLY_DATA_SECTION data_section
#define JUMP_TABLES_IN_TEXT_SECTION 0
#define ASM_COMMENT_START " ; "
@ -506,6 +487,7 @@ progmem_section (void) \
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
#define TARGET_ASM_INIT_SECTIONS avr_asm_init_sections
#define ASM_OUTPUT_ASCII(FILE, P, SIZE) gas_output_ascii (FILE,P,SIZE)
@ -682,7 +664,8 @@ sprintf (STRING, "*.%s%lu", PREFIX, (unsigned long)(NUM))
avr_output_addr_vec_elt(STREAM, VALUE)
#define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
progmem_section (), (*targetm.asm_out.internal_label) (STREAM, PREFIX, NUM)
(switch_to_section (progmem_section), \
(*targetm.asm_out.internal_label) (STREAM, PREFIX, NUM))
#define ASM_OUTPUT_SKIP(STREAM, N) \
fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N))

View File

@ -1094,7 +1094,7 @@ do { char __buf[256]; \
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
do { \
data_section(); \
switch_to_section (data_section); \
if ((SIZE) >= (unsigned int) 4 ) ASM_OUTPUT_ALIGN(FILE,2); \
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
ASM_OUTPUT_LABEL (FILE, NAME); \

View File

@ -1239,37 +1239,6 @@ if (REG_P (OP1) && ! REG_P (OP0)) \
#define FINI_SECTION_ASM_OP "\t.sect\t\".fini\""
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_init, in_fini
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
INIT_SECTION_FUNCTION \
FINI_SECTION_FUNCTION
#define INIT_SECTION_FUNCTION \
extern void init_section (void); \
void \
init_section (void) \
{ \
if (in_section != in_init) \
{ \
fprintf (asm_out_file, ";\t.init\n"); \
in_section = in_init; \
} \
}
#define FINI_SECTION_FUNCTION \
void \
fini_section () \
{ \
if (in_section != in_fini) \
{ \
fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
in_section = in_fini; \
} \
}
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION c4x_asm_named_section

View File

@ -18,6 +18,7 @@ along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
extern void darwin_init_sections (void);
extern int name_needs_quotes (const char *);
extern void machopic_validate_stub_or_non_lazy_ptr (const char *);
@ -27,18 +28,6 @@ extern void machopic_output_function_base_name (FILE *);
extern const char *machopic_indirection_name (rtx, bool);
extern const char *machopic_mcount_stub_name (void);
extern void machopic_picsymbol_stub_section (void);
extern void machopic_picsymbol_stub1_section (void);
extern void machopic_symbol_stub_section (void);
extern void machopic_symbol_stub1_section (void);
extern void machopic_lazy_symbol_ptr_section (void);
extern void machopic_nl_symbol_ptr_section (void);
extern void constructor_section (void);
extern void destructor_section (void);
extern void mod_init_section (void);
extern void mod_term_section (void);
#ifdef RTX_CODE
extern rtx machopic_function_base_sym (void);
@ -62,11 +51,9 @@ extern void darwin_encode_section_info (tree, rtx, int);
extern void machopic_finish (FILE *);
extern void darwin_exception_section (void);
extern void darwin_eh_frame_section (void);
extern void machopic_select_section (tree, int, unsigned HOST_WIDE_INT);
extern void machopic_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
extern section *machopic_select_section (tree, int, unsigned HOST_WIDE_INT);
extern section *machopic_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
extern void darwin_unique_section (tree decl, int reloc);
extern void darwin_asm_named_section (const char *, unsigned int, tree);
@ -85,51 +72,7 @@ extern void darwin_mark_decl_preserved (const char *);
extern tree darwin_handle_weak_import_attribute (tree *node, tree name,
tree args, int flags,
bool * no_add_attrs);
/* Expanded by EXTRA_SECTION_FUNCTIONS into varasm.o. */
extern void text_coal_section (void);
extern void text_unlikely_section (void);
extern void text_unlikely_coal_section (void);
extern void const_section (void);
extern void const_coal_section (void);
extern void const_data_section (void);
extern void const_data_coal_section (void);
extern void data_coal_section (void);
extern void cstring_section (void);
extern void literal4_section (void);
extern void literal8_section (void);
extern void constructor_section (void);
extern void mod_init_section (void);
extern void mod_term_section (void);
extern void destructor_section (void);
extern void objc_class_section (void);
extern void objc_meta_class_section (void);
extern void objc_category_section (void);
extern void objc_class_vars_section (void);
extern void objc_instance_vars_section (void);
extern void objc_cls_meth_section (void);
extern void objc_inst_meth_section (void);
extern void objc_cat_cls_meth_section (void);
extern void objc_cat_inst_meth_section (void);
extern void objc_selector_refs_section (void);
extern void objc_selector_fixup_section (void);
extern void objc_symbols_section (void);
extern void objc_module_info_section (void);
extern void objc_image_info_section (void);
extern void objc_protocol_section (void);
extern void objc_string_object_section (void);
extern void objc_constant_string_object_section (void);
extern void objc_class_names_section (void);
extern void objc_meth_var_names_section (void);
extern void objc_meth_var_types_section (void);
extern void objc_cls_refs_section (void);
extern void machopic_lazy_symbol_ptr_section (void);
extern void machopic_nl_symbol_ptr_section (void);
extern void machopic_symbol_stub_section (void);
extern void machopic_picsymbol_stub_section (void);
extern void machopic_output_stub (FILE *, const char *, const char *);
extern void darwin_exception_section (void);
extern void darwin_eh_frame_section (void);
extern void darwin_globalize_label (FILE *, const char *);
extern void darwin_assemble_visibility (tree, int);
extern void darwin_asm_output_dwarf_delta (FILE *, int, const char *,

View File

@ -0,0 +1,62 @@
DEF_SECTION (text_coal_section, SECTION_CODE,
".section __TEXT,__textcoal_nt,coalesced,pure_instructions", 0)
DEF_SECTION (text_unlikely_coal_section, SECTION_CODE,
".section __TEXT,__text_unlikely_coal,"
"coalesced,pure_instructions", 0)
DEF_SECTION (const_section, 0, ".const", 0)
DEF_SECTION (const_coal_section, 0,
".section __TEXT,__const_coal,coalesced", 0)
DEF_SECTION (const_data_section, 0, ".const_data", 0)
DEF_SECTION (const_data_coal_section, 0,
".section __DATA,__const_coal,coalesced", 0)
DEF_SECTION (data_coal_section, SECTION_WRITE,
".section __DATA,__datacoal_nt,coalesced", 0)
DEF_SECTION (cstring_section, 0, ".cstring", 0)
DEF_SECTION (literal4_section, 0, ".literal4", 0)
DEF_SECTION (literal8_section, 0, ".literal8", 0)
DEF_SECTION (constructor_section, 0, ".constructor", 0)
DEF_SECTION (mod_init_section, 0, ".mod_init_func", 0)
DEF_SECTION (mod_term_section, 0, ".mod_term_func", 0)
DEF_SECTION (destructor_section, 0, ".destructor", 0)
DEF_SECTION (objc_class_section, 0, ".objc_class", 1)
DEF_SECTION (objc_meta_class_section, 0, ".objc_meta_class", 1)
DEF_SECTION (objc_category_section, 0, ".objc_category", 1)
DEF_SECTION (objc_class_vars_section, 0, ".objc_class_vars", 1)
DEF_SECTION (objc_instance_vars_section, 0, ".objc_instance_vars", 1)
DEF_SECTION (objc_cls_meth_section, 0, ".objc_cls_meth", 1)
DEF_SECTION (objc_inst_meth_section, 0, ".objc_inst_meth", 1)
DEF_SECTION (objc_cat_cls_meth_section, 0, ".objc_cat_cls_meth", 1)
DEF_SECTION (objc_cat_inst_meth_section, 0, ".objc_cat_inst_meth", 1)
DEF_SECTION (objc_selector_refs_section, 0, ".objc_message_refs", 1)
DEF_SECTION (objc_selector_fixup_section, 0,
".section __OBJC, __sel_fixup, regular, no_dead_strip", 1)
DEF_SECTION (objc_symbols_section, 0, ".objc_symbols", 1)
DEF_SECTION (objc_module_info_section, 0, ".objc_module_info", 1)
DEF_SECTION (objc_protocol_section, 0, ".objc_protocol", 1)
DEF_SECTION (objc_string_object_section, 0, ".objc_string_object", 1)
DEF_SECTION (objc_constant_string_object_section, 0,
".section __OBJC, __cstring_object, regular, no_dead_strip", 1)
/* Fix-and-Continue image marker. */
DEF_SECTION (objc_image_info_section, 0,
".section __OBJC, __image_info, regular, no_dead_strip", 1)
DEF_SECTION (objc_class_names_section, 0, ".objc_class_names", 1)
DEF_SECTION (objc_meth_var_names_section, 0, ".objc_meth_var_names", 1)
DEF_SECTION (objc_meth_var_types_section, 0, ".objc_meth_var_types", 1)
DEF_SECTION (objc_cls_refs_section, 0, ".objc_cls_refs", 1)
DEF_SECTION (machopic_lazy_symbol_ptr_section, 0, ".lazy_symbol_pointer", 0)
DEF_SECTION (machopic_nl_symbol_ptr_section, 0, ".non_lazy_symbol_pointer", 0)
DEF_SECTION (machopic_symbol_stub_section, 0, ".symbol_stub", 0)
DEF_SECTION (machopic_symbol_stub1_section, 0,
".section __TEXT,__symbol_stub1,symbol_stubs,"
"pure_instructions,16", 0)
DEF_SECTION (machopic_picsymbol_stub_section, 0, ".picsymbol_stub", 0)
DEF_SECTION (machopic_picsymbol_stub1_section, 0,
".section __TEXT,__picsymbolstub1,symbol_stubs,"
"pure_instructions,32", 0)
DEF_SECTION (darwin_exception_section, 0,
".section __DATA,__gcc_except_tab", 0)
DEF_SECTION (darwin_eh_frame_section, 0,
".section " EH_FRAME_SECTION_NAME ",__eh_frame"
EH_FRAME_SECTION_ATTR, 0)

View File

@ -76,6 +76,65 @@ Boston, MA 02110-1301, USA. */
of MACHO_SYMBOL_STATIC for the code that handles @code{static}
symbol indirection. */
/* Define the individual section variables. */
#define DEF_SECTION(NAME, FLAGS, DIRECTIVE, OBJC) section *NAME;
#include "config/darwin-sections.def"
#undef DEF_SECTION
/* A get_unnamed_section callback used to switch to an ObjC section.
DIRECTIVE is as for output_section_asm_op. */
static void
output_objc_section_asm_op (const void *directive)
{
static int been_here = 0;
if (been_here == 0)
{
been_here = 1;
/* written, cold -> hot */
switch_to_section (objc_cat_cls_meth_section);
switch_to_section (objc_cat_inst_meth_section);
switch_to_section (objc_string_object_section);
switch_to_section (objc_constant_string_object_section);
switch_to_section (objc_selector_refs_section);
switch_to_section (objc_selector_fixup_section);
switch_to_section (objc_cls_refs_section);
switch_to_section (objc_class_section);
switch_to_section (objc_meta_class_section);
/* shared, hot -> cold */
switch_to_section (objc_cls_meth_section);
switch_to_section (objc_inst_meth_section);
switch_to_section (objc_protocol_section);
switch_to_section (objc_class_names_section);
switch_to_section (objc_meth_var_types_section);
switch_to_section (objc_meth_var_names_section);
switch_to_section (objc_category_section);
switch_to_section (objc_class_vars_section);
switch_to_section (objc_instance_vars_section);
switch_to_section (objc_module_info_section);
switch_to_section (objc_symbols_section);
}
output_section_asm_op (directive);
}
/* Implement TARGET_ASM_INIT_SECTIONS. */
void
darwin_init_sections (void)
{
#define DEF_SECTION(NAME, FLAGS, DIRECTIVE, OBJC) \
NAME = get_unnamed_section (FLAGS, (OBJC \
? output_objc_section_asm_op \
: output_section_asm_op), \
"\t" DIRECTIVE);
#include "darwin-sections.def"
#undef DEF_SECTION
readonly_data_section = const_section;
exception_section = darwin_exception_section;
eh_frame_section = darwin_eh_frame_section;
}
int
name_needs_quotes (const char *name)
@ -909,7 +968,7 @@ machopic_output_indirection (void **slot, void *data)
&& (machopic_symbol_defined_p (symbol)
|| SYMBOL_REF_LOCAL_P (symbol)))
{
data_section ();
switch_to_section (data_section);
assemble_align (GET_MODE_ALIGNMENT (Pmode));
assemble_label (ptr_name);
assemble_integer (gen_rtx_SYMBOL_REF (Pmode, sym_name),
@ -920,7 +979,7 @@ machopic_output_indirection (void **slot, void *data)
{
rtx init = const0_rtx;
machopic_nl_symbol_ptr_section ();
switch_to_section (machopic_nl_symbol_ptr_section);
assemble_name (asm_out_file, ptr_name);
fprintf (asm_out_file, ":\n");
@ -1022,41 +1081,38 @@ darwin_mark_decl_preserved (const char *name)
fputc ('\n', asm_out_file);
}
void
section *
machopic_select_section (tree exp, int reloc,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
{
void (*base_function)(void);
section *base_section;
bool weak_p = (DECL_P (exp) && DECL_WEAK (exp)
&& (lookup_attribute ("weak", DECL_ATTRIBUTES (exp))
|| ! lookup_attribute ("weak_import",
DECL_ATTRIBUTES (exp))));
static void (* const base_funs[][2])(void) = {
{ text_section, text_coal_section },
{ unlikely_text_section, text_unlikely_coal_section },
{ readonly_data_section, const_coal_section },
{ const_data_section, const_data_coal_section },
{ data_section, data_coal_section }
};
if (reloc == 0
&& (last_text_section == in_text_unlikely
|| last_text_section == in_text_unlikely_coal))
reloc = 1;
if (TREE_CODE (exp) == FUNCTION_DECL)
base_function = base_funs[reloc][weak_p];
{
if (reloc == 1
|| unlikely_text_section_p (last_text_section)
|| last_text_section == text_unlikely_coal_section)
base_section = (weak_p
? text_unlikely_coal_section
: unlikely_text_section ());
else
base_section = weak_p ? text_coal_section : text_section;
}
else if (decl_readonly_section_1 (exp, reloc, MACHOPIC_INDIRECT))
base_function = base_funs[2][weak_p];
base_section = weak_p ? const_coal_section : const_section;
else if (TREE_READONLY (exp) || TREE_CONSTANT (exp))
base_function = base_funs[3][weak_p];
base_section = weak_p ? const_data_coal_section : const_data_section;
else
base_function = base_funs[4][weak_p];
base_section = weak_p ? data_coal_section : data_section;
if (TREE_CODE (exp) == STRING_CST
&& ((size_t) TREE_STRING_LENGTH (exp)
== strlen (TREE_STRING_POINTER (exp)) + 1))
cstring_section ();
return cstring_section;
else if ((TREE_CODE (exp) == INTEGER_CST || TREE_CODE (exp) == REAL_CST)
&& flag_merge_constants)
{
@ -1065,13 +1121,13 @@ machopic_select_section (tree exp, int reloc,
if (TREE_CODE (size) == INTEGER_CST &&
TREE_INT_CST_LOW (size) == 4 &&
TREE_INT_CST_HIGH (size) == 0)
literal4_section ();
return literal4_section;
else if (TREE_CODE (size) == INTEGER_CST &&
TREE_INT_CST_LOW (size) == 8 &&
TREE_INT_CST_HIGH (size) == 0)
literal8_section ();
return literal8_section;
else
base_function ();
return base_section;
}
else if (TREE_CODE (exp) == CONSTRUCTOR
&& TREE_TYPE (exp)
@ -1085,12 +1141,12 @@ machopic_select_section (tree exp, int reloc,
if (!strcmp (IDENTIFIER_POINTER (name), "__builtin_ObjCString"))
{
if (flag_next_runtime)
objc_constant_string_object_section ();
return objc_constant_string_object_section;
else
objc_string_object_section ();
return objc_string_object_section;
}
else
base_function ();
return base_section;
}
else if (TREE_CODE (exp) == VAR_DECL &&
DECL_NAME (exp) &&
@ -1101,89 +1157,89 @@ machopic_select_section (tree exp, int reloc,
const char *name = IDENTIFIER_POINTER (DECL_NAME (exp));
if (!strncmp (name, "_OBJC_CLASS_METHODS_", 20))
objc_cls_meth_section ();
return objc_cls_meth_section;
else if (!strncmp (name, "_OBJC_INSTANCE_METHODS_", 23))
objc_inst_meth_section ();
return objc_inst_meth_section;
else if (!strncmp (name, "_OBJC_CATEGORY_CLASS_METHODS_", 20))
objc_cat_cls_meth_section ();
return objc_cat_cls_meth_section;
else if (!strncmp (name, "_OBJC_CATEGORY_INSTANCE_METHODS_", 23))
objc_cat_inst_meth_section ();
return objc_cat_inst_meth_section;
else if (!strncmp (name, "_OBJC_CLASS_VARIABLES_", 22))
objc_class_vars_section ();
return objc_class_vars_section;
else if (!strncmp (name, "_OBJC_INSTANCE_VARIABLES_", 25))
objc_instance_vars_section ();
return objc_instance_vars_section;
else if (!strncmp (name, "_OBJC_CLASS_PROTOCOLS_", 22))
objc_cat_cls_meth_section ();
return objc_cat_cls_meth_section;
else if (!strncmp (name, "_OBJC_CLASS_NAME_", 17))
objc_class_names_section ();
return objc_class_names_section;
else if (!strncmp (name, "_OBJC_METH_VAR_NAME_", 20))
objc_meth_var_names_section ();
return objc_meth_var_names_section;
else if (!strncmp (name, "_OBJC_METH_VAR_TYPE_", 20))
objc_meth_var_types_section ();
return objc_meth_var_types_section;
else if (!strncmp (name, "_OBJC_CLASS_REFERENCES", 22))
objc_cls_refs_section ();
return objc_cls_refs_section;
else if (!strncmp (name, "_OBJC_CLASS_", 12))
objc_class_section ();
return objc_class_section;
else if (!strncmp (name, "_OBJC_METACLASS_", 16))
objc_meta_class_section ();
return objc_meta_class_section;
else if (!strncmp (name, "_OBJC_CATEGORY_", 15))
objc_category_section ();
return objc_category_section;
else if (!strncmp (name, "_OBJC_SELECTOR_REFERENCES", 25))
objc_selector_refs_section ();
return objc_selector_refs_section;
else if (!strncmp (name, "_OBJC_SELECTOR_FIXUP", 20))
objc_selector_fixup_section ();
return objc_selector_fixup_section;
else if (!strncmp (name, "_OBJC_SYMBOLS", 13))
objc_symbols_section ();
return objc_symbols_section;
else if (!strncmp (name, "_OBJC_MODULES", 13))
objc_module_info_section ();
return objc_module_info_section;
else if (!strncmp (name, "_OBJC_IMAGE_INFO", 16))
objc_image_info_section ();
return objc_image_info_section;
else if (!strncmp (name, "_OBJC_PROTOCOL_INSTANCE_METHODS_", 32))
objc_cat_inst_meth_section ();
return objc_cat_inst_meth_section;
else if (!strncmp (name, "_OBJC_PROTOCOL_CLASS_METHODS_", 29))
objc_cat_cls_meth_section ();
return objc_cat_cls_meth_section;
else if (!strncmp (name, "_OBJC_PROTOCOL_REFS_", 20))
objc_cat_cls_meth_section ();
return objc_cat_cls_meth_section;
else if (!strncmp (name, "_OBJC_PROTOCOL_", 15))
objc_protocol_section ();
return objc_protocol_section;
else
base_function ();
return base_section;
}
else
base_function ();
return base_section;
}
/* This can be called with address expressions as "rtx".
They must go in "const". */
void
section *
machopic_select_rtx_section (enum machine_mode mode, rtx x,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
{
if (GET_MODE_SIZE (mode) == 8
&& (GET_CODE (x) == CONST_INT
|| GET_CODE (x) == CONST_DOUBLE))
literal8_section ();
return literal8_section;
else if (GET_MODE_SIZE (mode) == 4
&& (GET_CODE (x) == CONST_INT
|| GET_CODE (x) == CONST_DOUBLE))
literal4_section ();
return literal4_section;
else if (MACHOPIC_INDIRECT
&& (GET_CODE (x) == SYMBOL_REF
|| GET_CODE (x) == CONST
|| GET_CODE (x) == LABEL_REF))
const_data_section ();
return const_data_section;
else
const_section ();
return const_section;
}
void
machopic_asm_out_constructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
{
if (MACHOPIC_INDIRECT)
mod_init_section ();
switch_to_section (mod_init_section);
else
constructor_section ();
switch_to_section (constructor_section);
assemble_align (POINTER_SIZE);
assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
@ -1195,9 +1251,9 @@ void
machopic_asm_out_destructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
{
if (MACHOPIC_INDIRECT)
mod_term_section ();
switch_to_section (mod_term_section);
else
destructor_section ();
switch_to_section (destructor_section);
assemble_align (POINTER_SIZE);
assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
@ -1389,8 +1445,8 @@ darwin_file_end (void)
machopic_finish (asm_out_file);
if (strcmp (lang_hooks.name, "GNU C++") == 0)
{
constructor_section ();
destructor_section ();
switch_to_section (constructor_section);
switch_to_section (destructor_section);
ASM_OUTPUT_ALIGN (asm_out_file, 1);
}
fprintf (asm_out_file, "\t.subsections_via_symbols\n");

View File

@ -441,7 +441,7 @@ Boston, MA 02110-1301, USA. */
#define NO_PROFILE_COUNTERS 1
#undef INIT_SECTION_ASM_OP
#define INIT_SECTION_ASM_OP
#define HAS_INIT_SECTION
#undef INVOKE__main
@ -609,233 +609,10 @@ Boston, MA 02110-1301, USA. */
#undef MAX_OFILE_ALIGNMENT
#define MAX_OFILE_ALIGNMENT 0x8000
/* Create new Mach-O sections. */
#undef SECTION_FUNCTION
#define SECTION_FUNCTION(FUNCTION, SECTION, DIRECTIVE, OBJC) \
extern void FUNCTION (void); \
void \
FUNCTION (void) \
{ \
if (in_section != SECTION) \
{ \
if (OBJC) \
objc_section_init (); \
if (asm_out_file) \
fputs ("\t" DIRECTIVE "\n", asm_out_file); \
in_section = SECTION; \
if ((SECTION == in_text_coal) \
|| (SECTION == in_text_unlikely) \
|| (SECTION == in_text_unlikely_coal)) \
last_text_section = SECTION; \
} \
} \
/* Darwin uses many types of special sections. */
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS \
in_text_coal, in_text_unlikely, in_text_unlikely_coal, \
in_const, in_const_data, in_cstring, in_literal4, in_literal8, \
in_const_coal, in_const_data_coal, in_data_coal, \
in_constructor, in_destructor, in_mod_init, in_mod_term, \
in_objc_class, in_objc_meta_class, in_objc_category, \
in_objc_class_vars, in_objc_instance_vars, \
in_objc_cls_meth, in_objc_inst_meth, \
in_objc_cat_cls_meth, in_objc_cat_inst_meth, \
in_objc_selector_refs, \
in_objc_selector_fixup, \
in_objc_symbols, in_objc_module_info, \
in_objc_protocol, in_objc_string_object, \
in_objc_constant_string_object, \
in_objc_image_info, \
in_objc_class_names, in_objc_meth_var_names, \
in_objc_meth_var_types, in_objc_cls_refs, \
in_machopic_nl_symbol_ptr, \
in_machopic_lazy_symbol_ptr, \
in_machopic_symbol_stub, \
in_machopic_symbol_stub1, \
in_machopic_picsymbol_stub, \
in_machopic_picsymbol_stub1, \
in_darwin_exception, in_darwin_eh_frame, \
num_sections
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
static void objc_section_init (void); \
SECTION_FUNCTION (text_coal_section, \
in_text_coal, \
".section __TEXT,__textcoal_nt,coalesced," \
"pure_instructions", 0) \
SECTION_FUNCTION (text_unlikely_coal_section, \
in_text_unlikely_coal, \
".section __TEXT,__text_unlikely_coal," \
"coalesced,pure_instructions", 0) \
SECTION_FUNCTION (const_section, \
in_const, \
".const", 0) \
SECTION_FUNCTION (const_coal_section, \
in_const_coal, \
".section __TEXT,__const_coal,coalesced", 0) \
SECTION_FUNCTION (const_data_section, \
in_const_data, \
".const_data", 0) \
SECTION_FUNCTION (const_data_coal_section, \
in_const_data_coal, \
".section __DATA,__const_coal,coalesced", 0) \
SECTION_FUNCTION (data_coal_section, \
in_data_coal, \
".section __DATA,__datacoal_nt,coalesced", 0) \
SECTION_FUNCTION (cstring_section, \
in_cstring, \
".cstring", 0) \
SECTION_FUNCTION (literal4_section, \
in_literal4, \
".literal4", 0) \
SECTION_FUNCTION (literal8_section, \
in_literal8, \
".literal8", 0) \
SECTION_FUNCTION (constructor_section, \
in_constructor, \
".constructor", 0) \
SECTION_FUNCTION (mod_init_section, \
in_mod_init, \
".mod_init_func", 0) \
SECTION_FUNCTION (mod_term_section, \
in_mod_term, \
".mod_term_func", 0) \
SECTION_FUNCTION (destructor_section, \
in_destructor, \
".destructor", 0) \
SECTION_FUNCTION (objc_class_section, \
in_objc_class, \
".objc_class", 1) \
SECTION_FUNCTION (objc_meta_class_section, \
in_objc_meta_class, \
".objc_meta_class", 1) \
SECTION_FUNCTION (objc_category_section, \
in_objc_category, \
".objc_category", 1) \
SECTION_FUNCTION (objc_class_vars_section, \
in_objc_class_vars, \
".objc_class_vars", 1) \
SECTION_FUNCTION (objc_instance_vars_section, \
in_objc_instance_vars, \
".objc_instance_vars", 1) \
SECTION_FUNCTION (objc_cls_meth_section, \
in_objc_cls_meth, \
".objc_cls_meth", 1) \
SECTION_FUNCTION (objc_inst_meth_section, \
in_objc_inst_meth, \
".objc_inst_meth", 1) \
SECTION_FUNCTION (objc_cat_cls_meth_section, \
in_objc_cat_cls_meth, \
".objc_cat_cls_meth", 1) \
SECTION_FUNCTION (objc_cat_inst_meth_section, \
in_objc_cat_inst_meth, \
".objc_cat_inst_meth", 1) \
SECTION_FUNCTION (objc_selector_refs_section, \
in_objc_selector_refs, \
".objc_message_refs", 1) \
SECTION_FUNCTION (objc_selector_fixup_section, \
in_objc_selector_fixup, \
".section __OBJC, __sel_fixup, regular, no_dead_strip", 1) \
SECTION_FUNCTION (objc_symbols_section, \
in_objc_symbols, \
".objc_symbols", 1) \
SECTION_FUNCTION (objc_module_info_section, \
in_objc_module_info, \
".objc_module_info", 1) \
SECTION_FUNCTION (objc_protocol_section, \
in_objc_protocol, \
".objc_protocol", 1) \
SECTION_FUNCTION (objc_string_object_section, \
in_objc_string_object, \
".objc_string_object", 1) \
SECTION_FUNCTION (objc_constant_string_object_section, \
in_objc_constant_string_object, \
".section __OBJC, __cstring_object, regular, " \
"no_dead_strip", 1) \
/* Fix-and-Continue image marker. */ \
SECTION_FUNCTION (objc_image_info_section, \
in_objc_image_info, \
".section __OBJC, __image_info, regular, " \
"no_dead_strip", 1) \
SECTION_FUNCTION (objc_class_names_section, \
in_objc_class_names, \
".objc_class_names", 1) \
SECTION_FUNCTION (objc_meth_var_names_section, \
in_objc_meth_var_names, \
".objc_meth_var_names", 1) \
SECTION_FUNCTION (objc_meth_var_types_section, \
in_objc_meth_var_types, \
".objc_meth_var_types", 1) \
SECTION_FUNCTION (objc_cls_refs_section, \
in_objc_cls_refs, \
".objc_cls_refs", 1) \
\
SECTION_FUNCTION (machopic_lazy_symbol_ptr_section, \
in_machopic_lazy_symbol_ptr, \
".lazy_symbol_pointer", 0) \
SECTION_FUNCTION (machopic_nl_symbol_ptr_section, \
in_machopic_nl_symbol_ptr, \
".non_lazy_symbol_pointer", 0) \
SECTION_FUNCTION (machopic_symbol_stub_section, \
in_machopic_symbol_stub, \
".symbol_stub", 0) \
SECTION_FUNCTION (machopic_symbol_stub1_section, \
in_machopic_symbol_stub1, \
".section __TEXT,__symbol_stub1,symbol_stubs," \
"pure_instructions,16", 0) \
SECTION_FUNCTION (machopic_picsymbol_stub_section, \
in_machopic_picsymbol_stub, \
".picsymbol_stub", 0) \
SECTION_FUNCTION (machopic_picsymbol_stub1_section, \
in_machopic_picsymbol_stub1, \
".section __TEXT,__picsymbolstub1,symbol_stubs," \
"pure_instructions,32", 0) \
SECTION_FUNCTION (darwin_exception_section, \
in_darwin_exception, \
".section __DATA,__gcc_except_tab", 0) \
SECTION_FUNCTION (darwin_eh_frame_section, \
in_darwin_eh_frame, \
".section " EH_FRAME_SECTION_NAME ",__eh_frame" \
EH_FRAME_SECTION_ATTR, 0) \
\
static void \
objc_section_init (void) \
{ \
static int been_here = 0; \
\
if (been_here == 0) \
{ \
been_here = 1; \
/* written, cold -> hot */ \
objc_cat_cls_meth_section (); \
objc_cat_inst_meth_section (); \
objc_string_object_section (); \
objc_constant_string_object_section (); \
objc_selector_refs_section (); \
objc_selector_fixup_section (); \
objc_cls_refs_section (); \
objc_class_section (); \
objc_meta_class_section (); \
/* shared, hot -> cold */ \
objc_cls_meth_section (); \
objc_inst_meth_section (); \
objc_protocol_section (); \
objc_class_names_section (); \
objc_meth_var_types_section (); \
objc_meth_var_names_section (); \
objc_category_section (); \
objc_class_vars_section (); \
objc_instance_vars_section (); \
objc_module_info_section (); \
objc_symbols_section (); \
} \
}
#define READONLY_DATA_SECTION const_section
/* Declare the section variables. */
#define DEF_SECTION(NAME, FLAGS, DIRECTIVE, OBJC) extern section *NAME;
#include "darwin-sections.def"
#undef DEF_SECTION
#undef TARGET_ASM_SELECT_SECTION
#define TARGET_ASM_SELECT_SECTION machopic_select_section
@ -986,10 +763,6 @@ enum machopic_addr_class {
} \
} while (0)
#define TARGET_ASM_EXCEPTION_SECTION darwin_exception_section
#define TARGET_ASM_EH_FRAME_SECTION darwin_eh_frame_section
#define EH_FRAME_SECTION_NAME "__TEXT"
#define EH_FRAME_SECTION_ATTR ",coalesced,no_toc+strip_static_syms+live_support"
@ -1020,6 +793,7 @@ enum machopic_addr_class {
#define TARGET_TERMINATE_DW2_EH_FRAME_INFO false
#define TARGET_ASM_INIT_SECTIONS darwin_init_sections
#undef TARGET_ASM_NAMED_SECTION
#define TARGET_ASM_NAMED_SECTION darwin_asm_named_section

View File

@ -128,11 +128,6 @@ extern int frv_acc_group (rtx);
extern int frv_adjust_field_align (tree, int);
#endif
extern void fixup_section (void);
extern void sdata_section (void);
extern void sbss_section (void);
extern void data_section (void);
#ifdef RTX_CODE
extern int integer_register_operand (rtx, enum machine_mode);
extern int frv_load_operand (rtx, enum machine_mode);

View File

@ -9542,7 +9542,7 @@ frv_rtx_costs (rtx x,
static void
frv_asm_out_constructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
{
ctors_section ();
switch_to_section (ctors_section);
assemble_align (POINTER_SIZE);
if (TARGET_FDPIC)
{
@ -9557,7 +9557,7 @@ frv_asm_out_constructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
static void
frv_asm_out_destructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
{
dtors_section ();
switch_to_section (dtors_section);
assemble_align (POINTER_SIZE);
if (TARGET_FDPIC)
{

View File

@ -2272,43 +2272,6 @@ do { \
program so they can be changed program startup time if the program is loaded
at a different address than linked for. */
#define FIXUP_SECTION_ASM_OP "\t.section .rofixup,\"a\""
/* A list of names for sections other than the standard two, which are
`in_text' and `in_data'. You need not define this macro
on a system with no other sections (that GCC needs to use). */
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_sdata, in_const, in_fixup
/* One or more functions to be defined in "varasm.c". These
functions should do jobs analogous to those of `text_section' and
`data_section', for your additional sections. Do not define this
macro if you do not define `EXTRA_SECTIONS'. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
SDATA_SECTION_FUNCTION \
FIXUP_SECTION_FUNCTION
#define SDATA_SECTION_FUNCTION \
void \
sdata_section (void) \
{ \
if (in_section != in_sdata) \
{ \
fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
in_section = in_sdata; \
} \
}
#define FIXUP_SECTION_FUNCTION \
void \
fixup_section (void) \
{ \
if (in_section != in_fixup) \
{ \
fprintf (asm_out_file, "%s\n", FIXUP_SECTION_ASM_OP); \
in_section = in_fixup; \
} \
}
/* Position Independent Code. */
@ -2394,9 +2357,9 @@ extern int size_directive_output;
#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \
do { \
if ((SIZE) > 0 && (SIZE) <= g_switch_value) \
named_section (0, ".sbss", 0); \
switch_to_section (get_named_section (NULL, ".sbss", 0)); \
else \
bss_section (); \
switch_to_section (bss_section); \
ASM_OUTPUT_ALIGN (STREAM, floor_log2 ((ALIGN) / BITS_PER_UNIT)); \
ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL); \
ASM_OUTPUT_SKIP (STREAM, (SIZE) ? (SIZE) : 1); \
@ -2652,8 +2615,8 @@ fprintf (STREAM, "\t.word .L%d\n", VALUE)
#define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
do { \
if (flag_pic) \
function_section (current_function_decl); \
(*targetm.asm_out.internal_label) (STREAM, PREFIX, NUM); \
switch_to_section (function_section (current_function_decl)); \
(*targetm.asm_out.internal_label) (STREAM, PREFIX, NUM); \
} while (0)

View File

@ -108,53 +108,14 @@ Boston, MA 02110-1301, USA. */
union tree_node;
#define TREE union tree_node *
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_drectve
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
DRECTVE_SECTION_FUNCTION \
SWITCH_TO_SECTION_FUNCTION
#define DRECTVE_SECTION_FUNCTION \
void \
drectve_section (void) \
{ \
if (in_section != in_drectve) \
{ \
fprintf (asm_out_file, "%s\n", "\t.section .drectve\n"); \
in_section = in_drectve; \
} \
}
void drectve_section (void);
#define drectve_section() \
(fprintf (asm_out_file, "\t.section .drectve\n"), \
in_section = NULL)
/* Older versions of gas don't handle 'r' as data.
Explicitly set data flag with 'd'. */
#define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata,\"dr\""
/* Switch to SECTION (an `enum in_section').
??? This facility should be provided by GCC proper.
The problem is that we want to temporarily switch sections in
ASM_DECLARE_OBJECT_NAME and then switch back to the original section
afterwards. */
#define SWITCH_TO_SECTION_FUNCTION \
void switch_to_section (enum in_section, tree); \
void \
switch_to_section (enum in_section section, tree decl) \
{ \
switch (section) \
{ \
case in_text: text_section (); break; \
case in_unlikely_executed_text: unlikely_text_section (); break; \
case in_data: data_section (); break; \
case in_readonly_data: readonly_data_section (); break; \
case in_named: named_section (decl, NULL, 0); break; \
case in_drectve: drectve_section (); break; \
default: abort (); break; \
} \
}
/* Don't allow flag_pic to propagate since gas may produce invalid code
otherwise. */

View File

@ -110,7 +110,7 @@ Boston, MA 02110-1301, USA. */
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
do { if ((LOG) != 0) \
{ \
if (in_text_section ()) \
if (in_section == text_section) \
fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \
else \
fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \

View File

@ -956,9 +956,9 @@ static void init_ext_80387_constants (void);
static bool ix86_in_large_data_p (tree) ATTRIBUTE_UNUSED;
static void ix86_encode_section_info (tree, rtx, int) ATTRIBUTE_UNUSED;
static void x86_64_elf_unique_section (tree decl, int reloc) ATTRIBUTE_UNUSED;
static void x86_64_elf_select_section (tree decl, int reloc,
unsigned HOST_WIDE_INT align)
ATTRIBUTE_UNUSED;
static section *x86_64_elf_select_section (tree decl, int reloc,
unsigned HOST_WIDE_INT align)
ATTRIBUTE_UNUSED;
/* Initialize the GCC target structure. */
#undef TARGET_ATTRIBUTE_TABLE
@ -1695,9 +1695,9 @@ override_options (void)
RELOC indicates whether forming the initial value of DECL requires
link-time relocations. */
static void
static section *
x86_64_elf_select_section (tree decl, int reloc,
unsigned HOST_WIDE_INT align)
unsigned HOST_WIDE_INT align)
{
if ((ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_MEDIUM_PIC)
&& ix86_in_large_data_p (decl))
@ -1741,12 +1741,9 @@ x86_64_elf_select_section (tree decl, int reloc,
break;
}
if (sname)
{
named_section (decl, sname, reloc);
return;
}
return get_named_section (decl, sname, reloc);
}
default_elf_select_section (decl, reloc, align);
return default_elf_select_section (decl, reloc, align);
}
/* Build up a unique section name, expressed as a
@ -1846,9 +1843,9 @@ x86_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED,
{
if ((ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_MEDIUM_PIC)
&& size > (unsigned int)ix86_section_threshold)
named_section (decl, ".lbss", 0);
switch_to_section (get_named_section (decl, ".lbss", 0));
else
bss_section ();
switch_to_section (bss_section);
ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
#ifdef ASM_DECLARE_OBJECT_NAME
last_assemble_variable_decl = decl;
@ -4389,7 +4386,7 @@ ix86_file_end (void)
DECL_ONE_ONLY (decl) = 1;
(*targetm.asm_out.unique_section) (decl, 0);
named_section (decl, NULL, 0);
switch_to_section (get_named_section (decl, NULL, 0));
(*targetm.asm_out.globalize_label) (asm_out_file, name);
fputs ("\t.hidden\t", asm_out_file);
@ -4399,7 +4396,7 @@ ix86_file_end (void)
}
else
{
text_section ();
switch_to_section (text_section);
ASM_OUTPUT_LABEL (asm_out_file, name);
}
@ -16582,9 +16579,9 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub)
sprintf (lazy_ptr_name, "L%d$lz", label);
if (MACHOPIC_PURE)
machopic_picsymbol_stub_section ();
switch_to_section (machopic_picsymbol_stub_section);
else
machopic_symbol_stub_section ();
switch_to_section (machopic_symbol_stub_section);
fprintf (file, "%s:\n", stub);
fprintf (file, "\t.indirect_symbol %s\n", symbol_name);
@ -16610,7 +16607,7 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub)
fprintf (file, "\tjmp dyld_stub_binding_helper\n");
machopic_lazy_symbol_ptr_section ();
switch_to_section (machopic_lazy_symbol_ptr_section);
fprintf (file, "%s:\n", lazy_ptr_name);
fprintf (file, "\t.indirect_symbol %s\n", symbol_name);
fprintf (file, "\t.long %s\n", binder_name);
@ -18102,8 +18099,7 @@ void ix86_emit_i387_log1p (rtx op0, rtx op1)
emit_label (label2);
}
/* Solaris named-section hook. Parameters are as for
named_section_real. */
/* Solaris implementation of TARGET_ASM_NAMED_SECTION. */
static void
i386_solaris_elf_named_section (const char *name, unsigned int flags,

View File

@ -48,7 +48,7 @@ nwld_named_section_asm_out_constructor (rtx symbol, int priority)
MAX_INIT_PRIORITY - priority);
#endif
named_section_flags (section, 0);
switch_to_section (get_section (section, 0, NULL));
assemble_align (POINTER_SIZE);
assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
}
@ -68,7 +68,7 @@ nwld_named_section_asm_out_destructor (rtx symbol, int priority)
MAX_INIT_PRIORITY - priority);
#endif
named_section_flags (section, 0);
switch_to_section (get_section (section, 0, NULL));
assemble_align (POINTER_SIZE);
assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
}

View File

@ -102,14 +102,6 @@ extern int ia64_dbx_register_number (int);
extern rtx ia64_return_addr_rtx (HOST_WIDE_INT, rtx);
extern void ia64_split_return_addr_rtx (rtx);
#ifdef SDATA_SECTION_ASM_OP
extern void sdata_section (void);
#endif
#ifdef SBSS_SECTION_ASM_OP
extern void sbss_section (void);
#endif
#ifdef ARGS_SIZE_RTX
/* expr.h defines ARGS_SIZE_RTX and `enum direction'. */
extern enum direction ia64_hpux_function_arg_padding (enum machine_mode, tree);

View File

@ -229,16 +229,16 @@ static void ia64_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
HOST_WIDE_INT, tree);
static void ia64_file_start (void);
static void ia64_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static section *ia64_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static void ia64_output_dwarf_dtprel (FILE *, int, rtx)
ATTRIBUTE_UNUSED;
static void ia64_rwreloc_select_section (tree, int, unsigned HOST_WIDE_INT)
static section *ia64_rwreloc_select_section (tree, int, unsigned HOST_WIDE_INT)
ATTRIBUTE_UNUSED;
static void ia64_rwreloc_unique_section (tree, int)
ATTRIBUTE_UNUSED;
static void ia64_rwreloc_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT)
static section *ia64_rwreloc_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT)
ATTRIBUTE_UNUSED;
static unsigned int ia64_section_type_flags (tree, const char *, int);
static void ia64_hpux_add_extern_decl (tree decl)
@ -8507,27 +8507,27 @@ ia64_sysv4_init_libfuncs (void)
glibc doesn't have them. */
}
/* Switch to the section to which we should output X. The only thing
special we do here is to honor small data. */
/* Return the section to use for X. The only special thing we do here
is to honor small data. */
static void
static section *
ia64_select_rtx_section (enum machine_mode mode, rtx x,
unsigned HOST_WIDE_INT align)
{
if (GET_MODE_SIZE (mode) > 0
&& GET_MODE_SIZE (mode) <= ia64_section_threshold)
sdata_section ();
return sdata_section;
else
default_elf_select_rtx_section (mode, x, align);
return default_elf_select_rtx_section (mode, x, align);
}
/* It is illegal to have relocations in shared segments on AIX and HPUX.
Pretend flag_pic is always set. */
static void
static section *
ia64_rwreloc_select_section (tree exp, int reloc, unsigned HOST_WIDE_INT align)
{
default_elf_select_section_1 (exp, reloc, align, true);
return default_elf_select_section_1 (exp, reloc, align, true);
}
static void
@ -8536,14 +8536,16 @@ ia64_rwreloc_unique_section (tree decl, int reloc)
default_unique_section_1 (decl, reloc, true);
}
static void
static section *
ia64_rwreloc_select_rtx_section (enum machine_mode mode, rtx x,
unsigned HOST_WIDE_INT align)
{
section *sect;
int save_pic = flag_pic;
flag_pic = 1;
ia64_select_rtx_section (mode, x, align);
sect = ia64_select_rtx_section (mode, x, align);
flag_pic = save_pic;
return sect;
}
#ifndef TARGET_RWRELOC

View File

@ -46,9 +46,9 @@ extern int size_directive_output;
#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
do { \
if ((DECL) && sdata_symbolic_operand (XEXP (DECL_RTL (DECL), 0), Pmode)) \
sbss_section (); \
switch_to_section (sbss_section); \
else \
bss_section (); \
switch_to_section (bss_section); \
ASM_OUTPUT_ALIGN (FILE, floor_log2 ((ALIGN) / BITS_PER_UNIT)); \
ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \
ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
@ -124,36 +124,5 @@ do { \
#undef TARGET_ASM_SELECT_RTX_SECTION
#define TARGET_ASM_SELECT_RTX_SECTION ia64_select_rtx_section
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_sdata, in_sbss
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
SDATA_SECTION_FUNCTION \
SBSS_SECTION_FUNCTION
#define SDATA_SECTION_ASM_OP "\t.sdata"
#define SDATA_SECTION_FUNCTION \
void \
sdata_section (void) \
{ \
if (in_section != in_sdata) \
{ \
fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
in_section = in_sdata; \
} \
}
#define SBSS_SECTION_ASM_OP "\t.sbss"
#define SBSS_SECTION_FUNCTION \
void \
sbss_section (void) \
{ \
if (in_section != in_sbss) \
{ \
fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
in_section = in_sbss; \
} \
}

View File

@ -154,7 +154,8 @@ static enum machine_mode gpr_mode;
/* Initialize the GCC target structure. */
static struct machine_function* iq2000_init_machine_status (void);
static bool iq2000_handle_option (size_t, const char *, int);
static void iq2000_select_rtx_section (enum machine_mode, rtx, unsigned HOST_WIDE_INT);
static section *iq2000_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static void iq2000_init_builtins (void);
static rtx iq2000_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
static bool iq2000_return_in_memory (tree, tree);
@ -163,7 +164,7 @@ static void iq2000_setup_incoming_varargs (CUMULATIVE_ARGS *,
int);
static bool iq2000_rtx_costs (rtx, int, int, int *);
static int iq2000_address_cost (rtx);
static void iq2000_select_section (tree, int, unsigned HOST_WIDE_INT);
static section *iq2000_select_section (tree, int, unsigned HOST_WIDE_INT);
static bool iq2000_return_in_memory (tree, tree);
static bool iq2000_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
@ -2146,15 +2147,13 @@ symbolic_expression_p (rtx x)
/* Choose the section to use for the constant rtx expression X that has
mode MODE. */
static void
static section *
iq2000_select_rtx_section (enum machine_mode mode, rtx x ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT align)
{
/* For embedded applications, always put constants in read-only data,
in order to reduce RAM usage. */
/* For embedded applications, always put constants in read-only data,
in order to reduce RAM usage. */
mergeable_constant_section (mode, align, 0);
return mergeable_constant_section (mode, align, 0);
}
/* Choose the section to use for DECL. RELOC is true if its value contains
@ -2164,7 +2163,7 @@ iq2000_select_rtx_section (enum machine_mode mode, rtx x ATTRIBUTE_UNUSED,
ENCODE_SECTION_INFO in iq2000.h so that references to these symbols
are done correctly. */
static void
static section *
iq2000_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
{
@ -2179,9 +2178,9 @@ iq2000_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
|| TREE_CONSTANT (DECL_INITIAL (decl))))
/* Deal with calls from output_constant_def_contents. */
|| TREE_CODE (decl) != VAR_DECL)
readonly_data_section ();
return readonly_data_section;
else
data_section ();
return data_section;
}
else
{
@ -2194,9 +2193,9 @@ iq2000_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
|| TREE_CONSTANT (DECL_INITIAL (decl))))
/* Deal with calls from output_constant_def_contents. */
|| TREE_CODE (decl) != VAR_DECL)
readonly_data_section ();
return readonly_data_section;
else
data_section ();
return data_section;
}
}
/* Return register to use for a function return value with VALTYPE for function

View File

@ -835,11 +835,6 @@ enum processor_type
/* Recast the cpu class to be the cpu attribute. */
#define iq2000_cpu_attr ((enum attr_cpu) iq2000_tune)
/* Functions to change what output section we are using. */
extern void rdata_section (void);
extern void sdata_section (void);
extern void sbss_section (void);
#define BITMASK_UPPER16 ((unsigned long) 0xffff << 16) /* 0xffff0000 */
#define BITMASK_LOWER16 ((unsigned long) 0xffff) /* 0x0000ffff */

View File

@ -23,8 +23,6 @@
complications. */
#define Mmode enum machine_mode
extern void sbss_section (void);
extern void sdata_section (void);
extern void m32r_init (void);
extern void m32r_init_expanders (void);
extern unsigned m32r_compute_frame_size (int);

View File

@ -1529,9 +1529,9 @@ extern char m32r_punct_chars[256];
{ \
if (! TARGET_SDATA_NONE \
&& (SIZE) > 0 && (SIZE) <= g_switch_value) \
named_section (0, ".sbss", 0); \
switch_to_section (get_named_section (NULL, ".sbss", 0)); \
else \
bss_section (); \
switch_to_section (bss_section); \
ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
last_assemble_variable_decl = DECL; \
ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \

View File

@ -32,34 +32,13 @@ Boston, MA 02110-1301, USA. */
#undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
#define EXPORTS_SECTION_ASM_OP "\t.section .exports"
#define SUBTARGET_EXTRA_SECTIONS in_exports
#define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
EXPORT_SECTION_FUNCTION
#define EXPORT_SECTION_FUNCTION \
void \
exports_section () \
{ \
if (in_section != in_exports) \
{ \
fprintf (asm_out_file, "%s\n", EXPORTS_SECTION_ASM_OP); \
in_section = in_exports; \
} \
}
#define SUBTARGET_SWITCH_SECTIONS \
case in_exports: exports_section (); break;
#define MCORE_EXPORT_NAME(STREAM, NAME) \
do \
{ \
exports_section (); \
fprintf (STREAM, "\t.section .exports\n"); \
fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
(* targetm.strip_name_encoding) (NAME)); \
in_section = NULL; \
} \
while (0);
@ -73,7 +52,7 @@ exports_section () \
if (mcore_dllexport_name_p (NAME)) \
{ \
MCORE_EXPORT_NAME (FILE, NAME); \
function_section (DECL); \
switch_to_section (function_section (DECL)); \
} \
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
@ -89,9 +68,9 @@ exports_section () \
HOST_WIDE_INT size; \
if (mcore_dllexport_name_p (NAME)) \
{ \
enum in_section save_section = in_section; \
section *save_section = in_section; \
MCORE_EXPORT_NAME (FILE, NAME); \
switch_to_section (save_section, (DECL)); \
switch_to_section (save_section); \
} \
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
size_directive_output = 0; \

View File

@ -41,37 +41,15 @@ Boston, MA 02110-1301, USA. */
/* Computed in toplev.c. */
#undef PREFERRED_DEBUGGING_TYPE
/* Lay out additional 'sections' where we place things like code
and readonly data. This gets them out of default places. */
#define SUBTARGET_SWITCH_SECTIONS \
case in_drectve: drectve_section (); break;
#define DRECTVE_SECTION_ASM_OP "\t.section .drectve"
#define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata"
#define SUBTARGET_EXTRA_SECTIONS in_drectve
#define SUBTARGET_EXTRA_SECTION_FUNCTIONS \
DRECTVE_SECTION_FUNCTION
#define DRECTVE_SECTION_FUNCTION \
void \
drectve_section () \
{ \
if (in_section != in_drectve) \
{ \
fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP); \
in_section = in_drectve; \
} \
}
#define MCORE_EXPORT_NAME(STREAM, NAME) \
do \
{ \
drectve_section (); \
fprintf (STREAM, "\t.section .drectve\n"); \
fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
(* targetm.strip_name_encoding) (NAME)); \
in_section = NULL; \
} \
while (0);
@ -82,9 +60,9 @@ drectve_section () \
{ \
if (mcore_dllexport_name_p (NAME)) \
{ \
enum in_section save_section = in_section; \
section *save_section = in_section; \
MCORE_EXPORT_NAME (STREAM, NAME); \
switch_to_section (save_section, (DECL)); \
switch_to_section (save_section); \
} \
ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
} \
@ -97,7 +75,7 @@ drectve_section () \
if (mcore_dllexport_name_p (NAME)) \
{ \
MCORE_EXPORT_NAME (STREAM, NAME); \
function_section (DECL); \
switch_to_section (function_section (DECL)); \
} \
ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
} \

View File

@ -857,36 +857,6 @@ extern const enum reg_class reg_class_from_letter[];
#define TEXT_SECTION_ASM_OP "\t.text"
#define DATA_SECTION_ASM_OP "\t.data"
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
SUBTARGET_EXTRA_SECTION_FUNCTIONS \
SWITCH_SECTION_FUNCTION
/* Switch to SECTION (an `enum in_section').
??? This facility should be provided by GCC proper.
The problem is that we want to temporarily switch sections in
ASM_DECLARE_OBJECT_NAME and then switch back to the original section
afterwards. */
#define SWITCH_SECTION_FUNCTION \
static void switch_to_section (enum in_section, tree); \
static void \
switch_to_section (enum in_section section, tree decl) \
{ \
switch (section) \
{ \
case in_text: text_section (); break; \
case in_unlikely_executed_text: unlikely_text_section (); break; \
case in_data: data_section (); break; \
case in_named: named_section (decl, NULL, 0); break; \
SUBTARGET_SWITCH_SECTIONS \
default: gcc_unreachable (); \
} \
}
/* Switch into a generic section. */
#undef TARGET_ASM_NAMED_SECTION
#define TARGET_ASM_NAMED_SECTION mcore_asm_named_section

View File

@ -328,9 +328,9 @@ static void mips_restore_reg (rtx, rtx);
static void mips_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
HOST_WIDE_INT, tree);
static int symbolic_expression_p (rtx);
static void mips_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static void mips_function_rodata_section (tree);
static section *mips_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static section *mips_function_rodata_section (tree);
static bool mips_in_small_data_p (tree);
static int mips_fpr_return_fields (tree, tree *);
static bool mips_return_in_msb (tree);
@ -5762,7 +5762,7 @@ mips_file_start (void)
default:
gcc_unreachable ();
}
/* Note - we use fprintf directly rather than called named_section()
/* Note - we use fprintf directly rather than calling switch_to_section
because in this way we can avoid creating an allocated section. We
do not want this section to take up any space in the running
executable. */
@ -5804,9 +5804,9 @@ mips_output_aligned_bss (FILE *stream, tree decl, const char *name,
extern tree last_assemble_variable_decl;
if (mips_in_small_data_p (decl))
named_section (0, ".sbss", 0);
switch_to_section (get_named_section (NULL, ".sbss", 0));
else
bss_section ();
switch_to_section (bss_section);
ASM_OUTPUT_ALIGN (stream, floor_log2 (align / BITS_PER_UNIT));
last_assemble_variable_decl = decl;
ASM_DECLARE_OBJECT_NAME (stream, name, decl);
@ -5875,7 +5875,7 @@ mips_output_aligned_decl_common (FILE *stream, tree decl, const char *name,
if (TREE_PUBLIC (decl) && DECL_NAME (decl))
targetm.asm_out.globalize_label (stream, name);
readonly_data_section ();
switch_to_section (readonly_data_section);
ASM_OUTPUT_ALIGN (stream, floor_log2 (align / BITS_PER_UNIT));
mips_declare_object (stream, name, "",
":\n\t.space\t" HOST_WIDE_INT_PRINT_UNSIGNED "\n",
@ -7110,7 +7110,7 @@ symbolic_expression_p (rtx x)
/* Choose the section to use for the constant rtx expression X that has
mode MODE. */
static void
static section *
mips_select_rtx_section (enum machine_mode mode, rtx x,
unsigned HOST_WIDE_INT align)
{
@ -7119,13 +7119,13 @@ mips_select_rtx_section (enum machine_mode mode, rtx x,
/* In mips16 mode, the constant table always goes in the same section
as the function, so that constants can be loaded using PC relative
addressing. */
function_section (current_function_decl);
return function_section (current_function_decl);
}
else if (TARGET_EMBEDDED_DATA)
{
/* For embedded applications, always put constants in read-only data,
in order to reduce RAM usage. */
mergeable_constant_section (mode, align, 0);
return mergeable_constant_section (mode, align, 0);
}
else
{
@ -7135,11 +7135,11 @@ mips_select_rtx_section (enum machine_mode mode, rtx x,
if (GET_MODE_SIZE (mode) <= (unsigned) mips_section_threshold
&& mips_section_threshold > 0)
named_section (0, ".sdata", 0);
return get_named_section (NULL, ".sdata", 0);
else if (flag_pic && symbolic_expression_p (x))
named_section (0, ".data.rel.ro", 3);
return get_named_section (NULL, ".data.rel.ro", 3);
else
mergeable_constant_section (mode, align, 0);
return mergeable_constant_section (mode, align, 0);
}
}
@ -7151,32 +7151,30 @@ mips_select_rtx_section (enum machine_mode mode, rtx x,
cases by selecting a normal data section instead of a read-only one.
The logic apes that in default_function_rodata_section. */
static void
static section *
mips_function_rodata_section (tree decl)
{
if (!TARGET_ABICALLS || TARGET_GPWORD)
default_function_rodata_section (decl);
else if (decl && DECL_SECTION_NAME (decl))
return default_function_rodata_section (decl);
if (decl && DECL_SECTION_NAME (decl))
{
const char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
if (DECL_ONE_ONLY (decl) && strncmp (name, ".gnu.linkonce.t.", 16) == 0)
{
char *rname = ASTRDUP (name);
rname[14] = 'd';
named_section_real (rname, SECTION_LINKONCE | SECTION_WRITE, decl);
return get_section (rname, SECTION_LINKONCE | SECTION_WRITE, decl);
}
else if (flag_function_sections && flag_data_sections
&& strncmp (name, ".text.", 6) == 0)
{
char *rname = ASTRDUP (name);
memcpy (rname + 1, "data", 4);
named_section_flags (rname, SECTION_WRITE);
return get_section (rname, SECTION_WRITE, decl);
}
else
data_section ();
}
else
data_section ();
return data_section;
}
/* Implement TARGET_IN_SMALL_DATA_P. Return true if it would be safe to
@ -7807,7 +7805,7 @@ build_mips16_function_stub (FILE *file)
fprintf (file, ")\n");
fprintf (file, "\t.set\tnomips16\n");
function_section (stubdecl);
switch_to_section (function_section (stubdecl));
ASM_OUTPUT_ALIGN (file, floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT));
/* ??? If FUNCTION_NAME_ALREADY_DECLARED is defined, then we are
@ -7852,7 +7850,7 @@ build_mips16_function_stub (FILE *file)
fprintf (file, "\t.set\tmips16\n");
function_section (current_function_decl);
switch_to_section (function_section (current_function_decl));
}
/* We keep a list of functions for which we have already built stubs

View File

@ -2698,7 +2698,7 @@ do { \
{ \
const char *p = STRING; \
int size = strlen (p) + 1; \
readonly_data_section (); \
switch_to_section (readonly_data_section); \
assemble_string (p, size); \
}
@ -2710,7 +2710,6 @@ do { \
/* Define the strings to put out for each section in the object file. */
#define TEXT_SECTION_ASM_OP "\t.text" /* instructions */
#define DATA_SECTION_ASM_OP "\t.data" /* large data */
#define SDATA_SECTION_ASM_OP "\t.sdata" /* small data */
#undef READONLY_DATA_SECTION_ASM_OP
#define READONLY_DATA_SECTION_ASM_OP "\t.rdata" /* read-only data */

View File

@ -17,15 +17,6 @@ along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_sdata, in_sbss
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP)
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (MIPS, VxWorks syntax)");

View File

@ -1182,7 +1182,7 @@ mmix_file_start (void)
fputs ("! mmixal:= 8H LOC Data_Section\n", asm_out_file);
/* Make sure each file starts with the text section. */
text_section ();
switch_to_section (text_section);
}
/* TARGET_ASM_FILE_END. */
@ -1191,7 +1191,7 @@ static void
mmix_file_end (void)
{
/* Make sure each file ends with the data section. */
data_section ();
switch_to_section (data_section);
}
/* ASM_OUTPUT_SOURCE_FILENAME. */
@ -1350,7 +1350,7 @@ mmix_asm_output_aligned_local (FILE *stream,
int size,
int align)
{
data_section ();
switch_to_section (data_section);
ASM_OUTPUT_ALIGN (stream, exact_log2 (align/BITS_PER_UNIT));
assemble_name (stream, name);

View File

@ -138,7 +138,6 @@ extern int zdepi_cint_p (unsigned HOST_WIDE_INT);
extern void override_options (void);
extern void output_ascii (FILE *, const char *, int);
extern const char * som_text_section_asm_op (void);
extern HOST_WIDE_INT compute_frame_size (HOST_WIDE_INT, int *);
extern int and_mask_p (unsigned HOST_WIDE_INT);
extern int cint_ok_for_move (HOST_WIDE_INT);
@ -179,9 +178,3 @@ extern void pa_hpux_asm_output_external (FILE *, tree, const char *);
extern const int magic_milli[];
extern int shadd_constant_p (int);
/* Functions in varasm.c used by pa.c. */
extern void som_readonly_data_section (void);
extern void som_one_only_readonly_data_section (void);
extern void som_one_only_data_section (void);
extern void forget_section (void);

View File

@ -107,7 +107,8 @@ static void pa_output_function_epilogue (FILE *, HOST_WIDE_INT);
static int pa_adjust_cost (rtx, rtx, rtx, int);
static int pa_adjust_priority (rtx, int);
static int pa_issue_rate (void);
static void pa_select_section (tree, int, unsigned HOST_WIDE_INT)
static void pa_som_asm_init_sections (void) ATTRIBUTE_UNUSED;
static section *pa_select_section (tree, int, unsigned HOST_WIDE_INT)
ATTRIBUTE_UNUSED;
static void pa_encode_section_info (tree, rtx, int);
static const char *pa_strip_name_encoding (const char *);
@ -155,6 +156,11 @@ static enum reg_class pa_secondary_reload (bool, rtx, enum reg_class,
secondary_reload_info *);
/* The following extra sections are only used for SOM. */
static GTY(()) section *som_readonly_data_section;
static GTY(()) section *som_one_only_readonly_data_section;
static GTY(()) section *som_one_only_data_section;
/* Save the operands last given to a compare for use when we
generate a scc or bcc insn. */
rtx hppa_compare_op0, hppa_compare_op1;
@ -3928,7 +3934,7 @@ pa_output_function_epilogue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
/* We done with this subspace except possibly for some additional
debug information. Forget that we are in this subspace to ensure
that the next function is output in its own subspace. */
forget_section ();
in_section = NULL;
}
if (INSN_ADDRESSES_SET_P ())
@ -4149,7 +4155,7 @@ output_deferred_profile_counters (void)
if (VEC_empty (int, funcdef_nos))
return;
data_section ();
switch_to_section (data_section);
align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE);
ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
@ -5299,7 +5305,7 @@ output_deferred_plabels (void)
deferred plabels. */
if (n_deferred_plabels)
{
data_section ();
switch_to_section (data_section);
ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2);
}
@ -7795,13 +7801,13 @@ pa_asm_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta,
if (TARGET_SOM && flag_pic && TREE_PUBLIC (function))
{
data_section ();
switch_to_section (data_section);
output_asm_insn (".align 4", xoperands);
ASM_OUTPUT_LABEL (file, label);
output_asm_insn (".word P'%0", xoperands);
}
else if (TARGET_SOM && TARGET_GAS)
forget_section ();
in_section = NULL;
current_thunk_number++;
nbytes = ((nbytes + FUNCTION_BOUNDARY / BITS_PER_UNIT - 1)
@ -7977,7 +7983,7 @@ pa_asm_output_aligned_bss (FILE *stream,
unsigned HOST_WIDE_INT size,
unsigned int align)
{
bss_section ();
switch_to_section (bss_section);
fprintf (stream, "\t.align %u\n", align / BITS_PER_UNIT);
#ifdef ASM_OUTPUT_TYPE_DIRECTIVE
@ -8017,7 +8023,7 @@ pa_asm_output_aligned_common (FILE *stream,
align = max_common_align;
}
bss_section ();
switch_to_section (bss_section);
assemble_name (stream, name);
fprintf (stream, "\t.comm "HOST_WIDE_INT_PRINT_UNSIGNED"\n",
@ -8037,7 +8043,7 @@ pa_asm_output_aligned_local (FILE *stream,
unsigned HOST_WIDE_INT size,
unsigned int align)
{
bss_section ();
switch_to_section (bss_section);
fprintf (stream, "\t.align %u\n", align / BITS_PER_UNIT);
#ifdef LOCAL_ASM_OP
@ -9029,17 +9035,16 @@ pa_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode,
}
/* Return a string to output before text in the current function.
/* A get_unnamed_section callback for switching to the text section.
This function is only used with SOM. Because we don't support
named subspaces, we can only create a new subspace or switch back
to the default text subspace. */
const char *
som_text_section_asm_op (void)
{
if (!TARGET_SOM)
return "";
static void
som_output_text_section_asm_op (const void *data ATTRIBUTE_UNUSED)
{
gcc_assert (TARGET_SOM);
if (TARGET_GAS)
{
if (cfun && !cfun->machine->in_nsubspa)
@ -9053,10 +9058,12 @@ som_text_section_asm_op (void)
if (cfun->decl
&& DECL_ONE_ONLY (cfun->decl)
&& !DECL_WEAK (cfun->decl))
return
"\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=24,COMDAT";
return "\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$";
output_section_asm_op ("\t.SPACE $TEXT$\n"
"\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,"
"ACCESS=44,SORT=24,COMDAT");
else
output_section_asm_op ("\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$");
return;
}
else
{
@ -9064,13 +9071,66 @@ som_text_section_asm_op (void)
function has been completed. So, we are changing to the
text section to output debugging information. Do this in
the default text section. We need to forget that we are
in the text section so that the function text_section in
varasm.c will call us the next time around. */
forget_section ();
in the text section so that varasm.c will call us when
text_section is selected again. */
in_section = NULL;
}
}
output_section_asm_op ("\t.SPACE $TEXT$\n\t.SUBSPA $CODE$");
}
return "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$";
/* Implement TARGET_ASM_INITIALIZE_SECTIONS */
static void
pa_som_asm_init_sections (void)
{
text_section
= get_unnamed_section (0, som_output_text_section_asm_op, NULL);
/* SOM puts readonly data in the default $LIT$ subspace when PIC code
is not being generated. */
som_readonly_data_section
= get_unnamed_section (0, output_section_asm_op,
"\t.SPACE $TEXT$\n\t.SUBSPA $LIT$");
/* When secondary definitions are not supported, SOM makes readonly
data one-only by creating a new $LIT$ subspace in $TEXT$ with
the comdat flag. */
som_one_only_readonly_data_section
= get_unnamed_section (0, output_section_asm_op,
"\t.SPACE $TEXT$\n"
"\t.NSUBSPA $LIT$,QUAD=0,ALIGN=8,"
"ACCESS=0x2c,SORT=16,COMDAT");
/* When secondary definitions are not supported, SOM makes data one-only
by creating a new $DATA$ subspace in $PRIVATE$ with the comdat flag. */
som_one_only_data_section
= get_unnamed_section (SECTION_WRITE, output_section_asm_op,
"\t.SPACE $PRIVATE$\n"
"\t.NSUBSPA $DATA$,QUAD=1,ALIGN=8,"
"ACCESS=31,SORT=24,COMDAT");
/* FIXME: HPUX ld generates incorrect GOT entries for "T" fixups
which reference data within the $TEXT$ space (for example constant
strings in the $LIT$ subspace).
The assemblers (GAS and HP as) both have problems with handling
the difference of two symbols which is the other correct way to
reference constant data during PIC code generation.
So, there's no way to reference constant data which is in the
$TEXT$ space during PIC generation. Instead place all constant
data into the $PRIVATE$ subspace (this reduces sharing, but it
works correctly). */
readonly_data_section = flag_pic ? data_section : som_readonly_data_section;
/* We must not have a reference to an external symbol defined in a
shared library in a readonly section, else the SOM linker will
complain.
So, we force exception information into the data section. */
exception_section = data_section;
}
/* On hpux10, the linker will give an error if we have a reference
@ -9078,7 +9138,7 @@ som_text_section_asm_op (void)
library. Therefore, expressions that might require a reloc can
not be placed in the read-only data section. */
static void
static section *
pa_select_section (tree exp, int reloc,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
{
@ -9093,19 +9153,19 @@ pa_select_section (tree exp, int reloc,
if (TARGET_SOM
&& DECL_ONE_ONLY (exp)
&& !DECL_WEAK (exp))
som_one_only_readonly_data_section ();
return som_one_only_readonly_data_section;
else
readonly_data_section ();
return readonly_data_section;
}
else if (CONSTANT_CLASS_P (exp) && !reloc)
readonly_data_section ();
return readonly_data_section;
else if (TARGET_SOM
&& TREE_CODE (exp) == VAR_DECL
&& DECL_ONE_ONLY (exp)
&& !DECL_WEAK (exp))
som_one_only_data_section ();
return som_one_only_data_section;
else
data_section ();
return data_section;
}
static void

View File

@ -1568,72 +1568,6 @@ do { \
((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \
&& DECL_SECTION_NAME (DECL) != NULL_TREE)
/* The following extra sections and extra section functions are only used
for SOM, but they must be provided unconditionally because pa.c's calls
to the functions might not get optimized out when other object formats
are in use. */
#define EXTRA_SECTIONS \
in_som_readonly_data, \
in_som_one_only_readonly_data, \
in_som_one_only_data
#define EXTRA_SECTION_FUNCTIONS \
SOM_READONLY_DATA_SECTION_FUNCTION \
SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION \
SOM_ONE_ONLY_DATA_SECTION_FUNCTION \
FORGET_SECTION_FUNCTION
/* SOM puts readonly data in the default $LIT$ subspace when PIC code
is not being generated. */
#define SOM_READONLY_DATA_SECTION_FUNCTION \
void \
som_readonly_data_section (void) \
{ \
if (!TARGET_SOM) \
return; \
if (in_section != in_som_readonly_data) \
{ \
in_section = in_som_readonly_data; \
fputs ("\t.SPACE $TEXT$\n\t.SUBSPA $LIT$\n", asm_out_file); \
} \
}
/* When secondary definitions are not supported, SOM makes readonly data one
only by creating a new $LIT$ subspace in $TEXT$ with the comdat flag. */
#define SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION \
void \
som_one_only_readonly_data_section (void) \
{ \
if (!TARGET_SOM) \
return; \
in_section = in_som_one_only_readonly_data; \
fputs ("\t.SPACE $TEXT$\n" \
"\t.NSUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16,COMDAT\n",\
asm_out_file); \
}
/* When secondary definitions are not supported, SOM makes data one only by
creating a new $DATA$ subspace in $PRIVATE$ with the comdat flag. */
#define SOM_ONE_ONLY_DATA_SECTION_FUNCTION \
void \
som_one_only_data_section (void) \
{ \
if (!TARGET_SOM) \
return; \
in_section = in_som_one_only_data; \
fputs ("\t.SPACE $PRIVATE$\n" \
"\t.NSUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31,SORT=24,COMDAT\n", \
asm_out_file); \
}
#define FORGET_SECTION_FUNCTION \
void \
forget_section (void) \
{ \
in_section = no_section; \
}
/* Define this macro if references to a symbol must be treated
differently depending on something about the variable or
function named by the symbol (such as what section it is in).

View File

@ -175,9 +175,7 @@ do { \
}} while (0)
#define TARGET_ASM_FILE_START pa_som_file_start
/* String to output before text. */
#define TEXT_SECTION_ASM_OP som_text_section_asm_op ()
#define TARGET_ASM_INIT_SECTIONS pa_som_asm_init_sections
/* String to output before writable data. */
#define DATA_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $DATA$\n"
@ -185,28 +183,6 @@ do { \
/* String to output before uninitialized data. */
#define BSS_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $BSS$\n"
/* FIXME: HPUX ld generates incorrect GOT entries for "T" fixups
which reference data within the $TEXT$ space (for example constant
strings in the $LIT$ subspace).
The assemblers (GAS and HP as) both have problems with handling
the difference of two symbols which is the other correct way to
reference constant data during PIC code generation.
So, there's no way to reference constant data which is in the
$TEXT$ space during PIC generation. Instead place all constant
data into the $PRIVATE$ subspace (this reduces sharing, but it
works correctly). */
#define READONLY_DATA_SECTION \
(flag_pic ? data_section : som_readonly_data_section)
/* We must not have a reference to an external symbol defined in a
shared library in a readonly section, else the SOM linker will
complain.
So, we force exception information into the data section. */
#define TARGET_ASM_EXCEPTION_SECTION data_section
/* This is how to output a command to make the user-level label
named NAME defined for reference from other files. We use
assemble_name_raw instead of assemble_name since a symbol in

View File

@ -141,13 +141,6 @@ extern void rs6000_gen_section_name (char **, const char *, const char *);
extern void output_function_profiler (FILE *, int);
extern void output_profile_hook (int);
extern int rs6000_trampoline_size (void);
extern void toc_section (void);
extern void sdata_section (void);
extern void sdata2_section (void);
extern void sbss_section (void);
extern void private_data_section (void);
extern void read_only_data_section (void);
extern void read_only_private_data_section (void);
extern int get_TOC_alias_set (void);
extern void rs6000_emit_prologue (void);
extern void rs6000_emit_load_toc_table (int);

View File

@ -230,6 +230,12 @@ static enum {
int toc_initialized;
char toc_label_name[10];
static GTY(()) section *read_only_data_section;
static GTY(()) section *private_data_section;
static GTY(()) section *read_only_private_data_section;
static GTY(()) section *sdata2_section;
static GTY(()) section *toc_section;
/* Control alignment for fields within structures. */
/* String from -malign-XXXXX. */
int rs6000_alignment_flags;
@ -605,20 +611,23 @@ static unsigned int rs6000_elf_section_type_flags (tree, const char *, int);
static void rs6000_elf_asm_out_constructor (rtx, int);
static void rs6000_elf_asm_out_destructor (rtx, int);
static void rs6000_elf_end_indicate_exec_stack (void) ATTRIBUTE_UNUSED;
static void rs6000_elf_select_section (tree, int, unsigned HOST_WIDE_INT);
static void rs6000_elf_asm_init_sections (void);
static section *rs6000_elf_select_section (tree, int, unsigned HOST_WIDE_INT);
static void rs6000_elf_unique_section (tree, int);
static void rs6000_elf_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static section *rs6000_elf_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static void rs6000_elf_encode_section_info (tree, rtx, int)
ATTRIBUTE_UNUSED;
#endif
#if TARGET_XCOFF
static void rs6000_xcoff_asm_globalize_label (FILE *, const char *);
static void rs6000_xcoff_asm_init_sections (void);
static void rs6000_xcoff_asm_named_section (const char *, unsigned int, tree);
static void rs6000_xcoff_select_section (tree, int, unsigned HOST_WIDE_INT);
static void rs6000_xcoff_unique_section (tree, int);
static void rs6000_xcoff_select_rtx_section (enum machine_mode, rtx,
static section *rs6000_xcoff_select_section (tree, int,
unsigned HOST_WIDE_INT);
static void rs6000_xcoff_unique_section (tree, int);
static section *rs6000_xcoff_select_rtx_section
(enum machine_mode, rtx, unsigned HOST_WIDE_INT);
static const char * rs6000_xcoff_strip_name_encoding (const char *);
static unsigned int rs6000_xcoff_section_type_flags (tree, const char *, int);
static void rs6000_xcoff_file_start (void);
@ -1903,8 +1912,8 @@ rs6000_file_start (void)
if (DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic == 2))
{
toc_section ();
text_section ();
switch_to_section (toc_section);
switch_to_section (text_section);
}
}
@ -10806,15 +10815,14 @@ rs6000_assemble_integer (rtx x, unsigned int size, int aligned_p)
/* Special handling for SI values. */
if (RELOCATABLE_NEEDS_FIXUP && size == 4 && aligned_p)
{
extern int in_toc_section (void);
static int recurse = 0;
/* For -mrelocatable, we mark all addresses that need to be fixed up
in the .fixup section. */
if (TARGET_RELOCATABLE
&& !in_toc_section ()
&& !in_text_section ()
&& !in_unlikely_text_section ()
&& in_section != toc_section
&& in_section != text_section
&& unlikely_text_section_p (in_section)
&& !recurse
&& GET_CODE (x) != CONST_INT
&& GET_CODE (x) != CONST_DOUBLE
@ -17323,31 +17331,74 @@ rs6000_longcall_ref (rtx call_ref)
#ifdef USING_ELFOS_H
/* A C statement or statements to switch to the appropriate section
for output of RTX in mode MODE. You can assume that RTX is some
kind of constant in RTL. The argument MODE is redundant except in
the case of a `const_int' rtx. Select the section by calling
`text_section' or one of the alternatives for other sections.
Do not define this macro if you put all constants in the read-only
data section. */
/* A get_unnamed_section callback, used for switching to toc_section. */
static void
rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED)
{
if (DEFAULT_ABI == ABI_AIX
&& TARGET_MINIMAL_TOC
&& !TARGET_RELOCATABLE)
{
if (!toc_initialized)
{
toc_initialized = 1;
fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);
(*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0);
fprintf (asm_out_file, "\t.tc ");
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],");
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1");
fprintf (asm_out_file, "\n");
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1");
fprintf (asm_out_file, " = .+32768\n");
}
else
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
}
else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE)
fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);
else
{
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
if (!toc_initialized)
{
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1");
fprintf (asm_out_file, " = .+32768\n");
toc_initialized = 1;
}
}
}
/* Implement TARGET_ASM_INIT_SECTIONS. */
static void
rs6000_elf_asm_init_sections (void)
{
toc_section
= get_unnamed_section (0, rs6000_elf_output_toc_section_asm_op, NULL);
sdata2_section
= get_unnamed_section (SECTION_WRITE, output_section_asm_op,
SDATA2_SECTION_ASM_OP);
}
/* Implement TARGET_SELECT_RTX_SECTION. */
static section *
rs6000_elf_select_rtx_section (enum machine_mode mode, rtx x,
unsigned HOST_WIDE_INT align)
{
if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (x, mode))
toc_section ();
return toc_section;
else
default_elf_select_rtx_section (mode, x, align);
return default_elf_select_rtx_section (mode, x, align);
}
/* A C statement or statements to switch to the appropriate
section for output of DECL. DECL is either a `VAR_DECL' node
or a constant of some sort. RELOC indicates whether forming
the initial value of DECL requires link-time relocations. */
/* Implement TARGET_ASM_SELECT_SECTION for ELF targets. */
static void
static section *
rs6000_elf_select_section (tree decl, int reloc,
unsigned HOST_WIDE_INT align)
{
@ -17355,8 +17406,8 @@ rs6000_elf_select_section (tree decl, int reloc,
ABI_AIX, because otherwise we end up with dynamic relocations
in read-only sections. This happens for function pointers,
references to vtables in typeinfo, and probably other cases. */
default_elf_select_section_1 (decl, reloc, align,
flag_pic || DEFAULT_ABI == ABI_AIX);
return default_elf_select_section_1 (decl, reloc, align,
flag_pic || DEFAULT_ABI == ABI_AIX);
}
/* A C statement to build up a unique section name, expressed as a
@ -17678,9 +17729,9 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub)
GEN_LAZY_PTR_NAME_FOR_SYMBOL (lazy_ptr_name, symb, length);
if (flag_pic == 2)
machopic_picsymbol_stub1_section ();
switch_to_section (machopic_picsymbol_stub1_section);
else
machopic_symbol_stub1_section ();
switch_to_section (machopic_symbol_stub1_section);
if (flag_pic == 2)
{
@ -17720,7 +17771,7 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub)
fprintf (file, "\tbctr\n");
}
machopic_lazy_symbol_ptr_section ();
switch_to_section (machopic_lazy_symbol_ptr_section);
fprintf (file, "%s:\n", lazy_ptr_name);
fprintf (file, "\t.indirect_symbol %s\n", symbol_name);
fprintf (file, "%sdyld_stub_binding_helper\n",
@ -17781,16 +17832,6 @@ rs6000_machopic_legitimize_pic_address (rtx orig, enum machine_mode mode,
return machopic_legitimize_pic_address (orig, mode, reg);
}
/* This is just a placeholder to make linking work without having to
add this to the generic Darwin EXTRA_SECTIONS. If -mcall-aix is
ever needed for Darwin (not too likely!) this would have to get a
real definition. */
void
toc_section (void)
{
}
/* Output a .machine directive for the Darwin assembler, and call
the generic start_file routine. */
@ -17876,7 +17917,7 @@ rs6000_elf_asm_out_constructor (rtx symbol, int priority)
section = buf;
}
named_section_flags (section, SECTION_WRITE);
switch_to_section (get_section (section, SECTION_WRITE, NULL));
assemble_align (POINTER_SIZE);
if (TARGET_RELOCATABLE)
@ -17905,7 +17946,7 @@ rs6000_elf_asm_out_destructor (rtx symbol, int priority)
section = buf;
}
named_section_flags (section, SECTION_WRITE);
switch_to_section (get_section (section, SECTION_WRITE, NULL));
assemble_align (POINTER_SIZE);
if (TARGET_RELOCATABLE)
@ -18011,6 +18052,73 @@ rs6000_xcoff_asm_globalize_label (FILE *stream, const char *name)
putc ('\n', stream);
}
/* A get_unnamed_decl callback, used for read-only sections. PTR
points to the section string variable. */
static void
rs6000_xcoff_output_readonly_section_asm_op (const void *directive)
{
fprintf (asm_out_file, "\t.csect %s[RO],3\n",
*(const char *const *) directive);
}
/* Likewise for read-write sections. */
static void
rs6000_xcoff_output_readwrite_section_asm_op (const void *directive)
{
fprintf (asm_out_file, "\t.csect %s[RW],3\n",
*(const char *const *) directive);
}
/* A get_unnamed_section callback, used for switching to toc_section. */
static void
rs6000_xcoff_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED)
{
if (TARGET_MINIMAL_TOC)
{
/* toc_section is always selected at least once from
rs6000_xcoff_file_start, so this is guaranteed to
always be defined once and only once in each file. */
if (!toc_initialized)
{
fputs ("\t.toc\nLCTOC..1:\n", asm_out_file);
fputs ("\t.tc toc_table[TC],toc_table[RW]\n", asm_out_file);
toc_initialized = 1;
}
fprintf (asm_out_file, "\t.csect toc_table[RW]%s\n",
(TARGET_32BIT ? "" : ",3"));
}
else
fputs ("\t.toc\n", asm_out_file);
}
/* Implement TARGET_ASM_INIT_SECTIONS. */
static void
rs6000_xcoff_asm_init_sections (void)
{
read_only_data_section
= get_unnamed_section (0, rs6000_xcoff_output_readonly_section_asm_op,
&xcoff_read_only_section_name);
private_data_section
= get_unnamed_section (SECTION_WRITE,
rs6000_xcoff_output_readwrite_section_asm_op,
&xcoff_private_data_section_name);
read_only_private_data_section
= get_unnamed_section (0, rs6000_xcoff_output_readonly_section_asm_op,
&xcoff_private_data_section_name);
toc_section
= get_unnamed_section (0, rs6000_xcoff_output_toc_section_asm_op, NULL);
readonly_data_section = read_only_data_section;
exception_section = data_section;
}
static void
rs6000_xcoff_asm_named_section (const char *name, unsigned int flags,
tree decl ATTRIBUTE_UNUSED)
@ -18030,23 +18138,23 @@ rs6000_xcoff_asm_named_section (const char *name, unsigned int flags,
name, suffix[smclass], flags & SECTION_ENTSIZE);
}
static void
static section *
rs6000_xcoff_select_section (tree decl, int reloc,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
{
if (decl_readonly_section_1 (decl, reloc, 1))
{
if (TREE_PUBLIC (decl))
read_only_data_section ();
return read_only_data_section;
else
read_only_private_data_section ();
return read_only_private_data_section;
}
else
{
if (TREE_PUBLIC (decl))
data_section ();
return data_section;
else
private_data_section ();
return private_data_section;
}
}
@ -18075,14 +18183,14 @@ rs6000_xcoff_unique_section (tree decl, int reloc ATTRIBUTE_UNUSED)
However, if this is being placed in the TOC it must be output as a
toc entry. */
static void
static section *
rs6000_xcoff_select_rtx_section (enum machine_mode mode, rtx x,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
{
if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (x, mode))
toc_section ();
return toc_section;
else
read_only_private_data_section ();
return read_only_private_data_section;
}
/* Remove any trailing [DS] or the like from the symbol name. */
@ -18146,8 +18254,8 @@ rs6000_xcoff_file_start (void)
output_quoted_string (asm_out_file, main_input_filename);
fputc ('\n', asm_out_file);
if (write_symbols != NO_DEBUG)
private_data_section ();
text_section ();
switch_to_section (private_data_section);
switch_to_section (text_section);
if (profile_flag)
fprintf (asm_out_file, "\t.extern %s\n", RS6000_MCOUNT);
rs6000_file_start ();
@ -18159,9 +18267,9 @@ rs6000_xcoff_file_start (void)
static void
rs6000_xcoff_file_end (void)
{
text_section ();
switch_to_section (text_section);
fputs ("_section_.text:\n", asm_out_file);
data_section ();
switch_to_section (data_section);
fputs (TARGET_32BIT
? "\t.long _section_.text\n" : "\t.llong _section_.text\n",
asm_out_file);

View File

@ -359,126 +359,8 @@ do { \
#define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
#define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
/* Besides the usual ELF sections, we need a toc section. */
/* Override elfos.h definition. */
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
/* Override elfos.h definition. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
TOC_SECTION_FUNCTION \
SDATA_SECTION_FUNCTION \
SDATA2_SECTION_FUNCTION \
SBSS_SECTION_FUNCTION \
INIT_SECTION_FUNCTION \
FINI_SECTION_FUNCTION
#define TOC_SECTION_FUNCTION \
void \
toc_section (void) \
{ \
if (in_section != in_toc) \
{ \
in_section = in_toc; \
if (DEFAULT_ABI == ABI_AIX \
&& TARGET_MINIMAL_TOC \
&& !TARGET_RELOCATABLE) \
{ \
if (! toc_initialized) \
{ \
toc_initialized = 1; \
fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
(*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0); \
fprintf (asm_out_file, "\t.tc "); \
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
fprintf (asm_out_file, "\n"); \
\
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
fprintf (asm_out_file, " = .+32768\n"); \
} \
else \
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
} \
else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE) \
fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
else \
{ \
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
if (! toc_initialized) \
{ \
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
fprintf (asm_out_file, " = .+32768\n"); \
toc_initialized = 1; \
} \
} \
} \
} \
\
extern int in_toc_section (void); \
int in_toc_section (void) \
{ \
return in_section == in_toc; \
}
#define SDATA_SECTION_FUNCTION \
void \
sdata_section (void) \
{ \
if (in_section != in_sdata) \
{ \
in_section = in_sdata; \
fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
} \
}
#define SDATA2_SECTION_FUNCTION \
void \
sdata2_section (void) \
{ \
if (in_section != in_sdata2) \
{ \
in_section = in_sdata2; \
fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
} \
}
#define SBSS_SECTION_FUNCTION \
void \
sbss_section (void) \
{ \
if (in_section != in_sbss) \
{ \
in_section = in_sbss; \
fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
} \
}
#define INIT_SECTION_FUNCTION \
void \
init_section (void) \
{ \
if (in_section != in_init) \
{ \
in_section = in_init; \
fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
} \
}
#define FINI_SECTION_FUNCTION \
void \
fini_section (void) \
{ \
if (in_section != in_fini) \
{ \
in_section = in_fini; \
fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
} \
}
/* Override default elf definitions. */
#define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
#undef TARGET_ASM_SELECT_RTX_SECTION
#define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
#undef TARGET_ASM_SELECT_SECTION
@ -555,7 +437,7 @@ extern int rs6000_pic_labelno;
do { \
if ((DECL) && rs6000_elf_in_small_data_p (DECL)) \
{ \
sbss_section (); \
switch_to_section (sbss_section); \
ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
ASM_OUTPUT_LABEL (FILE, NAME); \
ASM_OUTPUT_SKIP (FILE, SIZE); \

View File

@ -56,93 +56,6 @@
#define DOLLARS_IN_IDENTIFIERS 0
/* Define the extra sections we need. We define three: one is the read-only
data section which is used for constants. This is a csect whose name is
derived from the name of the input file. The second is for initialized
global variables. This is a csect whose name is that of the variable.
The third is the TOC. */
#define EXTRA_SECTIONS \
read_only_data, private_data, read_only_private_data, toc, bss
/* Define the routines to implement these extra sections.
BIGGEST_ALIGNMENT is 64, so align the sections that much. */
#define EXTRA_SECTION_FUNCTIONS \
READ_ONLY_DATA_SECTION_FUNCTION \
PRIVATE_DATA_SECTION_FUNCTION \
READ_ONLY_PRIVATE_DATA_SECTION_FUNCTION \
TOC_SECTION_FUNCTION
#define READ_ONLY_DATA_SECTION_FUNCTION \
void \
read_only_data_section (void) \
{ \
if (in_section != read_only_data) \
{ \
fprintf (asm_out_file, "\t.csect %s[RO],3\n", \
xcoff_read_only_section_name); \
in_section = read_only_data; \
} \
}
#define PRIVATE_DATA_SECTION_FUNCTION \
void \
private_data_section (void) \
{ \
if (in_section != private_data) \
{ \
fprintf (asm_out_file, "\t.csect %s[RW],3\n", \
xcoff_private_data_section_name); \
in_section = private_data; \
} \
}
#define READ_ONLY_PRIVATE_DATA_SECTION_FUNCTION \
void \
read_only_private_data_section (void) \
{ \
if (in_section != read_only_private_data) \
{ \
fprintf (asm_out_file, "\t.csect %s[RO],3\n", \
xcoff_private_data_section_name); \
in_section = read_only_private_data; \
} \
}
#define TOC_SECTION_FUNCTION \
void \
toc_section (void) \
{ \
if (TARGET_MINIMAL_TOC) \
{ \
/* toc_section is always called at least once \
from rs6000_xcoff_file_start, so this is \
guaranteed to always be defined once and \
only once in each file. */ \
if (! toc_initialized) \
{ \
fputs ("\t.toc\nLCTOC..1:\n", asm_out_file); \
fputs ("\t.tc toc_table[TC],toc_table[RW]\n", asm_out_file); \
toc_initialized = 1; \
} \
\
if (in_section != toc) \
fprintf (asm_out_file, "\t.csect toc_table[RW]%s\n", \
(TARGET_32BIT ? "" : ",3")); \
} \
else \
{ \
if (in_section != toc) \
fputs ("\t.toc\n", asm_out_file); \
} \
in_section = toc; \
}
/* Define the name of our readonly data section. */
#define READONLY_DATA_SECTION read_only_data_section
/* Return nonzero if this entry is to be written into the constant
pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
or a CONST containing one of them. If -mfp-in-toc (the default),
@ -168,6 +81,7 @@ toc_section (void) \
&& ! TARGET_NO_FP_IN_TOC)))))
#define TARGET_ASM_GLOBALIZE_LABEL rs6000_xcoff_asm_globalize_label
#define TARGET_ASM_INIT_SECTIONS rs6000_xcoff_asm_init_sections
#define TARGET_ASM_NAMED_SECTION rs6000_xcoff_asm_named_section
#define TARGET_ASM_SELECT_SECTION rs6000_xcoff_select_section
#define TARGET_ASM_SELECT_RTX_SECTION rs6000_xcoff_select_rtx_section
@ -213,9 +127,8 @@ toc_section (void) \
On the RS/6000, we need to place an extra '.' in the function name and
output the function descriptor.
The csect for the function will have already been created by the
`text_section' call previously done. We do have to go back to that
csect, however.
The csect for the function will have already been created when
text_section was selected. We do have to go back to that csect, however.
The third and fourth parameters to the .function pseudo-op (16 and 044)
are placeholders which no longer have any use. */
@ -244,8 +157,8 @@ toc_section (void) \
fputs (TARGET_32BIT ? "\t.long ." : "\t.llong .", FILE); \
RS6000_OUTPUT_BASENAME (FILE, NAME); \
fputs (", TOC[tc0], 0\n", FILE); \
in_section = no_section; \
function_section(DECL); \
in_section = NULL; \
switch_to_section (function_section (DECL)); \
putc ('.', FILE); \
RS6000_OUTPUT_BASENAME (FILE, NAME); \
fputs (":\n", FILE); \
@ -362,10 +275,6 @@ toc_section (void) \
Align entire section to BIGGEST_ALIGNMENT. */
#define DATA_SECTION_ASM_OP "\t.csect .data[RW],3"
/* Define the name of the section to use for the EH language specific
data areas (.gcc_except_table on most other systems). */
#define TARGET_ASM_EXCEPTION_SECTION data_section
/* Define to prevent DWARF2 unwind info in the data section rather
than in the .eh_frame section. We do this because the AIX linker
would otherwise garbage collect these sections. */

View File

@ -1785,7 +1785,7 @@ sh_file_start (void)
else
/* Switch to the data section so that the coffsem symbol
isn't in the text section. */
data_section ();
switch_to_section (data_section);
if (TARGET_LITTLE_ENDIAN)
fputs ("\t.little\n", asm_out_file);

View File

@ -3287,7 +3287,7 @@ emit_pic_helper (void)
const char *pic_name = reg_names[REGNO (pic_offset_table_rtx)];
int align;
text_section ();
switch_to_section (text_section);
align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT);
if (align > 0)
@ -7477,7 +7477,7 @@ sparc_output_deferred_case_vectors (void)
return;
/* Align to cache line in the function's code section. */
current_function_section (current_function_decl);
switch_to_section (current_function_section ());
align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT);
if (align > 0)

View File

@ -29,7 +29,6 @@ extern int direct_return (void);
extern int xstormy16_interrupt_function_p (void);
extern int xstormy16_epilogue_uses (int);
extern void xstormy16_function_profiler (void);
extern void bss100_section (void);
#if defined (TREE_CODE)
extern void xstormy16_asm_output_aligned_common (FILE *, tree, const char *,

View File

@ -47,6 +47,7 @@ Boston, MA 02110-1301, USA. */
#include "tm_p.h"
#include "langhooks.h"
#include "tree-gimple.h"
#include "ggc.h"
static rtx emit_addhi3_postreload (rtx, rtx, rtx);
static void xstormy16_asm_out_constructor (rtx, int);
@ -65,6 +66,8 @@ static bool xstormy16_return_in_memory (tree, tree);
struct rtx_def * xstormy16_compare_op0;
struct rtx_def * xstormy16_compare_op1;
static GTY(()) section *bss100_section;
/* Compute a (partial) cost for rtx X. Return true if the complete
cost has been computed, and false if subexpressions should be
scanned. In either case, *TOTAL contains the cost result. */
@ -1593,7 +1596,7 @@ xstormy16_asm_output_aligned_common (FILE *stream,
const char *name2;
int p2align = 0;
bss100_section ();
switch_to_section (bss100_section);
while (align > 8)
{
@ -1623,6 +1626,17 @@ xstormy16_asm_output_aligned_common (FILE *stream,
fprintf (stream, ",%u,%u\n", size, align / BITS_PER_UNIT);
}
/* Implement TARGET_ASM_INIT_SECTIONS. */
static void
xstormy16_asm_init_sections (void)
{
bss100_section
= get_unnamed_section (SECTION_WRITE | SECTION_BSS,
output_section_asm_op,
"\t.section \".bss_below100\",\"aw\",@nobits");
}
/* Mark symbols with the "below100" attribute so that we can use the
special addressing modes for them. */
@ -1666,7 +1680,7 @@ xstormy16_asm_out_destructor (rtx symbol, int priority)
section = buf;
}
named_section_flags (section, 0);
switch_to_section (get_section (section, 0, NULL));
assemble_align (POINTER_SIZE);
assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
}
@ -1688,7 +1702,7 @@ xstormy16_asm_out_constructor (rtx symbol, int priority)
section = buf;
}
named_section_flags (section, 0);
switch_to_section (get_section (section, 0, NULL));
assemble_align (POINTER_SIZE);
assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
}
@ -1917,7 +1931,7 @@ xstormy16_output_addr_vec (FILE *file, rtx label ATTRIBUTE_UNUSED, rtx table)
{
int vlen, idx;
current_function_section (current_function_decl);
switch_to_section (current_function_section ());
vlen = XVECLEN (table, 0);
for (idx = 0; idx < vlen; idx++)
@ -2668,3 +2682,5 @@ xstormy16_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
#define TARGET_MACHINE_DEPENDENT_REORG xstormy16_reorg
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-stormy16.h"

View File

@ -618,29 +618,10 @@ do { \
#undef DTORS_SECTION_ASM_OP
#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"a\""
#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"a\""
#define EXTRA_SECTIONS in_bss100
/* We define the function body in a separate macro so that if we ever
add another section, we can just add an entry to
EXTRA_SECTION_FUNCTIONS without making it difficult to read. It is
not used anywhere else. */
#define XSTORMY16_SECTION_FUNCTION(name, in, string, bits) \
void \
name () \
{ \
if (in_section != in) \
{ \
fprintf (asm_out_file, "\t.section %s,\"aw\",@%sbits\n", string, bits); \
in_section = in; \
} \
}
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
XSTORMY16_SECTION_FUNCTION (bss100_section, in_bss100, ".bss_below100", "no")
#define TARGET_ASM_INIT_SECTIONS xstormy16_asm_init_sections
#define JUMP_TABLES_IN_TEXT_SECTION 1
/* The Overall Framework of an Assembler File. */

View File

@ -54,7 +54,7 @@ Boston, MA 02110-1301, USA. */
do { \
int align = exact_log2 (ROUNDED); \
if (align > 2) align = 2; \
data_section (); \
switch_to_section (data_section); \
ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
ASM_OUTPUT_LABEL ((FILE), (NAME)); \
fprintf ((FILE), "\t.set .,.+%u\n", (int)(ROUNDED)); \
@ -159,33 +159,3 @@ do { \
} while (0)
#endif /* STACK_GROWS_DOWNWARD */
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_init, in_fini
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
INIT_SECTION_FUNCTION \
FINI_SECTION_FUNCTION
#define INIT_SECTION_FUNCTION \
void \
init_section () \
{ \
if (in_section != in_init) \
{ \
fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
in_section = in_init; \
} \
}
#define FINI_SECTION_FUNCTION \
void \
fini_section () \
{ \
if (in_section != in_fini) \
{ \
fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
in_section = in_fini; \
} \
}

View File

@ -1,7 +1,8 @@
darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(REAL_H) insn-config.h \
conditions.h insn-flags.h output.h insn-attr.h flags.h $(TREE_H) expr.h \
reload.h function.h $(GGC_H) langhooks.h $(TARGET_H) $(TM_P_H) gt-darwin.h
reload.h function.h $(GGC_H) langhooks.h $(TARGET_H) $(TM_P_H) gt-darwin.h \
config/darwin-sections.def
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/darwin.c
darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \

View File

@ -27,13 +27,6 @@
extern void expand_prologue (void);
extern void expand_epilogue (void);
extern void sdata_section (void);
extern void rosdata_section (void);
extern void sbss_section (void);
extern void tdata_section (void);
extern void zdata_section (void);
extern void rozdata_section (void);
extern void zbss_section (void);
extern int v850_handle_pragma (int (*)(void), void (*)(int), char *);
extern int compute_register_save_size (long *);
extern int compute_frame_size (int, long *);

View File

@ -62,7 +62,8 @@ const struct attribute_spec v850_attribute_table[];
static tree v850_handle_interrupt_attribute (tree *, tree, tree, int, bool *);
static tree v850_handle_data_area_attribute (tree *, tree, tree, int, bool *);
static void v850_insert_attributes (tree, tree *);
static void v850_select_section (tree, int, unsigned HOST_WIDE_INT);
static void v850_asm_init_sections (void);
static section *v850_select_section (tree, int, unsigned HOST_WIDE_INT);
static void v850_encode_data_area (tree, rtx);
static void v850_encode_section_info (tree, rtx, int);
static bool v850_return_in_memory (tree, tree);
@ -96,6 +97,12 @@ static int v850_interrupt_cache_p = FALSE;
/* Whether current function is an interrupt handler. */
static int v850_interrupt_p = FALSE;
static GTY(()) section *rosdata_section;
static GTY(()) section *rozdata_section;
static GTY(()) section *tdata_section;
static GTY(()) section *zdata_section;
static GTY(()) section *zbss_section;
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
@ -2498,18 +2505,18 @@ v850_output_aligned_bss (FILE * file,
switch (v850_get_data_area (decl))
{
case DATA_AREA_ZDA:
zbss_section ();
switch_to_section (zbss_section);
break;
case DATA_AREA_SDA:
sbss_section ();
switch_to_section (sbss_section);
break;
case DATA_AREA_TDA:
tdata_section ();
switch_to_section (tdata_section);
default:
bss_section ();
switch_to_section (bss_section);
break;
}
@ -2927,7 +2934,34 @@ v850_return_addr (int count)
return get_hard_reg_initial_val (Pmode, LINK_POINTER_REGNUM);
}
/* Implement TARGET_ASM_INIT_SECTIONS. */
static void
v850_asm_init_sections (void)
{
rosdata_section
= get_unnamed_section (0, output_section_asm_op,
"\t.section .rosdata,\"a\"");
rozdata_section
= get_unnamed_section (0, output_section_asm_op,
"\t.section .rozdata,\"a\"");
tdata_section
= get_unnamed_section (SECTION_WRITE, output_section_asm_op,
"\t.section .tdata,\"aw\"");
zdata_section
= get_unnamed_section (SECTION_WRITE, output_section_asm_op,
"\t.section .zdata,\"aw\"");
zbss_section
= get_unnamed_section (SECTION_WRITE | SECTION_BSS,
output_section_asm_op,
"\t.section .zbss,\"aw\"");
}
static section *
v850_select_section (tree exp,
int reloc ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
@ -2947,33 +2981,19 @@ v850_select_section (tree exp,
switch (v850_get_data_area (exp))
{
case DATA_AREA_ZDA:
if (is_const)
rozdata_section ();
else
zdata_section ();
break;
return is_const ? rozdata_section : zdata_section;
case DATA_AREA_TDA:
tdata_section ();
break;
return tdata_section;
case DATA_AREA_SDA:
if (is_const)
rosdata_section ();
else
sdata_section ();
break;
return is_const ? rosdata_section : sdata_section;
default:
if (is_const)
readonly_data_section ();
else
data_section ();
break;
return is_const ? readonly_data_section : data_section;
}
}
else
readonly_data_section ();
return readonly_data_section;
}
/* Worker function for TARGET_RETURN_IN_MEMORY. */
@ -2996,3 +3016,5 @@ v850_setup_incoming_varargs (CUMULATIVE_ARGS *ca,
{
ca->anonymous_args = (!TARGET_GHS ? 1 : 0);
}
#include "gt-v850.h"

View File

@ -876,101 +876,11 @@ typedef enum
DATA_AREA_ZDA
} v850_data_area;
/* A list of names for sections other than the standard two, which are
`in_text' and `in_data'. You need not define this macro on a
system with no other sections (that GCC needs to use). */
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, \
in_rozdata, in_rosdata, in_sbss, in_zbss, in_zcommon, in_scommon
/* One or more functions to be defined in `varasm.c'. These
functions should do jobs analogous to those of `text_section' and
`data_section', for your additional sections. Do not define this
macro if you do not define `EXTRA_SECTIONS'. */
#undef EXTRA_SECTION_FUNCTIONS
/* This could be done a lot more cleanly using ANSI C.... */
#define EXTRA_SECTION_FUNCTIONS \
void \
sdata_section () \
{ \
if (in_section != in_sdata) \
{ \
fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
in_section = in_sdata; \
} \
} \
\
void \
rosdata_section () \
{ \
if (in_section != in_rosdata) \
{ \
fprintf (asm_out_file, "%s\n", ROSDATA_SECTION_ASM_OP); \
in_section = in_sdata; \
} \
} \
\
void \
sbss_section () \
{ \
if (in_section != in_sbss) \
{ \
fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
in_section = in_sbss; \
} \
} \
\
void \
tdata_section () \
{ \
if (in_section != in_tdata) \
{ \
fprintf (asm_out_file, "%s\n", TDATA_SECTION_ASM_OP); \
in_section = in_tdata; \
} \
} \
\
void \
zdata_section () \
{ \
if (in_section != in_zdata) \
{ \
fprintf (asm_out_file, "%s\n", ZDATA_SECTION_ASM_OP); \
in_section = in_zdata; \
} \
} \
\
void \
rozdata_section () \
{ \
if (in_section != in_rozdata) \
{ \
fprintf (asm_out_file, "%s\n", ROZDATA_SECTION_ASM_OP); \
in_section = in_rozdata; \
} \
} \
\
void \
zbss_section () \
{ \
if (in_section != in_zbss) \
{ \
fprintf (asm_out_file, "%s\n", ZBSS_SECTION_ASM_OP); \
in_section = in_zbss; \
} \
}
#define TEXT_SECTION_ASM_OP "\t.section .text"
#define DATA_SECTION_ASM_OP "\t.section .data"
#define BSS_SECTION_ASM_OP "\t.section .bss"
#define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\""
#define SBSS_SECTION_ASM_OP "\t.section .sbss,\"aw\""
#define ZDATA_SECTION_ASM_OP "\t.section .zdata,\"aw\""
#define ZBSS_SECTION_ASM_OP "\t.section .zbss,\"aw\""
#define TDATA_SECTION_ASM_OP "\t.section .tdata,\"aw\""
#define ROSDATA_SECTION_ASM_OP "\t.section .rosdata,\"a\""
#define ROZDATA_SECTION_ASM_OP "\t.section .rozdata,\"a\""
#define SCOMMON_ASM_OP "\t.scomm\t"
#define ZCOMMON_ASM_OP "\t.zcomm\t"
@ -1230,4 +1140,6 @@ extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_K
#define SYMBOL_REF_TDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_TDA) != 0)
#define SYMBOL_REF_SDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_SDA) != 0)
#define TARGET_ASM_INIT_SECTIONS v850_asm_init_sections
#endif /* ! GCC_V850_H */

View File

@ -48,7 +48,7 @@ Boston, MA 02110-1301, USA. */
#undef ASM_OUTPUT_LOCAL
#define ASM_OUTPUT_LOCAL(FILE,NAME,SIZE,ROUNDED) \
( data_section (), \
( switch_to_section (data_section), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ":\n\t.space %u\n", (int)(ROUNDED)))

View File

@ -83,17 +83,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
sorry ("profiler support for VxWorks"); \
} while (0)
/* This section either contains dynamic relocations, or contains
PC-rel indirections to stubs in the data section which contain dynamic
relocations. General dynamic relocations are not processed
for shared libraries' text segments, and PC-relative displacements
from the text segment to the data segment don't work. So force
it to .gcc_except_section, which the linker will place in .data. */
void vxworks_exception_section (void);
#undef TARGET_ASM_EXCEPTION_SECTION
#define TARGET_ASM_EXCEPTION_SECTION default_exception_section
/* We occasionally need to distinguish between the VxWorks variants. */
#define VXWORKS_KIND_NORMAL 1
#define VXWORKS_KIND_AE 2

View File

@ -204,8 +204,8 @@ static void xtensa_function_epilogue (FILE *, HOST_WIDE_INT);
static rtx xtensa_builtin_saveregs (void);
static unsigned int xtensa_multibss_section_type_flags (tree, const char *,
int) ATTRIBUTE_UNUSED;
static void xtensa_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static section *xtensa_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static bool xtensa_rtx_costs (rtx, int, int, int *);
static tree xtensa_build_builtin_va_list (void);
static bool xtensa_return_in_memory (tree, tree);
@ -2421,12 +2421,12 @@ xtensa_multibss_section_type_flags (tree decl, const char *name, int reloc)
/* The literal pool stays with the function. */
static void
static section *
xtensa_select_rtx_section (enum machine_mode mode ATTRIBUTE_UNUSED,
rtx x ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
{
function_section (current_function_decl);
return function_section (current_function_decl);
}

View File

@ -1210,7 +1210,7 @@ typedef struct xtensa_args
} \
if ((SIZE) > 0) \
{ \
function_section (FUNDECL); \
switch_to_section (function_section (FUNDECL)); \
fprintf (FILE, "\t.literal_position\n"); \
} \
} while (0)

View File

@ -43,6 +43,8 @@ struct rtvec_def;
typedef struct rtvec_def *rtvec;
union tree_node;
typedef union tree_node *tree;
union section;
typedef union section section;
/* Provide forward struct declaration so that we don't have to include
all of cpplib.h whenever a random prototype includes a pointer.

View File

@ -269,7 +269,7 @@ static int pending_bincls = 0;
static const char *base_input_file;
#ifdef DEBUG_SYMS_TEXT
#define FORCE_TEXT current_function_section (current_function_decl);
#define FORCE_TEXT switch_to_section (current_function_section ())
#else
#define FORCE_TEXT
#endif
@ -907,7 +907,7 @@ dbxout_function_end (tree decl)
/* The Lscope label must be emitted even if we aren't doing anything
else; dbxout_block needs it. */
function_section (current_function_decl);
switch_to_section (function_section (current_function_decl));
/* Convert Lscope into the appropriate format for local labels in case
the system doesn't insert underscores in front of user generated
@ -1033,7 +1033,7 @@ dbxout_init (const char *input_file_name)
if (used_ltext_label_name)
{
text_section ();
switch_to_section (text_section);
targetm.asm_out.internal_label (asm_out_file, "Ltext", 0);
}
@ -1232,7 +1232,7 @@ dbxout_source_file (const char *filename)
{
/* Don't change section amid function. */
if (current_function_decl == NULL_TREE)
text_section ();
switch_to_section (text_section);
dbxout_begin_simple_stabs (filename, N_SOL);
dbxout_stab_value_internal_label ("Ltext", &source_label_number);
@ -1347,7 +1347,7 @@ dbxout_finish (const char *filename ATTRIBUTE_UNUSED)
DBX_OUTPUT_MAIN_SOURCE_FILE_END (asm_out_file, filename);
#elif defined DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
{
text_section ();
switch_to_section (text_section);
dbxout_begin_empty_stabs (N_SO);
dbxout_stab_value_internal_label ("Letext", 0);
}
@ -2838,7 +2838,7 @@ dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home)
{
/* Ultrix `as' seems to need this. */
#ifdef DBX_STATIC_STAB_DATA_SECTION
data_section ();
switch_to_section (data_section);
#endif
code = N_STSYM;
}

View File

@ -4688,10 +4688,8 @@ to generate it on the spot.
@end defmac
@defmac TRAMPOLINE_SECTION
The name of a subroutine to switch to the section in which the
trampoline template is to be placed (@pxref{Sections}). The default is
a value of @samp{readonly_data_section}, which places the trampoline in
the section containing read-only data.
Return the section into which the trampoline template is to be placed
(@pxref{Sections}). The default value is @code{readonly_data_section}.
@end defmac
@defmac TRAMPOLINE_SIZE
@ -5914,9 +5912,32 @@ section}, which holds initialized writable data; and the @dfn{bss
section}, which holds uninitialized data. Some systems have other kinds
of sections.
The compiler must tell the assembler when to switch sections. These
macros control what commands to output to tell the assembler this. You
can also define additional sections.
@file{varasm.c} provides several well-known sections, such as
@code{text_section}, @code{data_section} and @code{bss_section}.
The normal way of controlling a @code{@var{foo}_section} variable
is to define the associated @code{@var{FOO}_SECTION_ASM_OP} macro,
as described below. The macros are only read once, when @file{varasm.c}
initializes itself, so their values must be run-time constants.
They may however depend on command-line flags.
@emph{Note:} Some run-time files, such @file{crtstuff.c}, also make
use of the @code{@var{FOO}_SECTION_ASM_OP} macros, and expect them
to be string literals.
Some assemblers require a different string to be written every time a
section is selected. If your assembler falls into this category, you
should define the @code{TARGET_ASM_INIT_SECTIONS} hook and use
@code{get_unnamed_section} to set up the sections.
You must always create a @code{text_section}, either by defining
@code{TEXT_SECTION_ASM_OP} or by initializing @code{text_section}
in @code{TARGET_ASM_INIT_SECTIONS}. The same is true of
@code{data_section} and @code{DATA_SECTION_ASM_OP}. If you do not
create a distinct @code{readonly_data_section}, the default is to
reuse @code{text_section}.
All the other @file{varasm.c} sections are optional, and are null
if the target does not provide them.
@defmac TEXT_SECTION_ASM_OP
A C expression whose value is a string, including spacing, containing the
@ -5941,22 +5962,18 @@ assembler operation to identify the following data as writable initialized
data. Normally @code{"\t.data"} is right.
@end defmac
@defmac SDATA_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
initialized, writable small data.
@end defmac
@defmac READONLY_DATA_SECTION_ASM_OP
A C expression whose value is a string, including spacing, containing the
assembler operation to identify the following data as read-only initialized
data.
@end defmac
@defmac READONLY_DATA_SECTION
A macro naming a function to call to switch to the proper section for
read-only data. The default is to use @code{READONLY_DATA_SECTION_ASM_OP}
if defined, else fall back to @code{text_section}.
The most common definition will be @code{data_section}, if the target
does not have a special read-only data section, and does not put data
in the text section.
@end defmac
@defmac BSS_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
@ -5967,6 +5984,12 @@ uninitialized global data will be output in the data section if
used.
@end defmac
@defmac SBSS_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
uninitialized, writable small data.
@end defmac
@defmac INIT_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
@ -6016,23 +6039,6 @@ arbitrary boundary. This is used to force all fragments of the
and thus prevent the linker from having to add any padding.
@end defmac
@findex in_text
@findex in_data
@defmac EXTRA_SECTIONS
A list of names for sections other than the standard two, which are
@code{in_text} and @code{in_data}. You need not define this macro
on a system with no other sections (that GCC needs to use).
@end defmac
@findex text_section
@findex data_section
@defmac EXTRA_SECTION_FUNCTIONS
One or more functions to be defined in @file{varasm.c}. These
functions should do jobs analogous to those of @code{text_section} and
@code{data_section}, for your additional sections. Do not define this
macro if you do not define @code{EXTRA_SECTIONS}.
@end defmac
@defmac JUMP_TABLES_IN_TEXT_SECTION
Define this macro to be an expression with a nonzero value if jump
tables (for @code{tablejump} insns) should be output in the text
@ -6042,15 +6048,23 @@ readonly data section is used.
This macro is irrelevant if there is no separate readonly data section.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_SELECT_SECTION (tree @var{exp}, int @var{reloc}, unsigned HOST_WIDE_INT @var{align})
Switches to the appropriate section for output of @var{exp}. You can
@deftypefn {Target Hook} void TARGET_ASM_INIT_SECTIONS (void)
Define this hook if you need to do something special to set up the
@file{varasm.c} sections, or if your target has some special sections
of its own that you need to create.
GCC calls this hook after processing the command line, but before writing
any assembly code, and before calling any of the section-returning hooks
described below.
@end deftypefn
@deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_SECTION (tree @var{exp}, int @var{reloc}, unsigned HOST_WIDE_INT @var{align})
Return the section into which @var{exp} should be placed. You can
assume that @var{exp} is either a @code{VAR_DECL} node or a constant of
some sort. @var{reloc} indicates whether the initial value of @var{exp}
requires link-time relocations. Bit 0 is set when variable contains
local relocations only, while bit 1 is set for global relocations.
Select the section by calling @code{data_section} or one of the
alternatives for other sections. @var{align} is the constant alignment
in bits.
@var{align} is the constant alignment in bits.
The default version of this function takes care of putting read-only
variables in @code{readonly_data_section}.
@ -6079,22 +6093,21 @@ example, the function @code{foo} would be placed in @code{.text.foo}.
Whatever the actual target object format, this is often good enough.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_RODATA_SECTION (tree @var{decl})
Switches to a readonly data section associated with
@deftypefn {Target Hook} {section *} TARGET_ASM_FUNCTION_RODATA_SECTION (tree @var{decl})
Return the readonly data section associated with
@samp{DECL_SECTION_NAME (@var{decl})}.
The default version of this function switches to @code{.gnu.linkonce.r.name}
section if function's section is @code{.gnu.linkonce.t.name}, to
@code{.rodata.name} if function is in @code{.text.name} section
and otherwise switches to the normal readonly data section.
The default version of this function selects @code{.gnu.linkonce.r.name} if
the function's section is @code{.gnu.linkonce.t.name}, @code{.rodata.name}
if function is in @code{.text.name}, and the normal readonly-data section
otherwise.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_SELECT_RTX_SECTION (enum machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align})
Switches to the appropriate section for output of constant pool entry
@var{x} in @var{mode}. You can assume that @var{x} is some kind of
@deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_RTX_SECTION (enum machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align})
Return the section into which a constant @var{x}, of mode @var{mode},
should be placed. You can assume that @var{x} is some kind of
constant in RTL@. The argument @var{mode} is redundant except in the
case of a @code{const_int} rtx. Select the section by calling
@code{readonly_data_section} or one of the alternatives for other
sections. @var{align} is the constant alignment in bits.
case of a @code{const_int} rtx. @var{align} is the constant alignment
in bits.
The default version of this function takes care of putting symbolic
constants in @code{flag_pic} mode in @code{data_section} and everything
@ -7742,24 +7755,6 @@ minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if
the target supports DWARF 2 frame unwind information.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_EXCEPTION_SECTION ()
If defined, a function that switches to the section in which the main
exception table is to be placed (@pxref{Sections}). The default is a
function that switches to a section named @code{.gcc_except_table} on
machines that support named sections via
@code{TARGET_ASM_NAMED_SECTION}, otherwise if @option{-fpic} or
@option{-fPIC} is in effect, the @code{data_section}, otherwise the
@code{readonly_data_section}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_EH_FRAME_SECTION ()
If defined, a function that switches to the section in which the DWARF 2
frame unwind information to be placed (@pxref{Sections}). The default
is a function that outputs a standard GAS section directive, if
@code{EH_FRAME_SECTION_NAME} is defined, or else a data section
directive followed by a synthetic label.
@end deftypefn
@deftypevar {Target Hook} bool TARGET_TERMINATE_DW2_EH_FRAME_INFO
Contains the value true if the target should add a zero word onto the
end of a Dwarf-2 frame info section when used for exception handling.

View File

@ -113,12 +113,12 @@ dwarf2out_do_frame (void)
#define PTR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
#endif
/* Various versions of targetm.eh_frame_section. Note these must appear
outside the DWARF2_DEBUGGING_INFO || DWARF2_UNWIND_INFO macro guards. */
/* Return the default value of eh_frame_section. Note that this function
must appear outside the DWARF2_DEBUGGING_INFO || DWARF2_UNWIND_INFO
macro guards. */
/* Version of targetm.eh_frame_section for systems with named sections. */
void
named_section_eh_frame_section (void)
section *
default_eh_frame_section (void)
{
#ifdef EH_FRAME_SECTION_NAME
int flags;
@ -143,30 +143,9 @@ named_section_eh_frame_section (void)
}
else
flags = SECTION_WRITE;
named_section_flags (EH_FRAME_SECTION_NAME, flags);
#endif
}
/* Version of targetm.eh_frame_section for systems using collect2. */
void
collect2_eh_frame_section (void)
{
tree label = get_file_function_name ('F');
data_section ();
ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
targetm.asm_out.globalize_label (asm_out_file, IDENTIFIER_POINTER (label));
ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
}
/* Default version of targetm.eh_frame_section. */
void
default_eh_frame_section (void)
{
#ifdef EH_FRAME_SECTION_NAME
named_section_eh_frame_section ();
return get_section (EH_FRAME_SECTION_NAME, flags, NULL);
#else
collect2_eh_frame_section ();
return NULL;
#endif
}
@ -190,6 +169,17 @@ static GTY(()) VEC(tree,gc) *incomplete_types;
define type declaration DIE's. */
static GTY(()) VEC(tree,gc) *decl_scope_table;
/* Pointers to various DWARF2 sections. */
static GTY(()) section *debug_info_section;
static GTY(()) section *debug_abbrev_section;
static GTY(()) section *debug_aranges_section;
static GTY(()) section *debug_macinfo_section;
static GTY(()) section *debug_line_section;
static GTY(()) section *debug_loc_section;
static GTY(()) section *debug_pubnames_section;
static GTY(()) section *debug_str_section;
static GTY(()) section *debug_ranges_section;
/* How to start an assembler comment. */
#ifndef ASM_COMMENT_START
#define ASM_COMMENT_START ";#"
@ -1994,6 +1984,28 @@ dw_cfi_oprnd2_desc (enum dwarf_call_frame_info cfi)
#if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO)
/* Switch to eh_frame_section. If we don't have an eh_frame_section,
switch to the data section instead, and write out a synthetic label
for collect2. */
static void
switch_to_eh_frame_section (void)
{
tree label;
if (eh_frame_section)
switch_to_section (eh_frame_section);
else
{
switch_to_section (data_section);
label = get_file_function_name ('F');
ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
targetm.asm_out.globalize_label (asm_out_file,
IDENTIFIER_POINTER (label));
ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
}
}
/* Map register numbers held in the call frame info that gcc has
collected using DWARF_FRAME_REGNUM to those that should be output in
.debug_frame and .eh_frame. */
@ -2188,9 +2200,9 @@ output_call_frame_info (int for_eh)
app_enable ();
if (for_eh)
targetm.asm_out.eh_frame_section ();
switch_to_eh_frame_section ();
else
named_section_flags (DEBUG_FRAME_SECTION, SECTION_DEBUG);
switch_to_section (get_section (DEBUG_FRAME_SECTION, SECTION_DEBUG, NULL));
ASM_GENERATE_INTERNAL_LABEL (section_start_label, FRAME_BEGIN_LABEL, for_eh);
ASM_OUTPUT_LABEL (asm_out_file, section_start_label);
@ -2492,7 +2504,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
return;
#endif
function_section (current_function_decl);
switch_to_section (function_section (current_function_decl));
ASM_GENERATE_INTERNAL_LABEL (label, FUNC_BEGIN_LABEL,
current_function_funcdef_no);
ASM_OUTPUT_DEBUG_LABEL (asm_out_file, FUNC_BEGIN_LABEL,
@ -4988,7 +5000,7 @@ AT_string_form (dw_attr_ref a)
/* If we cannot expect the linker to merge strings in .debug_str
section, only put it into .debug_str if it is worth even in this
single module. */
if ((DEBUG_STR_SECTION_FLAGS & SECTION_MERGE) == 0
if ((debug_str_section->common.flags & SECTION_MERGE) == 0
&& (len - DWARF_OFFSET_SIZE) * node->refcount <= len)
return node->form = DW_FORM_string;
@ -7196,12 +7208,12 @@ output_comp_unit (dw_die_ref die, int output_if_empty)
sprintf (tmp, ".gnu.linkonce.wi.%s", oldsym);
secname = tmp;
die->die_symbol = NULL;
switch_to_section (get_section (secname, SECTION_DEBUG, NULL));
}
else
secname = (const char *) DEBUG_INFO_SECTION;
switch_to_section (debug_info_section);
/* Output debugging information. */
named_section_flags (secname, SECTION_DEBUG);
output_compilation_unit_header ();
output_die (die);
@ -7828,10 +7840,7 @@ output_line_info (void)
current_file = 1;
current_line = 1;
if (cfun
&& (last_text_section == in_unlikely_executed_text
|| (last_text_section == in_named
&& last_text_section_name == cfun->unlikely_text_section_name)))
if (cfun && unlikely_text_section_p (last_text_section))
strcpy (prev_line_label, cfun->cold_section_label);
else
strcpy (prev_line_label, text_section_label);
@ -10176,11 +10185,7 @@ secname_for_decl (tree decl)
tree sectree = DECL_SECTION_NAME (current_function_decl);
secname = TREE_STRING_POINTER (sectree);
}
else if (cfun
&& (last_text_section == in_unlikely_executed_text
|| (last_text_section == in_named
&& last_text_section_name
== cfun->unlikely_text_section_name)))
else if (cfun && unlikely_text_section_p (last_text_section))
secname = cfun->cold_section_label;
else
secname = text_section_label;
@ -13383,7 +13388,7 @@ static void
dwarf2out_begin_block (unsigned int line ATTRIBUTE_UNUSED,
unsigned int blocknum)
{
current_function_section (current_function_decl);
switch_to_section (current_function_section ());
ASM_OUTPUT_DEBUG_LABEL (asm_out_file, BLOCK_BEGIN_LABEL, blocknum);
}
@ -13393,7 +13398,7 @@ dwarf2out_begin_block (unsigned int line ATTRIBUTE_UNUSED,
static void
dwarf2out_end_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int blocknum)
{
current_function_section (current_function_decl);
switch_to_section (current_function_section ());
ASM_OUTPUT_DEBUG_LABEL (asm_out_file, BLOCK_END_LABEL, blocknum);
}
@ -13550,10 +13555,7 @@ dwarf2out_var_location (rtx loc_note)
newloc->var_loc_note = loc_note;
newloc->next = NULL;
if (cfun
&& (last_text_section == in_unlikely_executed_text
|| (last_text_section == in_named
&& last_text_section_name == cfun->unlikely_text_section_name)))
if (cfun && unlikely_text_section_p (last_text_section))
newloc->section_label = cfun->cold_section_label;
else
newloc->section_label = text_section_label;
@ -13588,7 +13590,7 @@ dwarf2out_source_line (unsigned int line, const char *filename)
if (debug_info_level >= DINFO_LEVEL_NORMAL
&& line != 0)
{
current_function_section (current_function_decl);
switch_to_section (current_function_section ());
/* If requested, emit something human-readable. */
if (flag_debug_asm)
@ -13685,7 +13687,7 @@ dwarf2out_start_source_file (unsigned int lineno, const char *filename)
{
int fileno;
named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
switch_to_section (debug_macinfo_section);
dw2_asm_output_data (1, DW_MACINFO_start_file, "Start new file");
dw2_asm_output_data_uleb128 (lineno, "Included from line number %d",
lineno);
@ -13706,7 +13708,7 @@ dwarf2out_end_source_file (unsigned int lineno ATTRIBUTE_UNUSED)
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
switch_to_section (debug_macinfo_section);
dw2_asm_output_data (1, DW_MACINFO_end_file, "End file");
}
}
@ -13721,7 +13723,7 @@ dwarf2out_define (unsigned int lineno ATTRIBUTE_UNUSED,
{
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
switch_to_section (debug_macinfo_section);
dw2_asm_output_data (1, DW_MACINFO_define, "Define macro");
dw2_asm_output_data_uleb128 (lineno, "At line number %d", lineno);
dw2_asm_output_nstring (buffer, -1, "The macro");
@ -13738,7 +13740,7 @@ dwarf2out_undef (unsigned int lineno ATTRIBUTE_UNUSED,
{
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
switch_to_section (debug_macinfo_section);
dw2_asm_output_data (1, DW_MACINFO_undef, "Undefine macro");
dw2_asm_output_data_uleb128 (lineno, "At line number %d", lineno);
dw2_asm_output_nstring (buffer, -1, "The macro");
@ -13790,6 +13792,25 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
used_rtx_array = VEC_alloc (rtx, gc, 32);
debug_info_section = get_section (DEBUG_INFO_SECTION,
SECTION_DEBUG, NULL);
debug_abbrev_section = get_section (DEBUG_ABBREV_SECTION,
SECTION_DEBUG, NULL);
debug_aranges_section = get_section (DEBUG_ARANGES_SECTION,
SECTION_DEBUG, NULL);
debug_macinfo_section = get_section (DEBUG_MACINFO_SECTION,
SECTION_DEBUG, NULL);
debug_line_section = get_section (DEBUG_LINE_SECTION,
SECTION_DEBUG, NULL);
debug_loc_section = get_section (DEBUG_LOC_SECTION,
SECTION_DEBUG, NULL);
debug_pubnames_section = get_section (DEBUG_PUBNAMES_SECTION,
SECTION_DEBUG, NULL);
debug_str_section = get_section (DEBUG_STR_SECTION,
DEBUG_STR_SECTION_FLAGS, NULL);
debug_ranges_section = get_section (DEBUG_RANGES_SECTION,
SECTION_DEBUG, NULL);
ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (abbrev_section_label,
DEBUG_ABBREV_SECTION_LABEL, 0);
@ -13804,22 +13825,22 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
DEBUG_LINE_SECTION_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (ranges_section_label,
DEBUG_RANGES_SECTION_LABEL, 0);
named_section_flags (DEBUG_ABBREV_SECTION, SECTION_DEBUG);
switch_to_section (debug_abbrev_section);
ASM_OUTPUT_LABEL (asm_out_file, abbrev_section_label);
named_section_flags (DEBUG_INFO_SECTION, SECTION_DEBUG);
switch_to_section (debug_info_section);
ASM_OUTPUT_LABEL (asm_out_file, debug_info_section_label);
named_section_flags (DEBUG_LINE_SECTION, SECTION_DEBUG);
switch_to_section (debug_line_section);
ASM_OUTPUT_LABEL (asm_out_file, debug_line_section_label);
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
switch_to_section (debug_macinfo_section);
ASM_GENERATE_INTERNAL_LABEL (macinfo_section_label,
DEBUG_MACINFO_SECTION_LABEL, 0);
ASM_OUTPUT_LABEL (asm_out_file, macinfo_section_label);
}
text_section ();
switch_to_section (text_section);
ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
if (flag_reorder_blocks_and_partition)
{
@ -13838,7 +13859,7 @@ output_indirect_string (void **h, void *v ATTRIBUTE_UNUSED)
if (node->form == DW_FORM_strp)
{
named_section_flags (DEBUG_STR_SECTION, DEBUG_STR_SECTION_FLAGS);
switch_to_section (debug_str_section);
ASM_OUTPUT_LABEL (asm_out_file, node->label);
assemble_string (node->str, strlen (node->str) + 1);
}
@ -14155,7 +14176,7 @@ dwarf2out_finish (const char *filename)
add_sibling_attributes (node->die);
/* Output a terminator label for the .text section. */
text_section ();
switch_to_section (text_section);
targetm.asm_out.internal_label (asm_out_file, TEXT_END_LABEL, 0);
if (flag_reorder_blocks_and_partition)
{
@ -14170,7 +14191,7 @@ dwarf2out_finish (const char *filename)
examining the file. */
if (! DWARF2_ASM_LINE_DEBUG_INFO)
{
named_section_flags (DEBUG_LINE_SECTION, SECTION_DEBUG);
switch_to_section (debug_line_section);
output_line_info ();
}
@ -14178,7 +14199,7 @@ dwarf2out_finish (const char *filename)
if (have_location_lists)
{
/* Output the location lists info. */
named_section_flags (DEBUG_LOC_SECTION, SECTION_DEBUG);
switch_to_section (debug_loc_section);
ASM_GENERATE_INTERNAL_LABEL (loc_section_label,
DEBUG_LOC_SECTION_LABEL, 0);
ASM_OUTPUT_LABEL (asm_out_file, loc_section_label);
@ -14214,13 +14235,13 @@ dwarf2out_finish (const char *filename)
output_comp_unit (comp_unit_die, 0);
/* Output the abbreviation table. */
named_section_flags (DEBUG_ABBREV_SECTION, SECTION_DEBUG);
switch_to_section (debug_abbrev_section);
output_abbrev_section ();
/* Output public names table if necessary. */
if (pubname_table_in_use)
{
named_section_flags (DEBUG_PUBNAMES_SECTION, SECTION_DEBUG);
switch_to_section (debug_pubnames_section);
output_pubnames ();
}
@ -14228,14 +14249,14 @@ dwarf2out_finish (const char *filename)
table, so don't write it out if we don't have any. */
if (fde_table_in_use)
{
named_section_flags (DEBUG_ARANGES_SECTION, SECTION_DEBUG);
switch_to_section (debug_aranges_section);
output_aranges ();
}
/* Output ranges section if necessary. */
if (ranges_table_in_use)
{
named_section_flags (DEBUG_RANGES_SECTION, SECTION_DEBUG);
switch_to_section (debug_ranges_section);
ASM_OUTPUT_LABEL (asm_out_file, ranges_section_label);
output_ranges ();
}
@ -14243,7 +14264,7 @@ dwarf2out_finish (const char *filename)
/* Have to end the macro section. */
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
switch_to_section (debug_macinfo_section);
dw2_asm_output_data (1, 0, "End compilation unit");
}

View File

@ -3425,10 +3425,9 @@ sjlj_output_call_site_table (void)
call_site_base += n;
}
/* Tell assembler to switch to the section for the exception handling
table. */
/* Return the default value of exception_section. */
void
section *
default_exception_section (void)
{
if (targetm.have_named_sections)
@ -3446,12 +3445,10 @@ default_exception_section (void)
}
else
flags = SECTION_WRITE;
named_section_flags (".gcc_except_table", flags);
return get_section (".gcc_except_table", flags, NULL);
}
else if (flag_pic)
data_section ();
else
readonly_data_section ();
return flag_pic ? data_section : readonly_data_section;
}
@ -3533,7 +3530,7 @@ output_function_exception_table (void)
/* Note that varasm still thinks we're in the function's code section.
The ".endp" directive that will immediately follow will take us back. */
#else
targetm.asm_out.exception_section ();
switch_to_section (exception_section);
#endif
have_tt_data = (VEC_length (tree, cfun->eh->ttype_data) > 0
@ -3687,7 +3684,7 @@ output_function_exception_table (void)
(i ? NULL : "Exception specification table"));
}
current_function_section (current_function_decl);
switch_to_section (current_function_section ());
}
void

View File

@ -114,12 +114,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#define JUMP_TABLES_IN_TEXT_SECTION 0
#endif
#if defined(READONLY_DATA_SECTION) || defined(READONLY_DATA_SECTION_ASM_OP)
#define HAVE_READONLY_DATA_SECTION 1
#else
#define HAVE_READONLY_DATA_SECTION 0
#endif
/* Bitflags used by final_scan_insn. */
#define SEEN_BB 1
#define SEEN_NOTE 2
@ -887,7 +881,8 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
next = next_nonnote_insn (insn);
/* ADDR_VECs only take room if read-only data goes into the text
section. */
if (JUMP_TABLES_IN_TEXT_SECTION || !HAVE_READONLY_DATA_SECTION)
if (JUMP_TABLES_IN_TEXT_SECTION
|| readonly_data_section == text_section)
if (next && JUMP_P (next))
{
rtx nextbody = PATTERN (next);
@ -1050,7 +1045,8 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
{
/* This only takes room if read-only data goes into the text
section. */
if (JUMP_TABLES_IN_TEXT_SECTION || !HAVE_READONLY_DATA_SECTION)
if (JUMP_TABLES_IN_TEXT_SECTION
|| readonly_data_section == text_section)
insn_lengths[uid] = (XVECLEN (body,
GET_CODE (body) == ADDR_DIFF_VEC)
* GET_MODE_SIZE (GET_MODE (body)));
@ -1251,7 +1247,8 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
PUT_MODE (body, CASE_VECTOR_SHORTEN_MODE (min_addr - rel_addr,
max_addr - rel_addr,
body));
if (JUMP_TABLES_IN_TEXT_SECTION || !HAVE_READONLY_DATA_SECTION)
if (JUMP_TABLES_IN_TEXT_SECTION
|| readonly_data_section == text_section)
{
insn_lengths[uid]
= (XVECLEN (body, 1) * GET_MODE_SIZE (GET_MODE (body)));
@ -1468,13 +1465,13 @@ profile_function (FILE *file ATTRIBUTE_UNUSED)
if (! NO_PROFILE_COUNTERS)
{
int align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE);
data_section ();
switch_to_section (data_section);
ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
targetm.asm_out.internal_label (file, "LP", current_function_funcdef_no);
assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1);
}
current_function_section (current_function_decl);
switch_to_section (current_function_section ());
#if defined(ASM_OUTPUT_REG_PUSH)
if (sval && svrtx != NULL_RTX && REG_P (svrtx))
@ -1717,15 +1714,15 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
not already writing to the cold section we need to change
to it. */
if (last_text_section == in_text)
if (last_text_section == text_section)
{
(*debug_hooks->switch_text_section) ();
unlikely_text_section ();
switch_to_section (unlikely_text_section ());
}
else
{
(*debug_hooks->switch_text_section) ();
text_section ();
switch_to_section (text_section);
}
break;
@ -1939,7 +1936,8 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
{
int log_align;
targetm.asm_out.function_rodata_section (current_function_decl);
switch_to_section (targetm.asm_out.function_rodata_section
(current_function_decl));
#ifdef ADDR_VEC_ALIGN
log_align = ADDR_VEC_ALIGN (next);
@ -1949,7 +1947,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
ASM_OUTPUT_ALIGN (file, log_align);
}
else
current_function_section (current_function_decl);
switch_to_section (current_function_section ());
#ifdef ASM_OUTPUT_CASE_LABEL
ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
@ -2006,9 +2004,10 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
#endif
if (! JUMP_TABLES_IN_TEXT_SECTION)
targetm.asm_out.function_rodata_section (current_function_decl);
switch_to_section (targetm.asm_out.function_rodata_section
(current_function_decl));
else
current_function_section (current_function_decl);
switch_to_section (current_function_section ());
if (app_on)
{
@ -2066,7 +2065,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
#endif
#endif
current_function_section (current_function_decl);
switch_to_section (current_function_section ());
break;
}

View File

@ -1080,7 +1080,7 @@ open_base_files (void)
"hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h",
"optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
"tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
"except.h", NULL
"except.h", "output.h", NULL
};
const char *const *ifp;
outf_p gtype_desc_c;

View File

@ -1,3 +1,8 @@
2005-12-07 Richard Sandiford <richard@codesourcery.com>
* class.c (build_utf8_ref, emit_register_classes): Use
switch_to_section and get_section.
2005-12-06 Tom Tromey <tromey@redhat.com>
PR java/25283:

View File

@ -915,7 +915,7 @@ build_utf8_ref (tree name)
int flags = (SECTION_OVERRIDE
| SECTION_MERGE | (SECTION_ENTSIZE & decl_size));
sprintf (buf, ".rodata.jutf8.%d", decl_size);
named_section_flags (buf, flags);
switch_to_section (get_section (buf, flags, NULL));
DECL_SECTION_NAME (decl) = build_string (strlen (buf), buf);
}
}
@ -2434,7 +2434,7 @@ emit_register_classes (tree *list_p)
int i;
#ifdef JCR_SECTION_NAME
named_section_flags (JCR_SECTION_NAME, SECTION_WRITE);
switch_to_section (get_section (JCR_SECTION_NAME, SECTION_WRITE, NULL));
#else
/* A target has defined TARGET_USE_JCR_SECTION,
but doesn't have a JCR_SECTION_NAME. */

View File

@ -153,77 +153,6 @@ extern int regno_clobbered_at_setjmp (int);
/* Functions in varasm.c. */
/* Tell assembler to switch to text section. */
extern void text_section (void);
/* Tell assembler to switch to unlikely-to-be-executed text section. */
extern void unlikely_text_section (void);
/* Tell assembler to switch to data section. */
extern void data_section (void);
/* Tell assembler to switch to read-only data section. This is normally
the text section. */
extern void readonly_data_section (void);
/* Determine if we're in the text section. */
extern int in_text_section (void);
/* Determine if we're in the unlikely-to-be-executed text section. */
extern int in_unlikely_text_section (void);
#ifdef CTORS_SECTION_ASM_OP
extern void ctors_section (void);
#endif
#ifdef DTORS_SECTION_ASM_OP
extern void dtors_section (void);
#endif
#ifdef BSS_SECTION_ASM_OP
extern void bss_section (void);
#endif
#ifdef INIT_SECTION_ASM_OP
extern void init_section (void);
#endif
#ifdef FINI_SECTION_ASM_OP
extern void fini_section (void);
#endif
#ifdef EXPORTS_SECTION_ASM_OP
extern void exports_section (void);
#endif
#ifdef DRECTVE_SECTION_ASM_OP
extern void drectve_section (void);
#endif
#ifdef SDATA_SECTION_ASM_OP
extern void sdata_section (void);
#endif
/* Tell assembler to change to section NAME for DECL.
If DECL is NULL, just switch to section NAME.
If NAME is NULL, get the name from DECL.
If RELOC is 1, the initializer for DECL contains relocs. */
extern void named_section (tree, const char *, int);
/* Tell assembler to switch to the section for function DECL. */
extern void function_section (tree);
/* Tell assembler to switch to the most recently used text section. */
extern void current_function_section (tree);
/* Tell assembler to switch to the section for string merging. */
extern void mergeable_string_section (tree, unsigned HOST_WIDE_INT,
unsigned int);
/* Tell assembler to switch to the section for constant merging. */
extern void mergeable_constant_section (enum machine_mode,
unsigned HOST_WIDE_INT, unsigned int);
/* Declare DECL to be a weak symbol. */
extern void declare_weak (tree);
/* Merge weak status. */
@ -438,27 +367,6 @@ extern rtx this_is_asm_operands;
extern int size_directive_output;
extern tree last_assemble_variable_decl;
enum in_section { no_section, in_text, in_unlikely_executed_text, in_data,
in_named
#ifdef BSS_SECTION_ASM_OP
, in_bss
#endif
#ifdef CTORS_SECTION_ASM_OP
, in_ctors
#endif
#ifdef DTORS_SECTION_ASM_OP
, in_dtors
#endif
#ifdef READONLY_DATA_SECTION_ASM_OP
, in_readonly_data
#endif
#ifdef EXTRA_SECTIONS
, EXTRA_SECTIONS
#endif
};
extern const char *last_text_section_name;
extern enum in_section last_text_section;
extern bool first_function_block_is_cold;
/* Decide whether DECL needs to be in a writable section.
@ -476,13 +384,11 @@ extern const char *user_label_prefix;
/* Default target function prologue and epilogue assembler output. */
extern void default_function_pro_epilogue (FILE *, HOST_WIDE_INT);
/* Tell assembler to switch to the section for the exception table. */
extern void default_exception_section (void);
/* Return the default value of exception_section. */
extern section *default_exception_section (void);
/* Tell assembler to switch to the section for the EH frames. */
extern void named_section_eh_frame_section (void);
extern void collect2_eh_frame_section (void);
extern void default_eh_frame_section (void);
/* Return the default value of eh_frame_section. */
extern section *default_eh_frame_section (void);
/* Default target hook that outputs nothing to a stream. */
extern void no_asm_to_stream (FILE *);
@ -502,7 +408,9 @@ extern void no_asm_to_stream (FILE *);
#define SECTION_OVERRIDE 0x20000 /* allow override of default flags */
#define SECTION_TLS 0x40000 /* contains thread-local storage */
#define SECTION_NOTYPE 0x80000 /* don't output @progbits */
#define SECTION_MACH_DEP 0x100000 /* subsequent bits reserved for target */
#define SECTION_DECLARED 0x100000 /* section has been used */
#define SECTION_NAMED 0x200000 /* section has a name */
#define SECTION_MACH_DEP 0x400000 /* subsequent bits reserved for target */
/* A helper function for default_elf_select_section and
default_elf_unique_section. Categorizes the DECL. */
@ -541,12 +449,81 @@ enum section_category
SECCAT_TBSS
};
/* Information that is provided by all instances of the section type. */
struct section_common GTY(()) {
/* The set of SECTION_* flags that apply to this section. */
unsigned int flags;
};
/* Information that is provided by named sections. */
struct named_section GTY(()) {
struct section_common common;
/* The name of the section. */
const char *name;
/* If nonnull, the VAR_DECL or FUNCTION_DECL with which the
section is associated. */
tree decl;
};
/* A callback that writes the assembly code for switching to an unnamed
section. The argument provides callback-specific data. */
typedef void (*unnamed_section_callback) (const void *);
/* Information that is provided by unnamed sections. */
struct unnamed_section GTY(()) {
struct section_common common;
/* The callback used to switch to the section, and the data that
should be passed to the callback. */
unnamed_section_callback GTY ((skip)) callback;
const void *GTY ((skip)) data;
/* The next entry in the chain of unnamed sections. */
section *next;
};
/* Information about a section, which may be named or unnamed. */
union section GTY ((desc ("(%h).common.flags & SECTION_NAMED")))
{
struct section_common GTY ((skip)) common;
struct named_section GTY ((tag ("SECTION_NAMED"))) named;
struct unnamed_section GTY ((tag ("0"))) unnamed;
};
/* Special well-known sections. */
extern GTY(()) section *text_section;
extern GTY(()) section *data_section;
extern GTY(()) section *readonly_data_section;
extern GTY(()) section *sdata_section;
extern GTY(()) section *ctors_section;
extern GTY(()) section *dtors_section;
extern GTY(()) section *bss_section;
extern GTY(()) section *sbss_section;
extern GTY(()) section *init_section;
extern GTY(()) section *fini_section;
extern GTY(()) section *exception_section;
extern GTY(()) section *eh_frame_section;
extern GTY(()) section *in_section;
extern GTY(()) section *last_text_section;
extern section *get_unnamed_section (unsigned int, void (*) (const void *),
const void *);
extern section *get_section (const char *, unsigned int, tree);
extern section *get_named_section (tree, const char *, int);
extern section *mergeable_constant_section (enum machine_mode,
unsigned HOST_WIDE_INT,
unsigned int);
extern section *function_section (tree);
extern section *unlikely_text_section (void);
extern section *current_function_section (void);
extern bool unlikely_text_section_p (section *);
extern void switch_to_section (section *);
extern void output_section_asm_op (const void *);
extern bool set_named_section_flags (const char *, unsigned int);
#define named_section_flags(NAME, FLAGS) \
named_section_real((NAME), (FLAGS), /*decl=*/NULL_TREE)
extern void named_section_real (const char *, unsigned int, tree);
extern bool named_section_first_declaration (const char *);
extern unsigned int default_section_type_flags (tree, const char *, int);
extern unsigned int default_section_type_flags_1 (tree, const char *, int, int);
@ -563,18 +540,21 @@ extern void default_stabs_asm_out_constructor (rtx, int);
extern void default_named_section_asm_out_constructor (rtx, int);
extern void default_ctor_section_asm_out_constructor (rtx, int);
extern void default_select_section (tree, int, unsigned HOST_WIDE_INT);
extern void default_elf_select_section (tree, int, unsigned HOST_WIDE_INT);
extern void default_elf_select_section_1 (tree, int,
unsigned HOST_WIDE_INT, int);
extern section *default_select_section (tree, int,
unsigned HOST_WIDE_INT);
extern section *default_elf_select_section (tree, int,
unsigned HOST_WIDE_INT);
extern section *default_elf_select_section_1 (tree, int,
unsigned HOST_WIDE_INT,
int);
extern void default_unique_section (tree, int);
extern void default_unique_section_1 (tree, int, int);
extern void default_function_rodata_section (tree);
extern void default_no_function_rodata_section (tree);
extern void default_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
extern void default_elf_select_rtx_section (enum machine_mode, rtx,
extern section *default_function_rodata_section (tree);
extern section *default_no_function_rodata_section (tree);
extern section *default_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
extern section *default_elf_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
extern void default_encode_section_info (tree, rtx, int);
extern const char *default_strip_name_encoding (const char *);
extern bool default_binds_local_p (tree);

View File

@ -2114,7 +2114,6 @@ extern rtx emit_library_call_value (rtx, rtx, enum libcall_type,
enum machine_mode, int, ...);
/* In varasm.c */
extern int in_data_section (void);
extern void init_varasm_once (void);
extern enum tls_model decl_default_tls_model (tree);

View File

@ -1050,7 +1050,7 @@ sdbout_one_type (tree type)
&& DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
; /* Don't change section amid function. */
else
text_section ();
switch_to_section (text_section);
switch (TREE_CODE (type))
{

View File

@ -728,7 +728,9 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
TARGET_ESC TARGET_FF TARGET_NEWLINE TARGET_TAB TARGET_VT \
LINK_LIBGCC_SPECIAL DONT_ACCESS_GBLS_AFTER_EPILOGUE \
TARGET_OPTIONS TARGET_SWITCHES EXTRA_CC_MODES FINALIZE_PIC \
PREDICATE_CODES SPECIAL_MODE_PREDICATES HOST_PTR_PRINTF
PREDICATE_CODES SPECIAL_MODE_PREDICATES HOST_PTR_PRINTF \
EXTRA_SECTIONS EXTRA_SECTION_FUNCTIONS READONLY_DATA_SECTION \
TARGET_ASM_EXCEPTION_SECTION TARGET_ASM_EH_FRAME_SECTION
/* Hooks that are no longer used. */
#pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \

View File

@ -136,6 +136,10 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# endif
#endif
#ifndef TARGET_ASM_INIT_SECTIONS
#define TARGET_ASM_INIT_SECTIONS hook_void_void
#endif
#ifdef TARGET_ASM_NAMED_SECTION
#define TARGET_HAVE_NAMED_SECTIONS true
#else
@ -169,14 +173,6 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define TARGET_DWARF_REGISTER_SPAN hook_rtx_rtx_null
#ifndef TARGET_ASM_EXCEPTION_SECTION
#define TARGET_ASM_EXCEPTION_SECTION default_exception_section
#endif
#ifndef TARGET_ASM_EH_FRAME_SECTION
#define TARGET_ASM_EH_FRAME_SECTION default_eh_frame_section
#endif
#ifndef TARGET_ASM_FILE_START
#define TARGET_ASM_FILE_START default_file_start
#endif
@ -233,9 +229,8 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
TARGET_ASM_FUNCTION_END_PROLOGUE, \
TARGET_ASM_FUNCTION_BEGIN_EPILOGUE, \
TARGET_ASM_FUNCTION_EPILOGUE, \
TARGET_ASM_INIT_SECTIONS, \
TARGET_ASM_NAMED_SECTION, \
TARGET_ASM_EXCEPTION_SECTION, \
TARGET_ASM_EH_FRAME_SECTION, \
TARGET_ASM_SELECT_SECTION, \
TARGET_ASM_SELECT_RTX_SECTION, \
TARGET_ASM_UNIQUE_SECTION, \

View File

@ -127,35 +127,31 @@ struct gcc_target
/* Output the assembler code for function exit. */
void (* function_epilogue) (FILE *, HOST_WIDE_INT);
/* Initialize target-specific sections. */
void (* init_sections) (void);
/* Tell assembler to change to section NAME with attributes FLAGS.
If DECL is non-NULL, it is the VAR_DECL or FUNCTION_DECL with
which this section is associated. */
void (* named_section) (const char *name, unsigned int flags, tree decl);
/* Switch to the section that holds the exception table. */
void (* exception_section) (void);
/* Return a section for EXP. It may be a DECL or a constant. RELOC
is nonzero if runtime relocations must be applied; bit 1 will be
set if the runtime relocations require non-local name resolution.
ALIGN is the required alignment of the data. */
section *(* select_section) (tree, int, unsigned HOST_WIDE_INT);
/* Switch to the section that holds the exception frames. */
void (* eh_frame_section) (void);
/* Select and switch to a section for EXP. It may be a DECL or a
constant. RELOC is nonzero if runtime relocations must be applied;
bit 1 will be set if the runtime relocations require non-local
name resolution. ALIGN is the required alignment of the data. */
void (* select_section) (tree, int, unsigned HOST_WIDE_INT);
/* Select and switch to a section for X with MODE. ALIGN is
the desired alignment of the data. */
void (* select_rtx_section) (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
/* Return a section for X. MODE is X's mode and ALIGN is its
alignment in bits. */
section *(* select_rtx_section) (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
/* Select a unique section name for DECL. RELOC is the same as
for SELECT_SECTION. */
void (* unique_section) (tree, int);
/* Tell assembler to switch to the readonly data section associated
with function DECL. */
void (* function_rodata_section) (tree);
/* Return the readonly data section associated with function DECL. */
section *(* function_rodata_section) (tree);
/* Output a constructor for a symbol with a given priority. */
void (* constructor) (rtx, int);

File diff suppressed because it is too large Load Diff

View File

@ -1697,13 +1697,13 @@ vmsdbgout_finish (const char *main_input_filename ATTRIBUTE_UNUSED)
return;
/* Output a terminator label for the .text section. */
text_section ();
switch_to_section (text_section);
targetm.asm_out.internal_label (asm_out_file, TEXT_END_LABEL, 0);
/* Output debugging information.
Warning! Do not change the name of the .vmsdebug section without
changing it in the assembler also. */
named_section (NULL_TREE, ".vmsdebug", 0);
switch_to_section (get_named_section (NULL, ".vmsdebug", 0));
ASM_OUTPUT_ALIGN (asm_out_file, 0);
totsize = write_modbeg (1);