summaryrefslogtreecommitdiff
path: root/gcc/except.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-02 18:40:54 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-02 18:40:54 +0000
commitf1d76faf669014f97bd62b72e169387ed88f1201 (patch)
treef42d8ac2181f6aa81b4776a59939e9acada4e38e /gcc/except.c
parent94993257623f2c3e7961ba18dc7ea95d96a88abd (diff)
downloadgcc-f1d76faf669014f97bd62b72e169387ed88f1201.tar.gz
PR other/29639
* except.c (switch_to_exception_section): Do not cache the section if named sections are supported and HAVE_LD_EH_GC_SECTIONS is defined and flag_function_sections is set. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118422 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/except.c')
-rw-r--r--gcc/except.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/except.c b/gcc/except.c
index 306916968e8..39827c9b68d 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -3522,8 +3522,14 @@ sjlj_output_call_site_table (void)
static void
switch_to_exception_section (const char * ARG_UNUSED (fnname))
{
- if (exception_section == 0)
+ section *s;
+
+ if (exception_section)
+ s = exception_section;
+ else
{
+ /* Compute the section and cache it into exception_section,
+ unless it depends on the function name. */
if (targetm.have_named_sections)
{
int flags;
@@ -3539,22 +3545,26 @@ switch_to_exception_section (const char * ARG_UNUSED (fnname))
}
else
flags = SECTION_WRITE;
+
#ifdef HAVE_LD_EH_GC_SECTIONS
if (flag_function_sections)
{
char *section_name = xmalloc (strlen (fnname) + 32);
sprintf (section_name, ".gcc_except_table.%s", fnname);
- exception_section = get_section (section_name, flags, NULL);
+ s = get_section (section_name, flags, NULL);
free (section_name);
}
else
#endif
- exception_section = get_section (".gcc_except_table", flags, NULL);
+ exception_section
+ = s = get_section (".gcc_except_table", flags, NULL);
}
else
- exception_section = flag_pic ? data_section : readonly_data_section;
+ exception_section
+ = s = flag_pic ? data_section : readonly_data_section;
}
- switch_to_section (exception_section);
+
+ switch_to_section (s);
}
#endif