0033-clang-Do-not-use-install-relative-libc-headers.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 21cdaa9e3e8ec001d3f2de9a6e1e142c1b67066a Mon Sep 17 00:00:00 2001
  2. From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  3. Date: Tue, 9 Nov 2021 11:07:52 +0800
  4. Subject: [PATCH 33/34] clang: Do not use install relative libc++ headers
  5. In OE we use same clang for native and cross builds, therefore we need
  6. to ensure that native sysroot install of libc++ is not searched for
  7. headers when doing cross compile instead it searches the target sysroot
  8. this is especially troublesome when libcxx-native is staged along with
  9. libcxx e.g. chromium
  10. Rebased to LLVM 14.0.0 by Jun Yuan Tan
  11. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  12. Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  13. ---
  14. clang/lib/Driver/ToolChains/Gnu.cpp | 4 +++-
  15. 1 file changed, 3 insertions(+), 1 deletion(-)
  16. diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
  17. index e6f440902e97..fc65d92e8ea0 100644
  18. --- a/clang/lib/Driver/ToolChains/Gnu.cpp
  19. +++ b/clang/lib/Driver/ToolChains/Gnu.cpp
  20. @@ -2934,7 +2934,9 @@ Generic_GCC::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
  21. // Android never uses the libc++ headers installed alongside the toolchain,
  22. // which are generally incompatible with the NDK libraries anyway.
  23. - if (!getTriple().isAndroid())
  24. + // And also do not add it when --sysroot is specified, since it would expect
  25. + // libc++ headers from sysroot
  26. + if (!getTriple().isAndroid() && SysRoot.empty())
  27. if (AddIncludePath(getDriver().Dir + "/../include"))
  28. return;
  29. // If this is a development, non-installed, clang, libcxx will
  30. --
  31. 2.33.1