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
This commit is contained in:
parent
1665e40e16
commit
cfd16c04f8
|
@ -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++")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
|
|
@ -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*;
|
||||
};
|
|
@ -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:
|
||||
*;
|
||||
};
|
Loading…
Reference in New Issue