summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0025-clang-Do-not-use-install-relative-libc-headers.patch
blob: d19d16506b19420db757df370ad77409516e5446 (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
From 0a80036efcec431252a1e8a521e7aab3df11c8fc Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 11 Aug 2021 18:37:11 -0700
Subject: [PATCH] clang: Do not use install relative libc++ headers

In OE we use same clang for native and cross builds, therefore we need
to ensure that native sysroot install of libc++ is not searched for
headers when doing cross compile instead it searches the target sysroot
this is especially troublesome when libcxx-native is staged along with
libcxx e.g. chromium

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 clang/lib/Driver/ToolChains/Gnu.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 0db37c6ef1a8..80a21d58c86c 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -3093,7 +3093,9 @@ Generic_GCC::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
 
   // Android never uses the libc++ headers installed alongside the toolchain,
   // which are generally incompatible with the NDK libraries anyway.
-  if (!getTriple().isAndroid())
+  // And also do not add it when --sysroot is specified, since it would expect
+  // libc++ headers from sysroot
+  if (!getTriple().isAndroid() && SysRoot.empty())
     if (AddIncludePath(getDriver().Dir + "/../include"))
       return;
   // If this is a development, non-installed, clang, libcxx will