Bug:Boost: Use shlibs instead of header-only for call_stack::top_

This symbol is defined as a static member object inside of a
boost detail header. When boost headers are used in a project
that uses Boost in both the main binary as well as dlopen()'d
shlibs, the top_ symbol gets duplicated and the metadata gets
partitioned.

We use the Boost shlib to unify both the main binary and the
shlibs to use the same memory address for top_.

This involves marking the templated object call_stack::top_ as
"extern" and then declaring to Boost that we intend to use the
shlibs.
This commit is contained in:
2025-11-03 22:18:45 -04:00
parent 6ea90c2dae
commit 5845f1a41d
22 changed files with 156 additions and 15 deletions
+10 -2
View File
@@ -21,8 +21,9 @@ if(ENABLE_STIMBUFFAPI_livoxGen1)
${CMAKE_SOURCE_DIR}/commonLibs
${URING_INCLUDE_DIRS}
)
target_link_libraries(livoxGen1
${Boost_LIBRARIES}
target_link_libraries(livoxGen1 PUBLIC
Boost::system
Boost::log
${URING_LIBRARIES}
attachmentSupport
)
@@ -30,6 +31,13 @@ if(ENABLE_STIMBUFFAPI_livoxGen1)
${URING_LIBRARY_DIRS}
)
# Verify Boost dynamic dependencies after build
add_custom_command(TARGET livoxGen1 POST_BUILD
COMMAND ${CMAKE_COMMAND} -DVERIFY_FILE="$<TARGET_FILE:livoxGen1>"
-P ${CMAKE_SOURCE_DIR}/cmake/VerifyBoostDynamic.cmake
COMMENT "Verifying Boost dynamic dependencies for livoxGen1"
)
# Install rules
install(TARGETS livoxGen1 DESTINATION lib)
endif()
@@ -1,3 +1,4 @@
#include <boostAsioLinkageFix.h>
#include <cstring>
#include <sys/socket.h>
#include <boost/system/error_code.hpp>
@@ -1,6 +1,7 @@
#ifndef _LIVOX_GEN1_IOURING_ASSEMBLY_ENGINE_H
#define _LIVOX_GEN1_IOURING_ASSEMBLY_ENGINE_H
#include <boostAsioLinkageFix.h>
#include <cstdint>
#include <cstddef>
#include <memory>
+3 -1
View File
@@ -1,3 +1,4 @@
#include <boostAsioLinkageFix.h>
#include <iostream>
#include <memory>
#include <vector>
@@ -16,13 +17,14 @@
#include <asynchronousContinuation.h>
#include <boost/asio/deadline_timer.hpp>
#include "pcloudStimulusBuffer.h"
#include "livoxGen1.h"
namespace smo {
namespace stim_buff {
// Salmanoff hooks, obtained from SMO_GET_STIM_BUFF_API_DESC_FN_NAME().
static const SmoCallbacks* smoHooksPtr = nullptr;
const SmoCallbacks* smoHooksPtr = nullptr;
static SmoThreadingModelDesc smoThreadingModelDesc;
// Local collection of stimulus buffers