0009-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From da2647d56a98cc708a6b13e3586e7fb364ef77a0 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Thu, 16 Mar 2017 19:06:26 -0700
  4. Subject: [PATCH] clang: Look inside the target sysroot for compiler runtime
  5. In OE compiler-rt and libc++ are built and staged into target
  6. sysroot and not into resourcedir which is relative to clang
  7. driver installation where the libraries are not instlled
  8. Specific to cross compiling the way yocto/OE works
  9. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  10. ---
  11. clang/lib/Driver/ToolChain.cpp | 6 +++++-
  12. 1 file changed, 5 insertions(+), 1 deletion(-)
  13. diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
  14. index d657d21bfcdb..e83a556b708c 100644
  15. --- a/clang/lib/Driver/ToolChain.cpp
  16. +++ b/clang/lib/Driver/ToolChain.cpp
  17. @@ -13,6 +13,7 @@
  18. #include "ToolChains/InterfaceStubs.h"
  19. #include "clang/Basic/ObjCRuntime.h"
  20. #include "clang/Basic/Sanitizers.h"
  21. +#include "clang/Basic/Version.h"
  22. #include "clang/Config/config.h"
  23. #include "clang/Driver/Action.h"
  24. #include "clang/Driver/Driver.h"
  25. @@ -419,7 +420,10 @@ StringRef ToolChain::getOSLibName() const {
  26. }
  27. std::string ToolChain::getCompilerRTPath() const {
  28. - SmallString<128> Path(getDriver().ResourceDir);
  29. + SmallString<128> Path(getDriver().SysRoot);
  30. + StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
  31. + llvm::sys::path::append(Path, "/usr/", Twine("lib") + ClangLibdirSuffix, "clang",
  32. + CLANG_VERSION_STRING);
  33. if (Triple.isOSUnknown()) {
  34. llvm::sys::path::append(Path, "lib");
  35. } else {