https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66815
Bug ID: 66815 Summary: Segfault with -lto and libitm Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: heiner.litz at gmail dot com Target Milestone: --- When I compile STAMP's intruder with libitm and link time optimization (-flto), execution fails (if compiled without lto it runs fine): Program received signal SIGABRT, Aborted. 0x00007ffff6e12cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007ffff6e12cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007ffff6e160d8 in __GI_abort () at abort.c:89 #2 0x00007ffff71a9db8 in _ITM_getTMCloneSafe () from /usr/lib/x86_64-linux-gnu/libitm.so.1 #3 0x0000000000403f16 in processPackets.lto_priv.5 () #4 0x0000000000404a5d in threadWait.lto_priv.11 () #5 0x000000000040193a in main () The problem seems to be that no calls to _ITM_registerTMCloneTable (void *xent, size_t size) in libitm/clone.cc are ever emitted and hence access to the clone table fails. This error occurs with gcc4.9 and gcc5.1 to reproduce: 1. get STAMP: https://github.com/mfs409/stamp.git 2. enable lto by modifying <PATH-TO-STAMP>/stamp/TRANSACT/Makefile.common 3. export ITM_DEFAULT_METHOD=ml_wt 4. run <PATH_TO_STAMP>/stamp/obj/intruder/intruder