(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
+2005-12-07 Richard Sandiford <richard@codesourcery.com>
+
+ * config/alpha/alpha.c (alpha_start_function): Use switch_to_section.
+ (alpha_elf_select_rtx_section): Return the selected section rather
+ than emitting assembly code.
+ (alpha_write_linkage): Emit a ".link" directive directly and then
+ set in_section to NULL.
+ (vms_asm_out_constructor): Use switch_to_section.
+ (vms_asm_out_destructor): Likewise.
+ (unicosmk_output_common): Set in_section to NULL instead of calling
+ the dummy common_section function.
+ (unicosmk_text_section): Delete in favor of...
+ (unicosmk_output_text_section_asm_op): ...this new function.
+ (unicosmk_data_section): Delete in favor of...
+ (unicosmk_output_data_section_asm_op): ...this new function.
+ (unicosmk_init_sections): New function.
+ (unicosmk_output_deferred_case_vectors): Use switch_to_section.
+ (unicosmk_output_ssib): Set in_section to NULL instead of calling
+ the dummy ssib_section function.
+ (unicosmk_section_buf): Delete.
+ * config/alpha/alpha-protos.h (unicosmk_text_section): Delete.
+ (unicosmk_data_section): Delete.
+ * config/alpha/elf.h (ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
+ (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, sbss_section, sdata_section)
+ (SECTION_FUNCTION_TEMPLATE): Delete.
+ * config/alpha/unicosmk.h (TEXT_SECTION_ASM_OP, DATA_SECTION_ASM_OP)
+ (READONLY_DATA_SECTION, EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
+ (common_section, COMMON_SECTION, ssib_section, SSIB_SECTION): Delete.
+ (ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
+ (TARGET_ASM_INIT_SECTIONS): Define.
+ * config/alpha/vms.h (LINK_SECTION_ASM_OP, LITERALS_SECTION_ASM_OP)
+ (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
+ (link_section, literals_section): Delete.
+ (ASM_OUTPUT_DEF): Emit the ".literal" directive directly and then
+ set in_section to NULL.
+
+ * config/arm/aof.h (TEXT_SECTION_ASM_OP, DATA_SECTION_ASM_OP): Delete.
+ (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, ZERO_INIT_SECTION): Delete.
+ (COMMON_SECTION): Delete.
+ (TARGET_ASM_INIT_SECTIONS): Define.
+ (ASM_OUTPUT_COMMON): Set in_section to NULL rather than calling
+ the dummy common_section function.
+ * config/arm/aout.h (ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
+ * config/arm/arm.c (get_jump_table_size): Use pointer comparison
+ between readonly_data_section and text_section to check whether
+ read-only data is being put in the text section.
+ (arm_output_function_epilogue): Use switch_to_section.
+ (arm_elf_asm_constructor): Likewise.
+ (thumb_call_via_reg): Replace call to in_text_section with
+ a comparison between in_section and text_section.
+ (arm_file_end): Use switch_to_section.
+ (aof_text_section): Delete in favor of...
+ (aof_output_text_section_asm_op): ...this new function.
+ (aof_data_section): Delete in favor of...
+ (aof_output_data_section_asm_op): ...this new function.
+ (aof_asm_init_sections): New function.
+ (zero_init_section): Moved from config/arm/aof.h.
+ (aof_dump_imports, aof_file_start): Use switch_to_section.
+ * config/arm/arm.h (thumb_call_via_label): Update comment.
+ * config/arm/arm-protos.h (aof_text_section, aof_data_section): Delete.
+ (common_section): Delete.
+ * config/arm/pe.h (ASM_DECLARE_FUNCTION_NAME): Use switch_to_section.
+ (ASM_DECLARE_OBJECT_NAME): Update the type of save_section. Use the
+ global switch_to_section function instead of the old port-local one.
+ (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, DRECTVE_SECTION_FUNCTION)
+ (SWITCH_TO_SECTION_FUNCTION): Delete.
+ (drectve_section): Redefine as a macro.
+ * config/arm/unknown-elf.h (ASM_OUTPUT_ALIGNED_BSS):
+ (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use get_named_section and
+ switch_to_section.
+
+ * config/avr/avr.c (progmem_section): New variable.
+ (avr_output_progmem_section_asm_op): New function.
+ (avr_asm_init_sections): New function.
+ (avr_output_addr_vec_elt): Use switch_to_section.
+ * config/avr/avr.h (progmem_section): Declare.
+ (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
+ (READONLY_DATA_SECTION): Delete.
+ (TARGET_ASM_INIT_SECTIONS): Define.
+ (ASM_OUTPUT_CASE_LABEL): Use switch_to_section.
+ * config/avr/avr-protos.h (progmem_section): Delete.
+
+ * config/bfin/bfin.h (ASM_OUTPUT_LOCAL): Use switch_to_section.
+
+ * config/c4x/c4x.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
+ (INIT_SECTION_FUNCTION, FINI_SECTION_FUNCTION): Delete.
+
+ * config/darwin-sections.def: New file.
+ * config/darwin.c: Define all sections in darwin-sections.def.
+ (output_objc_section_asm_op, darwin_init_sections): New functions.
+ (machopic_output_indirection): Use switch_to_section.
+ (machopic_select_section): Return the selected section rather than
+ emitting assembly code. Replace the static function table with
+ inline conditional expressions. Update the tests of last_text_section
+ and move them into the FUNCTION_DECL block.
+ (machopic_select_rtx_section): Return the selected section rather than
+ emitting assembly code.
+ (machopic_asm_out_constructor, machopic_asm_out_destructor)
+ (darwin_file_end): Use switch_to_section.
+ * config/darwin.h: Use darwin-sections.def to declare sections.
+ (INIT_SECTION_ASM_OP): Remove empty definition.
+ (HAS_INIT_SECTION): Define this instead.
+ (SECTION_FUNCTION, EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
+ (READONLY_DATA_SECTION, TARGET_ASM_EXCEPTION_SECTION): Delete.
+ (TARGET_ASM_EH_FRAME_SECTION): Delete.
+ (TARGET_ASM_INIT_SECTIONS): Define.
+ * config/darwin-protos.h (darwin_init_sections): Declare.
+ (machopic_picsymbol_stub_section, machopic_picsymbol_stub1_section)
+ (machopic_symbol_stub_section, machopic_symbol_stub1_section): Delete.
+ (machopic_lazy_symbol_ptr_section, machopic_nl_symbol_ptr_section)
+ (constructor_section, destructor_section, mod_init_section): Delete.
+ (mod_term_section): Delete.
+ (darwin_exception_section, darwin_eh_frame_section): Delete.
+ (machopic_select_section): Return a section.
+ (machopic_select_rtx_section): Likewise.
+ (text_coal_section, text_unlikely_section, text_unlikely_coal_section)
+ (const_section, const_coal_section, const_data_section): Delete.
+ (const_data_coal_section, data_coal_section, cstring_section): Delete.
+ (literal4_section, literal8_section, constructor_section): Delete.
+ (mod_init_section, mod_term_section, destructor_section): Delete.
+ (objc_class_section, objc_meta_class_section, objc_category_section)
+ (objc_class_vars_section, objc_instance_vars_section): Delete.
+ (objc_cls_meth_section, objc_inst_meth_section): Delete.
+ (objc_cat_cls_meth_section, objc_cat_inst_meth_section): Delete.
+ (objc_selector_refs_section, objc_selector_fixup_section): Delete.
+ (objc_symbols_section, objc_module_info_section): Delete.
+ (objc_image_info_section, objc_protocol_section): Delete.
+ (objc_string_object_section, objc_constant_string_object_section)
+ (objc_class_names_section, objc_meth_var_names_section): Delete.
+ (objc_meth_var_types_section, objc_cls_refs_section): Delete.
+ (machopic_lazy_symbol_ptr_section, machopic_nl_symbol_ptr_section)
+ (machopic_symbol_stub_section, machopic_picsymbol_stub_section)
+ (darwin_exception_section, darwin_eh_frame_section): Delete.
+ * config/t-darwin (darwin.o): Depend on config/darwin-sections.def.
+
+ * config/frv/frv.c (frv_asm_out_constructor): Use switch_to_section.
+ (frv_asm_out_destructor): Likewise.
+ * config/frv/frv.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
+ (SDATA_SECTION_FUNCTION, FIXUP_SECTION_FUNCTION): Delete.
+ (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use switch_to_section and
+ get_named_section.
+ (ASM_OUTPUT_CASE_LABEL): Use switch_to_section.
+ * config/frv/frv-protos.h (fixup_section, sdata_section, sbss_section)
+ (data_section): Delete.
+
+ * config/i386/cygming.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
+ (DRECTVE_SECTION_FUNCTION): Delete.
+ (drectve_section): Redefine as a macro that sets in_section after
+ emitting the directive.
+ (SWITCH_TO_SECTION_FUNCTION): Delete.
+ * config/i386/darwin.h (ASM_OUTPUT_ALIGN): Replace call to
+ in_text_section with comparison between in_section and text_section.
+ * config/i386/i386.c (x86_64_elf_select_section): Return the section
+ rather than emitting assembly code. Use get_named_section.
+ (x86_output_aligned_bss, ix86_file_end): Use switch_to_section and
+ get_named_section.
+ (machopic_output_stub): Use switch_to_section.
+ * config/i386/nwld.c (nwld_named_section_asm_out_constructor)
+ (nwld_named_section_asm_out_destructor): Use get_section and
+ switch_to_section.
+
+ * config/ia64/ia64.c (ia64_select_rtx_section): Return the section
+ rather than emitting assembly code.
+ (ia64_rwreloc_select_section): Likewise.
+ (ia64_rwreloc_select_rtx_section): Likewise.
+ * config/ia64/ia64-protos.h (sdata_section, sbss_section): Delete.
+ * config/ia64/sysv4.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use
+ switch_to_section.
+ (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
+ (SDATA_SECTION_FUNCTION, SBSS_SECTION_FUNCTION): Delete.
+
+ * config/iq2000/iq2000.c (iq2000_select_rtx_section): Return the
+ section rather than emitting assembly code.
+ (iq2000_select_section): Likewise.
+ * config/iq2000/iq2000.h (rdata_section, sdata_section): Delete.
+ (sbss_section): Delete.
+
+ * config/m32r/m32r.h (ASM_OUTPUT_ALIGNED_BSS): Use switch_to_section
+ and get_named_section.
+ * config/m32r/m32r-protos.h (sbss_section, sdata_section): Delete.
+
+ * config/mcore/mcore-elf.h (EXPORTS_SECTION_ASM_OP): Delete.
+ (SUBTARGET_EXTRA_SECTIONS, SUBTARGET_EXTRA_SECTION_FUNCTIONS): Delete.
+ (EXPORT_SECTION_FUNCTION, SUBTARGET_SWITCH_SECTIONS): Delete.
+ (MCORE_EXPORT_NAME): Emit the exports directive directly, then set
+ in_section to NULL.
+ (ASM_DECLARE_FUNCTION_NAME): Use switch_to_section.
+ (ASM_DECLARE_OBJECT_NAME): Update the type of save_section. Use the
+ global switch_to_section function instead of the old port-local one.
+ * config/mcore/mcore.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
+ (SWITCH_SECTION_FUNCTION): Delete.
+ * config/mcore/mcore-pe.h (SUBTARGET_SWITCH_SECTIONS): Delete.
+ (DRECTVE_SECTION_ASM_OP, SUBTARGET_EXTRA_SECTIONS): Delete.
+ (SUBTARGET_EXTRA_SECTION_FUNCTIONS, DRECTVE_SECTION_FUNCTION): Delete.
+ (MCORE_EXPORT_NAME): Emit ".section .drectve" directly, then set
+ in_section to NULL.
+ (ASM_DECLARE_OBJECT_NAME): Update the type of save_section. Use the
+ global switch_to_section function instead of the old port-local one.
+ (ASM_DECLARE_FUNCTION_NAME): Use switch_to_section.
+
+ * config/mips/mips.c (mips_file_start): Update comment.
+ (mips_output_aligned_bss): Use switch_to_section and get_named_section.
+ (mips_output_aligned_decl_common): Use switch_to_section.
+ (mips_select_rtx_section): Return the section rather than emitting
+ assembly code. Use get_named_section.
+ (mips_function_rodata_section: Likewise get_section.
+ (build_mips16_function_stub): Use switch_to_section.
+ * config/mips/mips.h (ASM_OUTPUT_IDENT): Use switch_to_section.
+ (SDATA_SECTION_ASM_OP): Delete.
+ * config/mips/vxworks.h (EXTRA_SECTIONS): Delete.
+ (EXTRA_SECTION_FUNCTIONS): Delete.
+
+ * config/mmix/mmix.c (mmix_file_start, mmix_file_end)
+ (mmix_asm_output_aligned_local): Use switch_to_section.
+
+ * config/pa/pa.c (som_readonly_data_section, som_one_only_data_section)
+ (som_one_only_readonly_data_section): New variables.
+ (pa_output_function_epilogue): Set in_section to NULL instead of
+ calling forget_section.
+ (output_deferred_plabels): Use select_section.
+ (pa_asm_output_mi_thunk): Likewise. Set in_section to NULL instead
+ of calling forget_section.
+ (pa_asm_output_aligned_bss, pa_asm_output_aligned_common)
+ (pa_asm_output_aligned_local): Use select_section.
+ (som_text_section_asm_op): Delete in favor of...
+ (som_output_text_section_asm_op): ...this new function.
+ (pa_som_asm_init_sections): New function.
+ (pa_select_section): Return the section rather than emitting
+ assembly code.
+ * config/pa/pa.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
+ (SOM_READONLY_DATA_SECTION_FUNCTION): Delete.
+ (SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION): Delete.
+ (SOM_ONE_ONLY_DATA_SECTION_FUNCTION, FORGET_SECTION_FUNCTION): Delete.
+ * config/pa/pa-protos.h (som_text_section_asm_op): Delete.
+ (som_readonly_data_section, som_one_only_readonly_data_section)
+ (som_one_only_data_section, forget_section): Delete.
+ * config/pa/som.h (TEXT_SECTION_ASM_OP): Delete.
+ (TARGET_ASM_INIT_SECTIONS): Define.
+ (READONLY_DATA_SECTION, TARGET_ASM_EXCEPTION_SECTION): Delete.
+
+ * config/rs6000/rs6000.c (read_only_data_section): New variable.
+ (private_data_section, read_only_private_data_section): New variables.
+ (sdata2_section, toc_section): New variables.
+ (rs6000_file_start): Use switch_to_section.
+ (rs6000_assemble_integer): Use comparisons against in_section
+ instead of calling in_toc_section and in_text_section. Use
+ unlikely_text_section_p.
+ (rs6000_elf_output_toc_section_asm_op): New function, derived
+ from the old rs6000/sysv4.h toc_section function.
+ (rs6000_elf_asm_init_sections): New function.
+ (rs6000_elf_select_rtx_section, rs6000_elf_select_section): Return
+ the section rather than emitting assembly code.
+ (machopic_output_stub): Use switch_to_section.
+ (toc_section): Delete dummy function.
+ (rs6000_elf_asm_out_constructor, rs6000_elf_asm_out_destructor): Use
+ switch_to_section and get_section.
+ (rs6000_xcoff_output_readonly_section_asm_op): New function.
+ (rs6000_xcoff_output_readwrite_section_asm_op): New function.
+ (rs6000_xcoff_output_toc_section_asm_op): New function, derived from
+ the old rs6000/xcoff.h toc_section function.
+ (rs6000_xcoff_asm_init_sections): New function.
+ (rs6000_xcoff_select_section, rs6000_xcoff_select_rtx_section): Return
+ the section rather than emitting assembly code.
+ (rs6000_xcoff_file_start): Use switch_to_section.
+ (rs6000_xcoff_file_end): Likewise.
+ * config/rs6000/rs6000-protos.h (toc_section, sdata_section): Delete.
+ (sdata2_section, sbss_section, private_data_section): Delete.
+ (read_only_data_section, read_only_private_data_section): Delete.
+ * config/rs6000/sysv4.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
+ (TOC_SECTION_FUNCTION, SDATA_SECTION_FUNCTION, SDATA2_SECTION_FUNCTION)
+ (SBSS_SECTION_FUNCTION, INIT_SECTION_FUNCTION): Delete.
+ (FINI_SECTION_FUNCTION): Delete.
+ (TARGET_ASM_INIT_SECTIONS): Define.
+ (ASM_OUTPUT_ALIGNED_LOCAL): Use switch_to_section.
+ * config/rs6000/xcoff.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
+ (READ_ONLY_DATA_SECTION_FUNCTION, PRIVATE_DATA_SECTION_FUNCTION)
+ (READ_ONLY_PRIVATE_DATA_SECTION_FUNCTION, TOC_SECTION_FUNCTION)
+ (READONLY_DATA_SECTION): Delete.
+ (TARGET_ASM_INIT_SECTIONS): Define.
+ (ASM_DECLARE_FUNCTION_NAME): Use switch_to_section. Set in_section
+ to NULL rather than no_section.
+ (TARGET_ASM_EXCEPTION_SECTION): Delete.
+
+ * config/sh/sh.c (sh_file_start): Use switch_to_section.
+
+ * config/sparc/sparc.c (emit_pic_helper): Use switch_to_section.
+ (sparc_output_deferred_case_vectors): Likewise. Remove argument
+ from call to current_function_section.
+
+ * config/stormy16/stormy16.c: Include ggc.h and gt-storm16.h.
+ (bss100_section): New variable.
+ (xstormy16_asm_output_aligned_common): Use switch_to_section.
+ (xstormy16_asm_init_sections): New function.
+ (xstormy16_asm_out_destructor, xstormy16_asm_out_constructor): Use
+ switch_to_section and get_section.
+ (xstormy16_output_addr_vec): Use switch_to_section. Remove argument
+ from calls to current_function_section.
+ * config/stormy16/stormy16.h (EXTRA_SECTIONS): Delete.
+ (XSTORMY16_SECTION_FUNCTION, EXTRA_SECTION_FUNCTIONS): Delete.
+ (TARGET_ASM_INIT_SECTIONS): Define.
+ * config/stormy16/stormy16-protos.h (bss100_section): Delete.
+
+ * config/svr3.h (ASM_OUTPUT_LOCAL): Use switch_to_section.
+ (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, INIT_SECTION_FUNCTION)
+ (FINI_SECTION_FUNCTION): Delete.
+
+ * config/v850/v850.c: Include gt-v850.h.
+ (rosdata_section, rozdata_section, tdata_section, zdata_section)
+ (zbss_section): New variables.
+ (v850_output_aligned_bss): Use switch_to_section.
+ (v850_asm_init_sections): New function.
+ (v850_select_section): Return the section rather than emitting
+ assembly code.
+ * config/v850/v850.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS)
+ (ZDATA_SECTION_ASM_OP, ZBSS_SECTION_ASM_OP, TDATA_SECTION_ASM_OP)
+ (ROSDATA_SECTION_ASM_OP, ROZDATA_SECTION_ASM_OP): Delete.
+ (TARGET_ASM_INIT_SECTIONS): Define.
+ * config/v850/v850-protos.h (sdata_section, rosdata_section): Delete.
+ (sbss_section, tdata_section, zdata_section, rozdata_section): Delete.
+ (zbss_section): Delete.
+
+ * config/vax/vaxv.h (ASM_OUTPUT_LOCAL): Use switch_to_section.
+
+ * config/vx-common.h (vxworks_exception_section): Delete.
+ (TARGET_ASM_EXCEPTION_SECTION): Delete.
+
+ * config/xtensa/xtensa.c (xtensa_select_rtx_section): Return the
+ section rather than emitting assembly code.
+ * config/xtensa/xtensa.h (ASM_OUTPUT_POOL_PROLOGUE): Use
+ switch_to_section.
+
+ * Makefile.in (GTFILES): Add $(srcdir)/output.h.
+ * coretypes.h (section): New union and typedef.
+ * dbxout.c (FORCE_TEXT): Use switch_to_section. Remove argument
+ from call to current_function_section.
+ (dbxout_function_end, dbxout_init, dbxout_source_file, dbxout_finish)
+ (dbxout_symbol_location): Use switch_to_section.
+ * dwarf2out.c (named_section_eh_frame_section): Delete, moving
+ most of the code into...
+ (default_eh_frame_section): ...here. Return a section.
+ (collect2_eh_frame_section): Delete, moving most of the code into..
+ (switch_to_eh_frame_section): ...this new function.
+ (debug_info_section, debug_abbrev_section, debug_aranges_section)
+ (debug_macinfo_section, debug_line_section, debug_loc_section)
+ (debug_pubnames_section, debug_str_section, debug_ranges_section): New
+ variables.
+ (output_call_frame_info): Call switch_to_eh_frame_section instead of
+ eh_frame_section. Use switch_to_section and get_section.
+ (dwarf2out_begin_prologue): Use switch_to_section.
+ (AT_string_form): Check the flags in debug_str_section instead of
+ DEBUG_STR_SECTION_FLAGS.
+ (output_comp_unit): Use switch_to_section, get_section, and
+ debug_info_section.
+ (output_line_info, secname_for_decl): Use unlikely_text_section_p.
+ (dwarf2out_begin_block): Use switch_to_section. Remove argument
+ from call to current_function_section.
+ (dwarf2out_var_location): Use unlikely_text_section_p.
+ (dwarf2out_source_line): Use switch_to_section. Remove argument
+ from call to current_function_section.
+ (dwarf2out_start_source_file, dwarf2out_end_source_file)
+ (dwarf2out_define, dwarf2out_undef: Use switch_to_section and
+ debug_macinfo_section.
+ (dwarf2out_init): Initialize the new section variables. Use them
+ instead of calls to named_section_flags. Use switch_to_section.
+ (output_indirect_string): Use switch_to_section and debug_str_section.
+ (dwarf2out_finish): Use switch_to_section and the new section
+ variables.
+ * except.c (default_exception_section): Return the section instead
+ of emitting assembly code.
+ (output_function_exception_table): Use the global exception_section
+ variable instead of the target hook. Use switch_to_section. Remove
+ argument from call to current_function_section.
+ * final.c (HAVE_READONLY_DATA_SECTION): Delete.
+ (shorten_branches): Use pointer comparisons to detect whether the
+ text section is the same as readonly_data_section.
+ (profile_function): Use switch_to_section. Remove argument from
+ call to current_function_section.
+ (final_scan_insn): Likewise. Update use of last_text_section.
+ * gengtype.c (open_base_files): Add an include of output.h.
+ * output.h (text_section, data_section, readonly_data_section)
+ (ctors_section, dtors_section, bss_section, init_section)
+ (fini_section, sdata_section): Turn into section pointers.
+ (in_text_section, in_unlikely_text_section, exports_section)
+ (drectve_section, named_section, mergeable_string_section)
+ (last_text_section_name): Delete.
+ (default_exception_section, default_eh_frame_section): Return sections.
+ (SECTION_DECLARED, SECTION_NAMED): New macros.
+ (SECTION_MACH_DEP): Bump value.
+ (section_common, named_section, unnamed_section): New structures.
+ (unnamed_section_callback): New typedef.
+ (section): New union.
+ (sbss_section, exception_section, eh_frame_section): New variables.
+ (in_section, last_text_section): Turn into section pointers.
+ (get_unnamed_section, get_section, get_named_section): New functions.
+ (mergeable_constant_section, function_section): Return a section.
+ (unlikely_text_section): Likewise.
+ (current_function_section): Likewise. Remove the decl argument.
+ (unlikely_text_section_p, switch_to_section): New functions.
+ (output_section_asm_op): New function.
+ (set_named_section_flags, named_section_flags, named_section_real)
+ (named_section_first_declaration): Delete.
+ (default_select_section, default_elf_select_section): Return a section.
+ (default_elf_select_section_1, default_function_rodata_section)
+ (default_no_function_rodata_section, default_select_rtx_section)
+ (default_elf_select_rtx_section): Likewise.
+ * rtl.h (in_data_section): Delete.
+ * sdbout.c (sdbout_one_type): Use switch_to_section.
+ * system.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Poison.
+ (READONLY_DATA_SECTION, TARGET_ASM_EXCEPTION_SECTION): Poison.
+ (TARGET_ASM_EH_FRAME_SECTION): Poison.
+ * target-def.h (TARGET_ASM_INIT_SECTIONS): New macro.
+ (TARGET_ASM_EXCEPTION_SECTION, TARGET_ASM_EH_FRAME_SECTION): Delete.
+ (TARGET_ASM_OUT): Update after above changes.
+ * target.h (init_sections): New hook.
+ (exception_section, eh_frame_section): Delete.
+ (select_section, select_rtx_section, function_rodata_section): Return
+ a section rather than emitting assembly code.
+ * varasm.c (text_section, data_section, readonly_data_section)
+ (ctors_section, dtors_section, bss_section, init_section)
+ (fini_section): Turn into section pointers.
+ (sdata_section, sbss_section, exception_section): New variables.
+ (eh_frame_section): New variable.
+ (in_section): Make global and turn into a section pointer.
+ (last_text_section): Turn into a section pointer.
+ (unnamed_sections): New variable.
+ (in_named_name, last_text_section_name): Delete.
+ (EXTRA_SECTION_FUNCTIONS): Delete.
+ (in_named_entry): Delete.
+ (section_htab): New variable, replacing...
+ (in_named_htab): ...this deleted variable.
+ (section_entry_eq, section_entry_hash): New functions, based on...
+ (in_named_entry_eq, in_named_entry_hash): ...these deleted functions.
+ (get_unnamed_section, get_section): New functions.
+ (unlikely_text_section): Return a section instead of emitting
+ assembly code.
+ (in_text_section, in_unlikely_text_section, in_data_section): Delete.
+ (get_named_section_flags, named_section_first_declaration): Delete.
+ (unlikely_text_section_p): New function.
+ (named_section_real, named_section): Delete.
+ (get_named_section): New function.
+ (asm_output_bss, asm_output_aligned_bss): Use switch_to_section.
+ (function_section): Return a section rather than emitting
+ assembly code.
+ (current_function_section): Likewise. Remove argument. Use
+ last_text_section if nonnull, otherwise use function_section.
+ (default_function_rodata_section): Return a section rather than
+ emitting assembly code. Use get_section.
+ (default_no_function_rodata_section): Return a section rather than
+ emitting assembly code.
+ (variable_section): Use switch_to_section and get_named_section.
+ (mergeable_string_section): Return a section rather than emitting
+ assembly code. Use get_section. Make static. Don't take special
+ countermeasures for empty strings.
+ (mergeable_constant_section): Return a section rather than emitting
+ assembly code. Use get_section.
+ (default_named_section_asm_out_destructor): Use switch_to_section
+ and get_section.
+ (default_dtor_section_asm_out_destructor): Use switch_to_section.
+ (default_named_section_asm_out_constructor): Use switch_to_section
+ and get_section.
+ (default_ctor_section_asm_out_constructor): Use switch_to_section.
+ (assemble_start_function): Likewise. Set last_text_section to
+ NULL rather than no_section. Change the type of save_section.
+ (assemble_zeros, assemble_variable): Use the section flags to detect
+ whether or not a section is text.
+ (assemble_static_space): Use switch_to_section.
+ (assemble_trampoline_template): Likewise.
+ (output_constant_def_contents): Use switch_to_section and
+ get_named_section.
+ (output_constant_pool_1): Use switch_to_section. Use the section
+ flags to see whether sections contain mergeable data.
+ (init_varasm_once): Initialize section_htab instead of in_named_htab.
+ Initialize new section variables. Call TARGET_ASM_INIT_SECTIONS.
+ (default_elf_asm_named_section): Use SECTION_DECLARED to detect
+ whether a section has already been declared.
+ (default_select_section, default_elf_select_section): Return a
+ section rather than emitting assembly code.
+ (default_elf_select_section_1): Likewise. Use bss_section for
+ SECCAT_BSS if nonnull. Use get_named_section.
+ (default_select_rtx_section): Return a section rather than
+ emitting assembly code.
+ (default_elf_select_rtx_section): Likewise. Use get_named_section.
+ (file_end_indicate_exec_stack): Use switch_to_section and get_section.
+ (output_section_asm_op, switch_to_section): New functions.
+ * vmsdbgout.c (vmsdbgout_finish): Use switch_to_section and
+ get_named_section.
+
+ * doc/tm.texi: Expand the introduction to the sections documentation.
+ (TRAMPOLINE_SECTION): Document new interface.
+ (SDATA_SECTION_ASM_OP): Document new macro.
+ (READONLY_DATA_SECTION): Delete.
+ (SDATA_SECTION_ASM_OP): Document new macro.
+ (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Delete.
+ (TARGET_ASM_INIT_SECTIONS): Document new hook.
+ (TARGET_ASM_SELECT_SECTION, TARGET_ASM_FUNCTION_RODATA_SECTION)
+ (TARGET_ASM_SELECT_RTX_SECTION): Adjust for new interface.
+ (TARGET_EXCEPTION_SECTION, TARGET_EH_FRAME_SECTION): Delete.
+
2005-12-07 Alan Modra <amodra@bigpond.net.au>
* gcc.c (init_gcc_specs): Match braces inside conditionally
$(srcdir)/coverage.c $(srcdir)/function.h $(srcdir)/rtl.h \
$(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(SYMTAB_H) \
$(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/insn-addr.h $(srcdir)/hwint.h \
- $(srcdir)/ipa-reference.h \
+ $(srcdir)/ipa-reference.h $(srcdir)/output.h \
$(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/cgraph.h \
$(srcdir)/c-common.h $(srcdir)/c-tree.h $(srcdir)/reload.h \
$(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
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
#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
}
#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 */
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;
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);
}
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);
}
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));
#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)
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));
}
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 ());
+ 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
#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); \
#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
/* 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. */
#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));\
/* 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)
#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 ()
#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, " = "); \
#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]; \
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
/* 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", \
#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)); \
#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 */
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,
{
/* 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;
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);
}
/* 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);
/* 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;
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);
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
automagically. */
if (arm_main_function)
{
- text_section ();
+ switch_to_section (text_section);
fputs ("\tIMPORT __main\n", f);
fputs ("\tDCD __main\n", f);
}
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
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
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) \
{ \
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)); \
} \
#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)
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)); \
\
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); \
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);
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);
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;
}
}
+/* 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)
{
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
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)
#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 " ; "
/* 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)
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))
#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); \
#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
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 *);
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);
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);
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 *,
--- /dev/null
+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)
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)
&& (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),
{
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");
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)
{
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)
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) &&
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);
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);
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");
#define NO_PROFILE_COUNTERS 1
#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP
+#define HAS_INIT_SECTION
#undef INVOKE__main
#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
} \
} 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"
#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
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);
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)
{
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)
{
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; \
- } \
-}
\f
/* Position Independent Code. */
#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); \
#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)
\f
union tree_node;
#define TREE union tree_node *
\f
-#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. */
#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)); \
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;
\f
/* Initialize the GCC target structure. */
#undef TARGET_ATTRIBUTE_TABLE
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))
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
{
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;
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);
}
else
{
- text_section ();
+ switch_to_section (text_section);
ASM_OUTPUT_LABEL (asm_out_file, name);
}
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);
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);
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,
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);
}
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);
}
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);
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)
glibc doesn't have them. */
}
\f
-/* 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
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
#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); \
#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; \
- } \
-}
/* 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);
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);
/* 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
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)
{
|| 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
{
|| 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
/* 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 */
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);
{ \
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); \
#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);
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)); \
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; \
/* 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);
{ \
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)); \
} \
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)); \
} \
#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
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);
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. */
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);
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",
/* 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)
{
/* 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
{
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);
}
}
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
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
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
{ \
const char *p = STRING; \
int size = strlen (p) + 1; \
- readonly_data_section (); \
+ switch_to_section (readonly_data_section); \
assemble_string (p, size); \
}
\f
/* 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 */
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)");
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. */
mmix_file_end (void)
{
/* Make sure each file ends with the data section. */
- data_section ();
+ switch_to_section (data_section);
}
/* ASM_OUTPUT_SOURCE_FILENAME. */
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);
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);
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);
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 *);
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;
/* 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 ())
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));
deferred plabels. */
if (n_deferred_plabels)
{
- data_section ();
+ switch_to_section (data_section);
ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2);
}
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)
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
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",
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
}
-/* 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)
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
{
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
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)
{
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
((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).
}} 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"
/* 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
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);
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;
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);
if (DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic == 2))
{
- toc_section ();
- text_section ();
+ switch_to_section (toc_section);
+ switch_to_section (text_section);
}
}
/* 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
\f
#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)
{
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
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)
{
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",
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. */
section = buf;
}
- named_section_flags (section, SECTION_WRITE);
+ switch_to_section (get_section (section, SECTION_WRITE, NULL));
assemble_align (POINTER_SIZE);
if (TARGET_RELOCATABLE)
section = buf;
}
- named_section_flags (section, SECTION_WRITE);
+ switch_to_section (get_section (section, SECTION_WRITE, NULL));
assemble_align (POINTER_SIZE);
if (TARGET_RELOCATABLE)
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)
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;
}
}
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. */
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 ();
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);
#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
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); \
#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),
&& ! 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
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. */
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); \
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. */
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);
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)
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)
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 *,
#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);
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. */
const char *name2;
int p2align = 0;
- bss100_section ();
+ switch_to_section (bss100_section);
while (align > 8)
{
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. */
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);
}
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);
}
{
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++)
#define TARGET_MACHINE_DEPENDENT_REORG xstormy16_reorg
struct gcc_target targetm = TARGET_INITIALIZER;
+
+#include "gt-stormy16.h"
#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
\f
/* The Overall Framework of an Assembler File. */
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)); \
} 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; \
- } \
-}
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 \
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 *);
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);
/* 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;
\f
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
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;
}
return get_hard_reg_initial_val (Pmode, LINK_POINTER_REGNUM);
}
\f
+/* 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)
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;
}
\f
/* Worker function for TARGET_RETURN_IN_MEMORY. */
{
ca->anonymous_args = (!TARGET_GHS ? 1 : 0);
}
+
+#include "gt-v850.h"
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"
#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 */
#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)))
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
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);
/* 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);
}
} \
if ((SIZE) > 0) \
{ \
- function_section (FUNDECL); \
+ switch_to_section (function_section (FUNDECL)); \
fprintf (FILE, "\t.literal_position\n"); \
} \
} while (0)
typedef struct rtvec_def *rtvec;
union tree_node;
typedef union tree_node *tree;
+union section;
+typedef union section section;
/* Provide forward struct declaration so that we don't have to include
all of cpplib.h whenever a random prototype includes a pointer.
static const char *base_input_file;
#ifdef DEBUG_SYMS_TEXT
-#define FORCE_TEXT current_function_section (current_function_decl);
+#define FORCE_TEXT switch_to_section (current_function_section ())
#else
#define FORCE_TEXT
#endif
/* The Lscope label must be emitted even if we aren't doing anything
else; dbxout_block needs it. */
- function_section (current_function_decl);
+ switch_to_section (function_section (current_function_decl));
/* Convert Lscope into the appropriate format for local labels in case
the system doesn't insert underscores in front of user generated
if (used_ltext_label_name)
{
- text_section ();
+ switch_to_section (text_section);
targetm.asm_out.internal_label (asm_out_file, "Ltext", 0);
}
{
/* Don't change section amid function. */
if (current_function_decl == NULL_TREE)
- text_section ();
+ switch_to_section (text_section);
dbxout_begin_simple_stabs (filename, N_SOL);
dbxout_stab_value_internal_label ("Ltext", &source_label_number);
DBX_OUTPUT_MAIN_SOURCE_FILE_END (asm_out_file, filename);
#elif defined DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
{
- text_section ();
+ switch_to_section (text_section);
dbxout_begin_empty_stabs (N_SO);
dbxout_stab_value_internal_label ("Letext", 0);
}
{
/* Ultrix `as' seems to need this. */
#ifdef DBX_STATIC_STAB_DATA_SECTION
- data_section ();
+ switch_to_section (data_section);
#endif
code = N_STSYM;
}
@end defmac
@defmac TRAMPOLINE_SECTION
-The name of a subroutine to switch to the section in which the
-trampoline template is to be placed (@pxref{Sections}). The default is
-a value of @samp{readonly_data_section}, which places the trampoline in
-the section containing read-only data.
+Return the section into which the trampoline template is to be placed
+(@pxref{Sections}). The default value is @code{readonly_data_section}.
@end defmac
@defmac TRAMPOLINE_SIZE
section}, which holds uninitialized data. Some systems have other kinds
of sections.
-The compiler must tell the assembler when to switch sections. These
-macros control what commands to output to tell the assembler this. You
-can also define additional sections.
+@file{varasm.c} provides several well-known sections, such as
+@code{text_section}, @code{data_section} and @code{bss_section}.
+The normal way of controlling a @code{@var{foo}_section} variable
+is to define the associated @code{@var{FOO}_SECTION_ASM_OP} macro,
+as described below. The macros are only read once, when @file{varasm.c}
+initializes itself, so their values must be run-time constants.
+They may however depend on command-line flags.
+
+@emph{Note:} Some run-time files, such @file{crtstuff.c}, also make
+use of the @code{@var{FOO}_SECTION_ASM_OP} macros, and expect them
+to be string literals.
+
+Some assemblers require a different string to be written every time a
+section is selected. If your assembler falls into this category, you
+should define the @code{TARGET_ASM_INIT_SECTIONS} hook and use
+@code{get_unnamed_section} to set up the sections.
+
+You must always create a @code{text_section}, either by defining
+@code{TEXT_SECTION_ASM_OP} or by initializing @code{text_section}
+in @code{TARGET_ASM_INIT_SECTIONS}. The same is true of
+@code{data_section} and @code{DATA_SECTION_ASM_OP}. If you do not
+create a distinct @code{readonly_data_section}, the default is to
+reuse @code{text_section}.
+
+All the other @file{varasm.c} sections are optional, and are null
+if the target does not provide them.
@defmac TEXT_SECTION_ASM_OP
A C expression whose value is a string, including spacing, containing the
data. Normally @code{"\t.data"} is right.
@end defmac
+@defmac SDATA_SECTION_ASM_OP
+If defined, a C expression whose value is a string, including spacing,
+containing the assembler operation to identify the following data as
+initialized, writable small data.
+@end defmac
+
@defmac READONLY_DATA_SECTION_ASM_OP
A C expression whose value is a string, including spacing, containing the
assembler operation to identify the following data as read-only initialized
data.
@end defmac
-@defmac READONLY_DATA_SECTION
-A macro naming a function to call to switch to the proper section for
-read-only data. The default is to use @code{READONLY_DATA_SECTION_ASM_OP}
-if defined, else fall back to @code{text_section}.
-
-The most common definition will be @code{data_section}, if the target
-does not have a special read-only data section, and does not put data
-in the text section.
-@end defmac
-
@defmac BSS_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
used.
@end defmac
+@defmac SBSS_SECTION_ASM_OP
+If defined, a C expression whose value is a string, including spacing,
+containing the assembler operation to identify the following data as
+uninitialized, writable small data.
+@end defmac
+
@defmac INIT_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
and thus prevent the linker from having to add any padding.
@end defmac
-@findex in_text
-@findex in_data
-@defmac EXTRA_SECTIONS
-A list of names for sections other than the standard two, which are
-@code{in_text} and @code{in_data}. You need not define this macro
-on a system with no other sections (that GCC needs to use).
-@end defmac
-
-@findex text_section
-@findex data_section
-@defmac EXTRA_SECTION_FUNCTIONS
-One or more functions to be defined in @file{varasm.c}. These
-functions should do jobs analogous to those of @code{text_section} and
-@code{data_section}, for your additional sections. Do not define this
-macro if you do not define @code{EXTRA_SECTIONS}.
-@end defmac
-
@defmac JUMP_TABLES_IN_TEXT_SECTION
Define this macro to be an expression with a nonzero value if jump
tables (for @code{tablejump} insns) should be output in the text
This macro is irrelevant if there is no separate readonly data section.
@end defmac
-@deftypefn {Target Hook} void TARGET_ASM_SELECT_SECTION (tree @var{exp}, int @var{reloc}, unsigned HOST_WIDE_INT @var{align})
-Switches to the appropriate section for output of @var{exp}. You can
+@deftypefn {Target Hook} void TARGET_ASM_INIT_SECTIONS (void)
+Define this hook if you need to do something special to set up the
+@file{varasm.c} sections, or if your target has some special sections
+of its own that you need to create.
+
+GCC calls this hook after processing the command line, but before writing
+any assembly code, and before calling any of the section-returning hooks
+described below.
+@end deftypefn
+
+@deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_SECTION (tree @var{exp}, int @var{reloc}, unsigned HOST_WIDE_INT @var{align})
+Return the section into which @var{exp} should be placed. You can
assume that @var{exp} is either a @code{VAR_DECL} node or a constant of
some sort. @var{reloc} indicates whether the initial value of @var{exp}
requires link-time relocations. Bit 0 is set when variable contains
local relocations only, while bit 1 is set for global relocations.
-Select the section by calling @code{data_section} or one of the
-alternatives for other sections. @var{align} is the constant alignment
-in bits.
+@var{align} is the constant alignment in bits.
The default version of this function takes care of putting read-only
variables in @code{readonly_data_section}.
Whatever the actual target object format, this is often good enough.
@end deftypefn
-@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_RODATA_SECTION (tree @var{decl})
-Switches to a readonly data section associated with
+@deftypefn {Target Hook} {section *} TARGET_ASM_FUNCTION_RODATA_SECTION (tree @var{decl})
+Return the readonly data section associated with
@samp{DECL_SECTION_NAME (@var{decl})}.
-The default version of this function switches to @code{.gnu.linkonce.r.name}
-section if function's section is @code{.gnu.linkonce.t.name}, to
-@code{.rodata.name} if function is in @code{.text.name} section
-and otherwise switches to the normal readonly data section.
+The default version of this function selects @code{.gnu.linkonce.r.name} if
+the function's section is @code{.gnu.linkonce.t.name}, @code{.rodata.name}
+if function is in @code{.text.name}, and the normal readonly-data section
+otherwise.
@end deftypefn
-@deftypefn {Target Hook} void TARGET_ASM_SELECT_RTX_SECTION (enum machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align})
-Switches to the appropriate section for output of constant pool entry
-@var{x} in @var{mode}. You can assume that @var{x} is some kind of
+@deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_RTX_SECTION (enum machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align})
+Return the section into which a constant @var{x}, of mode @var{mode},
+should be placed. You can assume that @var{x} is some kind of
constant in RTL@. The argument @var{mode} is redundant except in the
-case of a @code{const_int} rtx. Select the section by calling
-@code{readonly_data_section} or one of the alternatives for other
-sections. @var{align} is the constant alignment in bits.
+case of a @code{const_int} rtx. @var{align} is the constant alignment
+in bits.
The default version of this function takes care of putting symbolic
constants in @code{flag_pic} mode in @code{data_section} and everything
the target supports DWARF 2 frame unwind information.
@end defmac
-@deftypefn {Target Hook} void TARGET_ASM_EXCEPTION_SECTION ()
-If defined, a function that switches to the section in which the main
-exception table is to be placed (@pxref{Sections}). The default is a
-function that switches to a section named @code{.gcc_except_table} on
-machines that support named sections via
-@code{TARGET_ASM_NAMED_SECTION}, otherwise if @option{-fpic} or
-@option{-fPIC} is in effect, the @code{data_section}, otherwise the
-@code{readonly_data_section}.
-@end deftypefn
-
-@deftypefn {Target Hook} void TARGET_ASM_EH_FRAME_SECTION ()
-If defined, a function that switches to the section in which the DWARF 2
-frame unwind information to be placed (@pxref{Sections}). The default
-is a function that outputs a standard GAS section directive, if
-@code{EH_FRAME_SECTION_NAME} is defined, or else a data section
-directive followed by a synthetic label.
-@end deftypefn
-
@deftypevar {Target Hook} bool TARGET_TERMINATE_DW2_EH_FRAME_INFO
Contains the value true if the target should add a zero word onto the
end of a Dwarf-2 frame info section when used for exception handling.
#define PTR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
#endif
-/* Various versions of targetm.eh_frame_section. Note these must appear
- outside the DWARF2_DEBUGGING_INFO || DWARF2_UNWIND_INFO macro guards. */
+/* Return the default value of eh_frame_section. Note that this function
+ must appear outside the DWARF2_DEBUGGING_INFO || DWARF2_UNWIND_INFO
+ macro guards. */
-/* Version of targetm.eh_frame_section for systems with named sections. */
-void
-named_section_eh_frame_section (void)
+section *
+default_eh_frame_section (void)
{
#ifdef EH_FRAME_SECTION_NAME
int flags;
}
else
flags = SECTION_WRITE;
- named_section_flags (EH_FRAME_SECTION_NAME, flags);
-#endif
-}
-
-/* Version of targetm.eh_frame_section for systems using collect2. */
-void
-collect2_eh_frame_section (void)
-{
- tree label = get_file_function_name ('F');
-
- data_section ();
- ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
- targetm.asm_out.globalize_label (asm_out_file, IDENTIFIER_POINTER (label));
- ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
-}
-
-/* Default version of targetm.eh_frame_section. */
-void
-default_eh_frame_section (void)
-{
-#ifdef EH_FRAME_SECTION_NAME
- named_section_eh_frame_section ();
+ return get_section (EH_FRAME_SECTION_NAME, flags, NULL);
#else
- collect2_eh_frame_section ();
+ return NULL;
#endif
}
define type declaration DIE's. */
static GTY(()) VEC(tree,gc) *decl_scope_table;
+/* Pointers to various DWARF2 sections. */
+static GTY(()) section *debug_info_section;
+static GTY(()) section *debug_abbrev_section;
+static GTY(()) section *debug_aranges_section;
+static GTY(()) section *debug_macinfo_section;
+static GTY(()) section *debug_line_section;
+static GTY(()) section *debug_loc_section;
+static GTY(()) section *debug_pubnames_section;
+static GTY(()) section *debug_str_section;
+static GTY(()) section *debug_ranges_section;
+
/* How to start an assembler comment. */
#ifndef ASM_COMMENT_START
#define ASM_COMMENT_START ";#"
#if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO)
+/* Switch to eh_frame_section. If we don't have an eh_frame_section,
+ switch to the data section instead, and write out a synthetic label
+ for collect2. */
+
+static void
+switch_to_eh_frame_section (void)
+{
+ tree label;
+
+ if (eh_frame_section)
+ switch_to_section (eh_frame_section);
+ else
+ {
+ switch_to_section (data_section);
+ label = get_file_function_name ('F');
+ ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
+ targetm.asm_out.globalize_label (asm_out_file,
+ IDENTIFIER_POINTER (label));
+ ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
+ }
+}
+
/* Map register numbers held in the call frame info that gcc has
collected using DWARF_FRAME_REGNUM to those that should be output in
.debug_frame and .eh_frame. */
app_enable ();
if (for_eh)
- targetm.asm_out.eh_frame_section ();
+ switch_to_eh_frame_section ();
else
- named_section_flags (DEBUG_FRAME_SECTION, SECTION_DEBUG);
+ switch_to_section (get_section (DEBUG_FRAME_SECTION, SECTION_DEBUG, NULL));
ASM_GENERATE_INTERNAL_LABEL (section_start_label, FRAME_BEGIN_LABEL, for_eh);
ASM_OUTPUT_LABEL (asm_out_file, section_start_label);
return;
#endif
- function_section (current_function_decl);
+ switch_to_section (function_section (current_function_decl));
ASM_GENERATE_INTERNAL_LABEL (label, FUNC_BEGIN_LABEL,
current_function_funcdef_no);
ASM_OUTPUT_DEBUG_LABEL (asm_out_file, FUNC_BEGIN_LABEL,
/* If we cannot expect the linker to merge strings in .debug_str
section, only put it into .debug_str if it is worth even in this
single module. */
- if ((DEBUG_STR_SECTION_FLAGS & SECTION_MERGE) == 0
+ if ((debug_str_section->common.flags & SECTION_MERGE) == 0
&& (len - DWARF_OFFSET_SIZE) * node->refcount <= len)
return node->form = DW_FORM_string;
sprintf (tmp, ".gnu.linkonce.wi.%s", oldsym);
secname = tmp;
die->die_symbol = NULL;
+ switch_to_section (get_section (secname, SECTION_DEBUG, NULL));
}
else
- secname = (const char *) DEBUG_INFO_SECTION;
+ switch_to_section (debug_info_section);
/* Output debugging information. */
- named_section_flags (secname, SECTION_DEBUG);
output_compilation_unit_header ();
output_die (die);
current_file = 1;
current_line = 1;
- if (cfun
- && (last_text_section == in_unlikely_executed_text
- || (last_text_section == in_named
- && last_text_section_name == cfun->unlikely_text_section_name)))
+ if (cfun && unlikely_text_section_p (last_text_section))
strcpy (prev_line_label, cfun->cold_section_label);
else
strcpy (prev_line_label, text_section_label);
tree sectree = DECL_SECTION_NAME (current_function_decl);
secname = TREE_STRING_POINTER (sectree);
}
- else if (cfun
- && (last_text_section == in_unlikely_executed_text
- || (last_text_section == in_named
- && last_text_section_name
- == cfun->unlikely_text_section_name)))
+ else if (cfun && unlikely_text_section_p (last_text_section))
secname = cfun->cold_section_label;
else
secname = text_section_label;
dwarf2out_begin_block (unsigned int line ATTRIBUTE_UNUSED,
unsigned int blocknum)
{
- current_function_section (current_function_decl);
+ switch_to_section (current_function_section ());
ASM_OUTPUT_DEBUG_LABEL (asm_out_file, BLOCK_BEGIN_LABEL, blocknum);
}
static void
dwarf2out_end_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int blocknum)
{
- current_function_section (current_function_decl);
+ switch_to_section (current_function_section ());
ASM_OUTPUT_DEBUG_LABEL (asm_out_file, BLOCK_END_LABEL, blocknum);
}
newloc->var_loc_note = loc_note;
newloc->next = NULL;
- if (cfun
- && (last_text_section == in_unlikely_executed_text
- || (last_text_section == in_named
- && last_text_section_name == cfun->unlikely_text_section_name)))
+ if (cfun && unlikely_text_section_p (last_text_section))
newloc->section_label = cfun->cold_section_label;
else
newloc->section_label = text_section_label;
if (debug_info_level >= DINFO_LEVEL_NORMAL
&& line != 0)
{
- current_function_section (current_function_decl);
+ switch_to_section (current_function_section ());
/* If requested, emit something human-readable. */
if (flag_debug_asm)
{
int fileno;
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_macinfo_section);
dw2_asm_output_data (1, DW_MACINFO_start_file, "Start new file");
dw2_asm_output_data_uleb128 (lineno, "Included from line number %d",
lineno);
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_macinfo_section);
dw2_asm_output_data (1, DW_MACINFO_end_file, "End file");
}
}
{
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_macinfo_section);
dw2_asm_output_data (1, DW_MACINFO_define, "Define macro");
dw2_asm_output_data_uleb128 (lineno, "At line number %d", lineno);
dw2_asm_output_nstring (buffer, -1, "The macro");
{
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_macinfo_section);
dw2_asm_output_data (1, DW_MACINFO_undef, "Undefine macro");
dw2_asm_output_data_uleb128 (lineno, "At line number %d", lineno);
dw2_asm_output_nstring (buffer, -1, "The macro");
used_rtx_array = VEC_alloc (rtx, gc, 32);
+ debug_info_section = get_section (DEBUG_INFO_SECTION,
+ SECTION_DEBUG, NULL);
+ debug_abbrev_section = get_section (DEBUG_ABBREV_SECTION,
+ SECTION_DEBUG, NULL);
+ debug_aranges_section = get_section (DEBUG_ARANGES_SECTION,
+ SECTION_DEBUG, NULL);
+ debug_macinfo_section = get_section (DEBUG_MACINFO_SECTION,
+ SECTION_DEBUG, NULL);
+ debug_line_section = get_section (DEBUG_LINE_SECTION,
+ SECTION_DEBUG, NULL);
+ debug_loc_section = get_section (DEBUG_LOC_SECTION,
+ SECTION_DEBUG, NULL);
+ debug_pubnames_section = get_section (DEBUG_PUBNAMES_SECTION,
+ SECTION_DEBUG, NULL);
+ debug_str_section = get_section (DEBUG_STR_SECTION,
+ DEBUG_STR_SECTION_FLAGS, NULL);
+ debug_ranges_section = get_section (DEBUG_RANGES_SECTION,
+ SECTION_DEBUG, NULL);
+
ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (abbrev_section_label,
DEBUG_ABBREV_SECTION_LABEL, 0);
DEBUG_LINE_SECTION_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (ranges_section_label,
DEBUG_RANGES_SECTION_LABEL, 0);
- named_section_flags (DEBUG_ABBREV_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_abbrev_section);
ASM_OUTPUT_LABEL (asm_out_file, abbrev_section_label);
- named_section_flags (DEBUG_INFO_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_info_section);
ASM_OUTPUT_LABEL (asm_out_file, debug_info_section_label);
- named_section_flags (DEBUG_LINE_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_line_section);
ASM_OUTPUT_LABEL (asm_out_file, debug_line_section_label);
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_macinfo_section);
ASM_GENERATE_INTERNAL_LABEL (macinfo_section_label,
DEBUG_MACINFO_SECTION_LABEL, 0);
ASM_OUTPUT_LABEL (asm_out_file, macinfo_section_label);
}
- text_section ();
+ switch_to_section (text_section);
ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
if (flag_reorder_blocks_and_partition)
{
if (node->form == DW_FORM_strp)
{
- named_section_flags (DEBUG_STR_SECTION, DEBUG_STR_SECTION_FLAGS);
+ switch_to_section (debug_str_section);
ASM_OUTPUT_LABEL (asm_out_file, node->label);
assemble_string (node->str, strlen (node->str) + 1);
}
add_sibling_attributes (node->die);
/* Output a terminator label for the .text section. */
- text_section ();
+ switch_to_section (text_section);
targetm.asm_out.internal_label (asm_out_file, TEXT_END_LABEL, 0);
if (flag_reorder_blocks_and_partition)
{
examining the file. */
if (! DWARF2_ASM_LINE_DEBUG_INFO)
{
- named_section_flags (DEBUG_LINE_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_line_section);
output_line_info ();
}
if (have_location_lists)
{
/* Output the location lists info. */
- named_section_flags (DEBUG_LOC_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_loc_section);
ASM_GENERATE_INTERNAL_LABEL (loc_section_label,
DEBUG_LOC_SECTION_LABEL, 0);
ASM_OUTPUT_LABEL (asm_out_file, loc_section_label);
output_comp_unit (comp_unit_die, 0);
/* Output the abbreviation table. */
- named_section_flags (DEBUG_ABBREV_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_abbrev_section);
output_abbrev_section ();
/* Output public names table if necessary. */
if (pubname_table_in_use)
{
- named_section_flags (DEBUG_PUBNAMES_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_pubnames_section);
output_pubnames ();
}
table, so don't write it out if we don't have any. */
if (fde_table_in_use)
{
- named_section_flags (DEBUG_ARANGES_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_aranges_section);
output_aranges ();
}
/* Output ranges section if necessary. */
if (ranges_table_in_use)
{
- named_section_flags (DEBUG_RANGES_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_ranges_section);
ASM_OUTPUT_LABEL (asm_out_file, ranges_section_label);
output_ranges ();
}
/* Have to end the macro section. */
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
+ switch_to_section (debug_macinfo_section);
dw2_asm_output_data (1, 0, "End compilation unit");
}