Skip to content

Commit c2a82c5

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 ba4ef24 commit c2a82c5

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"
@@ -708,7 +709,10 @@ StringRef ToolChain::getOSLibName() const {
708709
}
709710

710711
std::string ToolChain::getCompilerRTPath() const {
711-
SmallString<128> Path(getDriver().ResourceDir);
712+
SmallString<128> Path(getDriver().SysRoot);
713+
StringRef ClangLibdirBasename(CLANG_INSTALL_LIBDIR_BASENAME);
714+
llvm::sys::path::append(Path, "/usr/", ClangLibdirBasename, "clang",
715+
CLANG_VERSION_STRING);
712716
if (isBareMetal()) {
713717
llvm::sys::path::append(Path, "lib", getOSLibName());
714718
if (!SelectedMultilibs.empty()) {

0 commit comments

Comments
 (0)