Linking with LLD
The LLD linker is automatically built into llvmlite to provide easy-to-use, cross-platform linking.
Known limitations
Currently, only lld::elf::link is used and thus COFF and MACHO object files will not link.
The following llvm drivers are usable from lld_main()
ld.lld (Linux)
ld64.lld (macos/darwin)
lld-link (windows)
wasm-ld (Web Assembly)
Functions
- llvmlite.binding.lld_linux(output_file, objects, args=[])
objectsis a list of object files’ names as strings.argsis a list of strings passed to the lld linker as arguments (at the end of the command)returns the output of lld_main for the given arguments
Links given object files into an executable using
lld_main()
- llvmlite.binding.lld_windows(output_file, objects, args=[])
Link for Windows target
- llvmlite.binding.lld_macos(output_file, objects, args=[])
Link for Macos target
- llvmlite.binding.lld_wasm(output_file, objects, args=[])
Link for wasm target
- llvmlite.binding.lld_auto(output_file, objects, args=[], add_extension=True)
add_extensionshould this function automatically add .exe and .app for windows and macos targetsreturns the output of lld_main for the given arguments
Automatically determines which function to use given the host operating system. This will only use the
lld_linux,lld_windows, andlld_macosfunctions. ThrowsExceptionif the host operating system isn’tDarwin,Windows, orLinux