Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,22 @@ impl CommandLineStep for OmpOffload {
ldflags.push_all(format!("-L{}", dir.display()));
}

if *omp_target == *target.triple
&& builder.config.rpath_enabled(target)
&& helpers::use_host_linker(target)
&& llvm_output.link_shared()
&& target.contains("linux")
{
// Same logic as in Lld::run
// We inform libomptarget.so where it can find LLVM's libraries
// by adding an rpath entry to the expected parent `lib` directory.
//
// Be careful when changing this path, we need to ensure it's quoted or escaped:
// `$ORIGIN` would otherwise be expanded when the `LdFlags` are passed verbatim to
// cmake.
ldflags.push_all("-Wl,-rpath,'$ORIGIN/../../../'");
}

configure_cmake(builder, target, &mut cfg, true, ldflags, cflags, &[]);

cfg.define("CMAKE_C_COMPILER", &clang)
Expand Down