Skip to content

Commit 16fc449

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 <[email protected]>
1 parent ffdb94e commit 16fc449

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"
@@ -723,7 +724,10 @@ StringRef ToolChain::getOSLibName() const {
723724
}
724725

725726
std::string ToolChain::getCompilerRTPath() const {
726-
SmallString<128> Path(getDriver().ResourceDir);
727+
SmallString<128> Path(getDriver().SysRoot);
728+
StringRef ClangLibdirBasename(CLANG_INSTALL_LIBDIR_BASENAME);
729+
llvm::sys::path::append(Path, "/usr/", ClangLibdirBasename, "clang",
730+
CLANG_VERSION_STRING);
727731
if (isBareMetal()) {
728732
llvm::sys::path::append(Path, "lib", getOSLibName());
729733
if (!SelectedMultilibs.empty()) {

0 commit comments

Comments
 (0)