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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 3ed15d0ff104f4faada259a26d48e9bea2443e3b Mon Sep 17 00:00:00 2001
  2. From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  3. Date: Fri, 22 Oct 2021 11:16:47 +0800
  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. Rebased to LLVM 14.0.0 by Jun Yuan Tan
  13. Signed-off-by: Greg Fitzgerald <gregf@codeaurora.org>
  14. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  15. Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  16. ---
  17. compiler-rt/CMakeLists.txt | 11 ++++++++++-
  18. 1 file changed, 10 insertions(+), 1 deletion(-)
  19. diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
  20. index 17d7e4ffbdeb..690d8e171e77 100644
  21. --- a/compiler-rt/CMakeLists.txt
  22. +++ b/compiler-rt/CMakeLists.txt
  23. @@ -82,7 +82,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOL
  24. "Build for a bare-metal target.")
  25. if (COMPILER_RT_STANDALONE_BUILD)
  26. - load_llvm_config()
  27. + find_package(LLVM REQUIRED)
  28. + list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
  29. +
  30. + # Variables that AddLLVM.cmake depends on (included by AddCompilerRT)
  31. + set(LLVM_TOOLS_BINARY_DIR "${LLVM_INSTALL_PREFIX}/bin")
  32. + set(LLVM_LIBRARY_DIR "${LLVM_INSTALL_PREFIX}/lib")
  33. +
  34. + set(LLVM_LIBRARY_OUTPUT_INTDIR
  35. + ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
  36. +
  37. if (TARGET intrinsics_gen)
  38. # Loading the llvm config causes this target to be imported so place it
  39. # under the appropriate folder in an IDE.
  40. --
  41. 2.33.0