Llvm-test-suite cross-compilation configuration


I’m not sure this is quite the correct channel, but I couldn’t locate a dedicated one for llvm-test-suite.

I’ve recently been using the suite, with an x86-64 host and cross-compiling for a different target. The runtime for the target does not have the required headers to build tool/fcmp-target and tools/timeit-target. I configured CMake to use the host tools for timing and comparison, running the cross-compiled code in a simulator when llvm-lit is later executed (TEST_SUITE_USER_MODE_EMULATION).

However, some of the benchmarks have timeit-target and fcmp-target as dependencies, even if these tools are not going to be used when running llvm-lit on the suite. I had to manually edit tools/CMakeLists.txt, so that these targets are created without cross-compilation, enabling the benchmarks to build.

Have I missed something in the documents about disabling fcmp-target and timeit-target builds for a cross-compiled target?



I came across the same issue, and I also edited tools/CMakeLists.txt like this:

  if(ARCH STREQUAL "MyArch")
    add_executable(timeit-target ${CMAKE_CURRENT_SOURCE_DIR}/timeit-dummy.c)
    add_executable(timeit-target ${CMAKE_CURRENT_SOURCE_DIR}/timeit.c)

with timeit-dummy.c containing just int main(void) { return 1; }.
If I remember correctly, it is not used when TEST_SUITE_USER_MODE_EMULATION is enabled even though it is a required dependency.

1 Like

Related: ⚙ D150431 [lit] Add knob --run-prefix to allow developers to run LIT on a simulator when real machine is not available
Though I’m surprised some benchmarks have hard-coded dependencies on timeit/fcmp-target