summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-07 07:53:14 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-07 07:53:14 +0000
commit2f14b1f9d493c8f64d5ff6b284bfe91ad8433d37 (patch)
treee8b6f3dd6958e4f001043b151470fcccabfb4869 /gcc/config
parente885c83264bad15fe57462a7eeb88edb91bf006a (diff)
downloadgcc-2f14b1f9d493c8f64d5ff6b284bfe91ad8433d37.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108152 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/alpha/alpha-protos.h2
-rw-r--r--gcc/config/alpha/alpha.c85
-rw-r--r--gcc/config/alpha/elf.h35
-rw-r--r--gcc/config/alpha/unicosmk.h45
-rw-r--r--gcc/config/alpha/vms.h32
-rw-r--r--gcc/config/arm/aof.h46
-rw-r--r--gcc/config/arm/aout.h2
-rw-r--r--gcc/config/arm/arm-protos.h3
-rw-r--r--gcc/config/arm/arm.c72
-rw-r--r--gcc/config/arm/arm.h2
-rw-r--r--gcc/config/arm/pe.h57
-rw-r--r--gcc/config/arm/unknown-elf.h8
-rw-r--r--gcc/config/avr/avr-protos.h1
-rw-r--r--gcc/config/avr/avr.c28
-rw-r--r--gcc/config/avr/avr.h25
-rw-r--r--gcc/config/bfin/bfin.h2
-rw-r--r--gcc/config/c4x/c4x.h31
-rw-r--r--gcc/config/darwin-protos.h65
-rw-r--r--gcc/config/darwin-sections.def62
-rw-r--r--gcc/config/darwin.c184
-rw-r--r--gcc/config/darwin.h238
-rw-r--r--gcc/config/frv/frv-protos.h5
-rw-r--r--gcc/config/frv/frv.c4
-rw-r--r--gcc/config/frv/frv.h45
-rw-r--r--gcc/config/i386/cygming.h45
-rw-r--r--gcc/config/i386/darwin.h2
-rw-r--r--gcc/config/i386/i386.c34
-rw-r--r--gcc/config/i386/nwld.c4
-rw-r--r--gcc/config/ia64/ia64-protos.h8
-rw-r--r--gcc/config/ia64/ia64.c30
-rw-r--r--gcc/config/ia64/sysv4.h35
-rw-r--r--gcc/config/iq2000/iq2000.c21
-rw-r--r--gcc/config/iq2000/iq2000.h5
-rw-r--r--gcc/config/m32r/m32r-protos.h2
-rw-r--r--gcc/config/m32r/m32r.h4
-rw-r--r--gcc/config/mcore/mcore-elf.h31
-rw-r--r--gcc/config/mcore/mcore-pe.h32
-rw-r--r--gcc/config/mcore/mcore.h30
-rw-r--r--gcc/config/mips/mips.c46
-rw-r--r--gcc/config/mips/mips.h3
-rw-r--r--gcc/config/mips/vxworks.h9
-rw-r--r--gcc/config/mmix/mmix.c6
-rw-r--r--gcc/config/pa/pa-protos.h7
-rw-r--r--gcc/config/pa/pa.c118
-rw-r--r--gcc/config/pa/pa.h66
-rw-r--r--gcc/config/pa/som.h26
-rw-r--r--gcc/config/rs6000/rs6000-protos.h7
-rw-r--r--gcc/config/rs6000/rs6000.c218
-rw-r--r--gcc/config/rs6000/sysv4.h122
-rw-r--r--gcc/config/rs6000/xcoff.h101
-rw-r--r--gcc/config/sh/sh.c2
-rw-r--r--gcc/config/sparc/sparc.c4
-rw-r--r--gcc/config/stormy16/stormy16-protos.h1
-rw-r--r--gcc/config/stormy16/stormy16.c24
-rw-r--r--gcc/config/stormy16/stormy16.h23
-rw-r--r--gcc/config/svr3.h32
-rw-r--r--gcc/config/t-darwin3
-rw-r--r--gcc/config/v850/v850-protos.h7
-rw-r--r--gcc/config/v850/v850.c70
-rw-r--r--gcc/config/v850/v850.h92
-rw-r--r--gcc/config/vax/vaxv.h2
-rw-r--r--gcc/config/vx-common.h11
-rw-r--r--gcc/config/xtensa/xtensa.c8
-rw-r--r--gcc/config/xtensa/xtensa.h2
64 files changed, 782 insertions, 1590 deletions
diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h
index f6b237a1c0f..00fc52530b0 100644
--- a/gcc/config/alpha/alpha-protos.h
+++ b/gcc/config/alpha/alpha-protos.h
@@ -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
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 6824d077570..244aa271204 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -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
diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
index 43449f5adcc..043a5244c08 100644
--- a/gcc/config/alpha/elf.h
+++ b/gcc/config/alpha/elf.h
@@ -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
diff --git a/gcc/config/alpha/unicosmk.h b/gcc/config/alpha/unicosmk.h
index da7d375f3b4..a05b33396c0 100644
--- a/gcc/config/alpha/unicosmk.h
+++ b/gcc/config/alpha/unicosmk.h
@@ -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)
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
index c1f4a43e4b1..83545877190 100644
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -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, " = "); \
diff --git a/gcc/config/arm/aof.h b/gcc/config/arm/aof.h
index 45aacfe8c5b..8a1223c45d8 100644
--- a/gcc/config/arm/aof.h
+++ b/gcc/config/arm/aof.h
@@ -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", \
diff --git a/gcc/config/arm/aout.h b/gcc/config/arm/aout.h
index 2b5d42f6cab..903afa70f04 100644
--- a/gcc/config/arm/aout.h
+++ b/gcc/config/arm/aout.h
@@ -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)); \
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 2bd84ca6024..4e0d77b3341 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -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 */
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 009d1420d08..4f357190dbd 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -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)
+{
+ 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 char buf[100];
- sprintf (buf, "\tAREA |C$$data%d|, DATA", arm_data_section_count++);
- return buf;
+ 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
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 2bca1538dc1..b7b775c18bb 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -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
diff --git a/gcc/config/arm/pe.h b/gcc/config/arm/pe.h
index 2b806d3bcae..f96cd66a93d 100644
--- a/gcc/config/arm/pe.h
+++ b/gcc/config/arm/pe.h
@@ -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)
diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h
index 916aac9f255..c9ad9903490 100644
--- a/gcc/config/arm/unknown-elf.h
+++ b/gcc/config/arm/unknown-elf.h
@@ -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); \
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index 930329b00ae..169be85f6d4 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -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);
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 5367bd1fdb2..f6e9f9fbd03 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -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
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 53a0f9fb567..d69e67b7eba 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -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))
diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h
index 5ac00368c43..803aa589291 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -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); \
diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h
index 43d44b1ce8c..22904e1dc46 100644
--- a/gcc/config/c4x/c4x.h
+++ b/gcc/config/c4x/c4x.h
@@ -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
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index dfada767b01..ad9ce78419f 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -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 *,
diff --git a/gcc/config/darwin-sections.def b/gcc/config/darwin-sections.def
new file mode 100644
index 00000000000..327c1754a05
--- /dev/null
+++ b/gcc/config/darwin-sections.def
@@ -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)
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 54edae4896e..badc0d388fe 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -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");
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 48bf0790fcc..8afae4518e6 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -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
diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h
index b176ddf32c6..91f203394a6 100644
--- a/gcc/config/frv/frv-protos.h
+++ b/gcc/config/frv/frv-protos.h
@@ -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);
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index 4df467a3da4..82b7cbfd8c2 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -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)
{
diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h
index d5586c06493..f330f3c5ca6 100644
--- a/gcc/config/frv/frv.h
+++ b/gcc/config/frv/frv.h
@@ -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)
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 4005f1d8e63..bb02b7b8d49 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -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. */
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 89972339855..b42ed3cdd89 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -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)); \
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 476b47fec06..079ead85a16 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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,
diff --git a/gcc/config/i386/nwld.c b/gcc/config/i386/nwld.c
index 962432e9a88..4688ca0108c 100644
--- a/gcc/config/i386/nwld.c
+++ b/gcc/config/i386/nwld.c
@@ -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);
}
diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h
index 6de20c8afd1..b05cdab6bf4 100644
--- a/gcc/config/ia64/ia64-protos.h
+++ b/gcc/config/ia64/ia64-protos.h
@@ -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);
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 7b9389bbf57..2da3383d0f8 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -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
diff --git a/gcc/config/ia64/sysv4.h b/gcc/config/ia64/sysv4.h
index 69c24240948..bc85108b278 100644
--- a/gcc/config/ia64/sysv4.h
+++ b/gcc/config/ia64/sysv4.h
@@ -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; \
- } \
-}
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index 2adf50ac49b..dd42fe94094 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -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
diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h
index f60b6277f8a..45c1c349a08 100644
--- a/gcc/config/iq2000/iq2000.h
+++ b/gcc/config/iq2000/iq2000.h
@@ -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 */
diff --git a/gcc/config/m32r/m32r-protos.h b/gcc/config/m32r/m32r-protos.h
index a8479302540..ee03a1e4cd7 100644
--- a/gcc/config/m32r/m32r-protos.h
+++ b/gcc/config/m32r/m32r-protos.h
@@ -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);
diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h
index 7f82a1cd3bf..785896a75e8 100644
--- a/gcc/config/m32r/m32r.h
+++ b/gcc/config/m32r/m32r.h
@@ -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); \
diff --git a/gcc/config/mcore/mcore-elf.h b/gcc/config/mcore/mcore-elf.h
index 75c15d8cea8..4ec6d586810 100644
--- a/gcc/config/mcore/mcore-elf.h
+++ b/gcc/config/mcore/mcore-elf.h
@@ -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; \
diff --git a/gcc/config/mcore/mcore-pe.h b/gcc/config/mcore/mcore-pe.h
index f186805ff2c..5a3aba1c4aa 100644
--- a/gcc/config/mcore/mcore-pe.h
+++ b/gcc/config/mcore/mcore-pe.h
@@ -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)); \
} \
diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h
index d9960dc0edb..fd1ba70389b 100644
--- a/gcc/config/mcore/mcore.h
+++ b/gcc/config/mcore/mcore.h
@@ -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
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 733b9c6b7be..3e7d0f0baa3 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -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
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 2d11a88a7d4..7a1837f68fd 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -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 */
diff --git a/gcc/config/mips/vxworks.h b/gcc/config/mips/vxworks.h
index 53a9ae4a889..bf37901bac3 100644
--- a/gcc/config/mips/vxworks.h
+++ b/gcc/config/mips/vxworks.h
@@ -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)");
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index fc2a5c82d68..b57ed7aefa6 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -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);
diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h
index 0963844c36e..510ac07f7b3 100644
--- a/gcc/config/pa/pa-protos.h
+++ b/gcc/config/pa/pa-protos.h
@@ -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);
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index c9bac915481..ea2a9fa190e 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -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$");
+}
+
+/* Implement TARGET_ASM_INITIALIZE_SECTIONS */
- return "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$";
+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
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 6fc265edbe0..a98d1cdda02 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -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).
diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h
index e397b9dfd8e..abeafbeebf6 100644
--- a/gcc/config/pa/som.h
+++ b/gcc/config/pa/som.h
@@ -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
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index 65cb79d7cbf..dbde3d50a1b 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -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);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 30007531e6f..52312a7863b 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -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.
+/* 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;
+ }
+ }
+}
- Do not define this macro if you put all constants in the read-only
- data section. */
+/* 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);
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 30777762e48..62690f45364 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -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); \
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h
index 822b5a0de5e..e7560a86ab1 100644
--- a/gcc/config/rs6000/xcoff.h
+++ b/gcc/config/rs6000/xcoff.h
@@ -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. */
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 1cbdd99796b..81c787289e1 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -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);
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 7047af36179..52d2695d40f 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -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)
diff --git a/gcc/config/stormy16/stormy16-protos.h b/gcc/config/stormy16/stormy16-protos.h
index 1cc9c4fd098..32c5ea6d2d5 100644
--- a/gcc/config/stormy16/stormy16-protos.h
+++ b/gcc/config/stormy16/stormy16-protos.h
@@ -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 *,
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index 3e779248d1a..76becfc4f11 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -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"
diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h
index e37d19ab174..faf04727f98 100644
--- a/gcc/config/stormy16/stormy16.h
+++ b/gcc/config/stormy16/stormy16.h
@@ -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 JUMP_TABLES_IN_TEXT_SECTION 1
+#define TARGET_ASM_INIT_SECTIONS xstormy16_asm_init_sections
+#define JUMP_TABLES_IN_TEXT_SECTION 1
/* The Overall Framework of an Assembler File. */
diff --git a/gcc/config/svr3.h b/gcc/config/svr3.h
index ffdac98d335..283ebf0cdd7 100644
--- a/gcc/config/svr3.h
+++ b/gcc/config/svr3.h
@@ -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; \
- } \
-}
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
index d59f0b7a162..7fe322037cf 100644
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -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 \
diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h
index aff12412fed..8374b53c105 100644
--- a/gcc/config/v850/v850-protos.h
+++ b/gcc/config/v850/v850-protos.h
@@ -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 *);
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index e77d56ab5e7..7629a7af3a7 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -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"
diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h
index c43c802838a..c1dbd783113 100644
--- a/gcc/config/v850/v850.h
+++ b/gcc/config/v850/v850.h
@@ -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 */
diff --git a/gcc/config/vax/vaxv.h b/gcc/config/vax/vaxv.h
index 8394c64158a..83870a0230d 100644
--- a/gcc/config/vax/vaxv.h
+++ b/gcc/config/vax/vaxv.h
@@ -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)))
diff --git a/gcc/config/vx-common.h b/gcc/config/vx-common.h
index baa37f0e80e..cb8d7a0808e 100644
--- a/gcc/config/vx-common.h
+++ b/gcc/config/vx-common.h
@@ -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
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 9dfa3027d9d..d05d97e063e 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -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);
}
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 8434d1983ef..e541e2ad8e2 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -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)