Skip to content

Commit e08831b

Browse files
nickdesaulniersmasahir0y
authored andcommitted
Documentation/llvm: update CROSS_COMPILE inferencing
As noted by Masahiro, document how we can generally infer CROSS_COMPILE (and the more specific details about --target and --prefix) based on ARCH. Change use of env vars to command line parameters. Suggested-by: Masahiro Yamada <[email protected]> Reviewed-by: Fangrui Song <[email protected]> Signed-off-by: Nick Desaulniers <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 231ad7f commit e08831b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Documentation/kbuild/llvm.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Cross Compiling
3838
A single Clang compiler binary will typically contain all supported backends,
3939
which can help simplify cross compiling. ::
4040

41-
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
41+
make ARCH=arm64 CC=clang CROSS_COMPILE=aarch64-linux-gnu-
4242

4343
``CROSS_COMPILE`` is not used to prefix the Clang compiler binary, instead
4444
``CROSS_COMPILE`` is used to set a command line flag: ``--target=<triple>``. For
@@ -63,6 +63,23 @@ They can be enabled individually. The full list of the parameters: ::
6363
Currently, the integrated assembler is disabled by default. You can pass
6464
``LLVM_IAS=1`` to enable it.
6565

66+
Omitting CROSS_COMPILE
67+
----------------------
68+
69+
As explained above, ``CROSS_COMPILE`` is used to set ``--target=<triple>``.
70+
71+
Unless ``LLVM_IAS=1`` is specified, ``CROSS_COMPILE`` is also used to derive
72+
``--prefix=<path>`` to search for the GNU assembler and linker.
73+
74+
If ``CROSS_COMPILE`` is not specified, the ``--target=<triple>`` is inferred
75+
from ``ARCH``.
76+
77+
That means if you use only LLVM tools, ``CROSS_COMPILE`` becomes unnecessary.
78+
79+
For example, to cross-compile the arm64 kernel::
80+
81+
make ARCH=arm64 LLVM=1 LLVM_IAS=1
82+
6683
Supported Architectures
6784
-----------------------
6885

0 commit comments

Comments
 (0)