This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix HP-PA C++ failures
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 12 Aug 2007 01:16:46 +0200
- Subject: Fix HP-PA C++ failures
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)