diff mbox

[build] : Compile with -fasynchronous-unwind-tables

Message ID CAFULd4b-k8PzeXSjYQ1irw2VaFNihLEpy55cH46jNZLC+D1BFw@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Oct. 3, 2012, 3:06 a.m. UTC
On Tue, Oct 2, 2012 at 8:31 PM, Ian Lance Taylor <iant@google.com> 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  <ubizjak@gmail.com>

        * 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.

Comments

Ian Lance Taylor Oct. 3, 2012, 4:28 a.m. UTC | #1
On Tue, Oct 2, 2012 at 8:06 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>
> 2012-10-03  Uros Bizjak  <ubizjak@gmail.com>
>
>         * configure.ac (noexception_flags): Add -fasynchronous-unwind-tables.
>         * configure: Regenerate.

Thanks for measuring.  This is OK if nobody objects within 24 hours.

Ian
diff mbox

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 -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=