summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0009-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
blob: 90b286a9e7b836aae476b8dd257cc3afadd5400a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From c865d5064247bfc985bc92409869cd21ca5c74e9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 16 Mar 2017 19:06:26 -0700
Subject: [PATCH] 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>
---
 clang/lib/Driver/ToolChain.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index bc70205a6c01..527efd421e01 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -13,6 +13,7 @@
 #include "ToolChains/InterfaceStubs.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/Sanitizers.h"
+#include "clang/Basic/Version.h"
 #include "clang/Config/config.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Driver.h"
@@ -488,7 +489,10 @@ StringRef ToolChain::getOSLibName() const {
 }
 
 std::string ToolChain::getCompilerRTPath() const {
-  SmallString<128> Path(getDriver().ResourceDir);
+  SmallString<128> Path(getDriver().SysRoot);
+  StringRef ClangLibdirBasename(CLANG_INSTALL_LIBDIR_BASENAME);
+  llvm::sys::path::append(Path, "/usr/", ClangLibdirBasename, "clang",
+                            CLANG_VERSION_STRING);
   if (isBareMetal()) {
     llvm::sys::path::append(Path, "lib", getOSLibName());
     Path += SelectedMultilib.gccSuffix();