hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/Documentation/kbuild/llvm.rst
....@@ -1,3 +1,5 @@
1
+.. _kbuild_llvm:
2
+
13 ==============================
24 Building Linux with Clang/LLVM
35 ==============================
....@@ -23,8 +25,8 @@
2325 Clang
2426 -----
2527
26
-The compiler used can be swapped out via `CC=` command line argument to `make`.
27
-`CC=` should be set when selecting a config and during a build.
28
+The compiler used can be swapped out via ``CC=`` command line argument to ``make``.
29
+``CC=`` should be set when selecting a config and during a build. ::
2830
2931 make CC=clang defconfig
3032
....@@ -34,33 +36,32 @@
3436 ---------------
3537
3638 A single Clang compiler binary will typically contain all supported backends,
37
-which can help simplify cross compiling.
39
+which can help simplify cross compiling. ::
3840
3941 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
4042
41
-`CROSS_COMPILE` is not used to prefix the Clang compiler binary, instead
42
-`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
43
-example:
43
+``CROSS_COMPILE`` is not used to prefix the Clang compiler binary, instead
44
+``CROSS_COMPILE`` is used to set a command line flag: ``--target=<triple>``. For
45
+example: ::
4446
45
- clang --target aarch64-linux-gnu foo.c
47
+ clang --target=aarch64-linux-gnu foo.c
4648
4749 LLVM Utilities
4850 --------------
4951
50
-LLVM has substitutes for GNU binutils utilities. Kbuild supports `LLVM=1`
51
-to enable them.
52
+LLVM has substitutes for GNU binutils utilities. Kbuild supports ``LLVM=1``
53
+to enable them. ::
5254
5355 make LLVM=1
5456
55
-They can be enabled individually. The full list of the parameters:
57
+They can be enabled individually. The full list of the parameters: ::
5658
57
- make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
58
- OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\
59
- READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
60
- HOSTLD=ld.lld
59
+ make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \
60
+ OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump READELF=llvm-readelf \
61
+ HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar HOSTLD=ld.lld
6162
6263 Currently, the integrated assembler is disabled by default. You can pass
63
-`LLVM_IAS=1` to enable it.
64
+``LLVM_IAS=1`` to enable it.
6465
6566 Getting Help
6667 ------------
....@@ -73,10 +74,12 @@
7374 - `Wiki <https://github.com/ClangBuiltLinux/linux/wiki>`_
7475 - `Beginner Bugs <https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_
7576
77
+.. _getting_llvm:
78
+
7679 Getting LLVM
7780 -------------
7881
79
-- http://releases.llvm.org/download.html
82
+- https://releases.llvm.org/download.html
8083 - https://github.com/llvm/llvm-project
8184 - https://llvm.org/docs/GettingStarted.html
8285 - https://llvm.org/docs/CMake.html