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

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From 243f40f492fbbbc3104de0fc77eef3122a4a42c4 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. Upstream-Status: Pending
  10. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  11. ---
  12. clang/lib/Driver/ToolChain.cpp | 6 +++++-
  13. 1 file changed, 5 insertions(+), 1 deletion(-)
  14. diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
  15. index bc70205a6c01..527efd421e01 100644
  16. --- a/clang/lib/Driver/ToolChain.cpp
  17. +++ b/clang/lib/Driver/ToolChain.cpp
  18. @@ -13,6 +13,7 @@
  19. #include "ToolChains/InterfaceStubs.h"
  20. #include "clang/Basic/ObjCRuntime.h"
  21. #include "clang/Basic/Sanitizers.h"
  22. +#include "clang/Basic/Version.h"
  23. #include "clang/Config/config.h"
  24. #include "clang/Driver/Action.h"
  25. #include "clang/Driver/Driver.h"
  26. @@ -488,7 +489,10 @@ StringRef ToolChain::getOSLibName() const {
  27. }
  28. std::string ToolChain::getCompilerRTPath() const {
  29. - SmallString<128> Path(getDriver().ResourceDir);
  30. + SmallString<128> Path(getDriver().SysRoot);
  31. + StringRef ClangLibdirBasename(CLANG_INSTALL_LIBDIR_BASENAME);
  32. + llvm::sys::path::append(Path, "/usr/", ClangLibdirBasename, "clang",
  33. + CLANG_VERSION_STRING);
  34. if (isBareMetal()) {
  35. llvm::sys::path::append(Path, "lib", getOSLibName());
  36. Path += SelectedMultilib.gccSuffix();