.. | .. |
---|
| 1 | +.. _kbuild_llvm: |
---|
| 2 | + |
---|
1 | 3 | ============================== |
---|
2 | 4 | Building Linux with Clang/LLVM |
---|
3 | 5 | ============================== |
---|
.. | .. |
---|
23 | 25 | Clang |
---|
24 | 26 | ----- |
---|
25 | 27 | |
---|
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. :: |
---|
28 | 30 | |
---|
29 | 31 | make CC=clang defconfig |
---|
30 | 32 | |
---|
.. | .. |
---|
34 | 36 | --------------- |
---|
35 | 37 | |
---|
36 | 38 | 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. :: |
---|
38 | 40 | |
---|
39 | 41 | ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang |
---|
40 | 42 | |
---|
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: :: |
---|
44 | 46 | |
---|
45 | | - clang --target aarch64-linux-gnu foo.c |
---|
| 47 | + clang --target=aarch64-linux-gnu foo.c |
---|
46 | 48 | |
---|
47 | 49 | LLVM Utilities |
---|
48 | 50 | -------------- |
---|
49 | 51 | |
---|
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. :: |
---|
52 | 54 | |
---|
53 | 55 | make LLVM=1 |
---|
54 | 56 | |
---|
55 | | -They can be enabled individually. The full list of the parameters: |
---|
| 57 | +They can be enabled individually. The full list of the parameters: :: |
---|
56 | 58 | |
---|
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 |
---|
61 | 62 | |
---|
62 | 63 | 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. |
---|
64 | 65 | |
---|
65 | 66 | Getting Help |
---|
66 | 67 | ------------ |
---|
.. | .. |
---|
73 | 74 | - `Wiki <https://github.com/ClangBuiltLinux/linux/wiki>`_ |
---|
74 | 75 | - `Beginner Bugs <https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_ |
---|
75 | 76 | |
---|
| 77 | +.. _getting_llvm: |
---|
| 78 | + |
---|
76 | 79 | Getting LLVM |
---|
77 | 80 | ------------- |
---|
78 | 81 | |
---|
79 | | -- http://releases.llvm.org/download.html |
---|
| 82 | +- https://releases.llvm.org/download.html |
---|
80 | 83 | - https://github.com/llvm/llvm-project |
---|
81 | 84 | - https://llvm.org/docs/GettingStarted.html |
---|
82 | 85 | - https://llvm.org/docs/CMake.html |
---|