lld 22.1.5 Release Notes — lld 22.1.5 documentation

# lld 22.1.5 Release Notes

## Introduction

This document contains the release notes for the lld linker, release 22.1.5. 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

- Added `--print-gc-sections=<file>` to redirect garbage collection section listing to a file, avoiding contamination of stdout with other linker output. (#159706)

- Added `VersionNode` lexer state for better version script parsing. This brings the lexer behavior closer to GNU ld. (#174530)

- Unversioned undefined symbols now use version index 0, aligning with GNU ld 2.46 behavior. (#168189)

- `.data.rel.ro.hot` and `.data.rel.ro.unlikely` are now recognized as RELRO sections, allowing profile-guided static data partitioning. (#148920)

- DTLTO now supports archive members and bitcode members of thin archives. (#157043)

- For DTLTO, `--thinlto-remote-compiler-prepend-arg=<arg>` has been added to prepend an argument to the remote compiler’s command line. (#162456)

- Balanced Partitioning (BP) section ordering now skips input sections with null data, and filters out section symbols. (#149265) (#151685)

- For AArch64, fixed a crash when using `--fix-cortex-a53-843419` with synthetic sections and improved handling when patched code is far from the short jump. (#170495)

- For AArch64, added support for the `R_AARCH64_FUNCINIT64` dynamic relocation type for relocating word-sized data using the return value of a function. (#156564)

- For AArch64, added support for the `R_AARCH64_PATCHINST` relocation type to support deactivation symbols. (#133534)

- For AArch64, added support for reading AArch64 Build Attributes and converting them into GNU Properties. (#147970)

- For ARM, fixed incorrect veneer generation for wraparound branches at the high end of the 32-bit address space branching to the low end. (#165263)

- For LoongArch, `-r` now synthesizes `R_LARCH_ALIGN` at input section start to preserve alignment information. (#153935)

- For LoongArch, added relocation types for LA32R/LA32S. (#172618) (#176312)

- For RISC-V, added infrastructure for handling vendor-specific relocations. (#159987)

- For RISC-V, added support for statically resolved vendor-specific relocations. (#169273)

- For RISC-V, `-r` now synthesizes `R_RISCV_ALIGN` at input section start to preserve alignment information during two-stage linking. (#151639)

### Breaking changes

### COFF Improvements

- Added `-prefetch-inputs` to improve link times by asynchronously loading input files in RAM. This will dampen the effect of input file I/O latency on link times. However this flag can have an adverse effect when linking a large number of inputs files, or if all inputs do not fit in RAM at once. For those cases, linking might be a bit slower since the inputs will be streamed into RAM upfront, only to be evicted later by swapping. (#169224)

- Added `/sectionlayout:@<file>` to specify custom output section ordering. (#152779)

- Added `/nodbgdirmerge` to emit the debug directory section in `.cvinfo` instead of merging it to `.rdata`. (#159235)

- Added `-fat-lto-objects` to support FatLTO. Without `-fat-lto-objects` or with `-fat-lto-objects:no`, LLD will link LLVM FatLTO objects using the relocatable object file. (#165529)

- Added `/linkreprofullpathrsp` to print the full path to each object passed to the link line to a file. This is used in particular when linking Arm64X binaries. (#174971)

- Added CET flags: `/cetcompatstrict`, `/cetipvalidationrelaxed`, `/cetdynamicapisinproc`, and `/hotpatchcompatible`. (#150761)

- Added support for ARM64X same-address thunks. (#151255)

- Added more `--time-trace` tags for ThinLTO linking. (#156471)

- `/summary` now works when `/debug` isn’t provided. (#157476)

- `/summary` now displays the size of all consumed inputs. (#157284)

- For DTLTO, `-thinlto-remote-compiler-prepend-arg:<arg>` has been added to prepend an argument to the remote compiler’s command line. (#162456)

- Loop and SLP vectorize options are now passed to the LTO backend. (#173041)

- Deduplicate common chunks when linking COFF files. (#162553)

- Discard `.llvmbc` and `.llvmcmd` sections. (#150897)

- Prevent emitting relocations for discarded weak wrapped symbols. (#156214)

### MinGW Improvements

- Added `--fat-lto-objects` flag. (#174962)

- Handle `-m mipspe` for MIPS. (#157742)

- Fixed implicit DLL entry point for MinGW. (#171680)

### MachO Improvements

- Added `--read-workers=<N>` for multi-threaded preload of input files into memory, significantly reducing link times for large projects. (#147134)

- Added `--separate-cstring-literal-sections` to emit cstring literals into sections defined by their section name. (#158720)

- Added `--tail-merge-strings` to enable tail merging of cstrings. (#161262)

- Added `--lto-emit-llvm` command line option.

- Added `--slop-scale` flag for adjusting slop scale. (#164295)

- Added support for section branch relocations, including the 1-byte form. (#169062)

- Enabled Linker Optimization Hints pass for arm64_32. (#148964)

- Read cstring order for non-deduped sections. (#161879)

- Allow independent override of weak symbols aliased via `.set`. (#167825)

- Fixed segfault while processing malformed object file. (#167025)

- Fixed infinite recursion when parsing corrupted export tries. (#152569)

- Error out gracefully when offset is outside literal section. (#164660)

- Process OSO prefix only textually in both input and output. (#152063)

### WebAssembly Improvements

- `--stack-first` is now the default. Use `--no-stack-first` for the old behavior. (#166998)

- `--import-memory` can now take a single name (imports from default module). (#160409)

- `-r` now forces `-Bstatic`. (#108264)

- LTO now uses PIC reloc model with dynamic imports. (#165342)

- Honor command line reloc model during LTO. (#164838)

- Fixed visibility of `__stack_pointer` global. (#161284)

- Fixed check for exporting mutable globals. (#160787)

- Fixed check for implicitly exported mutable globals. (#160966)

- Don’t export deps for unused stub symbols. (#173422)

- Fixed SEGFAULT when importing wrapped symbol. (#169656)

- Error on unexpected relocation types in `-pie`/`-shared` data sections. (#162117)

#### Fixes