Skip to content

ohos: fix ohos.c test case error with LLVM_ENABLE_PER_TARGET_RUNTIME_… #121484

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

Closed
wants to merge 2 commits into from
Closed
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
6 changes: 5 additions & 1 deletion clang/lib/Driver/ToolChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,11 @@ std::string ToolChain::buildCompilerRTBasename(const llvm::opt::ArgList &Args,
std::string ArchAndEnv;
if (AddArch) {
StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
const char *Env = TT.isAndroid() ? "-android" : "";
const char *Env = "";
if (TT.isAndroid())
Env = "-android";
else if (TT.isOHOSFamily())
Env = "-ohos";
ArchAndEnv = ("-" + Arch + Env).str();
}
return (Prefix + Twine("clang_rt.") + Component + ArchAndEnv + Suffix).str();
Expand Down
5 changes: 5 additions & 0 deletions compiler-rt/cmake/Modules/CompilerRTUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ function(get_compiler_rt_target arch variable)
endfunction()

function(get_compiler_rt_install_dir arch install_dir)
if (NOT LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
if (LLVM_TARGET_TRIPLE MATCHES "ohos")
message(FATAL_ERROR "${LLVM_TARGET_TRIPLE} requires LLVM_ENABLE_PER_TARGET_RUNTIME_DIR")
endif()
endif()
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
get_compiler_rt_target(${arch} target)
set(${install_dir} ${COMPILER_RT_INSTALL_LIBRARY_DIR}/${target} PARENT_SCOPE)
Expand Down
Loading