diff --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt --- a/openmp/libomptarget/src/CMakeLists.txt +++ b/openmp/libomptarget/src/CMakeLists.txt @@ -30,13 +30,15 @@ Support Object - LINK_LIBS + LINK_LIBS PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports" NO_INSTALL_RPATH ) target_include_directories(omptarget PRIVATE ${LIBOMPTARGET_INCLUDE_DIR}) +target_compile_definitions(omptarget PRIVATE LLVM_VERSION=${LLVM_VERSION_MAJOR}${LLVM_VERSION_SUFFIX}) + # libomptarget.so needs to be aware of where the plugins live as they # are now separated in the build directory. set_target_properties(omptarget PROPERTIES INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..") diff --git a/openmp/libomptarget/src/rtl.cpp b/openmp/libomptarget/src/rtl.cpp --- a/openmp/libomptarget/src/rtl.cpp +++ b/openmp/libomptarget/src/rtl.cpp @@ -25,17 +25,30 @@ using namespace llvm; using namespace llvm::sys; +#ifndef LLVM_VERSION +#define PLUGIN_VERSION "" +#else +#define VERSION_STR(X) #X +#define PLUGIN_VERSION "." VERSION_STR(LLVM_VERSION) +#endif + // List of all plugins that can support offloading. + static const char *RTLNames[] = { - /* PowerPC target */ "libomptarget.rtl.ppc64.so", - /* x86_64 target */ "libomptarget.rtl.x86_64.so", - /* CUDA target */ "libomptarget.rtl.cuda.so", - /* AArch64 target */ "libomptarget.rtl.aarch64.so", - /* SX-Aurora VE target */ "libomptarget.rtl.ve.so", - /* AMDGPU target */ "libomptarget.rtl.amdgpu.so", - /* Remote target */ "libomptarget.rtl.rpc.so", + /* PowerPC target */ "libomptarget.rtl.ppc64.so" PLUGIN_VERSION, + /* x86_64 target */ "libomptarget.rtl.x86_64.so" PLUGIN_VERSION, + /* CUDA target */ "libomptarget.rtl.cuda.so" PLUGIN_VERSION, + /* AArch64 target */ "libomptarget.rtl.aarch64.so" PLUGIN_VERSION, + /* SX-Aurora VE target */ "libomptarget.rtl.ve.so" PLUGIN_VERSION, + /* AMDGPU target */ "libomptarget.rtl.amdgpu.so" PLUGIN_VERSION, + /* Remote target */ "libomptarget.rtl.rpc.so" PLUGIN_VERSION, }; +#undef PLUGIN_VERSION +#ifdef VERSION_STR +#undef VERSION_STR +#endif + PluginManager *PM; static char *ProfileTraceFile = nullptr;