diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp index 1d30090ca21c..6364cd133e0b 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -645,6 +645,22 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, /*IsLTO=*/true); } +void tools::addOpenMPRuntimeSpecificRPath(const ToolChain &TC, + const ArgList &Args, + ArgStringList &CmdArgs) { + + if (Args.hasFlag(options::OPT_fopenmp_implicit_rpath, + options::OPT_fno_openmp_implicit_rpath, true)) { + // Default to clang lib / lib64 folder, i.e. the same location as device + // runtime + SmallString<256> DefaultLibPath = + llvm::sys::path::parent_path(TC.getDriver().Dir); + llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX); + CmdArgs.push_back("-rpath"); + CmdArgs.push_back(Args.MakeArgString(DefaultLibPath)); + } +} + void tools::addArchSpecificRPath(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs) { // Enable -frtlib-add-rpath by default for the case of VE. @@ -702,6 +718,9 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs, const ToolChain &TC, addArchSpecificRPath(TC, Args, CmdArgs); + if (RTKind == Driver::OMPRT_OMP) + addOpenMPRuntimeSpecificRPath(TC, Args, CmdArgs); + return true; } @@ -826,16 +845,16 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args, if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes()) StaticRuntimes.push_back("stats_client"); + // Always link the static runtime regardless of DSO or executable. + if (SanArgs.needsAsanRt()) + HelperStaticRuntimes.push_back("asan_static"); + // Collect static runtimes. if (Args.hasArg(options::OPT_shared)) { // Don't link static runtimes into DSOs. return; } - // Always link the static runtime for executable. - if (SanArgs.needsAsanRt()) - HelperStaticRuntimes.push_back("asan_static"); - // Each static runtime that has a DSO counterpart above is excluded below, // but runtimes that exist only as static are not affected by needsSharedRt. |