[llvm] [BOLT] Enable cross compilation of runtime libraries (PR #101180)

Peter Waller via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 08:32:05 PDT 2024


================
@@ -29,24 +29,25 @@ if(NOT BOLT_BUILT_STANDALONE)
   add_custom_command(TARGET bolt_rt_hugify POST_BUILD
     COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/lib/libbolt_rt_hugify.a" "${LLVM_LIBRARY_DIR}")
 endif()
-
-set(BOLT_RT_FLAGS
+# In case of compiling with clang, the '--target' option is passed in BOLT_RT_FLAGS.
+set(BOLT_RT_FLAGS ${BOLT_RT_FLAGS}
   -ffreestanding
   -fno-exceptions
   -fno-rtti
   -fno-stack-protector
   -fPIC
   -mgeneral-regs-only)
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+if(CMAKE_TARGET_SYSTEM_PROCESSOR STREQUAL "x86_64")
   set(BOLT_RT_FLAGS ${BOLT_RT_FLAGS} "-mno-sse")
 endif()
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
+if(CMAKE_TARGET_SYSTEM_PROCESSOR STREQUAL "aarch64")
----------------
peterwaller-arm wrote:

I can't [find documentation CMAKE_TARGET_SYSTEM_PROCESSOR](https://cmake.org/cmake/help/book/mastering-cmake/search.html?q=CMAKE_TARGET_SYSTEM_PROCESSOR) ([duckduckgo](https://duckduckgo.com/?q=%22CMAKE_TARGET_SYSTEM_PROCESSOR%22&t=ffab&ia=web)), and https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_PROCESSOR.html#variable:CMAKE_SYSTEM_PROCESSOR documents that CMAKE_SYSTEM_PROCESSOR should be set to the target.

https://github.com/llvm/llvm-project/pull/101180


More information about the llvm-commits mailing list