Technical Details About LLD

From RAD Studio
Jump to: navigation, search

Go Up to C++ Linkers

Attention: This information only applies to 64-bit Windows (Modern) platforms.

Please see the Using LLD on the Command Line page, for information on using LLD on the command line.

LLD

LLD is a linker from the LLVM project that is a drop-in replacement for system linkers such as GNU BFD and gold linkers, running much faster than them. Besides, its features are useful for toolchain developers.

The LLD project supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and WebAssembly in descending order of completeness. But RAD Studio only supports COFF for Windows.

Linker Settings

Please consider the following information about the LLD linker characteristics and behavior.

  • Garbage collects unused sections: maps to --gc-sections, and when disabled --no-gc-sections. This may be very useful for reducing the size of your final binary (EXE or DLL).
  • Data Execution Prevention compatible (on by default). When disabled it maps to --disable-nxcompat.
  • Delay Load DLL: maps to --delayload=... Allows a list of DLLs to delay-load.
  • File alignment: maps to --file-alignment= with a 0x200 (512) default value.
    Attention: This value must be multiples of 512 bytes.
  • Object alignment: maps to --section-alignment= with a 0x1000 (4096) default value.
    Attention: This value must be multiples of 512 bytes.
  • ASLR/High entropy address space layout randomization (on by default): maps to --disable-dynamicbase when disabled.
  • Verbose linking: is useful to diagnose linking issues.
  • Refile and object/section alignment: note that the linker also supports data alignment on 16-byte boundaries, which is key for newer instruction sets. Legacy ilink did not, which was one reason we did not enable newer instruction sets by default in the past.
  • Now RAD Studio supports -fdata-sections and -ffunction-sections compilers options.

    See Also