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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 1752b43655f7ff5319e3b6c7abfbca965b3ff48c Mon Sep 17 00:00:00 2001
  2. From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  3. Date: Tue, 9 Nov 2021 10:00:32 +0800
  4. Subject: [PATCH 03/34] 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 | 10 ++++++++++
  18. 1 file changed, 10 insertions(+)
  19. diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
  20. index 4bbcf9aca4e8..bef42018877a 100644
  21. --- a/compiler-rt/CMakeLists.txt
  22. +++ b/compiler-rt/CMakeLists.txt
  23. @@ -81,6 +81,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOL
  24. if (COMPILER_RT_STANDALONE_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. if (TARGET intrinsics_gen)
  37. # Loading the llvm config causes this target to be imported so place it
  38. # under the appropriate folder in an IDE.
  39. --
  40. 2.33.1