Author: Jon Chesterfield Date: 2021-09-01T20:24:34+01:00 New Revision: 7a228f872fbbefa6a6eba1d51da192761879fcca
URL: https://github.com/llvm/llvm-project/commit/7a228f872fbbefa6a6eba1d51da192761879fcca DIFF: https://github.com/llvm/llvm-project/commit/7a228f872fbbefa6a6eba1d51da192761879fcca.diff LOG: [openmp] No longer use LIBRARY_PATH to find devicertl Given D109057, change test runner to use the libomptarget-x-bc-path argument instead of the LIBRARY_PATH environment variable to find the device library. Also drop the use of LIBRARY_PATH environment variable as it is far too easy to pull in the device library from an unrelated toolchain by accident with the current setup. No loss in flexibility to developers as the clang commandline used here is still available. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D109061 Added: Modified: clang/lib/Driver/ToolChains/CommonArgs.cpp openmp/libomptarget/test/lit.cfg Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 7c7f4d63eca0d..fb1aea20acc33 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1688,18 +1688,8 @@ void tools::addOpenMPDeviceRTL(const Driver &D, StringRef BitcodeSuffix, const llvm::Triple &Triple) { SmallVector<StringRef, 8> LibraryPaths; - // Add user defined library paths from LIBRARY_PATH. - llvm::Optional<std::string> LibPath = - llvm::sys::Process::GetEnv("LIBRARY_PATH"); - if (LibPath) { - SmallVector<StringRef, 8> Frags; - const char EnvPathSeparatorStr[] = {llvm::sys::EnvPathSeparator, '\0'}; - llvm::SplitString(*LibPath, Frags, EnvPathSeparatorStr); - for (StringRef Path : Frags) - LibraryPaths.emplace_back(Path.trim()); - } - - // Add path to lib / lib64 folder. + + // Add path to clang lib / lib64 folder. SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir); llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX); LibraryPaths.emplace_back(DefaultLibPath.c_str()); diff --git a/openmp/libomptarget/test/lit.cfg b/openmp/libomptarget/test/lit.cfg index d4f63dd6c6de2..b47e16c4be918 100644 --- a/openmp/libomptarget/test/lit.cfg +++ b/openmp/libomptarget/test/lit.cfg @@ -92,6 +92,10 @@ else: # Unices append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":") append_dynamic_library_path('LIBRARY_PATH', \ config.omp_host_rtl_directory, ":") + if config.libomptarget_current_target.startswith('amdgcn'): + config.test_flags += " --libomptarget-amdgcn-bc-path=" + config.library_dir + if config.libomptarget_current_target.startswith('nvptx'): + config.test_flags += " --libomptarget-nvptx-bc-path=" + config.library_dir # substitutions # - for targets that exist in the system create the actual command. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits