public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix HP-PA C++ failures
@ 2007-08-11 23:16 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2007-08-11 23:16 UTC (permalink / raw)
  To: gcc-patches

Hi,
On HPPA the collect2 is collecting also static symbols leading to link
errors since my changes to constructors/destructors mechanizm.
This patch avoids it by making those ctors/dtors always inline as was
originally suggested by Mark anyway.

Bootstrapped/regtested i686-linux and hppa. Comitted.
I apologize for the delays with comitting the patch, I lost track here.

Honza

	* cgraphunit.c (record_cdtor_fn): Declare all cdtors always inlined.
	(cgraph_process_new_functions): Honor previous value of
	disregard_inline_limits.
	* ipa-inline.c (compute_inline_parameters): Likewise.
Index: cgraphunit.c
===================================================================
*** cgraphunit.c	(revision 126480)
--- cgraphunit.c	(working copy)
*************** static GTY (()) tree static_dtors;
*** 181,201 ****
  static void
  record_cdtor_fn (tree fndecl)
  {
!   if (targetm.have_ctors_dtors)
      return;
  
    if (DECL_STATIC_CONSTRUCTOR (fndecl))
      {
        static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors);
        DECL_STATIC_CONSTRUCTOR (fndecl) = 0;
-       cgraph_mark_reachable_node (cgraph_node (fndecl));
      }
    if (DECL_STATIC_DESTRUCTOR (fndecl))
      {
        static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors);
        DECL_STATIC_DESTRUCTOR (fndecl) = 0;
-       cgraph_mark_reachable_node (cgraph_node (fndecl));
      }
  }
  
  /* Synthesize a function which calls all the global ctors or global
--- 181,206 ----
  static void
  record_cdtor_fn (tree fndecl)
  {
!   struct cgraph_node *node;
!   if (targetm.have_ctors_dtors
!       || (!DECL_STATIC_CONSTRUCTOR (fndecl)
! 	  && !DECL_STATIC_DESTRUCTOR (fndecl)))
      return;
  
    if (DECL_STATIC_CONSTRUCTOR (fndecl))
      {
        static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors);
        DECL_STATIC_CONSTRUCTOR (fndecl) = 0;
      }
    if (DECL_STATIC_DESTRUCTOR (fndecl))
      {
        static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors);
        DECL_STATIC_DESTRUCTOR (fndecl) = 0;
      }
+   DECL_INLINE (fndecl) = 1;
+   node = cgraph_node (fndecl);
+   node->local.disregard_inline_limits = 1;
+   cgraph_mark_reachable_node (node);
  }
  
  /* Synthesize a function which calls all the global ctors or global
*************** cgraph_process_new_functions (void)
*** 377,383 ****
  	  node->local.self_insns = estimate_num_insns (fndecl,
  						       &eni_inlining_weights);
  	  node->local.disregard_inline_limits
! 	    = lang_hooks.tree_inlining.disregard_inline_limits (fndecl);
  	  /* Inlining characteristics are maintained by the
  	     cgraph_mark_inline.  */
  	  node->global.insns = node->local.self_insns;
--- 382,388 ----
  	  node->local.self_insns = estimate_num_insns (fndecl,
  						       &eni_inlining_weights);
  	  node->local.disregard_inline_limits
! 	    |= lang_hooks.tree_inlining.disregard_inline_limits (fndecl);
  	  /* Inlining characteristics are maintained by the
  	     cgraph_mark_inline.  */
  	  node->global.insns = node->local.self_insns;
Index: ipa-inline.c
===================================================================
*** ipa-inline.c	(revision 126480)
--- ipa-inline.c	(working copy)
*************** compute_inline_parameters (void)
*** 1528,1534 ****
    node->local.inlinable = tree_inlinable_function_p (current_function_decl);
    node->local.self_insns = estimate_num_insns (current_function_decl,
  					       &eni_inlining_weights);
!   if (node->local.inlinable)
      node->local.disregard_inline_limits
        = lang_hooks.tree_inlining.disregard_inline_limits (current_function_decl);
    if (flag_really_no_inline && !node->local.disregard_inline_limits)
--- 1528,1534 ----
    node->local.inlinable = tree_inlinable_function_p (current_function_decl);
    node->local.self_insns = estimate_num_insns (current_function_decl,
  					       &eni_inlining_weights);
!   if (node->local.inlinable && !node->local.disregard_inline_limits)
      node->local.disregard_inline_limits
        = lang_hooks.tree_inlining.disregard_inline_limits (current_function_decl);
    if (flag_really_no_inline && !node->local.disregard_inline_limits)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-11 23:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-11 23:16 Fix HP-PA C++ failures Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).