public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH][SPARC] sparc: switch -fasynchronous-unwind-tables on by default.
Date: Thu, 25 Feb 2016 21:16:00 -0000	[thread overview]
Message-ID: <1456435447-23676-1-git-send-email-jose.marchesi@oracle.com> (raw)

In sparc systems glibc uses libgcc's unwinder to implement the
backtrace(3) function, defaulting to a simple non-dwarf unwinder if
libgcc_s doesn't provide a working _Unwind_Backtrace.

However, libgcc's unwinder uses .eh_frame instead of .frame_debug, and
.eh_frame is fully populated only if applications are built with
-fexceptions or -fasynchronous-unwind-tables.

This patch changes GCC to assume -fasynchronous-unwind-tables by default
in sparcv9 and sparc64, like other ports (notably x86) do.

Tested in both sparcv9-*-* and sparc64-*-* targets.

       * common/config/sparc/sparc-common.c (sparc_option_init_struct):
         New function.
         (TARGET_OPTION_INIT_STRUCT): Defined.
---
 gcc/ChangeLog                          |  6 ++++++
 gcc/common/config/sparc/sparc-common.c | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3a13f5f..ba7befe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-25  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+	* common/config/sparc/sparc-common.c (sparc_option_init_struct):
+	New function.
+	(TARGET_OPTION_INIT_STRUCT): Defined.
+
 2016-02-25  Richard Biener  <rguenther@suse.de>
 
 	PR tree-optimization/48795
diff --git a/gcc/common/config/sparc/sparc-common.c b/gcc/common/config/sparc/sparc-common.c
index 3958b7e..1c5bc06 100644
--- a/gcc/common/config/sparc/sparc-common.c
+++ b/gcc/common/config/sparc/sparc-common.c
@@ -24,6 +24,14 @@ along with GCC; see the file COPYING3.  If not see
 #include "common/common-target.h"
 #include "common/common-target-def.h"
 
+/* Implement TARGET_OPTION_INIT_STRUCT.  */
+
+static void
+sparc_option_init_struct (struct gcc_options *opts)
+{
+  opts->x_flag_asynchronous_unwind_tables = 2;
+}
+
 /* Implement TARGET_OPTION_OPTIMIZATION_TABLE.  */
 static const struct default_options sparc_option_optimization_table[] =
   {
@@ -31,6 +39,8 @@ static const struct default_options sparc_option_optimization_table[] =
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };
 
+#undef TARGET_OPTION_INIT_STRUCT
+#define TARGET_OPTION_INIT_STRUCT sparc_option_init_struct
 #undef TARGET_DEFAULT_TARGET_FLAGS
 #define TARGET_DEFAULT_TARGET_FLAGS TARGET_DEFAULT
 #undef TARGET_OPTION_OPTIMIZATION_TABLE
-- 
2.3.4

             reply	other threads:[~2016-02-25 21:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 21:16 Jose E. Marchesi [this message]
2016-02-28 18:35 ` Eric Botcazou
2016-02-29 15:42   ` Jose E. Marchesi
2016-03-09 10:03     ` Eric Botcazou
2016-03-15 16:38       ` Jose E. Marchesi
2016-03-17 21:17     ` Richard Henderson
2016-03-18  1:07       ` Jose E. Marchesi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456435447-23676-1-git-send-email-jose.marchesi@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).