Skip to content

Commit 14d95fb

Browse files
committed
ohos: fix ohos.c test case error with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
The problem is because libclang_rt.builtins-{arch}.a for all the arches will be installed into the same folder with old compiler rt layout (LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF) and OHOS driver will get a wrong library in this case. To fix the problem, `-ohos` suffix will be added to the ohos builtin libraries search path. Note: OHOS driver doesn't support the old layout, ${arch}-linux-unknown-ohos targets have to be built with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
1 parent 62cd050 commit 14d95fb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/Driver/ToolChain.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,11 @@ std::string ToolChain::buildCompilerRTBasename(const llvm::opt::ArgList &Args,
745745
std::string ArchAndEnv;
746746
if (AddArch) {
747747
StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
748-
const char *Env = TT.isAndroid() ? "-android" : "";
748+
const char *Env = "";
749+
if (TT.isAndroid())
750+
Env = "-android";
751+
else if (TT.isOHOSFamily())
752+
Env = "-ohos";
749753
ArchAndEnv = ("-" + Arch + Env).str();
750754
}
751755
return (Prefix + Twine("clang_rt.") + Component + ArchAndEnv + Suffix).str();

0 commit comments

Comments
 (0)