aboutsummaryrefslogtreecommitdiff
path: root/gcc/except.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard@codesourcery.com>2005-12-10 00:20:16 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2005-12-10 00:20:16 +0000
commit0f67af1ce30cdee9273baa65166fabbcb6eb04b8 (patch)
tree7670fde6cf99d8c4dcfee7a32b97bae2259e7736 /gcc/except.c
parent386e0f8c3e02ce5f2e88395c9180f0f1ad1c42fd (diff)
downloadgcc-0f67af1ce30cdee9273baa65166fabbcb6eb04b8.zip
gcc-0f67af1ce30cdee9273baa65166fabbcb6eb04b8.tar.gz
gcc-0f67af1ce30cdee9273baa65166fabbcb6eb04b8.tar.bz2
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
Diffstat (limited to 'gcc/except.c')
-rw-r--r--gcc/except.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/gcc/except.c b/gcc/except.c
index 782a516..f8aed34 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -3425,30 +3425,34 @@ sjlj_output_call_site_table (void)
call_site_base += n;
}
-/* Return the default value of exception_section. */
+/* Switch to the section that should be used for exception tables. */
-section *
-default_exception_section (void)
+static void
+switch_to_exception_section (void)
{
- if (targetm.have_named_sections)
+ if (exception_section == 0)
{
- int flags;
-
- if (EH_TABLES_CAN_BE_READ_ONLY)
+ if (targetm.have_named_sections)
{
- int tt_format = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/1);
-
- flags = (! flag_pic
- || ((tt_format & 0x70) != DW_EH_PE_absptr
- && (tt_format & 0x70) != DW_EH_PE_aligned))
- ? 0 : SECTION_WRITE;
+ int flags;
+
+ if (EH_TABLES_CAN_BE_READ_ONLY)
+ {
+ int tt_format =
+ ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/1);
+ flags = ((! flag_pic
+ || ((tt_format & 0x70) != DW_EH_PE_absptr
+ && (tt_format & 0x70) != DW_EH_PE_aligned))
+ ? 0 : SECTION_WRITE);
+ }
+ else
+ flags = SECTION_WRITE;
+ exception_section = get_section (".gcc_except_table", flags, NULL);
}
else
- flags = SECTION_WRITE;
- return get_section (".gcc_except_table", flags, NULL);
+ exception_section = flag_pic ? data_section : readonly_data_section;
}
- else
- return flag_pic ? data_section : readonly_data_section;
+ switch_to_section (exception_section);
}
@@ -3530,7 +3534,7 @@ output_function_exception_table (void)
/* Note that varasm still thinks we're in the function's code section.
The ".endp" directive that will immediately follow will take us back. */
#else
- switch_to_section (exception_section);
+ switch_to_exception_section ();
#endif
have_tt_data = (VEC_length (tree, cfun->eh->ttype_data) > 0