From cfd16c04f8316270b67c73775a5885d6bc4dc4e2 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 29 Jul 2022 17:31:52 +0200 Subject: Build: hide all symbols except a few required ones on Linux Instead of specifying which symbols to hide, we hide all and make a few visible. Some users may be relying on calling internal Blender functions, but Windows is already hiding all of them and this is just not supported. Fixes T99900: crash with some third-party Python libraries since OneAPI Ref T76442 Differential Revision: https://developer.blender.org/D14971 --- build_files/cmake/platform/platform_apple.cmake | 3 ++- build_files/cmake/platform/platform_unix.cmake | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'build_files/cmake') diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index 3c77a28d55f..f84be3c5238 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -470,8 +470,9 @@ string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024") # Avoid conflicts with Luxrender, and other plug-ins that may use the same # libraries as Blender with a different version or build options. +set(PLATFORM_SYMBOLS_MAP ${CMAKE_SOURCE_DIR}/source/creator/symbols_apple.map) string(APPEND PLATFORM_LINKFLAGS - " -Wl,-unexported_symbols_list,'${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'" + " -Wl,-unexported_symbols_list,'${PLATFORM_SYMBOLS_MAP}'" ) string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++") diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index d22cf437e59..f6e233a0c86 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -888,8 +888,9 @@ unset(_IS_LINKER_DEFAULT) # Avoid conflicts with Mesa llvmpipe, Luxrender, and other plug-ins that may # use the same libraries as Blender with a different version or build options. +set(PLATFORM_SYMBOLS_MAP ${CMAKE_SOURCE_DIR}/source/creator/symbols_unix.map) set(PLATFORM_LINKFLAGS - "${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'" + "${PLATFORM_LINKFLAGS} -Wl,--version-script='${PLATFORM_SYMBOLS_MAP}'" ) # Don't use position independent executable for portable install since file -- cgit v1.2.3