You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix ROOT-7775 by making all static init function name unique.
In EmitCXXGlobalVarDeclInitFunc make the init function name more unique when module are used.
Most static init are called from a wrapping function (whose name start with _GLOBAL__sub_I_ and is followed by the source filename).
The static init functions are named __cxx_global_var_init followed by a serial number which is local to each module.
Neither the _GLOBAL__sub_I_ nor the __cxx_global_var_init are effectively removed for the SymbolTable in the dynamic library corresponding to the module.
I assume normal functions they get properly removed because when the module is unloaded/removed the whole corresponding SymbolTable must be removed. There does not seem to be any interface to remove a single symbol from the symbol table.
To avoid the problem for the common case of static init, we alredy use a 'Hack to temporarily set the file entry's name to a unique name.' in IncrementalParser.cpp around line 539, which make the name of the wrapping init function whose name start with _GLOBAL__sub_I_ unique accross the whole execution.
Those routines in turn call routines that have *non* unique name (starting by __cxx_global_var_init), I suppose because the wrapping routines are compiled they see the init function with that name in the module before looking into other modules.
The static initialization for explicit template specialization are intentionally *not* put in this uniquely named wrapping function. Instead they are called directly. When they are called by runStaticInitializersOnce, the search-by-name we use find the 'first' instance of a function by that name (rather than the last).
The solution I found was to make the name of the static init functions that are named __cxx_global_var_init to be followed by the module name ....
0 commit comments