From patchwork Tue Oct 2 07:41:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 188411 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 253862C00A8 for ; Tue, 2 Oct 2012 17:42:06 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1349768527; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=xZaq8uc Va6v7lcNVnJQKnf78dnQ=; b=e+eBIh4A49T8+jWfuG1Z8bZ79C2j/bmEka+kbKE zR37Bh6jmQetRqRP7pOZCG9ZNB5z2RJpyGkJ7tnFwnQqVgksdl9+WMV+RTyiVtGg b7ybuurnldk0QlO0q/7p73sI/LeYlJ3xXdr/DTUWrKLDLbDbcoEP10vKo3UUVaQH rU7Q= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Lj8qskWAiYbac/xSTnz5YsiJkID06Yb0Q5d5DgXmgFahm0tTVhABDOhi2pyO/3 bsGwbAeOlCmCqsLEGrW4ufJlkQicTEiObsw0ZdFmO6snJwwnMvc9Z08PKdGAjD0S 14F7fJG9ctLRteolgzi1p+BtnyRZKMrJk9BjN1EBQ6ukM=; Received: (qmail 13211 invoked by alias); 2 Oct 2012 07:42:00 -0000 Received: (qmail 13199 invoked by uid 22791); 2 Oct 2012 07:41:58 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-da0-f47.google.com (HELO mail-da0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Oct 2012 07:41:54 +0000 Received: by daks35 with SMTP id s35so1862929dak.20 for ; Tue, 02 Oct 2012 00:41:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.217.104 with SMTP id ox8mr2210636pbc.35.1349163713756; Tue, 02 Oct 2012 00:41:53 -0700 (PDT) Received: by 10.66.20.232 with HTTP; Tue, 2 Oct 2012 00:41:53 -0700 (PDT) Date: Tue, 2 Oct 2012 09:41:53 +0200 Message-ID: Subject: [PATCH v2, libbacktrace]: Compile with -funwind-tables From: Uros Bizjak To: Ian Lance Taylor Cc: gcc-patches@gcc.gnu.org Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Tue, Oct 2, 2012 at 12:58 AM, Ian Lance Taylor 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 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