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

Peter Waller via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 05:11:24 PDT 2024


================
@@ -135,36 +134,168 @@ if (LLVM_INCLUDE_TESTS)
   endif()
 endif()
 
-if (BOLT_ENABLE_RUNTIME)
-  message(STATUS "Building BOLT runtime libraries for X86")
-  set(extra_args "")
-  if(CMAKE_SYSROOT)
-    list(APPEND extra_args -DCMAKE_SYSROOT=${CMAKE_SYSROOT})
+set(AARCH64_GNU_C_COMPILER aarch64-linux-gnu-gcc)
+set(AARCH64_GNU_CXX_COMPILER aarch64-linux-gnu-g++)
+set(X86_64_GNU_C_COMPILER x86_64-linux-gnu-gcc)
+set(X86_64_GNU_CXX_COMPILER x86_64-linux-gnu-g++)
+set(RISCV_GNU_C_COMPILER riscv64-linux-gnu-gcc)
+set(RISCV_GNU_CXX_COMPILER riscv64-linux-gnu-g++)
----------------
peterwaller-arm wrote:

My request is that the user should be able to specify the cross compiler to use.

Essentially, what if the user wants to do `-DBOLT_AARCH64_CXX_COMPILER=foobar`?. I think this should be fine, and it's not GNU. Ideally it should 'win' over the auto-detection as well.

That said, the user could probably also invoke cmake manually just for the runtimes for this use case, so maybe what you have - which I understand is opportunistically attempting to auto-detect if we can reuse the compiler used to compile bolt - is fine.


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


More information about the llvm-commits mailing list