diff --git a/mlir/lib/ExecutionEngine/JitRunner.cpp b/mlir/lib/ExecutionEngine/JitRunner.cpp --- a/mlir/lib/ExecutionEngine/JitRunner.cpp +++ b/mlir/lib/ExecutionEngine/JitRunner.cpp @@ -158,9 +158,6 @@ // If shared library implements custom mlir-runner library init and destroy // functions, we'll use them to register the library with the execution // engine. Otherwise we'll pass library directly to the execution engine. - SmallVector libs(options.clSharedLibs.begin(), - options.clSharedLibs.end()); - // Libraries that we'll pass to the ExecutionEngine for loading. SmallVector executionEngineLibs; @@ -171,14 +168,17 @@ SmallVector destroyFns; // Handle libraries that do support mlir-runner init/destroy callbacks. - for (auto libPath : libs) { - auto lib = llvm::sys::DynamicLibrary::getPermanentLibrary(libPath.data()); + for (auto libPath : options.clSharedLibs) { + SmallString<256> absPath(libPath.begin(), libPath.end()); + // Use absolute library path so that gdb can find the symbol table. + llvm::sys::fs::make_absolute(absPath); + auto lib = llvm::sys::DynamicLibrary::getPermanentLibrary(absPath.data()); void *initSym = lib.getAddressOfSymbol("__mlir_runner_init"); void *destroySim = lib.getAddressOfSymbol("__mlir_runner_destroy"); // Library does not support mlir runner, load it with ExecutionEngine. if (!initSym || !destroySim) { - executionEngineLibs.push_back(libPath); + executionEngineLibs.push_back(absPath); continue; }