re PR middle-end/46671 (ICE in default_no_named_section, at varasm .c:5994)

PR middle-end/46671
	PR target/46685
	* config/pa/pa.c (pa_function_section): New function.
	(TARGET_ASM_FUNCTION_SECTION): Define.

From-SVN: r167581
This commit is contained in:
John David Anglin 2010-12-08 01:26:44 +00:00 committed by John David Anglin
parent f38716953d
commit 7550cb35d1
2 changed files with 33 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2010-12-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR middle-end/46671
PR target/46685
* config/pa/pa.c (pa_function_section): New function.
(TARGET_ASM_FUNCTION_SECTION): Define.
2010-12-07 Ian Lance Taylor <iant@google.com>
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>

View file

@ -181,6 +181,7 @@ static bool pa_print_operand_punct_valid_p (unsigned char);
static rtx pa_internal_arg_pointer (void);
static bool pa_can_eliminate (const int, const int);
static void pa_conditional_register_usage (void);
static section *pa_function_section (tree, enum node_frequency, bool, bool);
/* The following extra sections are only used for SOM. */
static GTY(()) section *som_readonly_data_section;
@ -388,6 +389,8 @@ static const struct default_options pa_option_optimization_table[] =
#define TARGET_CAN_ELIMINATE pa_can_eliminate
#undef TARGET_CONDITIONAL_REGISTER_USAGE
#define TARGET_CONDITIONAL_REGISTER_USAGE pa_conditional_register_usage
#undef TARGET_ASM_FUNCTION_SECTION
#define TARGET_ASM_FUNCTION_SECTION pa_function_section
struct gcc_target targetm = TARGET_INITIALIZER;
@ -10200,4 +10203,27 @@ pa_conditional_register_usage (void)
fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;
}
/* Target hook for function_section. */
static section *
pa_function_section (tree decl, enum node_frequency freq,
bool startup, bool exit)
{
/* Put functions in text section if target doesn't have named sections. */
if (!targetm.have_named_sections)
return text_section;
/* Force nested functions into the same section as the containing
function. */
if (decl
&& DECL_SECTION_NAME (decl) == NULL_TREE
&& DECL_CONTEXT (decl) != NULL_TREE
&& TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL
&& DECL_SECTION_NAME (DECL_CONTEXT (decl)) == NULL_TREE)
return function_section (DECL_CONTEXT (decl));
/* Otherwise, use the default function section. */
return default_function_section (decl, freq, startup, exit);
}
#include "gt-pa.h"