0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From e1031fdbe63c6065b89e1e15f9bbc62cd36cd898 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Thu, 19 May 2016 23:11:45 -0700
  4. Subject: [PATCH] compiler-rt: Simplify cross-compilation. Don't use
  5. native-compiled llvm-config.
  6. Note: AddLLVM.cmake does not expose the LLVM source directory.
  7. So if you want to run the test suite, you need to either:
  8. 1) set LLVM_MAIN_SRC_DIR explicitly (to find lit.py)
  9. 2) change AddLLVM.cmake to point to an installed 'lit'.
  10. 3) add_subdirectory(compiler-rt/test) from clang instead of compiler-rt.
  11. https://us.codeaurora.org/patches/quic/llvm/50683/compiler-rt-cross-compilation.patch
  12. Upstream-Status: Pending
  13. Signed-off-by: Greg Fitzgerald <gregf@codeaurora.org>
  14. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  15. ---
  16. compiler-rt/CMakeLists.txt | 11 ++++++++++-
  17. 1 file changed, 10 insertions(+), 1 deletion(-)
  18. diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
  19. index 8a13508fcb98..2c2bda5befa5 100644
  20. --- a/compiler-rt/CMakeLists.txt
  21. +++ b/compiler-rt/CMakeLists.txt
  22. @@ -89,7 +89,16 @@ if (COMPILER_RT_STANDALONE_BUILD)
  23. set(CMAKE_CXX_EXTENSIONS NO)
  24. if (NOT LLVM_RUNTIMES_BUILD)
  25. - load_llvm_config()
  26. + find_package(LLVM REQUIRED)
  27. + list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
  28. +
  29. + # Variables that AddLLVM.cmake depends on (included by AddCompilerRT)
  30. + set(LLVM_TOOLS_BINARY_DIR "${LLVM_INSTALL_PREFIX}/bin")
  31. + set(LLVM_LIBRARY_DIR "${LLVM_INSTALL_PREFIX}/lib")
  32. +
  33. + set(LLVM_LIBRARY_OUTPUT_INTDIR
  34. + ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
  35. +
  36. endif()
  37. if (TARGET intrinsics_gen)
  38. # Loading the llvm config causes this target to be imported so place it