Skip to content

Commit 798985a

Browse files
committed
clang: Look inside the target sysroot for compiler runtime
In OE compiler-rt and libc++ are built and staged into target sysroot and not into resourcedir which is relative to clang driver installation where the libraries are not instlled Specific to cross compiling the way yocto/OE works Upstream-Status: Pending Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 parent 8b9887b commit 798985a

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
@@ -15,6 +15,7 @@
1515
#include "ToolChains/InterfaceStubs.h"
1616
#include "clang/Basic/ObjCRuntime.h"
1717
#include "clang/Basic/Sanitizers.h"
18+
#include "clang/Basic/Version.h"
1819
#include "clang/Config/config.h"
1920
#include "clang/Driver/Action.h"
2021
#include "clang/Driver/CommonArgs.h"
@@ -702,7 +703,10 @@ StringRef ToolChain::getOSLibName() const {
702703
}
703704

704705
std::string ToolChain::getCompilerRTPath() const {
705-
SmallString<128> Path(getDriver().ResourceDir);
706+
SmallString<128> Path(getDriver().SysRoot);
707+
StringRef ClangLibdirBasename(CLANG_INSTALL_LIBDIR_BASENAME);
708+
llvm::sys::path::append(Path, "/usr/", ClangLibdirBasename, "clang",
709+
CLANG_VERSION_STRING);
706710
if (isBareMetal()) {
707711
llvm::sys::path::append(Path, "lib", getOSLibName());
708712
if (!SelectedMultilibs.empty()) {

0 commit comments

Comments
 (0)