Data Plane Development Kit Logo
25.07.0
  • Getting Started Guide for Linux
  • Getting Started Guide for FreeBSD
  • Getting Started Guide for Windows
  • Sample Applications User Guides
  • Programmer’s Guide
    • Foundation Principles
    • Memory Management
    • CPU Management
    • CPU Packet Processing
    • Device Libraries
    • Protocol Processing Libraries
    • High-Level Libraries
    • Utility Libraries
    • Howto Guides
    • Tips & Tricks
      • 1. Performance Optimization Guidelines
      • 2. Writing Efficient Code
      • 3. Link Time Optimization
      • 4. Profile Your Application
      • 5. Running AddressSanitizer
  • HowTo Guides
  • DPDK Tools User Guides
  • Testpmd Application User Guide
  • Network Interface Controller Drivers
  • Baseband Device Drivers
  • Crypto Device Drivers
  • Compression Device Drivers
  • vDPA Device Drivers
  • REGEX Device Drivers
  • Machine Learning Device Driver
  • DMA Device Drivers
  • General-Purpose Graphics Processing Unit Drivers
  • Event Device Drivers
  • Rawdev Drivers
  • Mempool Device Driver
  • Platform Specific Guides
  • Contributor’s Guidelines
  • Release Notes
  • FAQ
Data Plane Development Kit
  • Programmer’s Guide
  • 3. Link Time Optimization
  • View page source

3. Link Time Optimization

The DPDK supports compilation with link time optimization turned on. This depends obviously on the ability of the compiler to do “whole program” optimization at link time and is available only for compilers that support that feature. To be more specific, compiler (in addition to performing LTO) have to support creation of ELF objects containing both normal code and internal representation (called fat-lto-objects in gcc). This is required since during build some code is generated by parsing produced ELF objects (pmdinfogen).

The amount of performance gain that one can get from LTO depends on the compiler and the code that is being compiled. However LTO is also useful for additional code analysis done by the compiler. In particular due to interprocedural analysis compiler can produce additional warnings about variables that might be used uninitialized. Some of these warnings might be “false positives” though and you might need to explicitly initialize variable in order to silence the compiler.

Please note that turning LTO on causes considerable extension of build time.

Link time optimization can be enabled by setting meson built-in ‘b_lto’ option:

meson setup build -Db_lto=true
Previous Next

Built with Sphinx using a theme provided by Read the Docs.