]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: workaround for boost::asio use of static member variables
authorJason Dillaman <dillaman@redhat.com>
Wed, 11 Nov 2020 02:05:15 +0000 (21:05 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 16 Nov 2020 23:16:11 +0000 (18:16 -0500)
boost::asio uses static member variables in a header-only library to
provide thread local storage. When boost::asio is used in multiple
independent shared libraries (e.g. librados and librbd), each module
will have its own version of the static variables and therefore will
cause inconsistencies when attempting to access the data.

Under GNU ELF extensions, static member variables are given global
unique symbol visibility. This was broken in librados due to the
symbol map, so manually export the static member variables so that
the dynamic linker can properly consolidate the variables.

See github.com boostorg/asio issue 150

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/CMakeLists.txt
src/librados/librados.map

index b8110eab6216c4d001bf84b51d0c8cf06ab156bd..bfb5c0e86743524e236268a9c8ffba6c987c1e06 100644 (file)
@@ -28,7 +28,8 @@ add_definitions(
   -D_REENTRANT
   -D_THREAD_SAFE
   -D__STDC_FORMAT_MACROS
-  -D_FILE_OFFSET_BITS=64)
+  -D_FILE_OFFSET_BITS=64
+  -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
 if(LINUX)
   add_definitions("-D_GNU_SOURCE")
 endif()
index b7552be61113f9d47b69c7bc11bf019b47c1c41d..279a0ba06910bdacb054eede55bf617120c0ad9b 100644 (file)
@@ -1,4 +1,14 @@
 LIBRADOS_PRIVATE {
+       global:
+               extern "C++" {
+                       "guard variable for boost::asio::detail::call_stack<boost::asio::detail::strand_executor_service::strand_impl, unsigned char>::top_";
+                       "guard variable for boost::asio::detail::call_stack<boost::asio::detail::strand_service::strand_impl, unsigned char>::top_";
+                       "guard variable for boost::asio::detail::call_stack<boost::asio::detail::thread_context, boost::asio::detail::thread_info_base>::top_";
+                       "boost::asio::detail::call_stack<boost::asio::detail::strand_executor_service::strand_impl, unsigned char>::top_";
+                       "boost::asio::detail::call_stack<boost::asio::detail::strand_service::strand_impl, unsigned char>::top_";
+                       "boost::asio::detail::call_stack<boost::asio::detail::thread_context, boost::asio::detail::thread_info_base>::top_";
+
+               };
        local:  *;
 };