bcc
bcc copied to clipboard
Libbcc_bpf.so should not export libstdc++ symbols
If libbcc_bpf.so is linked in a program that has another copy of libstdc++, then currently std:: globals can be constructed with one set of libstdc++ symbols and destructed with another one that gets dlopen'ed later.
src/cc/libbpf/src/Makefile already contains this:
VERSION_SCRIPT := libbpf.map
libbpf.so: $(SHARED_OBJS)
$(Q)$(CC) -shared -Wl,--version-script=$(VERSION_SCRIPT) ...
And src/cc/CMakeLists.txt should probably also have something equivalent:
target_link_libraries(bpf-shared elf z)
+target_link_options(bpf-shared PRIVATE -Wl,-version-script=${CMAKE_CURRENT_SOURCE_DIR}/libbpf/src/libbpf.map)
if(LIBDEBUGINFOD_FOUND)