From patchwork Wed Oct 3 03:06:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 188705 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 DD7272C0089 for ; Wed, 3 Oct 2012 13:06:43 +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=1349838404; 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=g68iYbp RerHEowZahkH5cysMvEQ=; b=Ejffz8HtPJkpv5w2rmohJ+3CXs7rM8pk9cZrjOz bUTJlnEhIfHFyizhBwAcb2V2/ndBVpjHifSt8ZjHndFxX1kKCpm2lHqgL4OW+zMk 6qKCEDy00xbJQ6O91Pg45xFtZd5dYLtAmerNItcGlKp02ZdIWFICWcwSix2GL6VO 9Wu8= 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=JHYFCnCzSZrHsltYUYGNm9EQsxToKSrbHyUKddSCODlBGCIOLppQSYznZpZQvE +vG5KtbpBCTZd3n2UUC1UBlOagXDcUopVRct74bokC5vKNaFkXCgpO08ppSQ0SDl oa06DOvsA+y7xVvv1Sg9bPbk8P89J/fM7ramOtjrWKpvg=; Received: (qmail 1370 invoked by alias); 3 Oct 2012 03:06:40 -0000 Received: (qmail 1360 invoked by uid 22791); 3 Oct 2012 03:06:38 -0000 X-SWARE-Spam-Status: No, hits=-3.4 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, SARE_LWSHORTT, TW_BD, TW_BF, TW_DB, TW_DF, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-pb0-f47.google.com (HELO mail-pb0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Oct 2012 03:06:32 +0000 Received: by pbbro12 with SMTP id ro12so9835546pbb.20 for ; Tue, 02 Oct 2012 20:06:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.217.104 with SMTP id ox8mr9365640pbc.35.1349233591541; Tue, 02 Oct 2012 20:06:31 -0700 (PDT) Received: by 10.66.20.232 with HTTP; Tue, 2 Oct 2012 20:06:31 -0700 (PDT) Date: Wed, 3 Oct 2012 05:06:31 +0200 Message-ID: Subject: [PATCH, build]: Compile with -fasynchronous-unwind-tables From: Uros Bizjak To: Ian Lance Taylor Cc: Gabriel Dos Reis , Jakub Jelinek , Andreas Schwab , 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 8:31 PM, Ian Lance Taylor 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). There is slight increase in bootstrap compile time with expected differences in .debug_frame and .eh_frame sections, but decrease in overal size of the executables. Bootstrap on alphaev68-pc-linux-gnu native, c,c++ languages only: real 139m1.755s user 437m33.065s sys 17m54.324s 88266972 Oct 3 01:07 cc1 106976374 Oct 3 01:07 cc1plus readelf -S gcc/cc1 There are 42 section headers, starting at offset 0x5287728: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .interp PROGBITS 00000001200002a8 000002a8 0000000000000013 0000000000000000 A 0 0 1 [ 2] .note.ABI-tag NOTE 00000001200002bc 000002bc 0000000000000020 0000000000000000 A 0 0 4 [ 3] .hash HASH 00000001200002e0 000002e0 00000000000154d0 0000000000000008 A 5 0 8 [ 4] .gnu.hash GNU_HASH 00000001200157b0 000157b0 000000000000be78 0000000000000000 A 5 0 8 [ 5] .dynsym DYNSYM 0000000120021628 00021628 0000000000030e88 0000000000000018 A 6 1 8 [ 6] .dynstr STRTAB 00000001200524b0 000524b0 000000000004aec9 0000000000000000 A 0 0 1 [ 7] .gnu.version VERSYM 000000012009d37a 0009d37a 0000000000004136 0000000000000002 A 5 0 2 [ 8] .gnu.version_r VERNEED 00000001200a14b0 000a14b0 00000000000000d0 0000000000000000 A 6 3 8 [ 9] .rela.dyn RELA 00000001200a1580 000a1580 0000000000000888 0000000000000018 A 5 0 8 [10] .rela.plt RELA 00000001200a1e08 000a1e08 0000000000001608 0000000000000018 A 5 12 8 [11] .init PROGBITS 00000001200a3410 000a3410 0000000000000038 0000000000000000 AX 0 0 8 [12] .plt PROGBITS 00000001200a3450 000a3450 00000000000003d0 0000000000000000 AX 0 0 16 [13] .text PROGBITS 00000001200a3820 000a3820 0000000000a21890 0000000000000000 AX 0 0 16 [14] .fini PROGBITS 0000000120ac50b0 00ac50b0 0000000000000028 0000000000000000 AX 0 0 8 [15] .rodata PROGBITS 0000000120ac50d8 00ac50d8 00000000000f7ba8 0000000000000000 A 0 0 8 [16] .eh_frame_hdr PROGBITS 0000000120bbcc80 00bbcc80 00000000000005dc 0000000000000000 A 0 0 4 [17] .eh_frame PROGBITS 0000000120bbd260 00bbd260 0000000000001dac 0000000000000000 A 0 0 8 [18] .gcc_except_table PROGBITS 0000000120bbf00c 00bbf00c 00000000000000f8 0000000000000000 A 0 0 4 [19] .tbss NOBITS 0000000120bc0be8 00bc0be8 0000000000000010 0000000000000000 WAT 0 0 8 [20] .init_array INIT_ARRAY 0000000120bc0be8 00bc0be8 0000000000000030 0000000000000000 WA 0 0 8 [21] .fini_array FINI_ARRAY 0000000120bc0c18 00bc0c18 0000000000000008 0000000000000000 WA 0 0 8 [22] .jcr PROGBITS 0000000120bc0c20 00bc0c20 0000000000000008 0000000000000000 WA 0 0 8 [23] .data.rel.ro PROGBITS 0000000120bc0c28 00bc0c28 000000000001b188 0000000000000000 WA 0 0 8 [24] .dynamic DYNAMIC 0000000120bdbdb0 00bdbdb0 0000000000000250 0000000000000010 WA 6 0 8 [25] .data PROGBITS 0000000120bdc000 00bdc000 0000000000008aa8 0000000000000000 WA 0 0 8 [26] .got PROGBITS 0000000120be4aa8 00be4aa8 000000000001aec8 0000000000000000 WA 0 0 8 [27] .sdata PROGBITS 0000000120bff970 00bff970 0000000000000a40 0000000000000000 WAp 0 0 8 [28] .sbss NOBITS 0000000120c003b0 00c003b0 0000000000002fd0 0000000000000000 WAp 0 0 8 [29] .bss NOBITS 0000000120c03380 00c003b0 0000000000068ac0 0000000000000000 WA 0 0 16 [30] .comment PROGBITS 0000000000000000 00c003b0 000000000000006e 0000000000000001 MS 0 0 1 [31] .debug_aranges PROGBITS 0000000000000000 00c0041e 000000000000e880 0000000000000000 0 0 1 [32] .debug_info PROGBITS 0000000000000000 00c0ec9e 0000000001df3c01 0000000000000000 0 0 1 [33] .debug_abbrev PROGBITS 0000000000000000 02a0289f 00000000000a6fba 0000000000000000 0 0 1 [34] .debug_line PROGBITS 0000000000000000 02aa9859 00000000002a8b78 0000000000000000 0 0 1 [35] .debug_frame PROGBITS 0000000000000000 02d523d8 00000000000ae558 0000000000000000 0 0 8 [36] .debug_str PROGBITS 0000000000000000 02e00930 000000000012bc32 0000000000000001 MS 0 0 1 [37] .debug_loc PROGBITS 0000000000000000 02f2c562 0000000001ae5dfb 0000000000000000 0 0 1 [38] .debug_ranges PROGBITS 0000000000000000 04a1235d 0000000000875240 0000000000000000 0 0 1 [39] .shstrtab STRTAB 0000000000000000 0528759d 0000000000000184 0000000000000000 0 0 1 [40] .symtab SYMTAB 0000000000000000 052881a8 00000000000a1160 0000000000000018 41 19147 8 [41] .strtab STRTAB 0000000000000000 05329308 00000000001045d4 0000000000000000 0 0 1 with -fasynchronous-unwind-tables: real 138m44.140s user 438m27.437s sys 18m4.465s 88245562 Oct 2 22:45 cc1 106953548 Oct 2 22:45 cc1plus readelf -S gcc/cc1 There are 42 section headers, starting at offset 0x5282398: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .interp PROGBITS 00000001200002a8 000002a8 0000000000000013 0000000000000000 A 0 0 1 [ 2] .note.ABI-tag NOTE 00000001200002bc 000002bc 0000000000000020 0000000000000000 A 0 0 4 [ 3] .hash HASH 00000001200002e0 000002e0 00000000000154d0 0000000000000008 A 5 0 8 [ 4] .gnu.hash GNU_HASH 00000001200157b0 000157b0 000000000000be78 0000000000000000 A 5 0 8 [ 5] .dynsym DYNSYM 0000000120021628 00021628 0000000000030e88 0000000000000018 A 6 1 8 [ 6] .dynstr STRTAB 00000001200524b0 000524b0 000000000004aec9 0000000000000000 A 0 0 1 [ 7] .gnu.version VERSYM 000000012009d37a 0009d37a 0000000000004136 0000000000000002 A 5 0 2 [ 8] .gnu.version_r VERNEED 00000001200a14b0 000a14b0 00000000000000d0 0000000000000000 A 6 3 8 [ 9] .rela.dyn RELA 00000001200a1580 000a1580 0000000000000888 0000000000000018 A 5 0 8 [10] .rela.plt RELA 00000001200a1e08 000a1e08 0000000000001608 0000000000000018 A 5 12 8 [11] .init PROGBITS 00000001200a3410 000a3410 0000000000000038 0000000000000000 AX 0 0 8 [12] .plt PROGBITS 00000001200a3450 000a3450 00000000000003d0 0000000000000000 AX 0 0 16 [13] .text PROGBITS 00000001200a3820 000a3820 0000000000a21890 0000000000000000 AX 0 0 16 [14] .fini PROGBITS 0000000120ac50b0 00ac50b0 0000000000000028 0000000000000000 AX 0 0 8 [15] .rodata PROGBITS 0000000120ac50d8 00ac50d8 00000000000f7ba8 0000000000000000 A 0 0 8 [16] .eh_frame_hdr PROGBITS 0000000120bbcc80 00bbcc80 000000000001a86c 0000000000000000 A 0 0 4 [17] .eh_frame PROGBITS 0000000120bd74f0 00bd74f0 000000000008b3b4 0000000000000000 A 0 0 8 [18] .gcc_except_table PROGBITS 0000000120c628a4 00c628a4 00000000000000f8 0000000000000000 A 0 0 4 [19] .tbss NOBITS 0000000120c72be8 00c62be8 0000000000000010 0000000000000000 WAT 0 0 8 [20] .init_array INIT_ARRAY 0000000120c72be8 00c62be8 0000000000000030 0000000000000000 WA 0 0 8 [21] .fini_array FINI_ARRAY 0000000120c72c18 00c62c18 0000000000000008 0000000000000000 WA 0 0 8 [22] .jcr PROGBITS 0000000120c72c20 00c62c20 0000000000000008 0000000000000000 WA 0 0 8 [23] .data.rel.ro PROGBITS 0000000120c72c28 00c62c28 000000000001b188 0000000000000000 WA 0 0 8 [24] .dynamic DYNAMIC 0000000120c8ddb0 00c7ddb0 0000000000000250 0000000000000010 WA 6 0 8 [25] .data PROGBITS 0000000120c8e000 00c7e000 0000000000008aa8 0000000000000000 WA 0 0 8 [26] .got PROGBITS 0000000120c96aa8 00c86aa8 000000000001aec8 0000000000000000 WA 0 0 8 [27] .sdata PROGBITS 0000000120cb1970 00ca1970 0000000000000a40 0000000000000000 WAp 0 0 8 [28] .sbss NOBITS 0000000120cb23b0 00ca23b0 0000000000002fd0 0000000000000000 WAp 0 0 8 [29] .bss NOBITS 0000000120cb5380 00ca23b0 0000000000068ac0 0000000000000000 WA 0 0 16 [30] .comment PROGBITS 0000000000000000 00ca23b0 000000000000006e 0000000000000001 MS 0 0 1 [31] .debug_aranges PROGBITS 0000000000000000 00ca241e 000000000000e880 0000000000000000 0 0 1 [32] .debug_info PROGBITS 0000000000000000 00cb0c9e 0000000001df3c01 0000000000000000 0 0 1 [33] .debug_abbrev PROGBITS 0000000000000000 02aa489f 00000000000a6fba 0000000000000000 0 0 1 [34] .debug_line PROGBITS 0000000000000000 02b4b859 00000000002a6660 0000000000000000 0 0 1 [35] .debug_frame PROGBITS 0000000000000000 02df1ec0 0000000000009710 0000000000000000 0 0 8 [36] .debug_str PROGBITS 0000000000000000 02dfb5d0 000000000012bc07 0000000000000001 MS 0 0 1 [37] .debug_loc PROGBITS 0000000000000000 02f271d7 0000000001ae5dfb 0000000000000000 0 0 1 [38] .debug_ranges PROGBITS 0000000000000000 04a0cfd2 0000000000875240 0000000000000000 0 0 1 [39] .shstrtab STRTAB 0000000000000000 05282212 0000000000000184 0000000000000000 0 0 1 [40] .symtab SYMTAB 0000000000000000 05282e18 00000000000a1160 0000000000000018 41 19147 8 [41] .strtab STRTAB 0000000000000000 05323f78 00000000001045c2 0000000000000000 0 0 1 2012-10-03 Uros Bizjak * configure.ac (noexception_flags): Add -fasynchronous-unwind-tables. * configure: Regenerate. Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32} and alphaev68-pc-linux-gnu. OK for mainline? Uros. 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 -fasynchronous-unwind-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 -fasynchronous-unwind-tables])), + [noexception_flags]) # Enable expensive internal checks is_release=