Patchwork [libbacktrace] : Compile with -fasynchronous-unwind-tables

login
register
mail settings
Submitter Uros Bizjak
Date Oct. 1, 2012, 9:12 p.m.
Message ID <CAFULd4aEDzemz1QcvAyttTLYbxMEdym+4XnWrrdbXVR_dfVA3w@mail.gmail.com>
Download mbox | patch
Permalink /patch/188347/
State New
Headers show

Comments

Uros Bizjak - Oct. 1, 2012, 9:12 p.m.
Hello!

Without -fasynchronous-unwind-tables, FDE is not generated for
backtrace_full and backtrace_simple wrappers. Without FDE, unwinding
terminates at these functions.

Attached patch fixes this problem by adding
-fasynchronous-unwind-tables, and this way forcing FDEs for all
functions. With this change, btest passes OK, failing log and
runtime/pprof from libgo testsuite also pass OK.

BTW: It would be enough to compile only backtrace.c and simple.c with
-fasynchronous-unwind-tables, since critical wrapper functions live
here.

2012-10-01  Uros Bizjak  <ubizjak@gmail.com>

        PR other/54761
        * Makefile.am (AM_CFLAGS): Add -fasynchronous-unwind-tables.
        * Makefile.in: Regenerate.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
{,-m32} and alphaev68-pc-linux-gnu (where fixes all mentioned
unwinding failures).

OK for mainline?

Uros.
Ian Taylor - Oct. 1, 2012, 10:58 p.m.
On Mon, Oct 1, 2012 at 2:12 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>
> Without -fasynchronous-unwind-tables, FDE is not generated for
> backtrace_full and backtrace_simple wrappers. Without FDE, unwinding
> terminates at these functions.

I'm not opposed to -fasynchronous-unwind-tables, but now that you
bring it up I'm fairly certain that it would suffice to use
-funwind-tables.  I've been testing mainly on x86_64, and I forgot
that on x86_64 -funwind-tables is the default.  Sorry about that.  And
-fasynchronous-unwind-tables is the default also, so I could be wrong
that -funwind-tables is all that is needed.

> Attached patch fixes this problem by adding
> -fasynchronous-unwind-tables, and this way forcing FDEs for all
> functions. With this change, btest passes OK, failing log and
> runtime/pprof from libgo testsuite also pass OK.

This is basically fine but libbacktrace may be compiled by the host
compiler and that may not be GCC, so please add a configure test to
see if the compiler accepts the -fasynchronous-unwind-tables option.

Ian

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 191932)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2012-10-01  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR other/54761
+	* Makefile.am (AM_CFLAGS): Add -fasynchronous-unwind-tables.
+	* Makefile.in: Regenerate.
+
 2012-09-29  Ian Lance Taylor  <iant@google.com>
 
 	PR other/54749
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 191932)
+++ Makefile.am	(working copy)
@@ -34,7 +34,7 @@ 
 AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
 	-I ../libgcc -I ../gcc/include -I $(MULTIBUILDTOP)../../gcc/include
 
-AM_CFLAGS = $(WARN_FLAGS) $(PIC_FLAG)
+AM_CFLAGS = $(WARN_FLAGS) $(PIC_FLAG) -fasynchronous-unwind-tables
 
 noinst_LTLIBRARIES = libbacktrace.la
 
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 191932)
+++ Makefile.in	(working copy)
@@ -253,7 +253,7 @@ 
 AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
 	-I ../libgcc -I ../gcc/include -I $(MULTIBUILDTOP)../../gcc/include
 
-AM_CFLAGS = $(WARN_FLAGS) $(PIC_FLAG)
+AM_CFLAGS = $(WARN_FLAGS) $(PIC_FLAG) -fasynchronous-unwind-tables
 noinst_LTLIBRARIES = libbacktrace.la
 libbacktrace_la_SOURCES = \
 	backtrace.h \