Using LLD on the Command Line

From RAD Studio
Jump to: navigation, search

Go Up to Command-Line Utilities Index

he Windows 64-bit Modern (bcc64x) toolchain uses LLVM’s lld linker. For reference, check the official lld documentation.

lld is normally invoked by the MSBuild scripts. If you want to invoke lld manually, there are a few things to note.

RTL linking

The startup code `crt2.o` and `crtbegin.o` object files should be the first objects listed and `crtend.o` must be the last.

When building for Delphi (as for a normal VCL or FMX application), add `sysinit.o` and additional Delphi-related libraries like rtl.lib and rtle.lib.

Linking Libraries

Add libraries using the `-l:[library]` flag. Note the colon between the lowercase L and the library name. Use `-lname` to add library `libname.a` with `.a` extension and use `-l:name.ext` for explicitly specified names like `-l:rtle.lib`.

For example, `-l:ucrt` links with the UCRT library `libucrt.a` and `-l:rtle.lib` for rtle.lib.

Note: Non-MinGW libraries may not have a `lib` prefix and may instead use a `.lib` extension. For example, `rtle.lib` or `import64.lib'.