Skip to content

[OpenMP] Update the bitcode library install and search path #136754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions clang/lib/Driver/ToolChains/CommonArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2794,6 +2794,11 @@ void tools::addOpenMPDeviceRTL(const Driver &D,
for (const auto &LibPath : HostTC.getFilePaths())
LibraryPaths.emplace_back(LibPath);

// Check the target specific library path for the triple as well.
SmallString<128> P(D.Dir);
llvm::sys::path::append(P, "..", "lib", Triple.getTriple());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common problem with compiler-rt and flang-rt: The installation target dir is lib${LLVM_LIBDIR_SUFFIX}, but LLVM_LIBDIR_SUFFIX is not used here. I guess some day somebody has to clean up the multilib support.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another note: Paths should not be relative to P.Dir. It should either be the resource dir or sysroot. Again, a common problem that I don't expect to be fixed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I mostly copied it from how clang gets the existing file paths. Probably should be cleaned up as a whole.

LibraryPaths.emplace_back(P);

OptSpecifier LibomptargetBCPathOpt =
Triple.isAMDGCN() ? options::OPT_libomptarget_amdgpu_bc_path_EQ
: Triple.isNVPTX() ? options::OPT_libomptarget_nvptx_bc_path_EQ
Expand Down
2 changes: 1 addition & 1 deletion offload/DeviceRTL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function(compileDeviceRTLLibrary target_name target_triple)
"-r" "-nostdlib" "-flto" "-Wl,--lto-emit-llvm" "-march=")
install(TARGETS libomptarget-${target_name}
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
DESTINATION ${OFFLOAD_INSTALL_LIBDIR})
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${target_triple}")

add_library(omptarget.${target_name}.all_objs OBJECT IMPORTED)
set_property(TARGET omptarget.${target_name}.all_objs APPEND PROPERTY IMPORTED_OBJECTS
Expand Down
Loading