1========================
2lld 12.0.0 Release Notes
3========================
4
5.. contents::
6    :local:
7
8.. warning::
9   These are in-progress notes for the upcoming LLVM 12.0.0 release.
10   Release notes for previous releases can be found on
11   `the Download Page <https://releases.llvm.org/download.html>`_.
12
13Introduction
14============
15
16This document contains the release notes for the lld linker, release 12.0.0.
17Here we describe the status of lld, including major improvements
18from the previous release. All lld releases may be downloaded
19from the `LLVM releases web site <https://llvm.org/releases/>`_.
20
21Non-comprehensive list of changes in this release
22=================================================
23
24ELF Improvements
25----------------
26
27* ``--dependency-file`` has been added. (Similar to ``cc -M -MF``.)
28  (`D82437 <https://reviews.llvm.org/D82437>`_)
29* ``--error-handling-script`` has been added to allow for user-defined handlers upon
30  missing libraries. (`D87758 <https://reviews.llvm.org/D87758>`_)
31* ``--exclude-libs`` can now localize defined version symbols and bitcode referenced libcall symbols.
32  (`D94280 <https://reviews.llvm.org/D94280>`_)
33* ``--gdb-index`` now works with DWARF v5 and ``--icf={safe,all}``.
34  (`D85579 <https://reviews.llvm.org/D85579>`_)
35  (`D89751 <https://reviews.llvm.org/D89751>`_)
36* ``--gdb-index --emit-relocs`` can now be used together.
37  (`D94354 <https://reviews.llvm.org/D94354>`_)
38* ``--icf={safe,all}`` conservatively no longer fold text sections with LSDA.
39  Previously ICF on ``-fexceptions`` code could be unsafe.
40  (`D84610 <https://reviews.llvm.org/D84610>`_)
41* ``--icf={safe,all}`` can now fold two sections with relocations referencing aliased symbols.
42  (`D88830 <https://reviews.llvm.org/D88830>`_)
43* ``--lto-pseudo-probe-for-profiling`` has been added.
44  (`D95056 <https://reviews.llvm.org/D95056>`_)
45* ``--no-lto-whole-program-visibility`` has been added.
46  (`D92060 <https://reviews.llvm.org/D92060>`_)
47* ``--oformat-binary`` has been fixed to respect LMA.
48  (`D85086 <https://reviews.llvm.org/D85086>`_)
49* ``--reproduce`` includes ``--lto-sample-profile``, ``--just-symbols``, ``--call-graph-ordering-file``, ``--retain-symbols-file`` files.
50* ``-r --gc-sections`` is now supported.
51  (`D84131 <https://reviews.llvm.org/D84131>`_)
52* A ``-u`` specified symbol will no longer change the binding to ``STB_WEAK``.
53  (`D88945 <https://reviews.llvm.org/D88945>`_)
54* ``--wrap`` support has been improved.
55  + If ``foo`` is not referenced, there is no longer an undefined symbol ``__wrap_foo``.
56  + If ``__real_foo`` is not referenced, there is no longer an undefined symbol ``foo``.
57* ``SHF_LINK_ORDER`` sections can now have zero ``sh_link`` values.
58* ``SHF_LINK_ORDER`` and non-``SHF_LINK_ORDER`` sections can now be mixed within an input section description.
59  (`D84001 <https://reviews.llvm.org/D84001>`_)
60* ``LOG2CEIL`` is now supported in linker scripts.
61  (`D84054 <https://reviews.llvm.org/D84054>`_)
62* ``DEFINED`` has been fixed to check whether the symbol is defined.
63  (`D83758 <https://reviews.llvm.org/D83758>`_)
64* An input section description may now have multiple ``SORT_*``.
65  The matched sections are ordered by radix sort with the keys being ``(SORT*, --sort-section, input order)``.
66  (`D91127 <https://reviews.llvm.org/D91127>`_)
67* Users can now provide a GNU style linker script to convert ``.ctors`` into ``.init_array``.
68  (`D91187 <https://reviews.llvm.org/D91187>`_)
69* An empty output section can now be discarded even if it is assigned to a program header.
70  (`D92301 <https://reviews.llvm.org/D92301>`_)
71* Non-``SHF_ALLOC`` sections now have larger file offsets than ``SHF_ALLOC`` sections.
72  (`D85867 <https://reviews.llvm.org/D85867>`_)
73* Some symbol versioning improvements.
74  + Defined ``foo@@v1`` now resolve undefined ``foo@v1`` (`D92259 <https://reviews.llvm.org/D92259>`_)
75  + Undefined ``foo@v1`` now gets an error (`D92260 <https://reviews.llvm.org/D92260>`_)
76* The AArch64 port now has support for ``STO_AARCH64_VARIANT_PCS`` and ``DT_AARCH64_VARIANT_PCS``.
77  (`D93045 <https://reviews.llvm.org/D93045>`_)
78* The AArch64 port now has support for ``R_AARCH64_LD64_GOTPAGE_LO15``.
79* The PowerPC64 port now detects missing R_PPC64_TLSGD/R_PPC64_TLSLD and disables TLS relaxation.
80  This allows linking with object files produced by very old IBM XL compilers.
81  (`D92959 <https://reviews.llvm.org/D92959>`_)
82* Many PowerPC PC-relative relocations are now supported.
83* ``R_PPC_ADDR24`` and ``R_PPC64_ADDR16_HIGH`` are now supported.
84* powerpcle is now supported. Tested with FreeBSD loader and freestanding.
85  (`D93917 <https://reviews.llvm.org/D93917>`_)
86* RISC-V: the first ``SHT_RISCV_ATTRIBUTES`` section is now retained.
87  (`D86309 <https://reviews.llvm.org/D86309>`_)
88* LTO pipeline now defaults to the new PM if the CMake variable ``ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER`` is on.
89  (`D92885 <https://reviews.llvm.org/D92885>`_)
90
91Breaking changes
92----------------
93
94* A COMMON symbol can now cause the fetch of an archive providing a ``STB_GLOBAL`` definition.
95  This behavior follows GNU ld newer than December 1999.
96  If you see ``duplicate symbol`` errors with the new behavior, check out `PR49226 <https://bugs.llvm.org//show_bug.cgi?id=49226>`_.
97  (`D86142 <https://reviews.llvm.org/D86142>`_)
98
99COFF Improvements
100-----------------
101
102* Error out clearly if creating a DLL with too many exported symbols.
103  (`D86701 <https://reviews.llvm.org/D86701>`_)
104
105MinGW Improvements
106------------------
107
108* Enabled dynamicbase by default. (`D86654 <https://reviews.llvm.org/D86654>`_)
109
110* Tolerate mismatches between COMDAT section sizes with different amount of
111  padding (produced by binutils) by inspecting the aux section definition.
112  (`D86659 <https://reviews.llvm.org/D86659>`_)
113
114* Support setting the subsystem version via the subsystem argument.
115  (`D88804 <https://reviews.llvm.org/D88804>`_)
116
117* Implemented the GNU -wrap option.
118  (`D89004 <https://reviews.llvm.org/D89004>`_,
119  `D91689 <https://reviews.llvm.org/D91689>`_)
120
121* Handle the ``--demangle`` and ``--no-demangle`` options.
122  (`D93950 <https://reviews.llvm.org/D93950>`_)
123
124
125Mach-O Improvements
126------------------
127
128We've gotten the new implementation of LLD for Mach-O to the point where it is
129able to link large x86_64 programs, and we'd love to get some alpha testing on
130it. The new Darwin back-end can be invoked as follows:
131
132.. code-block::
133   clang -fuse-ld=lld.darwinnew /path/to/file.c
134
135To reach this point, we implemented numerous features, and it's easier to list
136the major features we *haven't* yet completed:
137
138* LTO support
139* Stack unwinding for exceptions
140* Support for arm64, arm, and i386 architectures
141
142If you stumble upon an issue and it doesn't fall into one of these categories,
143please file a bug report!
144
145
146WebAssembly Improvements
147------------------------
148
149