diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst --- a/llvm/docs/CMake.rst +++ b/llvm/docs/CMake.rst @@ -698,6 +698,13 @@ %PATH%, then you can set this variable to the GnuWin32 directory so that lit can find tools needed for tests in that directory. +**LLVM_NATIVE_TOOL_DIR**:STRING + Full path to a directory containing executables for the build host + (containing binaries such as ``llvm-tblgen`` and ``clang-tblgen``). This is + intended for cross-compiling: if the user sets this variable and the + directory contains executables with the expected names, no separate + native versions of those executables will be built. + **LLVM_OPTIMIZED_TABLEGEN**:BOOL If enabled and building a debug or asserts build the CMake build system will generate a Release build tree to build a fully optimized tablegen for use diff --git a/llvm/docs/HowToBuildWithPGO.rst b/llvm/docs/HowToBuildWithPGO.rst --- a/llvm/docs/HowToBuildWithPGO.rst +++ b/llvm/docs/HowToBuildWithPGO.rst @@ -165,7 +165,6 @@ optimization that can be made: LLVM and Clang have a tool called tblgen that's built and run during the build process. While it's potentially nice to build this for coverage as part of step 3, none of your other builds should benefit -from building it. You can pass the CMake options -``-DCLANG_TABLEGEN=/path/to/stage1/bin/clang-tblgen --DLLVM_TABLEGEN=/path/to/stage1/bin/llvm-tblgen`` to steps 2 and onward to avoid -these useless rebuilds. +from building it. You can pass the CMake option +``-DLLVM_NATIVE_TOOL_DIR=/path/to/stage1/bin`` +to steps 2 and onward to avoid these useless rebuilds. diff --git a/llvm/docs/HowToCrossCompileLLVM.rst b/llvm/docs/HowToCrossCompileLLVM.rst --- a/llvm/docs/HowToCrossCompileLLVM.rst +++ b/llvm/docs/HowToCrossCompileLLVM.rst @@ -42,8 +42,7 @@ * ``-DCMAKE_SYSTEM_NAME=`` * ``-DCMAKE_INSTALL_PREFIX=`` - * ``-DLLVM_TABLEGEN=/llvm-tblgen`` - * ``-DCLANG_TABLEGEN=/clang-tblgen`` + * ``-DLLVM_NATIVE_TOOL_DIR=`` * ``-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf`` * ``-DLLVM_TARGET_ARCH=ARM`` * ``-DLLVM_TARGETS_TO_BUILD=ARM`` @@ -66,9 +65,12 @@ * Appropriate use of ``-I`` and ``-L``, depending on how the cross GCC is installed, and where are the libraries and headers. -The TableGen options are required to compile it with the host compiler, -so you'll need to compile LLVM (or at least ``llvm-tblgen``) to your host -platform before you start. The CXX flags define the target, cpu (which in this case +The ``LLVM_NATIVE_TOOL_DIR`` option allows you to reuse prebuilt binaries +(``llvm-tblgen``, ``clang-tblgen`` etc) for the build host, if such are +available. If that's not available, the LLVM cross build will automatically +launch a nested build to build the tools that are required. + +The CXX flags define the target, cpu (which in this case defaults to ``fpu=VFP3`` with NEON), and forcing the hard-float ABI. If you're using Clang as a cross-compiler, you will *also* have to set ``--sysroot`` to make sure it picks the correct linker.