lld 18.1.0rc Release Notes


This document contains the release notes for the lld linker, release 18.1.0rc. Here we describe the status of lld, including major improvements from the previous release. All lld releases may be downloaded from the LLVM releases web site.

Non-comprehensive list of changes in this release

ELF Improvements

  • --fat-lto-objects option is added to support LLVM FatLTO. Without --fat-lto-objects, LLD will link LLVM FatLTO objects using the relocatable object file. (D146778)

  • -Bsymbolic-non-weak is added to directly bind non-weak definitions. (D158322)

  • --lto-validate-all-vtables-have-type-infos, which complements --lto-whole-program-visibility, is added to disable unsafe whole-program devirtualization. --lto-known-safe-vtables=<glob> can be used to mark known-safe vtable symbols. (D155659)

  • --save-temps --lto-emit-asm now derives ELF/asm file names from bitcode file names. ld.lld --save-temps a.o d/b.o -o out will create ELF relocatable files out.lto.a.o/d/out.lto.b.o instead of out1.lto.o/out2.lto.o. (#78835)

  • --no-allow-shlib-undefined now reports errors for DSO referencing non-exported definitions. (#70769)

  • common-page-size can now be larger than the system page-size. (#57618)

  • When call graph profile information is available due to instrumentation or sample PGO, input sections are now sorted using the new cdsort algorithm, better than the previous hfsort algorithm. (D152840)

  • Symbol assignments like a = DEFINED(a) ? a : 0; are now handled. (#65866)

  • OVERLAY now supports optional start address and LMA (#77272)

  • Relocations referencing a symbol defined in /DISCARD/ section now lead to an error. (#69295)

  • For AArch64 MTE, global variable descriptors have been implemented. (D152921)

  • R_AARCH64_GOTPCREL32 is now supported. (#72584)

  • R_LARCH_PCREL20_S2/R_LARCH_ADD6/R_LARCH_CALL36 and extreme code model relocations are now supported.

  • --emit-relocs is now supported for RISC-V linker relaxation. (D159082)

  • Call relaxation respects RVC when mixing +c and -c relocatable files. (#73977)

  • R_RISCV_GOT32_PCREL is now supported. (#72587)

  • R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB128 relocations are now supported. (#72610) (#77261)

  • RISC-V TLSDESC is now supported. (#79239)

Breaking changes

COFF Improvements

  • Added support for --time-trace and associated --time-trace-granularity. This generates a .json profile trace of the linker execution. (#68236)

  • The -dependentloadflag option was implemented. (#71537)

  • LLD now prefers library paths specified with -libpath: over the implicitly detected toolchain paths. (#78039)

  • Added new options -lldemit:llvm and -lldemit:asm for getting the output of LTO compilation as LLVM bitcode or assembly. (#66964) (#67079)

  • Added a new option -build-id for generating a .buildid section when not generating a PDB. A new symbol __buildid is generated by the linker, allowing code to reference the build ID of the binary. (#71433) (#74652)

  • A new, LLD specific option, -lld-allow-duplicate-weak, was added for allowing duplicate weak symbols. (#68077)

  • More correctly handle LTO of files that define __imp_ prefixed dllimport redirections. (#70777) (#71376) (#72989)

  • Linking undefined references to weak symbols with LTO now works. (#70430)

  • Use the SOURCE_DATE_EPOCH environment variable for the PE header and debug directory timestamps, if neither the /Brepro nor /timestamp: options have been specified. This makes the linker output reproducible by setting this environment variable. (#81326)

  • Lots of incremental work towards supporting linking ARM64EC binaries.

MinGW Improvements

  • Added support for many LTO and ThinLTO options (most LTO options supported by the ELF driver, that are implemented by the COFF backend as well, should be supported now). (D158412) (D158887) (#77387) (#81475)

  • LLD no longer tries to autodetect and use library paths from MSVC/WinSDK installations when run in MinGW mode; that mode of operation shouldn’t ever be needed in MinGW mode, and could be a source of unexpected behaviours. (D144084)

  • The --icf=safe option now works as expected; it was previously a no-op. (#70037)

  • The strip flags -S and -s now can be used to strip out DWARF debug info and symbol tables while emitting a PDB debug info file. (#75181)

  • The option --dll is handled as an alias for the --shared option. (#68575)

  • The option --sort-common is ignored now. (#66336)

MachO Improvements

WebAssembly Improvements

  • Indexes are no longer required on archive files. Instead symbol information is read from object files within the archive. This matches the behaviour of the ELF linker.