lld 22 ELF changes

For those unfamiliar, lld is the LLVM linker, supporting PE/COFF, ELF, Mach-O, and WebAssembly ports. These object file formats differ significantly, and each port must follow the conventions of the platform's system linker. As a result, the ports share limited code (diagnostics, memory allocation, etc) and have largely separate reviewer groups.

With LLVM 22.1 releasing soon, I've added some notes to the https://github.com/llvm/llvm-project/blob/release/22.x/lld/docs/ReleaseNotes.rst as an lld/ELF maintainer. As usual, I've reviewed almost all the patches not authored by me.

For the first time, I used an LLM agent (Claude Code) to help look through commits (git log release/21.x..release/22.x -- lld/ELF) and draft the release notes. Despite my request to only read lld/ELF changes, Claude Code also crafted notes for other ports, which I retained since their release notes had been quite sparse for several releases.

  • --print-gc-sections=<file> has been added to redirect garbage collection section listing to a file, avoiding contamination of stdout with other linker output. (#159706)
  • A VersionNode lexer state has been added 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)

Besides me, Peter Smith (smithp35) and Jessica Clarke (jrtc27) have done a lot of reviews.

jrtc27 has done great work simplifying the dynamic relocation system, which is highly appreciated.

I should call out https://github.com/llvm/llvm-project/pull/172618: for this relatively large addition, the author and approver are from the same company and contributing to their architecture, and neither the author nor the approver is a regular lld contributor/reviewer. The author did not request review from regular reviewers and landed the patch just 3 minutes after their colleague's approval. I left a comment asking to keep the PR open for other maintainers to review.


Link: lld 21 ELF changes