diff --git a/mlir/tools/mlir-cpu-runner/CMakeLists.txt b/mlir/tools/mlir-cpu-runner/CMakeLists.txt --- a/mlir/tools/mlir-cpu-runner/CMakeLists.txt +++ b/mlir/tools/mlir-cpu-runner/CMakeLists.txt @@ -22,3 +22,17 @@ MLIRTargetLLVMIRExport MLIRSupport ) + +# The following symbols have to be exported, otherwhise the lookup in OrcJIT +# would fail. One would normally use CMake's export_executable_symbols, but +# that leads to ODR violation for EnableABIBreakingChecks when loading +# libmlir_async_runtime.so (this can be verified by enabling ASAN in your CMake +# set-up). +# FIXME: https://github.com/llvm/llvm-project/issues/61856 +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(CMAKE_EXE_LINKER_FLAGS + "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBWrapper + -Wl,--export-dynamic-symbol=llvm_orc_registerEHFrameSectionWrapper + -Wl,--export-dynamic-symbol=llvm_orc_deregisterEHFrameSectionWrapper + ${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "") +endif()