public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/56287] New: __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none @ 2013-02-11 14:59 honyakeprt at centrum dot cz 2013-02-11 15:20 ` [Bug c++/56287] " rguenth at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: honyakeprt at centrum dot cz @ 2013-02-11 14:59 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56287 Bug #: 56287 Summary: __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: honyakeprt@centrum.cz Hi, I am using gcc 4.7.2 under cygwin Using built-in specs. COLLECT_GCC=./powerpc-unknown-eabi-gcc-4.7.2 COLLECT_LTO_WRAPPER=/home/JKe/cross/libexec/gcc/powerpc-unknown-eabi/4.7.2/lto-w rapper.exe Target: powerpc-unknown-eabi Configured with: ....... Tmp/cross-toolchain-mpc8xx-eabi-tmp/gcc-4.7.2/configure --enable-languages=c,c++ --config-cache --prefix=/h ome/JKe/cross --target=powerpc-unknown-eabi --with-cpu=860 --without-fp --with-f loat=soft --disable-nls --disable-shared --disable-libssp --disable-libgomp --di sable-libmudflap --disable-libquadmath --disable-multilib --disable-decimal-floa t --disable-fixed-point --enable-threads=posix --with-newlib --with-gnu-ld --wit h-gnu-as --enable-lto Thread model: posix gcc version 4.7.2 (GCC) when I enable compilation/linking with LTO partitioning NONE, the .ctors constructor table gets somehow damaged. The symbol __CTOR_END__ points before the __CTOR_LIST__!!! Therefore the __do_global_ctors_aux() function is crashing. Here is an example: Compiler flags : -O2 -flto -fdata-sections -ffunction-sections -mno-strict-align -g3 -Wall -Wpointer-arith -Wwrite-strings -Wunused-parameter -Wextra -DHAVE_SNPRINTF -Wformat -Wformat-security -fcheck-new -Wnon-virtual-dtor -Wctor-dtor-privacy -mno-relocatable -mno-relocatable-lib -mcpu=860 -meabi -msdata=sysv -fno-exceptions A) Crashing configuration Linker flags: -Wl,--gc-sections -Wl,-flto=jobserver -flto-partition=none -O2 -static .ctor table from .map file ************************** .ctors 0x00186950 0x14 *crtbegin.o(.ctors) *crtbegin?.o(.ctors) *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) .ctors 0x00186950 0x0 /home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/ecrti.o 0x00186950 __CTOR_LIST__ .ctors 0x00186950 0xc /cygdrive/c/Users/JKe/AppData/Local/Temp/ccT7Msbu.lto.o .ctors 0x0018695c 0x4 /home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/../../../../powerpc-unknown-eabi/lib/libstdc++.a(eh_alloc.o) .ctors 0x00186960 0x4 /home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/../../../../powerpc-unknown-eabi/lib/libstdc++.a(eh_globals.o) .ctors 0x00186964 0x0 /home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/ecrtn.o 0x00186964 __CTOR_END__ *(SORT(.ctors.*)) *(.ctors) __CTOR Symbols using objdump tool (note that local are used in reality) ********************************* 00186958 l O .ctors 00000004 __CTOR_LIST__.1431 00186954 l O .ctors 00000004 __CTOR_END__.585871 00186950 g O .ctors 00000000 __CTOR_LIST__ 00186964 g O .ctors 00000000 __CTOR_END__ B) Not crashing configuration (using default LTO partitioning) Linker flags: -Wl,--gc-sections -Wl,-flto=jobserver -O2 -static .ctor table from .map file ************************** .ctors 0x00187a70 0x14 *crtbegin.o(.ctors) *crtbegin?.o(.ctors) *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) .ctors 0x00187a70 0x0 /home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/ecrti.o 0x00187a70 __CTOR_LIST__ .ctors 0x00187a70 0x4 /cygdrive/c/Users/JKe/AppData/Local/Temp/ccYYi7V7.ltrans24.ltrans.o .ctors 0x00187a74 0x8 /cygdrive/c/Users/JKe/AppData/Local/Temp/ccYYi7V7.ltrans25.ltrans.o .ctors 0x00187a7c 0x4 /home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/../../../../powerpc-unknown-eabi/lib/libstdc++.a(eh_alloc.o) .ctors 0x00187a80 0x4 /home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/../../../../powerpc-unknown-eabi/lib/libstdc++.a(eh_globals.o) .ctors 0x00187a84 0x0 /home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/ecrtn.o 0x00187a84 __CTOR_END__ *(SORT(.ctors.*)) *(.ctors) __CTOR Symbols using objdump tool (note that local are used in reality) ********************************* 00187a70 l O .ctors 00000004 __CTOR_LIST__.1431.20271 00187a78 l O .ctors 00000004 __CTOR_END__.603481.26462 00187a70 g O .ctors 00000000 __CTOR_LIST__ 00187a84 g O .ctors 00000000 __CTOR_END__ ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/56287] __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none 2013-02-11 14:59 [Bug c++/56287] New: __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none honyakeprt at centrum dot cz @ 2013-02-11 15:20 ` rguenth at gcc dot gnu.org 2013-02-11 15:48 ` honyakeprt at centrum dot cz ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: rguenth at gcc dot gnu.org @ 2013-02-11 15:20 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56287 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |powerpc-unknown-eabi Status|UNCONFIRMED |WAITING Last reconfirmed| |2013-02-11 Host| |cygwin Ever Confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-11 15:19:52 UTC --- Did the crt files somehow get LTO bytecode? That shouldn't happen. Please show objdump -h of the used crtbegin.o/crtend.o files. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/56287] __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none 2013-02-11 14:59 [Bug c++/56287] New: __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none honyakeprt at centrum dot cz 2013-02-11 15:20 ` [Bug c++/56287] " rguenth at gcc dot gnu.org @ 2013-02-11 15:48 ` honyakeprt at centrum dot cz 2013-02-11 16:11 ` rguenth at gcc dot gnu.org 2015-03-31 10:44 ` paolo.carlini at oracle dot com 3 siblings, 0 replies; 5+ messages in thread From: honyakeprt at centrum dot cz @ 2013-02-11 15:48 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56287 --- Comment #2 from Jan Keprt <honyakeprt at centrum dot cz> 2013-02-11 15:48:01 UTC --- (In reply to comment #1) > Did the crt files somehow get LTO bytecode? That shouldn't happen. Please > show objdump -h of the used crtbegin.o/crtend.o files. Here it is: $ ~/cross/bin/powerpc-unknown-eabi-objdump.exe -h crtbegin.o crtbegin.o: file format elf32-powerpc Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000020 00000000 00000000 00000034 2**0 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .data 00000000 00000000 00000000 00000054 2**0 CONTENTS, ALLOC, LOAD, DATA 2 .bss 00000000 00000000 00000000 00000054 2**0 ALLOC 3 .gnu.lto_.jmpfuncs.60ec31b70d4f2ad9 00000110 00000000 00000000 00000054 2**0 CONTENTS, READONLY, EXCLUDE 4 .gnu.lto_.inline.60ec31b70d4f2ad9 0000006f 00000000 00000000 00000164 2* *0 CONTENTS, READONLY, EXCLUDE 5 .gnu.lto_.pureconst.60ec31b70d4f2ad9 00000020 00000000 00000000 000001d3 2**0 CONTENTS, READONLY, EXCLUDE 6 .gnu.lto_deregister_tm_clones.60ec31b70d4f2ad9 00000260 00000000 00000000 000001f3 2**0 CONTENTS, READONLY, EXCLUDE 7 .gnu.lto_register_tm_clones.60ec31b70d4f2ad9 00000293 00000000 00000000 0 0000453 2**0 CONTENTS, READONLY, EXCLUDE 8 .gnu.lto___do_global_dtors_aux.60ec31b70d4f2ad9 000003c3 00000000 00000000 000006e6 2**0 CONTENTS, READONLY, EXCLUDE 9 .gnu.lto_call___do_global_dtors_aux.60ec31b70d4f2ad9 0000013c 00000000 000 00000 00000aa9 2**0 CONTENTS, READONLY, EXCLUDE 10 .gnu.lto_frame_dummy.60ec31b70d4f2ad9 00000285 00000000 00000000 00000be5 2**0 CONTENTS, READONLY, EXCLUDE 11 .gnu.lto_call_frame_dummy.60ec31b70d4f2ad9 0000013b 00000000 00000000 000 00e6a 2**0 CONTENTS, READONLY, EXCLUDE 12 .gnu.lto_.cgraph.60ec31b70d4f2ad9 000000a4 00000000 00000000 00000fa5 2* *0 CONTENTS, READONLY, EXCLUDE 13 .gnu.lto_.vars.60ec31b70d4f2ad9 0000003f 00000000 00000000 00001049 2**0 CONTENTS, READONLY, EXCLUDE 14 .gnu.lto_.refs.60ec31b70d4f2ad9 00000037 00000000 00000000 00001088 2**0 CONTENTS, READONLY, EXCLUDE 15 .gnu.lto_.statics.60ec31b70d4f2ad9 00000014 00000000 00000000 000010bf 2 **0 CONTENTS, READONLY, EXCLUDE 16 .gnu.lto_.decls.60ec31b70d4f2ad9 00000bb0 00000000 00000000 000010d3 2** 0 CONTENTS, READONLY, EXCLUDE 17 .gnu.lto_.symtab.60ec31b70d4f2ad9 00000116 00000000 00000000 00001c83 2* *0 CONTENTS, READONLY, EXCLUDE 18 .gnu.lto_.opts 0000018a 00000000 00000000 00001d99 2**0 CONTENTS, READONLY, EXCLUDE 19 .ctors 00000004 00000000 00000000 00001f24 2**2 CONTENTS, ALLOC, LOAD, DATA 20 .dtors 00000004 00000000 00000000 00001f28 2**2 CONTENTS, ALLOC, LOAD, DATA 21 .eh_frame 00000000 00000000 00000000 00001f2c 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 22 .jcr 00000000 00000000 00000000 00001f2c 2**2 CONTENTS, ALLOC, LOAD, DATA 23 .tm_clone_table 00000000 00000000 00000000 00001f2c 2**2 CONTENTS, ALLOC, LOAD, DATA 24 .text.deregister_tm_clones 00000038 00000000 00000000 00001f2c 2**2 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 25 .text.register_tm_clones 0000003c 00000000 00000000 00001f64 2**2 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 26 .data.__dso_handle 00000004 00000000 00000000 00001fa0 2**2 CONTENTS, ALLOC, LOAD, DATA 27 .text.__do_global_dtors_aux 000000c8 00000000 00000000 00001fa4 2**2 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 28 .text.call___do_global_dtors_aux 0000000c 00000000 00000000 0000206c 2** 2 CONTENTS, ALLOC, LOAD, READONLY, CODE 29 .fini 00000004 00000000 00000000 00002078 2**0 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 30 .text.frame_dummy 0000006c 00000000 00000000 0000207c 2**2 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 31 .text.call_frame_dummy 0000000c 00000000 00000000 000020e8 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 32 .init 00000004 00000000 00000000 000020f4 2**0 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 33 .bss.completed.3973 00000001 00000000 00000000 000020f8 2**0 ALLOC 34 .bss.dtor_idx.3975 00000004 00000000 00000000 000020f8 2**2 ALLOC 35 .bss.object.3988 00000018 00000000 00000000 000020f8 2**2 ALLOC 36 .comment 00000012 00000000 00000000 000020f8 2**0 CONTENTS, READONLY $ ~/cross/bin/powerpc-unknown-eabi-objdump.exe -h crtend.o crtend.o: file format elf32-powerpc Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000010 00000000 00000000 00000034 2**0 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .data 00000000 00000000 00000000 00000044 2**0 CONTENTS, ALLOC, LOAD, DATA 2 .bss 00000000 00000000 00000000 00000044 2**0 ALLOC 3 .gnu.lto_.jmpfuncs.f5543a1e693b4bff 0000001b 00000000 00000000 00000044 2**0 CONTENTS, READONLY, EXCLUDE 4 .gnu.lto_.inline.f5543a1e693b4bff 00000037 00000000 00000000 0000005f 2* *0 CONTENTS, READONLY, EXCLUDE 5 .gnu.lto_.pureconst.f5543a1e693b4bff 00000018 00000000 00000000 00000096 2**0 CONTENTS, READONLY, EXCLUDE 6 .gnu.lto___do_global_ctors_aux.f5543a1e693b4bff 000001f9 00000000 00000000 000000ae 2**0 CONTENTS, READONLY, EXCLUDE 7 .gnu.lto_call___do_global_ctors_aux.f5543a1e693b4bff 0000013f 00000000 000 00000 000002a7 2**0 CONTENTS, READONLY, EXCLUDE 8 .gnu.lto_.cgraph.f5543a1e693b4bff 00000037 00000000 00000000 000003e6 2* *0 CONTENTS, READONLY, EXCLUDE 9 .gnu.lto_.vars.f5543a1e693b4bff 0000002a 00000000 00000000 0000041d 2**0 CONTENTS, READONLY, EXCLUDE 10 .gnu.lto_.refs.f5543a1e693b4bff 00000018 00000000 00000000 00000447 2**0 CONTENTS, READONLY, EXCLUDE 11 .gnu.lto_.statics.f5543a1e693b4bff 00000014 00000000 00000000 0000045f 2 **0 CONTENTS, READONLY, EXCLUDE 12 .gnu.lto_.decls.f5543a1e693b4bff 000004ec 00000000 00000000 00000473 2** 0 CONTENTS, READONLY, EXCLUDE 13 .gnu.lto_.symtab.f5543a1e693b4bff 00000037 00000000 00000000 0000095f 2* *0 CONTENTS, READONLY, EXCLUDE 14 .gnu.lto_.opts 0000018a 00000000 00000000 00000996 2**0 CONTENTS, READONLY, EXCLUDE 15 .ctors 00000004 00000000 00000000 00000b20 2**2 CONTENTS, ALLOC, LOAD, DATA 16 .dtors 00000004 00000000 00000000 00000b24 2**2 CONTENTS, ALLOC, LOAD, DATA 17 .eh_frame 00000004 00000000 00000000 00000b28 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 18 .jcr 00000004 00000000 00000000 00000b2c 2**2 CONTENTS, ALLOC, LOAD, DATA 19 .tm_clone_table 00000000 00000000 00000000 00000b30 2**2 CONTENTS, ALLOC, LOAD, DATA 20 .text.__do_global_ctors_aux 0000004c 00000000 00000000 00000b30 2**2 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 21 .text.call___do_global_ctors_aux 0000000c 00000000 00000000 00000b7c 2** 2 CONTENTS, ALLOC, LOAD, READONLY, CODE 22 .init 00000004 00000000 00000000 00000b88 2**0 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 23 .comment 00000012 00000000 00000000 00000b8c 2**0 CONTENTS, READONLY ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/56287] __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none 2013-02-11 14:59 [Bug c++/56287] New: __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none honyakeprt at centrum dot cz 2013-02-11 15:20 ` [Bug c++/56287] " rguenth at gcc dot gnu.org 2013-02-11 15:48 ` honyakeprt at centrum dot cz @ 2013-02-11 16:11 ` rguenth at gcc dot gnu.org 2015-03-31 10:44 ` paolo.carlini at oracle dot com 3 siblings, 0 replies; 5+ messages in thread From: rguenth at gcc dot gnu.org @ 2013-02-11 16:11 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56287 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-11 16:10:40 UTC --- Yeah, they shouldn't have any .gnu.lto_* sections because we don't handle constraints on .ctors/.dtors sections properly. Which means you somehow ended up compiling them with -flto - don't. Honza, I suppose there is no good way to ensure linker-command-line ordering of decls with used attribute? (__CTOR_END__ also seems to lack that attribute) Supposedly CRTSTUFF_T_CFLAGS unconditionally should get -fno-lto (not sure if anybody builds with CFLAGS_FOR_TARGET=-flto or CFLAGS=-flto). I believe the fact that it works without -flto-partition=none is by luck and not by design. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/56287] __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none 2013-02-11 14:59 [Bug c++/56287] New: __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none honyakeprt at centrum dot cz ` (2 preceding siblings ...) 2013-02-11 16:11 ` rguenth at gcc dot gnu.org @ 2015-03-31 10:44 ` paolo.carlini at oracle dot com 3 siblings, 0 replies; 5+ messages in thread From: paolo.carlini at oracle dot com @ 2015-03-31 10:44 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56287 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-31 9:47 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-02-11 14:59 [Bug c++/56287] New: __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none honyakeprt at centrum dot cz 2013-02-11 15:20 ` [Bug c++/56287] " rguenth at gcc dot gnu.org 2013-02-11 15:48 ` honyakeprt at centrum dot cz 2013-02-11 16:11 ` rguenth at gcc dot gnu.org 2015-03-31 10:44 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).