On Tue, Oct 2, 2012 at 12:58 AM, Ian Lance Taylor <i...@google.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. Yes, you are correct. -funwind-tables works as well. >> 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. I have simplified the check for -funwind-tables to just look if the library is compiled with gcc. This option is supported by gcc-2.96 (and probably earlier versions too). 2012-10-02 Uros Bizjak <ubiz...@gmail.com> PR other/54761 * configure.ac (CFLAGS): Add -funwind-tables when compiling with GCC. * configure: Regenerate. The patch is re-tested on x86_64-linux-gnu and alphaev68-linux-gnu. OK for mainline? Uros.
Index: configure =================================================================== --- configure (revision 191953) +++ configure (working copy) @@ -4872,8 +4872,12 @@ +if test "x$GCC" = "xyes"; then + CFLAGS="$CFLAGS -funwind-tables" +fi + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 @@ -11080,7 +11084,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11083 "configure" +#line 11087 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11186,7 +11190,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11189 "configure" +#line 11193 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: configure.ac =================================================================== --- configure.ac (revision 191953) +++ configure.ac (working copy) @@ -66,6 +66,10 @@ AC_PROG_CC m4_rename_force([backtrace_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) +if test "x$GCC" = "xyes"; then + CFLAGS="$CFLAGS -funwind-tables" +fi + AC_SUBST(CFLAGS) AC_PROG_RANLIB