Boost logo

Boost Users :

Subject: [Boost-users] TLS/Non-TLS mismatch in ASIO when using LTO
From: Matthew S Wallace (mwallace_at_[hidden])
Date: 2015-09-11 15:07:37


When build/link my application with -flto (using GCC 4.8.3 and Boost 1.59) I get the following error when linking the executable:

1:58 /bin/ld: _ZN5boost4asio6detail15keyword_tss_ptrINS1_10call_stackINS1_15task_io_serviceENS1_27task_io_service_thread_infoEE7contextEE6value_E: TLS definition in ./build/lib/mylib.so section .tbss mismatches non-TLS definition in build/src/my_app/main.o (symbol from plugin) section .gnu.linkonce.t._ZN5boost4asio6detail15keyword_tss_ptrINS1_10call_stackINS1_15task_io_serviceENS1_27task_io_service_thread_infoEE7contextEE6value_E
build/src/my_app/main.o (symbol from plugin): could not read symbols: Bad value
collect2: error: ld returned 1 exit status

I do not see this error if I do not use the -flto option at link time.

I confess I have no real idea what’s going on here - a bit of googling suggested this might be related to the __thread directive in the GCC for thread local storage, so I tried to rebuild Boost like:
./b2 define=BOOST_ASIO_DISABLE_THREAD_KEYWORK_EXTENSION. This didn’t help.

-Matt



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net