Commit Graph

759 Commits

Author SHA1 Message Date
John David Anglin 2e3e8cea38 re PR middle-end/30174 (FAIL: g++.old-deja/g++.abi/cxa_vec.C execution test)
PR middle-end/30174
	* varasm.c (notice_global_symbol): Treat global objects as weak when
	flag_shlib is true.

From-SVN: r121551
2007-02-03 21:15:15 +00:00
Steve Ellcey 812b587e9d target.h (globalize_decl_name): New.
* target.h (globalize_decl_name): New.
	* target-def.h (TARGET_ASM_GLOBALIZE_DECL_NAME): New.
	* output.h (default_globalize_decl_name): New.
	* varasm.c (asm_output_bss): Use globalize_decl_name instead of
	globalize_label.
        (globalize_decl): Ditto.
	(default_globalize_decl_name): New.
	* config/ia64/ia64.c (ia64_globalize_decl_name): New.
	(ia64_handle_version_id_attribute): New.
	(TARGET_ASM_GLOBALIZE_DECL_NAME): New.
	(ia64_asm_output_external): Use globalize_decl_name instead
	of globalize_label.
	* doc/extend.texi (version_id): New pragma.
	* doc/tm.texi (ARGET_ASM_GLOBALIZE_DECL_NAME): New target hook.

From-SVN: r121128
2007-01-24 19:40:12 +00:00
Steve Ellcey 67e47f30d0 system.h (ASM_MAKE_LABEL_LINKONCE): Poison.
* system.h (ASM_MAKE_LABEL_LINKONCE): Poison.
	* varasm.c (globalize_decl): Remove ASM_MAKE_LABEL_LINKONCE ifdef.

From-SVN: r120976
2007-01-19 18:38:30 +00:00
H.J. Lu c47c29c896 re PR middle-end/17982 (stop calling assemble_external before final assembly output time)
2006-12-11  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/17982
	PR middle-end/20218
	* cgraphunit.c (cgraph_optimize): Remove call to
	process_pending_assemble_externals.

	* config/elfos.h (ASM_OUTPUT_EXTERNAL): New.

	* config/ia64/hpux.h (TARGET_ASM_FILE_END): Removed.

	* config/ia64/ia64.c (ia64_asm_output_external): Rewritten.
	(ia64_hpux_add_extern_decl): Removed.
	(ia64_hpux_file_end): Likewise.
	(extern_func_list): Likewise.
	(extern_func_head): Likewise.

	* output.h (assemble_external): Update comments.
	(default_elf_asm_output_external): New.
	(maybe_assemble_visibility): New.

	* toplev.c (compile_file): Update comment.

	* varasm.c (assemble_external): Always put it on
	pending_assemble_externals.
	(maybe_assemble_visibility): Make it extern and return int.
	(default_elf_asm_output_external): New.

From-SVN: r119764
2006-12-11 19:58:52 -08:00
Andreas Schwab 86aa531238 varasm.c (elf_record_gcc_switches): Cast second argument of ASM_OUTPUT_SKIP to unsigned HOST_WIDE_INT.
* varasm.c (elf_record_gcc_switches): Cast second argument of
	ASM_OUTPUT_SKIP to unsigned HOST_WIDE_INT.

From-SVN: r119744
2006-12-11 19:09:05 +00:00
Jan Hubicka 8a4a83ed92 Move all varpool routines out of cgraph/cgraphunit to varpool.c
Move all varpool routines out of cgraph/cgraphunit to varpool.c
	* cgraph.c: Update comments.
	(cgraph_varpool_hash,
	cgraph_varpool_nodes, cgraph_varpool_last_needed_node
	cgraph_varpool_node_name, cgraph_varpool_node,
	cgraph_varpol_mode_for_asm, cgraph_varpool_mark_needed_node,
	cgraph_variable_initializer_availability): Move to
	varpool.c and drop cgraph_ prefixes.
	(cgraph_varpool_enqueue_needed_node, cgraph_varpool_reset_queue,
	cgraph_varpool_first_unanalyzed_node, cgraph_varpool_finalize_decl):
	move to varpool.c; drop cgraph_ prefix; make static.
	(dump_cgraph_varpool_node): Move to varpool.c under name
	dump_varpool_node.
	(dump_varpool, hash_varpool_node, eq_varpool_node,
	decide_is_variable_needed): Move to varpool.c
	(decl_assembler_name_equal): Move to tree.c.
	(availability_names): Rename to ...
	(cgraph_availability_names): ... this one.
	(dump_cgraph_node): Update.
	* cgraph.h: Reorder declarations now in varpool.c
	(cgraph_vailablity_names): Declare.
	(struct cgraph_varpool_node): Rename to ...
	(struct varpool_node): ... this one.
	(cgraph_varpool_first_unanalyzed_node, cgraph_varpool_nodes_queue,
	cgraph_varpool_first_unanalyzed_node, cgraph_varpool_node,
	cgraph_varpool_node_for_asm, cgraph_varpool_mark_needed_node,
	cgraph_varpool_finalize_decl, cgraph_varpool_enqueue_needed_node,
	cgraph_varpool_reset_queue, cgraph_varpool_assemble_pending_decls,
	cgraph_variable_initializer_availability): Rename to ...
	(varpool_first_unanalyzed_node, varpool_nodes_queue,
	varpool_first_unanalyzed_node, varpool_node,
	varpool_node_for_asm, varpool_mark_needed_node,
	varpool_finalize_decl, varpool_enqueue_needed_node,
	varpool_assemble_pending_decls, variable_initializer_availability):
	Rename to ...
	* tree.c (decl_assembler_name_equal): Move here from cgraph.c.
	* tree.h (decl_assembler_name_equal): Declare.
	* omp-low.c (lower_omp_critical): Update.
	* ipa-reference (analyze_variable, static_execute): Likewise.
	* toplev.c (wrapup_global_declaration_2, compile_file): Update.
	* cgraphunit.c: Update comments.
	(cgraph_varpool_assembled_nodes_queue): Move to varpool.c under name
	varpool_assembled_nodes_queue.
	(cgraph_varpool_analyze_pending_decls): Move to varpool.c under name
	varpool_analyze_pending_decls.
	(cgraph_varpool_remove_unreferenced_decls): Move to varpool.c under name
	varpool_remove_unreferenced_decls.
	(record_reference): Update.
	(cgraph_create_edges): Update.
	(record_referneces_in_initializer): New function.
	(cgraph_varpool_assemble_decl): Move to varpool.c under name
	varpool_assemble_decl; make global.
	(cgraph_varpool_assemble_pending_decls): Move to varpool.c under name
	varpool_assemble_pending_decls.
	(process_function_and_variable_attributes, cgraph_finalize_compilation_unit,
	struct cgraph_order_sort, cgraph_output_in_order,
	cgraph_function_and_variable_invisibility, cgraph_optimize,
	cgraph_increase_alignment): Update.
	* dwarf2out.c (decls_for_scope): Likewise.
	* ipa-type-escape.c (analyze_variable, type_escape_execute): Likewise.
	* except.c (output_ttype): Likewise.
	* varasm.c (mark_decl_referenced): Likewise.
	(find_decl_and_mark_referenced, assemble_alias): update.
	* Makefile.in: Add varpool.c, gt-varpool.c and remove gt-cgraphunit.c
	* passes.c (rest_of_decl_compilation): Update.

	* cp/decl2.c (var_finalized_p): Update for renamed varpool functions.
	* fortran/f59-lang.c (gfc_expand_function): Update for renamed varpool functions.

From-SVN: r119731
2006-12-11 08:07:52 +00:00
Nick Clifton e0d9d0ddb6 common.opt (record-gcc-switches): New command line switch.
* common.opt (record-gcc-switches): New command line switch.
* target.h (print_switch_type): New enum.
  (print_switch_fn_type): New typedef for a function pointer.
  (struct gcc_target): Add record_gcc_switches and record_gcc_switches_section fields.
* target-def.h (TARGET_ASM_RECORD_GCC_SWITCHES): Provide a default definition.
  (TARGET_ASM_RECORD_GCC_SWITCHES_SECTION): Provide a default definition.
* toplev.c (print_single_switch): Simplify by providing a pointer to function that will format and output the switch appropriately.
  (print_switch_values): Likewise.
  (print_to_asm_out_file): New function.
  (print_to_stderr): New function.
  (init_asm_output): If flag_record_gcc_switches is set then if the target supports recording the switches then emit them into the assembler output file, otherwise tell the user that the switch is not supported.
* varasm.c (eld_record_gcc_switches): New function.  Example handler for the record_gcc_switches target hook.
* doc/tm.texi (TARGET_ASM_RECORD_GCC_SWITCHES): Document the new target hook.
  (TARGET_ASM_RECORD_GCC_SWITCHES_SECTION): Likewise.
* doc/invoke.texi (-frecord-gcc-switches): Document.

From-SVN: r119615
2006-12-07 10:54:13 +00:00
Richard Henderson a98d4769d5 Revert emutls patch.
From-SVN: r117578
2006-10-09 09:27:14 -07:00
Jakub Jelinek 86a0f64291 re PR c/29091 (vector constant not fully outputed)
PR c/29091
	* varasm.c (output_constant): If TREE_VECTOR_CST_ELTS chain is shorter than
	the number of vector elements fill the rest with zeros.

	* gcc.dg/pr29091.c: New test.

From-SVN: r117481
2006-10-06 09:15:48 +02:00
Richard Henderson e701a32a98 Makefile.in (libgcc.mk, [...]): Add emutls.c.
gcc/
        * Makefile.in (libgcc.mk, LIBGCC_DEPS): Add emutls.c.
        * builtin-types.def (BT_WORD): Make unsigned.
        (BT_FN_VOID_PTR_WORD_WORD_PTR): New.
        * builtins.def (BUILT_IN_EMUTLS_GET_ADDRESS): New.
        (BUILT_IN_EMUTLS_REGISTER_COMMON): New.
        * c-decl.c (grokdeclarator): Don't error if !have_tls.
        * c-parser.c (c_parser_omp_threadprivate): Likewise.
        * cgraph.c (decide_is_variable_needed): Look at force_output.
        Recurse for emulated tls.
        * cgraphunit.c (cgraph_varpool_remove_unreferenced_decls): Remove
        checks redundant with decide_is_variable_needed.
        (cgraph_build_static_cdtor): Do cgraph_varpool_assemble_pending_decls.
        * dwarf2out.c (loc_descriptor_from_tree_1): Don't do anything for
        emulated tls.
        * expr.c (emutls_var_address): New.
        (expand_expr_real_1): Expand emulated tls.
        (expand_expr_addr_expr_1): Likewise.
        * libgcc-std.ver: Add __emutls_get_address, __emutls_register_common.
        * output.h (emutls_finish): Declare.
        * toplev.c (compile_file): Call it.
        * tree-ssa-address.c (gen_addr_rtx): Check for const-ness of the
        address before wrapping in CONST.
        * varasm.c (emutls_htab, emutls_object_type): New.
        (EMUTLS_VAR_PREFIX, EMUTLS_TMPL_PREFIX): New.
        (get_emutls_object_name, get_emutls_object_type): New.
        (get_emutls_init_templ_addr, emutls_decl): New.
        (emutls_common_1, emutls_finish): New.
        (assemble_variable): When emulating tls, swap decls; generate
        constructor for the emutls objects.
        (do_assemble_alias): When emulating tls, swap decl and target name.
        (default_encode_section_info): Don't add SYMBOL_FLAG_TLS_SHIFT
        for emulated tls.
        * emutls.c: New file.
        * config/sparc/sol2.h (ASM_DECLARE_OBJECT_NAME): Only emit
        tls_object for real tls.

gcc/cp/
        * decl.c (grokvardecl): Don't error if !have_tls.
        (grokdeclarator): Likewise.
        * parser.c (cp_parser_omp_threadprivate): Likewise.

gcc/fortran/
        * f95-lang.c (gfc_init_builtin_functions): Add __emutls_get_address
        and __emutls_register_common.
        * openmp.c (gfc_match_omp_threadprivate): Don't error if !have_tls.
        * trans-common.c (build_common_decl): Don't check have_tls.
        * trans-decl.c (gfc_finish_var_decl): Likewise.
        * types.def (BT_WORD, BT_FN_PTR_PTR): New.
        (BT_FN_VOID_PTR_WORD_WORD_PTR): New.

gcc/testsuite/
        * lib/target-supports.exp (check_effective_target_tls): Redefine
        to mean non-emulated tls.
        * gcc.dg/tls/alias-1.c: Remove tls requirement.
        * gcc.dg/tls/asm-1.c, gcc.dg/tls/debug-1.c, gcc.dg/tls/diag-1.c,
        gcc.dg/tls/diag-2.c, gcc.dg/tls/diag-3.c, gcc.dg/tls/diag-4.c,
        gcc.dg/tls/diag-5.c, gcc.dg/tls/init-1.c, gcc.dg/tls/nonpic-1.c,
        gcc.dg/tls/opt-10.c, gcc.dg/tls/opt-5.c, gcc.dg/tls/opt-6.c,
        gcc.dg/tls/opt-8.c, gcc.dg/tls/opt-9.c, gcc.dg/tls/pic-1.c,
        gcc.dg/tls/struct-1.c, gcc.dg/tls/trivial.c: Likewise.

From-SVN: r117440
2006-10-04 14:09:20 -07:00
Richard Sandiford 2801ed8e2f varasm.c (copy_constant): Fix reversed gcc_assert check.
gcc/
	* varasm.c (copy_constant): Fix reversed gcc_assert check.

From-SVN: r117121
2006-09-21 21:52:23 +00:00
Jason Merrill df20ea24f9 re PR middle-end/27724 (internal compiler error: no-op convert from 4 to 8 bytes in initializer)
PR middle-end/27724
        * varasm.c (output_constant): Only strip actual no-op conversions.

From-SVN: r116777
2006-09-08 01:11:40 -04:00
Mark Mitchell f092a8668a re PR c++/28148 (ICE with pointer to member function initializer and cast to a different type)
PR c++/28148
	* varasm.c (output_constant): Give the front end another chance to
	expand constants, after stripping NOPs.

	PR c++/28148
	* g++.dg/init/ptrmem3.C: New test.

From-SVN: r115919
2006-08-04 04:58:36 +00:00
Olivier Hainque fe24d4852e tree.h (categorize_ctor_elements): Adjust prototype and add descriptive comment...
* tree.h (categorize_ctor_elements): Adjust prototype and add
	descriptive comment, both in accordance with the interface change
	described below.
	* varasm.c (constructor_static_from_elts_p): New function.
	Whether a constructor node is a valid static constant initializer
	if all its elements are.
	(initializer_constant_valid_p) <CONSTRUCTOR value>: Use it.
	* output.h: Declare it.	
	* expr.c (categorize_ctor_elements_1): Return whether the constructor
	is a valid constant initializer instead of computing the number of
	non-constant elements.  Use constructor_static_from_elts_p for this
	purpose.  Replace the head comment with an indication that this is a
	helper for categorize_ctor_elements.
	(categorize_ctor_elements): Same interface change as for the _1
	helper.  Former head comment from this helper moved here, adjusted to
	account for the interface changes.
	(mostly_zeros_p): Adjust call to categorize_ctor_elements.
	(all_zeros_p): Likewise.	
	* gimplify.c (gimplify_init_constructor): Decide whether we can make
	static versions of the constructor from the categorize_ctor_elements
	return value instead of the formerly computed number of non-constant
	elements.

	* gnat.dg/outer_agg_bitfield_constructor.adb: New test.
	* gnat.dg/nested_agg_bitfield_constructor.adb: New test.

From-SVN: r115553
2006-07-18 13:07:28 +00:00
Jan Hubicka 88d03811f8 cgraphunit.c (cgraph_varpool_analyze_pending_decls): Call align_variable.
* cgraphunit.c (cgraph_varpool_analyze_pending_decls): Call align_variable.
	* output.h (align_variable): Declare.
	* varasm.c (align_variable): Export.
	* value-prof.c (tree_value_profile_transformations): Recompute iterator
	when basic block changed.

From-SVN: r115421
2006-07-13 20:49:34 +00:00
Jason Merrill b9e7569630 re PR c++/26905 (default-visibility class symbol improperly resolved as hidden-visibility)
PR c++/26905
        PR c++/26612
        PR c++/27000
        PR c++/26984
        PR c++/19134
        * tree.c (build_decl_stat): Don't hande #pragma visibility here.
        * c-common.c (c_determine_visibility): Handle it here.
        * c-decl.c (finish_decl): Call c_determine_visibility for
        functions, too.
        * flags.h (enum symbol_visibility): Sort from most to least visibility.
        * tree.h: Likewise.
        * varasm.c (default_assemble_visibility): Likewise.
        * c-common.c (handle_visibility_attribute): Complain about trying
        to give visibility to an already defined class, or trying to change
        declared visibility. Always attach the attribute.
        * cp/decl2.c (determine_visibility): Overhaul.
        (determine_visibility_from_class): Likewise.
        (min_vis_r, type_visibility, constrain_visibility): New fns.
        (constrain_visibility_for_template): Likewise.
        (constrain_class_visibility): Likewise.
        * cp/decl.c (cp_finish_decl): Call determine_visibility for function
        decls, too.
        * cp/name-lookup.c (pushtag): Call determine_visibility.
        * cp/decl.c (duplicate_decls): Don't copy visibility from template to
        specialization.
        * cp/pt.c (check_explicit_specialization): Likewise.
        (lookup_template_class, tsubst_decl): Call determine_visibility.
        * cp/class.c (finish_struct_1): Call constrain_class_visibility.

        PR c++/26905
        PR c++/21675
        PR c++/17470
        * cp/parser.c (cp_parser_explicit_instantiation): Pass the attributes
        to grokdeclarator.
        (cp_parser_type_specifier): Allow 'enum __attribute ((...)) E'.
        (cp_parser_enum_specifier): Likewise.
        (cp_parser_elaborated_type_specifier): Apply attributes if this
        declares only the class.
        (cp_parser_class_specifier): Apply leading attributes immediately.
        * cp/semantics.c (begin_class_definition): Add attributes parameter,
        apply them to the type.
        * attribs.c (decl_attributes): Ignore type-in-place attributes
        once the type has been defined.

        PR c++/21581
        PR c++/25915
        * cp/tree.c (decl_anon_ns_mem_p): New function.
        * cp/cp-tree.h: Declare it.
        * cp/decl2.c (determine_visibility): Make anonymous namespace
        members static.
        (min_vis_r, constrain_visibility): Likewise.
        * cp/rtti.c (create_pseudo_type_info): Set TREE_PUBLIC on
        pseudo-types.
        * cp/decl.c (cxx_init_decl_processing): Set TREE_PUBLIC on
        global_namespace.
        * cp/name-lookup.c (push_namespace_with_attribs): Don't set TREE_PUBLIC
        on anonymous namespaces.

From-SVN: r115086
2006-06-29 21:15:56 -04:00
Jakub Jelinek 0841534abd varasm.c (mergeable_string_section): Check for embedded NULs and NUL termination in the first int_size_in_bytes...
* varasm.c (mergeable_string_section): Check for embedded NULs and
	NUL termination in the first int_size_in_bytes (TREE_TYPE (decl))
	rather than TREE_STRING_LENGTH bytes.

	* gcc.dg/merge-all-constants-1.c: New test.

From-SVN: r114842
2006-06-21 10:58:44 +02:00
Kazu Hirata eb5fa7733e * varasm.c (globalize_decl): Fix indentation.
From-SVN: r114203
2006-05-29 15:33:55 +00:00
David Edelsohn d5fa3ec8dc varasm.c (align_variable): New function.
* varasm.c (align_variable): New function.
	(get_block_for_decl): Apply align_variable to DECL before
	calculating section information.
	(assemble_variable): Split out alignment computation.

From-SVN: r113250
2006-04-25 11:00:53 -04:00
Roger Sayle b6f65e3c5d builtins.c (dummy_object): Use build_int_cst instead of convert.
* builtins.c (dummy_object): Use build_int_cst instead of convert.
	* tree-ssa-ccp.c (maybe_fold_stmt_addition): Use fold_convert
	instead of convert.
	* dojump.c (do_jump): Likewise.
	* expr.h (ADD_PARM_SIZE, SUB_PARM_SIZE, ARGS_SIZE_TREE): Likewise.
	* gimplify.c (gimple_boolify, gimplify_init_constructor,
	gimplify_boolean_expr): Likewise.
	* emit-rtl.c (set_mem_attributes_minus_bitpos): Likewise.
	* varasm.c (array_size_for_constructor): Likewise.
	* tree-object-size.c (compute_object_offset): Likewise.

From-SVN: r112633
2006-04-03 03:07:40 +00:00
Richard Sandiford c16ba1d5fe varasm.c (output_constant_pool): Restore fnname and fndecl arguments.
* varasm.c (output_constant_pool): Restore fnname and fndecl
	arguments.
	(assemble_start_function): Adjust call accordingly.
	(assemble_end_function): Likewise.

From-SVN: r112315
2006-03-23 09:29:15 +00:00
Geoffrey Keating cd55445430 * varasm.c (assemble_end_function): Say that 'fnname' is unused.
From-SVN: r111836
2006-03-08 01:26:21 +00:00
Richard Sandiford 6410fb814b * varasm.c (assemble_variable): Fix setting of DECL_IN_TEXT_SECTION.
From-SVN: r111805
2006-03-07 13:56:31 +00:00
Richard Sandiford 1d3dbd99b6 hooks.c (hook_bool_mode_rtx_true): New function.
* hooks.c (hook_bool_mode_rtx_true): New function.
	* hooks.h (hook_bool_mode_rtx_true): Declare.
	* toplev.c (compile_file): Call output_shared_constant_pool.
	* varasm.c (shared_constant_pool): New variable.
	(assemble_start_function, assemble_end_function): Remove arguments
	from call to output_constant_pool.
	(create_constant_pool): New function, split out from...
	(init_varasm_status): ...here.
	(force_const_mem): Choose between the shared and per-function constant
	pools.  Set current_function_uses_const_pool when reusing old entries
	as well as when creating new ones.
	(mark_constant): Ignore data argument.
	(mark_constants): Remove pool argument.
	(mark_constant_pool): Likewise.  Use current_function_uses_const_pool
	to decide whether the function uses a constant pool.
	(output_constant_pool_contents): New function, split out from...
	(output_constant_pool): ...here.
	(output_shared_constant_pool): New function.
	(init_varasm_once): Initialize shared_constant_pool.
	* output.h (output_constant_pool): Delete.
	(output_shared_constant_pool): Declare.
	* config/s390/s390-protos.h (s390_output_constant_pool): Delete.
	* config/i386/i386.c (TARGET_USE_BLOCKS_FOR_CONSTANT_P): Override.

From-SVN: r111804
2006-03-07 07:41:39 +00:00
Mike Stump b5abd706cd Fix formatting.
From-SVN: r111688
2006-03-03 22:38:15 +00:00
Richard Sandiford 3fa9c136c3 tm.texi: Refer to SYMBOL_REF_HAS_BLOCK_INFO_P instead of SYMBOL_REF_IN_BLOCK_P.
* doc/tm.texi: Refer to SYMBOL_REF_HAS_BLOCK_INFO_P instead of
	SYMBOL_REF_IN_BLOCK_P.
	* doc/rtl.texi: Likewise.  Refer to SYMBOL_FLAG_HAS_BLOCK_INFO instead
	of SYMBOL_FLAG_IN_BLOCK.
	* gengtype.c (adjust_field_rtx_def): Use SYMBOL_REF_HAS_BLOCK_INFO_P
	instead of SYMBOL_REF_IN_BLOCK_P.
	* explow.c (use_anchored_address): Likewise.
	* rtl.c (rtx_size): Likewise.
	* varasm.c (create_block_symbol): Set SYMBOL_FLAG_HAS_BLOCK_INFO
	instead of SYMBOL_FLAG_IN_BLOCK.
	(make_decl_rtl): Use SYMBOL_REF_HAS_BLOCK_INFO_P instead of
	SYMBOL_REF_IN_BLOCK_P.
	(assemble_variable): Likewise.
	(output_constant_def_contents): Likewise.
	(output_constant_pool): Likewise.
	(default_encode_section_info): Preserve SYMBOL_FLAG_HAS_BLOCK_INFO
	instead of SYMBOL_FLAG_IN_BLOCK.
	* rtl.h (block_symbol): Refer to SYMBOL_REF_HAS_BLOCK_INFO_P instead of
	SYMBOL_REF_IN_BLOCK_P.
	(SYMBOL_REF_BLOCK): Likewise.
	(SYMBOL_REF_OFFSET): Likewise.
	(BLOCK_SYMBOL_CHECK): Use SYMBOL_REF_HAS_BLOCK_INFO_P instead of
	SYMBOL_REF_IN_BLOCK_P.
	(SYMBOL_FLAG_IN_BLOCK): Replace with...
	(SYMBOL_FLAG_HAS_BLOCK_INFO): ...this.
	(SYMBOL_REF_IN_BLOCK_P): Replace with...
	(SYMBOL_REF_HAS_BLOCK_INFO_P): ...this.

From-SVN: r111675
2006-03-03 09:11:58 +00:00
Richard Sandiford 434aeebbff tm.texi (TARGET_HAVE_SWITCHABLE_BSS_SECTIONS): Document.
* doc/tm.texi (TARGET_HAVE_SWITCHABLE_BSS_SECTIONS): Document.
	(ASM_OUTPUT_BSS): Describe the two ways of handling global BSS,
	and say that only one is needed.
	* doc/rtl.texi (SYMBOL_REF_BLOCK): Say that the block can be null.
	* target.h (have_switchable_bss_sections): New hook.
	* explow.c (use_anchored_address): Check that the symbol is in a block.
	* varasm.c (tls_comm_section, comm_section, lcomm_section)
	(bss_noswitch_section): New variables.
	(get_unnamed_section): Add SECTION_UNNAMED to the flags.
	(get_noswitch_section): New function.
	(get_block_for_section): Allow SECT to be null.
	(unlikely_text_section_p): Use SECTION_STYLE.
	(bss_initializer_p): New function.
	(get_variable_section): Move earlier in file.  Take a new argument,
	prefer_noswitch_p.  Move bss checks from assemble_variable to here.
	Return one of the new *_sections in such cases.
	(get_block_for_decl): New function, extracting some logic from
	use_blocks_for_decl_p.
	(change_symbol_section): Remove in favor of...
	(change_symbol_block): ...this new function.
	(use_blocks_for_decl_p): Remove checks now performed by
	get_block_for_decl.
	(make_decl_rtl): Use change_symbol_block and get_block_for_decl.
	(ASM_EMIT_LOCAL, ASM_EMIT_BSS, ASM_EMIT_COMMON): Delete in favor of...
	(emit_local, emit_bss, emit_common): ...these new functions.
	Return true if the alignment was honored.
	(emit_tls_common): New function.
	(asm_emit_uninitialised): Delete.
	(assemble_variable_noswitch): New function, split out from...
	(assemble_variable): ...here.  Don't make decisions about common
	variables here.  Globalize all public decls that go into non-common
	sections.  Check whether SYMBOL_REF_BLOCK is null.
	(output_constant_def_contents): Check whether SYMBOL_REF_BLOCK is null.
	(output_constant_pool): Likewise.
	(init_varasm_once): Initialize the new section variables.
	(have_global_bss_p): New function.
	(categorize_decl_for_section): Use bss_initializer_p.
	(switch_to_section): Use SECTION_STYLE.  Abort for SECTION_NOSWITCH.
	(place_block_symbol): Assert that the symbol must be in a block.
	* target-def.h (TARGET_HAVE_SWITCHABLE_BSS_SECTIONS): New macro.
	(TARGET_INITIALIZER): Include it.
	* rtl.h (SYMBOL_REF_BLOCK): Document the null alternative.
	* output.h (SECTION_STYLE_MASK, SECTION_COMMON): New macros.
	(SECTION_MACH_DEP): Bump by two.
	(SECTION_UNNAMED, SECTION_NOSWITCH): New macros.
	(unnamed_section): Mention SECTION_UNNAMED in comment.
	(named_section): Likewise SECTION_NAMED.
	(noswitch_section_callback): New type.
	(noswitch_section): New structure.
	(section): Add a noswitch_section alternative.
	(SECTION_STYLE): New macro.
	(tls_comm_section, comm_section, lcomm_section): Declare.
	(bss_noswitch_section, have_global_bss_p): Declare.
	* config/elfos.h (TARGET_HAVE_SWITCHABLE_BSS_SECTIONS): Override.
	* config/iq2000/iq2000.c (TARGET_HAVE_SWITCHABLE_BSS_SECTIONS):
	Override.
	* config/v850/v850.c (TARGET_HAVE_SWITCHABLE_BSS_SECTIONS): Override.
	* config/stormy16/stormy16.c (TARGET_HAVE_SWITCHABLE_BSS_SECTIONS):
	Override.

cp/
	* decl.c (start_decl): Use have_global_bss_p when deciding
	whether to make the decl common.

ada/
	* utils.c (create_var_decl): Use have_global_bss_p when deciding
	whether to make the decl common.

From-SVN: r111644
2006-03-02 19:32:52 +00:00
Richard Sandiford e8dad6f060 tree.h (variable_section): Delete.
* tree.h (variable_section): Delete.
	* varasm.c (variable_section): Delete.

From-SVN: r111369
2006-02-22 19:58:37 +00:00
Richard Sandiford f5e605e540 * doc/tm.texi (ASM_OUTPUT_SHARED_COMMON, ASM_OUTPUT_SHARED_BSS)
(ASM_OUTPUT_SHARED_LOCAL): Delete.
	* doc/invoke.texi (-fshared-data): Delete.
	* common.opt (fshared-data): Delete.
	* varasm.c (asm_emit_uninitialised): Remove flag_shared_data handling.
	(assemble_static_space): Remove #if 0 code.
	* system.h (ASM_OUTPUT_SHARED_COMMON, ASM_OUTPUT_SHARED_BSS)
	(ASM_OUTPUT_SHARED_LOCAL): Poison.
	* config/cris/cris.h: Remove FIXME.

From-SVN: r111330
2006-02-21 08:51:26 +00:00
Roger Sayle 6a34c78895 re PR middle-end/19543 ([4.1 only] fortran LOGICAL*8 not consistently distinguished from 32 bit integers)
PR middle-end/19543
	* varasm.c (compare_constant) <INTEGER_CST>: Integer constants are
	only equivalent if the have both the same mode and precision.

	* gfortran.dg/logical_1.f90: New test case.

From-SVN: r111294
2006-02-20 00:34:12 +00:00
Richard Sandiford aacd3885eb re PR target/9703 ([arm] Accessing data through constant pool more times could be solved in less instructions)
* cselib.c (cselib_init): Change RTX_SIZE to RTX_CODE_SIZE.
	* emit-rtl.c (copy_rtx_if_shared_1): Use shallow_copy_rtx.
	(copy_insn_1): Likewise.  Don't copy each field individually.
	Reindent.
	* read-rtl.c (apply_macro_to_rtx): Use RTX_CODE_SIZE instead
	of RTX_SIZE.
	* reload1.c (eliminate_regs): Use shallow_copy_rtx.
	* rtl.c (rtx_size): Rename variable to...
	(rtx_code_size): ...this.
	(rtx_size): New function.
	(rtx_alloc_stat): Use RTX_CODE_SIZE instead of RTX_SIZE.
	(copy_rtx): Use shallow_copy_rtx.  Don't copy each field individually.
	Reindent.
	(shallow_copy_rtx_stat): Use rtx_size instead of RTX_SIZE.
	* rtl.h (rtx_code_size): New variable.
	(rtx_size): Change from a variable to a function.
	(RTX_SIZE): Rename to...
	(RTX_CODE_SIZE): ...this.

	PR target/9703
	PR tree-optimization/17106
	* doc/tm.texi (TARGET_USE_BLOCKS_FOR_CONSTANT_P): Document.
	(Anchored Addresses): New section.
	* doc/invoke.texi (-fsection-anchors): Document.
	* doc/rtl.texi (SYMBOL_REF_IN_BLOCK_P, SYMBOL_FLAG_IN_BLOCK): Likewise.
	(SYMBOL_REF_ANCHOR_P, SYMBOL_FLAG_ANCHOR): Likewise.
	(SYMBOL_REF_BLOCK, SYMBOL_REF_BLOCK_OFFSET): Likewise.
	* hooks.c (hook_bool_mode_rtx_false): New function.
	* hooks.h (hook_bool_mode_rtx_false): Declare.
	* gengtype.c (create_optional_field): New function.
	(adjust_field_rtx_def): Add the "block_sym" field for SYMBOL_REFs when
	SYMBOL_REF_IN_BLOCK_P is true.
	* target.h (output_anchor, use_blocks_for_constant_p): New hooks.
	(min_anchor_offset, max_anchor_offset): Likewise.
	(use_anchors_for_symbol_p): New hook.
	* toplev.c (compile_file): Call output_object_blocks.
	(target_supports_section_anchors_p): New function.
	(process_options): Check that -fsection-anchors is only used on
	targets that support it and when -funit-at-a-time is in effect.
	* tree-ssa-loop-ivopts.c (prepare_decl_rtl): Only create DECL_RTL
	if the decl doesn't have one.
	* dwarf2out.c: Remove instantiations of VEC(rtx,gc).
	* expr.c (emit_move_multi_word, emit_move_insn): Pass the result
	of force_const_mem through use_anchored_address.
	(expand_expr_constant): New function.
	(expand_expr_addr_expr_1): Call it.  Use the same modifier when
	calling expand_expr for INDIRECT_REF.
	(expand_expr_real_1): Pass DECL_RTL through use_anchored_address
	for all modifiers except EXPAND_INITIALIZER.  Use expand_expr_constant.
	* expr.h (use_anchored_address): Declare.
	* loop-unroll.c: Don't declare rtx vectors here.
	* explow.c: Include output.h.
	(validize_mem): Call use_anchored_address.
	(use_anchored_address): New function.
	* common.opt (-fsection-anchors): New switch.
	* varasm.c (object_block_htab, anchor_labelno): New variables.
	(hash_section, object_block_entry_eq, object_block_entry_hash)
	(use_object_blocks_p, get_block_for_section, create_block_symbol)
	(use_blocks_for_decl_p, change_symbol_section): New functions.
	(get_variable_section): New function, split out from assemble_variable.
	(make_decl_rtl): Create a block symbol if use_object_blocks_p and
	use_blocks_for_decl_p say so.  Use change_symbol_section if the
	symbol has already been created.
	(assemble_variable_contents): New function, split out from...
	(assemble_variable): ...here.  Don't output any code for
	block symbols; just pass them to place_block_symbol.
	Use get_variable_section and assemble_variable_contents.
	(get_constant_alignment, get_constant_section, get_constant_size): New
	functions, split from output_constant_def_contents.
	(build_constant_desc): Create a block symbol if use_object_blocks_p
	says so.  Or into SYMBOL_REF_FLAGS.
	(assemble_constant_contents): New function, split from...
	(output_constant_def_contents): ...here.  Don't output any code
	for block symbols; just pass them to place_section_symbol.
	Use get_constant_section and get_constant_alignment.
	(force_const_mem): Create a block symbol if use_object_blocks_p and
	use_blocks_for_constant_p say so.  Or into SYMBOL_REF_FLAGS.
	(output_constant_pool_1): Add an explicit alignment argument.
	Don't switch sections here.
	(output_constant_pool): Adjust call to output_constant_pool_1.
	Switch sections here instead.  Don't output anything for block symbols;
	just pass them to place_block_symbol.
	(init_varasm_once): Initialize object_block_htab.
	(default_encode_section_info): Keep the old SYMBOL_FLAG_IN_BLOCK.
	(default_asm_output_anchor, default_use_aenchors_for_symbol_p)
	(place_block_symbol, get_section_anchor, output_object_block)
	(output_object_block_htab, output_object_blocks): New functions.
	* target-def.h (TARGET_ASM_OUTPUT_ANCHOR): New macro.
	(TARGET_ASM_OUT): Include it.
	(TARGET_USE_BLOCKS_FOR_CONSTANT_P): New macro.
	(TARGET_MIN_ANCHOR_OFFSET, TARGET_MAX_ANCHOR_OFFSET): New macros.
	(TARGET_USE_ANCHORS_FOR_SYMBOL_P): New macro.
	(TARGET_INITIALIZER): Include them.
	* rtl.c (rtl_check_failed_block_symbol): New function.
	* rtl.h: Include vec.h.  Declare heap and gc rtx vectors.
	(block_symbol, object_block): New structures.
	(rtx_def): Add a block_symbol field to the union.
	(BLOCK_SYMBOL_CHECK): New macro.
	(rtl_check_failed_block_symbol): Declare.
	(SYMBOL_FLAG_IN_BLOCK, SYMBOL_FLAG_ANCHOR): New SYMBOL_REF flags.
	(SYMBOL_REF_IN_BLOCK_P, SYMBOL_REF_ANCHOR_P): New predicates.
	(SYMBOL_FLAG_MACH_DEP_SHIFT): Bump by 2.
	(SYMBOL_REF_BLOCK, SYMBOL_REF_BLOCK_OFFSET): New accessors.
	* output.h (output_section_symbols): Declare.
	(object_block): Name structure.
	(place_section_symbol, get_section_anchor, default_asm_output_anchor)
	(default_use_anchors_for_symbol_p): Declare.
	* Makefile.in (RTL_BASE_H): Add vec.h.
	(explow.o): Depend on output.h.
	* config/rs6000/rs6000.c (TARGET_MIN_ANCHOR_OFFSET): Override default.
	(TARGET_MAX_ANCHOR_OFFSET): Likewise.
	(TARGET_USE_BLOCKS_FOR_CONSTANT_P): Likewise.
	(rs6000_use_blocks_for_constant_p): New function.

From-SVN: r111254
2006-02-18 22:06:53 +00:00
Josh Conner 4c553323a6 re PR target/25376 (section attribute doesn't work on darwin)
PR target/25376
* varasm.c (function_section): Check for section name before
calling select_section on targets that define
USE_SELECT_SECTION_FOR_FUNCTIONS.  On other targets, use
unlikely_text_section instead of hot_function_section if
first_function_block_is_cold.
* gcc.dg/pr25376.c: New test.

* gcc.c-torture/compile/pr23237.c: Only compile test -- don't
assemble.
* lib/target-supports.exp (check_named_sections_available):
Only compile named-sections test -- don't assemble.

From-SVN: r110917
2006-02-13 18:12:17 +00:00
Roger Sayle 71d5938381 tree.def (CHAR_TYPE): Remove.
* tree.def (CHAR_TYPE): Remove.
	* dbxout.c (dbxout_type): Delete dead handling of CHAR_TYPE.
	* dwarf2out.c (base_type_die, is_base_type): Likewise.
	(gen_type_die) <ARRAY_TYPE>: Remove handling of CHAR_TYPE arrays.
	(gen_string_type_die): Delete unreachable function.

	* tree-pretty-print.c (dump_generic_node): Don't handle CHAR_TYPE.
	* tree.c (build_int_cst_wide, type_contains_placeholder_1,
	type_hash_eq, variably_modified_type_p, walk_type_fields): Likewise.
	* tree.h (NUMERICAL_TYPE_CHECK, INTEGRAL_TYPE_P): Likewise.
	* builtins.c (type_to_class): Likewise.
	* fold-const.c (fold_convert, build_range_check,
	merge_ranges): Likewise.
	* expr.c (count_type_elements): Likewise.
	* c-pretty-print.c (pp_c_type_specifier): Likewise.
	* stor-layout.c (layout_type): Likewise.
	* ipa-type-escape.c (type_to_consider): Likewise.
	* gimplify.c (omp_firstprivatize_type_sizes,
	gimplify_type_sizes): Likewise.
	* explow.c (promote_mode): Likewise.
	* tree-sra.c (is_sra_scalar_type): Likewise.
	* varasm.c (output_constant): Likewise.
	* tree-inline.c (remap_type_1): Likewise.
	* convert.c (convert_to_pointer, convert_to_real,
	convert_to_integer, convert_to_complex): Likewise.

From-SVN: r110775
2006-02-08 23:57:21 +00:00
Richard Sandiford 929e5e5b5d rtl.texi (SYMBOL_REF_DATA): Adjust documentation for new opaque type.
* doc/rtl.texi (SYMBOL_REF_DATA): Adjust documentation for new
	opaque type.
	* optabs.c (init_one_libfunc): Use SET_SYMBOL_REF_DECL.
	* varasm.c (make_decl_rtl, build_constant_desc): Likewise.
	(force_const_mem): Use SET_SYMBOL_REF_CONSTANT.
	* rtl.h (rtunion_def): Remove rt_ptr.
	(X0PTR): Delete.
	(SYMBOL_REF_DATA): Use X0ANY instead of X0PTR.
	(SET_SYMBOL_REF_DECL, SET_SYMBOL_REF_CONSTANT): New macros.
	* config/i386/winnt.c (i386_pe_mark_dllexport)
	(i386_pe_mark_dllimport): Use SET_SYMBOL_REF_DECL.

From-SVN: r110300
2006-01-27 16:17:39 +00:00
Richard Sandiford c185c79706 rtl.texi (SYMBOL_REF_CONSTANT, [...]): Document.
* doc/rtl.texi (SYMBOL_REF_CONSTANT, SYMBOL_REF_DATA): Document.
	* gengtype.c (adjust_field_rtx_def): Garbage-collect field 2 of
	a SYMBOL_REF as either a tree or a constant_descriptor_rtx,
	depending on the value of CONSTANT_POOL_ADDRESS_P.
	* optabs.c (init_one_libfunc): Nullify SYMBOL_REF_DATA rather than
	SYMBOL_REF_DECL.
	* varasm.c (make_decl_rtl, build_constant_desc): Set SYMBOL_REF_DATA
	rather than SYMBOL_REF_DECL.
	(rtx_constant_pool): Remove const_rtx_sym_htab.
	(const_desc_rtx_sym_hash, const_desc_rtx_sym_eq): Delete.
	(init_varasm_status): Don't initialize const_rtx_sym_htab.
	(force_const_mem): Point SYMBOL_REF_DATA to the constant pool entry.
	Remove handling of const_rtx_sym_htab.
	(find_pool_constant): Delete.
	(get_pool_constant, get_pool_constant_mark): Use SYMBOL_REF_CONSTANT
	rather than find_pool_constant.
	(get_pool_constant_for_function): Delete.
	(get_pool_mode, mark_constant): Use SYMBOL_REF_CONSTANT rather than
	find_pool_constant. 
	* rtl.h (rtunion_def): Add rt_constant and rt_ptr fields.
	(X0CONSTANT, X0PTR, SYMBOL_REF_DATA): New macros.
	(SYMBOL_REF_DECL): Return NULL if CONSTANT_POOL_ADDRESS_P.
	(SYMBOL_REF_CONSTANT): New macro.
	(get_pool_constant_for_function): Delete.
	* config/i386/winnt.c (i386_pe_mark_dllexport): Set SYMBOL_REF_DATA
	rather than SYMBOL_REF_DECL.
	(i386_pe_mark_dllimport): Likewise.
	* config/rs6000/rs6000.c (rs6000_emit_move): Copy SYMBOL_REF_DATA
	rather than SYMBOL_REF_DECL.
	* config/darwin.c (machopic_indirect_data_reference): Likewise.
	(machopic_indirect_call_target): Likewise.

From-SVN: r110210
2006-01-25 09:10:56 +00:00
Ben Elliston 5e5cf1ee55 * varasm.c (assemble_real): Initialise data array.
From-SVN: r110049
2006-01-21 10:25:11 +11:00
DJ Delorie 971dfb9b99 varasm.c (initialize_constant_valid_p): Allow pointers initialized from integer constants of lesser precision.
* varasm.c (initialize_constant_valid_p): Allow pointers
initialized from integer constants of lesser precision.
(output_constant): Allow non-int-sized pointer modes to be
initialized from integer constants.

From-SVN: r110041
2006-01-20 16:55:41 -05:00
Eric Christopher 083cad550d tm.texi (TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL): Document.
2006-01-06  Eric Christopher  <echristo@apple.com>

        * doc/tm.texi (TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL): Document.
        (TARGET_UNWIND_EMIT): Fix spelling.
        * target.h (gcc_target): Add except_table_label.
        * except.c (output_function_exception_table): Use.
        * varasm.c (default_emit_except_table_label): New.
        * target-def.h (TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL): New default
        define.
        (asm_out): Add here.
        * output.h (default_emit_except_table_label): Prototype.
        * config/darwin-protos.h (darwin_emit_except_table_label): Ditto.
        * config/darwin.c (darwin_emit_except_table_label): Define.
        * config/darwin.h (TARGET_ASM_EMIT_EXCEPT_TABLE): Ditto.

From-SVN: r109435
2006-01-06 23:16:23 +00:00
Jakub Jelinek a13e882c79 varasm.c (assemble_variable): Handle thread-local COMMON data.
* varasm.c (assemble_variable): Handle thread-local COMMON data.
        * defaults.h (ASM_OUTPUT_TLS_COMMON): Define.

Co-Authored-By: Richard Henderson <rth@redhat.com>

From-SVN: r109282
2006-01-03 08:19:21 -08:00
Nathan Sidwell bf2f234e75 varasm.c (get_section): Use gcc_assert.
* varasm.c (get_section): Use gcc_assert.
cp:
	* method.c (make_thunk): Don't set comdat_linkage here.
	(use_thunk): Make thunk one only here, if thunk target is
	DECL_ONE_ONLY.
testsuite:
	* g++.dg/abi/thunk3.C: New.
	* g++.dg/abi/thunk4.C: New.

From-SVN: r109149
2005-12-29 16:38:26 +00:00
Mark Mitchell 125f2a50c9 re PR c++/23171 (ICE on pointer initialization with C99 initializer)
PR c++/23171
	* varasm.c (initializer_constant_valid_p): An ADDR_EXPR of a
	CONSTRUCTOR is invalid.

	PR c++/23171
	* g++.dg/opt/init1.C: New test.

From-SVN: r109035
2005-12-24 08:51:05 +00:00
Richard Guenther 57decb7e53 tree.c (tree_fold_gcd): Use build_int_cst where appropriate.
2005-12-22  Richard Guenther  <rguenther@suse.de>

	* tree.c (tree_fold_gcd): Use build_int_cst where appropriate.
	* tree-ssa-loop-ivcanon.c (create_canonical_iv): Likewise.
	* varasm.c (array_size_for_constructor): Likewise.
	* fold-const.c (size_diffop, invert_truthvalue,
	optimize_bit_field_compare, make_range, build_range_check,
	fold_cond_expr_with_comparison, fold_truthop,
	fold_single_bit_test_into_sign_test, fold_binary): Likewise.

From-SVN: r108970
2005-12-22 19:40:27 +00:00
Jon Grimm 15ed7b52cb optabs.c (init_floating_libfuncs): Handle decimal float modes.
* optabs.c (init_floating_libfuncs): Handle decimal float modes.
	(init_optabs): Handle libfuncs for decimal float.
	* genopinit.c (gen_insn): Handle MODE_DECIMAL_FLOAT.
	* stor-layout.c (int_mode_for_mode): Likewise.
	* simplify-rtx.c (simplify_immed_subreg): Likewise.
	(simplify_unary_operation_1): Skip optimisations for decimal float
	modes.
	* varasm.c (output_constant_pool_2): Handle MODE_DECIMAL_FLOAT.
	* emit-rtl.c (gen_const_vector): Add assertion check.
	(init_emit_once): Populate const_tiny_rtx with constants in each
	decimal float mode.
	* expmed.c (extract_high_half, expand_mult_highpart_optab,
	expand_mult_highpart): Assert that mode is not a scalar float
	mode.
	* expr.c (convert_move): Handle conversion between decimal and
	binary floats of the same size.
	* convert.c (convert_to_real): Consider decimal float types when
	folding.
	* dwarf2out.c (base_type_die): Use DW_ATE_decimal_float to
	describe decimal floating point types.

Co-Authored-By: Ben Elliston <bje@au.ibm.com>
Co-Authored-By: Janis Johnson <janis187@us.ibm.com>

From-SVN: r108762
2005-12-19 08:40:47 +11:00
Jakub Jelinek 0a942feac9 varasm.c (default_unique_section_1): Use special section names for SECCAT_DATA_REL{,_RO}{,_LOCAL}.
* varasm.c (default_unique_section_1): Use special section
	names for SECCAT_DATA_REL{,_RO}{,_LOCAL}.

From-SVN: r108602
2005-12-15 23:33:15 +01:00
Richard Sandiford c543ca49c2 final.c (final_scan_insn): Flip in_cold_section_p when changing between the hot and cold sections.
* final.c (final_scan_insn): Flip in_cold_section_p when changing
	between the hot and cold sections.  Use current_function_section
	to get the new section.
	* dwarf2out.c (output_line_info): Use in_cold_section_p to
	determine whether we are assembling hot or cold code.
	(secname_for_decl, dwarf2out_var_location): Likewise.
	(dwarf2out_init, dwarf2out_finish): Use switch_to_section.
	* varasm.c (last_text_section): Delete.
	(in_cold_section_p): New variable.
	(hot_function_section): New function.
	(current_function_section): Pass in_cold_section_p as the
	reloc argument to select_section.  Use it to decide between
	unlikely_function_section and hot_function_section.
	(assemble_start_function): Use switch_to_section.  Set
	in_cold_section_p instead of last_text_section.
	(assemble_end_function): Use switch_to_section.
	(switch_to_section): Don't set last_text_section.
	* config/darwin/darwin.c (machopic_select_section): Trust the reloc
	argument to make the right choice between hot and cold sections.

From-SVN: r108572
2005-12-15 12:40:33 +00:00
Richard Sandiford 98bfa2fb83 output.h (init_section, [...]): Delete.
* output.h (init_section, fini_section): Delete.
	* varasm.c (init_section, fini_section): Delete.
	(init_varasm_once): Don't initialize them.
	* doc/tm.texi (INIT_SECTION_ASM_OP, FINI_SECTION_ASM_OP): Say that
	there are no corresponding varasm.c variables.

From-SVN: r108338
2005-12-10 00:22:11 +00:00
Richard Sandiford 0f67af1ce3 dwarf2out.c (default_eh_frame_section): Delete, moving handling of EH_FRAME_SECTION_NAME into...
* dwarf2out.c (default_eh_frame_section): Delete, moving handling
	of EH_FRAME_SECTION_NAME into...
	(switch_to_eh_frame_section): ...here.  Try to set eh_frame_section
	if it is still null.
	* except.c (default_exception_section): Delete, moving most
	of the code to...
	(switch_to_exception_section): ...this new function.  Set
	exception_section if it is still null, then switch to it.
	(output_function_exception_table): Use switch_to_exception_section.
	* varasm.c (exception_section, eh_frame_section): Update comments.
	(get_section): Hoist use of SECTION_NAMED.
	(init_varasm_once): Don't set exception_section and eh_frame_section.
	* output.h (default_exception_section): Delete.
	(default_eh_frame_section): Delete.

testsuite/
	* gcc.dg/20051207-1.c,
	* gcc.dg/20051207-2.c,
	* gcc.dg/20051207-3.c: New tests.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

From-SVN: r108152
2005-12-07 07:53:14 +00:00
Geoffrey Keating a9b0b82578 Index: gcc/ChangeLog
2005-12-05  Geoffrey Keating  <geoffk@apple.com>

	* varasm.c (default_binds_local_p_1): Weakrefs don't bind locally.
	A hidden weak object does bind locally.  Strong linkonce data
	counts like any other strong symbol for binding.
	(weak_finish_1): Don't specially handle weakrefs, they no longer
	arrive here.
	(assemble_alias): Weakrefs can't be TREE_PUBLIC yet.
	* c-common.c (handle_alias_attribute): Allow static aliases
	of variables.
	(handle_weakref_attribute): Don't call declare_weak on weakrefs.
	* gthr-dce.h: Make weakrefs static.
	* gthr-tpf.h: Likewise.
	* gthr-solaris.h: Likewise.
	* gthr-posix.h: Likewise.
	* gthr-posix95.h: Likewise.
	* config/darwin.c (darwin_encode_section_info): static weakref
	variables are not necessarily defined in this translation unit.
	* doc/extend.texi (Function Attributes): Mention that an alias
	attribute creates a definition for the thing it's attached to.
	Change the documentation for weakref to say that the thing
	it's attached to must be static.

Index: gcc/testsuite/ChangeLog
2005-12-05  Geoffrey Keating  <geoffk@apple.com>

	* g++.old-deja/g++.abi/vtable2.C: Make weakrefs static.
	* gcc.dg/attr-weakref-1.c: Modify to not try to test public weakrefs,
	and to work on Darwin.
	* gcc.dg/attr-weakref-1b.c: New file.
	* gcc.dg/attr-weakref-2.c: New test.
	* gcc.dg/darwin-weakref-1.c: New test.

From-SVN: r108074
2005-12-05 20:38:37 +00:00
Alexandre Oliva 2979bcca5d * varasm.c (ultimate_transparent_alias_target): Add comment.
From-SVN: r107611
2005-11-28 18:18:54 +00:00