[PATCH] D29030: [LNT] Add cross-compilation support to 'lnt runtest test-suite'

Kristof Beyls via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 08:18:50 PST 2017


kristof.beyls added a comment.

In https://reviews.llvm.org/D29030#653374, @rengolin wrote:

> Hi Kristof,
>
> Thanks for working on this, we really needed this functionality.
>
> My question is if we shouldn't have only one way to pass options. I'm worried that the external file will confuse people.


The external file seems to be the canonical way to cross-compile cmake-based projects, e.g. see https://cmake.org/cmake/help/v3.0/manual/cmake-toolchains.7.html#cross-compiling.
Therefore, I think that following "the one true way to do cross-compiling, the cmake-approach" in the long run will lead to least confusion.

> For instance, if you specify the cross compiler by full path, it should be able to figure out the sysroot (bin/..) in most cases.

Maybe in most cases, but at least not in the case of my setup, where I'm testing a clang I'm developing myself, with a Linaro-provided sysroot.
Anyway, I hope that by explicitly showing a cmake toolchain file in the documentation of LNT, it will help people to write a toolchain file. Although this really is cmake documentation (and the documentation at the URL I provided above wasn't too bad: it helped me to quickly write the clang-aarch64-linux.cmake file I've posted as an example in this thread above), I think it'd be useful to show a concrete example with a clang toolchain to help llvm developers to get up and running quickly.

> Also, that would work for GCC (with the triple in the name), but not for Clang. I see you're using "TARGET" for that, but other options (like -mthumb -mfloat-abi etc) will need to be passed as well.

The other options are being passed via the lnt command line, using --cppflags. Also see how I pass "-O3" in the example I have above.
TARGET seems to be the cmake approach to specify the target for cross-compiling, also see the URL I pointed at above. Again, I'd like to stick with how cmake documents how to do cross-compilation.

> I think these can be reduced cleanly to:
> 
> - CROSS_CC / CROSS_CXX
> - CROSS_CFLAGS / CROSS_CXXFLAGS
> 
>   and thus passed via LNT -- flags like all the others.
> 
>   cheers, --renato





================
Comment at: lnt/tests/test_suite.py:389
+
+        if self.opts.cc is not None and \
+           self.opts.cross_compiling_toolchain_file is not None:
----------------
rengolin wrote:
> So the tools like fpcmp will be compiled to the target and executed on the QEMU as well?
No, the test-suite's cmake infrastructure already handles this well: tools like fpcmp are built and run natively on the host.


https://reviews.llvm.org/D29030





More information about the llvm-commits mailing list