Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht>2022-07-29 18:31:52 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-07-29 18:54:32 +0300
commitcfd16c04f8316270b67c73775a5885d6bc4dc4e2 (patch)
treef58df47ddd3a94cf064db15a41656d21c044811b
parent1665e40e16fdf8cc914d6eea3577834ce9597ca4 (diff)
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
-rw-r--r--build_files/cmake/platform/platform_apple.cmake3
-rw-r--r--build_files/cmake/platform/platform_unix.cmake3
-rw-r--r--source/creator/CMakeLists.txt6
-rw-r--r--source/creator/blender.map173
-rw-r--r--source/creator/symbols_apple.map (renamed from source/creator/osx_locals.map)0
-rw-r--r--source/creator/symbols_unix.map44
6 files changed, 50 insertions, 179 deletions
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
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 278cd4362c3..11f48a72908 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -1216,10 +1216,8 @@ unset(LIB)
setup_platform_linker_flags(blender)
setup_platform_linker_libs(blender)
-if(APPLE)
- set_target_properties(blender PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/osx_locals.map)
-elseif(UNIX)
- set_target_properties(blender PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/blender.map)
+if(DEFINED PLATFORM_SYMBOLS_MAP)
+ set_target_properties(blender PROPERTIES LINK_DEPENDS ${PLATFORM_SYMBOLS_MAP})
endif()
# -----------------------------------------------------------------------------
diff --git a/source/creator/blender.map b/source/creator/blender.map
deleted file mode 100644
index 500892a20f3..00000000000
--- a/source/creator/blender.map
+++ /dev/null
@@ -1,173 +0,0 @@
-
-/* on Linux we exclude LLVM symbols, they conflict with Mesa llvmpipe
- * we also keep boost's symbols local, since some python modules could
- * be using boost as well (mainly that's for lux render)
- */
-
-{
-global:
- *;
- *_boost*;
-local:
- __once_proxy;
- _ZSt11__once_call;
- _ZSt15__once_callable;
- al*;
- *Alembic*;
- av*;
- blosc*;
- *boost*;
- *ceres*;
- *cineon*;
- *clang*;
- *COLLADA*;
- cu*;
- *default_error_condition*;
- *dpx*;
- *embree*;
- ff_*;
- fftw*;
- FLAC*;
- FT_*;
- *GeneratedSaxParser*;
- *google*;
- gsm*;
- Gsm*;
- html*;
- id3tag*;
- *Iex*;
- *Ilm*;
- *Imath*;
- *Imf*;
- jack_*;
- jpeg_*;
- jsimd**;
- lame_*;
- *llvm*;
- *LLVM*;
- *MathML*;
- *mkldnn*;
- nvrtc*;
- oc_*;
- ogg*;
- *oidn*;
- *OpenColorIO*;
- *OpenImageIO*;
- *OpenSubdiv*;
- *openvdb*;
- opj_*;
- opus_*;
- *OSL*;
- *pathYy*;
- png_*;
- *SDL*;
- *squish*;
- *tbb*;
- *textFileFormatYy*;
- *TIFF*;
- *tinyformat*;
- *usdBlender*;
- vorbis*;
- vp8*;
- vp9*;
- vpx*;
- x264_*;
- xml*;
- xvid*;
- *YAML*;
-
- /* LLVM symbols not in the LLVM namespace that can conflict with LLVM usage
- * in OpenGL and OpenCL drivers.
- *
- * These are found by doing a Blender build with and without OSL, and
- * comparing the output of nm -gD ./bin/blender to find symbols. */
- AlwaysSpillBase;
- AsmMacroMaxNestingDepth;
- AttributorRun;
- CheckBFIUnknownBlockQueries;
- *cloneBitwiseIVUser*;
- *computeHostNumHardwareThread*;
- *computeHostNumPhysicalCores*;
- decodeInstruction;
- DisableBasicAA;
- DisablePreInliner;
- DisableWholeProgramVisibility;
- EnableCHR;
- EnableConstraintElimination;
- EnableGVNHoist;
- EnableGVNSink;
- EnableHotColdSplit;
- EnableIPRA;
- EnableIROutliner;
- EnableKnowledgeRetention;
- EnableLoopFlatten;
- EnableMatrix;
- EnableOrderFileInstrumentation;
- EnablePGSO;
- EnableUnrollAndJam;
- EnableVPlanNativePath;
- EnableVPlanPredication;
- ExtraVectorizerPasses;
- FlattenedProfileUsed;
- ForcePGSO;
- ForceStackAlign;
- ForceSummaryEdgesCold;
- FSEC;
- *getExtendedOperandRecurrence*;
- *getWideRecurrence*;
- InlinerFunctionImportStats;
- *IROutlinerLegacyPass*;
- __jit_debug_descriptor;
- __jit_debug_register_code;
- _Jv_RegisterClasses;
- *LiveDebugValues*;
- *LoopInterchangeLegacyPass*;
- MachineRegionInfoPassID;
- MaxDevirtIterations;
- MaxRegistersForGCPointers;
- MemOPOptMemcmpBcmp;
- MemOPSizeLarge;
- MemOPSizeRange;
- MISchedPostRA;
- ModuleSummaryDotFile;
- __morestack;
- Name;
- NumNamedVarArgParams;
- PGOViewCounts;
- PGSOColdCodeOnly;
- PGSOColdCodeOnlyForInstrPGO;
- PGSOColdCodeOnlyForPartialSamplePGO;
- PGSOColdCodeOnlyForSamplePGO;
- PgsoCutoffInstrProf;
- PgsoCutoffSampleProf;
- PGSOLargeWorkingSetSizeOnly;
- PreInlineThreshold;
- PrintBlockFreqFuncName;
- PrintBranchProbFuncName;
- ProfileLikelyProb;
- RunNewGVN;
- RunPartialInlining;
- RunSLPVectorization;
- ScalePartialSampleProfileWorkingSetSize;
- *ScopedAliasMetadataDeepCloner*;
- ShouldPreserveAllAttributes;
- SkipFunctionNames;
- StartAfterOptName;
- StartBeforeOptName;
- StaticLikelyProb;
- StopAfterOptName;
- StopBeforeOptName;
- UseContextLessSummary;
- UseDbgAddr;
- UseLEB128Directives;
- UseRegistersForDeoptValues;
- UseRegistersForGCPointersInLandingPad;
- ViewBlockFreqFuncName;
- ViewBlockLayoutWithBFI;
- ViewHotFreqPercent;
- WholeProgramVisibility;
- *widenLoopCompare*;
- *widenWithVariant*;
- WriteRelBFToSummary;
- X86CompilationCallback*;
-};
diff --git a/source/creator/osx_locals.map b/source/creator/symbols_apple.map
index 5619f151bd2..5619f151bd2 100644
--- a/source/creator/osx_locals.map
+++ b/source/creator/symbols_apple.map
diff --git a/source/creator/symbols_unix.map b/source/creator/symbols_unix.map
new file mode 100644
index 00000000000..673c402022d
--- /dev/null
+++ b/source/creator/symbols_unix.map
@@ -0,0 +1,44 @@
+/* Hide all symbols except a few required ones.
+ *
+ * Otherwise LLVM symbols conflict with Mesa llvm pipe, boost symbols conflict
+ * with Luxrender, etc. */
+{
+global:
+ /* Essential symbols for the program to start and exit. */
+ _bss_start;
+ __end;
+ _fini;
+ _init;
+ /* Needed for Python modules to work. */
+ Py*;
+ _Py*;
+ /* Needed for sanitizers. Based on:
+ * llvm/compiler-rt/lib/sanitizer_common/scripts/gen_dynamic_list.py. */
+ __asan*;
+ __lsan*;
+ __tsan*;
+ __ubsan*;
+ __sanitizer*;
+ __Znw*;
+ __Zna*;
+ __Zdl*;
+ __Zda*;
+ aligned_alloc;
+ aligned_free;
+ calloc*;
+ free;
+ mallinfo;
+ malloc*;
+ mallopt;
+ memalign;
+ memcpy;
+ posix_memalign;
+ pthread_*;
+ pvalloc;
+ realloc*;
+ realpath;
+ sched_*;
+ valloc;
+local:
+ *;
+};