Support autoloading of dynamic symbols and callback from IncrementalExecutor
This patch contains two functionality: 1. Autoloading of dynamic symbols for system headers There is three kind of symbols in shared object file, which is 1 normal symbols, 2 dynamic symbols, and 3 hidden visibility symbols. Linker doesn't care about 3, but should take care (of course) 1 and 2. For system headers, often symbols are defined in .dynsym section which means they are 2 dynamic symbols. This patch adds support of autoloading those symbols. We fallback to resolving dynamic symbols from system headers only if we couldn't resolve from normal symbol table, as the initialization of header search is expensive (iterating through all system headers) 2. Register callback from IncrementalExecutor Previously, LazyFunctionCreatorAutoload was getting callback only from DynamicLibraryManager::loadLibrary. This was enough for fixing tests, but is insufficient to handle "symbol <something> unresolved while linking function" errors as those errors are emitted from IncrementalExecutor. Adding a callback from IncrementalExecutor enables us to unresolved symbols. It fixes these kind of errors: `IncrementalExecutor::executeFunction: symbol '_ZN7TCanvasC1EPKcS1_iiii' unresolved while linking function '_GLOBAL__sub_I_cling_module_8'!`
This commit is contained in:
parent
5789f5b2eb
commit
2849a2ab73
@ -77,6 +77,14 @@ namespace cling {
|
||||
const InterpreterCallbacks* getCallbacks() const { return m_Callbacks; }
|
||||
void setCallbacks(InterpreterCallbacks* C) { m_Callbacks = C; }
|
||||
|
||||
///\brief Returns the system include paths.
|
||||
///
|
||||
///\returns System include paths.
|
||||
///
|
||||
llvm::SmallVector<std::string, 32> getSystemSearchPath() {
|
||||
return m_SystemSearchPaths;
|
||||
}
|
||||
|
||||
///\brief Looks up a library taking into account the current include paths
|
||||
/// and the system include paths.
|
||||
///\param[in] libStem - The filename being looked up
|
||||
|
@ -363,6 +363,14 @@ bool IncrementalExecutor::diagnoseUnresolvedSymbols(llvm::StringRef trigger,
|
||||
if (m_unresolvedSymbols.empty())
|
||||
return false;
|
||||
|
||||
// Issue callback to TCling!!
|
||||
for (const std::string& sym : m_unresolvedSymbols) {
|
||||
// We emit callback to LibraryLoadingFailed when we get error with error message.
|
||||
if (InterpreterCallbacks* C = m_Callbacks)
|
||||
if (C->LibraryLoadingFailed(sym, "", false, false))
|
||||
return false;
|
||||
}
|
||||
|
||||
llvm::SmallVector<llvm::Function*, 128> funcsToFree;
|
||||
for (const std::string& sym : m_unresolvedSymbols) {
|
||||
#if 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user