lld 12.0.0 Release Notes — lld 12 documentation

# lld 12.0.0 Release Notes

- Introduction

- Non-comprehensive list of changes in this release

  - ELF Improvements

  - Breaking changes

  - COFF Improvements

  - MinGW Improvements

  - Mach-O Improvements

  - WebAssembly Improvements

Warning

These are in-progress notes for the upcoming LLVM 12.0.0 release. Release notes for previous releases can be found on the Download Page.

## Introduction

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

- `--dependency-file` has been added. (Similar to `cc -M -MF`.) (D82437)

- `--error-handling-script` has been added to allow for user-defined handlers upon missing libraries. (D87758)

- `--exclude-libs` can now localize defined version symbols and bitcode referenced libcall symbols. (D94280)

- `--gdb-index` now works with DWARF v5 and `--icf={safe,all}`. (D85579) (D89751)

- `--gdb-index --emit-relocs` can now be used together. (D94354)

- `--icf={safe,all}` conservatively no longer fold text sections with LSDA. Previously ICF on `-fexceptions` code could be unsafe. (D84610)

- `--icf={safe,all}` can now fold two sections with relocations referencing aliased symbols. (D88830)

- `--lto-pseudo-probe-for-profiling` has been added. (D95056)

- `--no-lto-whole-program-visibility` has been added. (D92060)

- `--oformat-binary` has been fixed to respect LMA. (D85086)

- `--reproduce` includes `--lto-sample-profile`, `--just-symbols`, `--call-graph-ordering-file`, `--retain-symbols-file` files.

- `-r --gc-sections` is now supported. (D84131)

- A `-u` specified symbol will no longer change the binding to `STB_WEAK`. (D88945)

- `--wrap` support has been improved. + If `foo` is not referenced, there is no longer an undefined symbol `__wrap_foo`. + If `__real_foo` is not referenced, there is no longer an undefined symbol `foo`.

- `SHF_LINK_ORDER` sections can now have zero `sh_link` values.

- `SHF_LINK_ORDER` and non-`SHF_LINK_ORDER` sections can now be mixed within an input section description. (D84001)

- `LOG2CEIL` is now supported in linker scripts. (D84054)

- `DEFINED` has been fixed to check whether the symbol is defined. (D83758)

- An input section description may now have multiple `SORT_*`. The matched sections are ordered by radix sort with the keys being `(SORT*, --sort-section, input order)`. (D91127)

- Users can now provide a GNU style linker script to convert `.ctors` into `.init_array`. (D91187)

- An empty output section can now be discarded even if it is assigned to a program header. (D92301)

- Non-`SHF_ALLOC` sections now have larger file offsets than `SHF_ALLOC` sections. (D85867)

- Some symbol versioning improvements. + Defined `foo@@v1` now resolve undefined `foo@v1` (D92259) + Undefined `foo@v1` now gets an error (D92260)

- The AArch64 port now has support for `STO_AARCH64_VARIANT_PCS` and `DT_AARCH64_VARIANT_PCS`. (D93045)

- The AArch64 port now has support for `R_AARCH64_LD64_GOTPAGE_LO15`.

- The PowerPC64 port now detects missing R_PPC64_TLSGD/R_PPC64_TLSLD and disables TLS relaxation. This allows linking with object files produced by very old IBM XL compilers. (D92959)

- Many PowerPC PC-relative relocations are now supported.

- `R_PPC_ADDR24` and `R_PPC64_ADDR16_HIGH` are now supported.

- powerpcle is now supported. Tested with FreeBSD loader and freestanding. (D93917)

- RISC-V: the first `SHT_RISCV_ATTRIBUTES` section is now retained. (D86309)

- LTO pipeline now defaults to the new PM if the CMake variable `ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER` is on. (D92885)

### Breaking changes

- A COMMON symbol can now cause the fetch of an archive providing a `STB_GLOBAL` definition. This behavior follows GNU ld newer than December 1999. If you see `duplicate symbol` errors with the new behavior, check out PR49226. (D86142)

### COFF Improvements

- Error out clearly if creating a DLL with too many exported symbols. (D86701)

### MinGW Improvements

- Enabled dynamicbase by default. (D86654)

- Tolerate mismatches between COMDAT section sizes with different amount of padding (produced by binutils) by inspecting the aux section definition. (D86659)

- Support setting the subsystem version via the subsystem argument. (D88804)

- Implemented the GNU -wrap option. (D89004, D91689)

- Handle the `--demangle` and `--no-demangle` options. (D93950)

### Mach-O Improvements

We’ve gotten the new implementation of LLD for Mach-O to the point where it is able to link large x86_64 programs, and we’d love to get some alpha testing on it. The new Darwin back-end can be invoked as follows:

To reach this point, we implemented numerous features, and it’s easier to list the major features we haven’t yet completed:

- LTO support

- Stack unwinding for exceptions

- Support for arm64, arm, and i386 architectures

If you stumble upon an issue and it doesn’t fall into one of these categories, please file a bug report!

### WebAssembly Improvements