doc: fix LTO config option
[dpdk.git] / doc / guides / prog_guide / lto.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2019 Marvell International Ltd.
3
4 Link Time Optimization
5 ======================
6
7 The DPDK supports compilation with link time optimization turned on.
8 This depends obviously on the ability of the compiler to do "whole
9 program" optimization at link time and is available only for compilers
10 that support that feature.
11 To be more specific, compiler (in addition to performing LTO) have to
12 support creation of ELF objects containing both normal code and internal
13 representation (called fat-lto-objects in gcc and icc).
14 This is required since during build some code is generated by parsing
15 produced ELF objects (pmdinfogen).
16
17 The amount of performance gain that one can get from LTO depends on the
18 compiler and the code that is being compiled.
19 However LTO is also useful for additional code analysis done by the
20 compiler.
21 In particular due to interprocedural analysis compiler can produce
22 additional warnings about variables that might be used uninitialized.
23 Some of these warnings might be "false positives" though and you might
24 need to explicitly initialize variable in order to silence the compiler.
25
26 Please note that turning LTO on causes considerable extension of
27 build time.
28
29 When using make based build, link time optimization can be enabled for
30 the whole DPDK by setting:
31
32 .. code-block:: console
33
34     CONFIG_RTE_ENABLE_LTO=y
35
36 in config file.
37
38 For the meson based build it can be enabled by setting meson built-in
39 'b_lto' option:
40
41 .. code-block:: console
42
43     meson build -Db_lto=true