summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
blob: 14db1e626853333c5075eb8214ef64d0894ace8f (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
42
43
44
From b47912e2304c1e3d3bca7e973037b859739aea15 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 5/6] 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

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 lib/Driver/ToolChain.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index 4f82503276..507e051afc 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -12,6 +12,7 @@
 #include "ToolChains/Arch/ARM.h"
 #include "ToolChains/Clang.h"
 #include "clang/Basic/ObjCRuntime.h"
+#include "clang/Basic/Version.h"
 #include "clang/Basic/VirtualFileSystem.h"
 #include "clang/Config/config.h"
 #include "clang/Driver/Action.h"
@@ -320,7 +321,10 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
   const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
                               : (IsITANMSVCWindows ? ".lib" : ".a");
 
-  SmallString<128> Path(getDriver().ResourceDir);
+  SmallString<128> Path(getDriver().SysRoot);
+  StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
+  llvm::sys::path::append(Path, "/usr/", Twine("lib") + ClangLibdirSuffix, "clang",
+                            CLANG_VERSION_STRING);
   StringRef OSLibName = Triple.isOSFreeBSD() ? "freebsd" : getOS();
   llvm::sys::path::append(Path, "lib", OSLibName);
   llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" +
-- 
2.13.0