Skip to content

Commit 4a4ac89

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 25230db commit 4a4ac89

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
@@ -16,6 +16,7 @@
1616
#include "ToolChains/InterfaceStubs.h"
1717
#include "clang/Basic/ObjCRuntime.h"
1818
#include "clang/Basic/Sanitizers.h"
19+
#include "clang/Basic/Version.h"
1920
#include "clang/Config/config.h"
2021
#include "clang/Driver/Action.h"
2122
#include "clang/Driver/Driver.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)