Patchwork [v2,libbacktrace] : Compile with -funwind-tables

login
register
mail settings
Submitter Uros Bizjak
Date Oct. 2, 2012, 5:48 p.m.
Message ID <CAFULd4bdzuOmdmoWfZZC4vovBfEzdm+oXaQ7D1eSPrMWrTqW3g@mail.gmail.com>
Download mbox | patch
Permalink /patch/188591/
State New
Headers show

Comments

Uros Bizjak - Oct. 2, 2012, 5:48 p.m.
On Tue, Oct 2, 2012 at 7:44 PM, Gabriel Dos Reis
<gdr@integrable-solutions.net> wrote:

>>> > On a related issue, it looks to me that the compiler itself should be
>>> > compiled with -funwind-tables, otherwise there are no backtraces
>>> > generated, even if libbacktrace is linked in and operational. Again,
>>> > x86_64-linux-gnu host defaults to this flag, but other hosts are left
>>> > behind.
>>>
>>> Compiling with C++ should always give us -funwind-tables.
>>
>> It doesn't give that, because the compiler is compiled with
>> -fno-exceptions -fno-rtti.
>
> I believe in the long term we would to drop either of those.

For the short term, I am bootstrapping attached patch, that adds
-funwind-tables to other noexcept flags.

Uros.
Ian Taylor - Oct. 2, 2012, 6:31 p.m.
On Tue, Oct 2, 2012 at 10:48 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Tue, Oct 2, 2012 at 7:44 PM, Gabriel Dos Reis
> <gdr@integrable-solutions.net> wrote:
>
>>>> > On a related issue, it looks to me that the compiler itself should be
>>>> > compiled with -funwind-tables, otherwise there are no backtraces
>>>> > generated, even if libbacktrace is linked in and operational. Again,
>>>> > x86_64-linux-gnu host defaults to this flag, but other hosts are left
>>>> > behind.
>>>>
>>>> Compiling with C++ should always give us -funwind-tables.
>>>
>>> It doesn't give that, because the compiler is compiled with
>>> -fno-exceptions -fno-rtti.
>>
>> I believe in the long term we would to drop either of those.
>
> For the short term, I am bootstrapping attached patch, that adds
> -funwind-tables to other noexcept flags.

I think you should use -fasynchronous-unwind-tables here.  That way we
can get a backtrace if the compiler gets a segmentation violation.

I'll approve this patch with that change.  But you might want to check
whether you can see any change in bootstrap time or compiler size
(sorry).

Thanks.

Ian

Patch

Index: configure
===================================================================
--- configure	(revision 191991)
+++ configure	(working copy)
@@ -6636,7 +6636,7 @@ 
 # Disable exceptions and RTTI if building with g++
 noexception_flags=
 save_CFLAGS="$CFLAGS"
-for real_option in -fno-exceptions -fno-rtti; do
+for real_option in -fno-exceptions -fno-rtti -funwind-tables; do
   # Do the check with the no- prefix removed since gcc silently
   # accepts any -Wno-* option on purpose
   case $real_option in
Index: configure.ac
===================================================================
--- configure.ac	(revision 191991)
+++ configure.ac	(working copy)
@@ -365,7 +365,8 @@ 
 
 # Disable exceptions and RTTI if building with g++
 ACX_PROG_CC_WARNING_OPTS(
-	m4_quote(m4_do([-fno-exceptions -fno-rtti])), [noexception_flags])
+	m4_quote(m4_do([-fno-exceptions -fno-rtti -funwind-tables])),
+		       [noexception_flags])
 	
 # Enable expensive internal checks
 is_release=