Thread (8 messages) 8 messages, 3 authors, 2021-08-02

Re: [PATCH v5 3/3] Documentation/llvm: update CROSS_COMPILE inferencing

From: Nick Desaulniers <hidden>
Date: 2021-08-02 17:57:26
Also in: lkml

On Fri, Jul 30, 2021 at 4:12 PM 'Fangrui Song' via Clang Built Linux
[off-list ref] wrote:
On 2021-07-30, Nick Desaulniers wrote:
quoted
As noted by Masahiro, document how we can generally infer CROSS_COMPILE
(and the more specific details about --target and --prefix) based on
ARCH.

Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nick Desaulniers <redacted>
---
Documentation/kbuild/llvm.rst | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst
index b18401d2ba82..4292f0686316 100644
--- a/Documentation/kbuild/llvm.rst
+++ b/Documentation/kbuild/llvm.rst
@@ -63,6 +63,23 @@ They can be enabled individually. The full list of the parameters: ::
Currently, the integrated assembler is disabled by default. You can pass
``LLVM_IAS=1`` to enable it.

+Omitting CROSS_COMPILE
+----------------------
+
+As explained above, ``CROSS_COMPILE`` is used to set ``--target=<triple>``.
+
+Unless ``LLVM_IAS=1`` is specified, ``CROSS_COMPILE`` is also used to derive
+``--prefix=<path>`` to search for the GNU assembler.
and the GNU linker.
Sure, I'll add this, but wanted to note that generally the compiler is
not used as the driver for kernel builds; the linker is invoked
directly. IIRC, there were a few spots where the compiler is used as
the driver; I think some of the various VDSO's are still built that
way, but it's not common.
Reviewed-by: Fangrui Song <redacted>
quoted
+If ``CROSS_COMPILE`` is not specified, the ``--target=<triple>`` is inferred
+from ``ARCH``.
+
+That means if you use only LLVM tools, ``CROSS_COMPILE`` becomes unnecessary.
+
+For example, to cross-compile the arm64 kernel::
+
+      ARCH=arm64 make LLVM=1 LLVM_IAS=1
Is  ARCH=arm64 make LLVM=1 LLVM_IAS=1

preferred over

   make ARCH=arm64 LLVM=1 LLVM_IAS=1

?
Will respond to this against Masahiro's reply.

-- 
Thanks,
~Nick Desaulniers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help