1===========================
2lld |release| Release Notes
3===========================
4
5.. contents::
6    :local:
7
8.. only:: PreRelease
9
10  .. warning::
11     These are in-progress notes for the upcoming LLVM |release| release.
12     Release notes for previous releases can be found on
13     `the Download Page <https://releases.llvm.org/download.html>`_.
14
15Introduction
16============
17
18This document contains the release notes for the lld linker, release |release|.
19Here we describe the status of lld, including major improvements
20from the previous release. All lld releases may be downloaded
21from the `LLVM releases web site <https://llvm.org/releases/>`_.
22
23Non-comprehensive list of changes in this release
24=================================================
25
26ELF Improvements
27----------------
28
29* ``--fat-lto-objects`` option is added to support LLVM FatLTO.
30  Without ``--fat-lto-objects``, LLD will link LLVM FatLTO objects using the
31  relocatable object file. (`D146778 <https://reviews.llvm.org/D146778>`_)
32* ``-Bsymbolic-non-weak`` is added to directly bind non-weak definitions.
33  (`D158322 <https://reviews.llvm.org/D158322>`_)
34* ``--lto-validate-all-vtables-have-type-infos``, which complements
35  ``--lto-whole-program-visibility``, is added to disable unsafe whole-program
36  devirtualization. ``--lto-known-safe-vtables=<glob>`` can be used
37  to mark known-safe vtable symbols.
38  (`D155659 <https://reviews.llvm.org/D155659>`_)
39* ``--save-temps --lto-emit-asm`` now derives ELF/asm file names from bitcode file names.
40  ``ld.lld --save-temps a.o d/b.o -o out`` will create ELF relocatable files
41  ``out.lto.a.o``/``d/out.lto.b.o`` instead of ``out1.lto.o``/``out2.lto.o``.
42  (`#78835 <https://github.com/llvm/llvm-project/pull/78835>`_)
43* ``--no-allow-shlib-undefined`` now reports errors for DSO referencing
44  non-exported definitions.
45  (`#70769 <https://github.com/llvm/llvm-project/pull/70769>`_)
46* common-page-size can now be larger than the system page-size.
47  (`#57618 <https://github.com/llvm/llvm-project/issues/57618>`_)
48* When call graph profile information is available due to instrumentation or
49  sample PGO, input sections are now sorted using the new ``cdsort`` algorithm,
50  better than the previous ``hfsort`` algorithm.
51  (`D152840 <https://reviews.llvm.org/D152840>`_)
52* Symbol assignments like ``a = DEFINED(a) ? a : 0;`` are now handled.
53  (`#65866 <https://github.com/llvm/llvm-project/pull/65866>`_)
54* ``OVERLAY`` now supports optional start address and LMA
55  (`#77272 <https://github.com/llvm/llvm-project/pull/77272>`_)
56* Relocations referencing a symbol defined in ``/DISCARD/`` section now lead to
57  an error.
58  (`#69295 <https://github.com/llvm/llvm-project/pull/69295>`_)
59* For AArch64 MTE, global variable descriptors have been implemented.
60  (`D152921 <https://reviews.llvm.org/D152921>`_)
61* ``R_AARCH64_GOTPCREL32`` is now supported.
62  (`#72584 <https://github.com/llvm/llvm-project/pull/72584>`_)
63* ``R_LARCH_PCREL20_S2``/``R_LARCH_ADD6``/``R_LARCH_CALL36`` and extreme code
64  model relocations are now supported.
65* ``--emit-relocs`` is now supported for RISC-V linker relaxation.
66  (`D159082 <https://reviews.llvm.org/D159082>`_)
67* Call relaxation respects RVC when mixing +c and -c relocatable files.
68  (`#73977 <https://github.com/llvm/llvm-project/pull/73977>`_)
69* ``R_RISCV_GOT32_PCREL`` is now supported.
70  (`#72587 <https://github.com/llvm/llvm-project/pull/72587>`_)
71* ``R_RISCV_SET_ULEB128``/``R_RISCV_SUB_ULEB128`` relocations are now supported.
72  (`#72610 <https://github.com/llvm/llvm-project/pull/72610>`_)
73  (`#77261 <https://github.com/llvm/llvm-project/pull/77261>`_)
74* RISC-V TLSDESC is now supported.
75  (`#79239 <https://github.com/llvm/llvm-project/pull/79239>`_)
76
77Breaking changes
78----------------
79
80COFF Improvements
81-----------------
82
83* Added support for ``--time-trace`` and associated ``--time-trace-granularity``.
84  This generates a .json profile trace of the linker execution.
85  (`#68236 <https://github.com/llvm/llvm-project/pull/68236>`_)
86
87* The ``-dependentloadflag`` option was implemented.
88  (`#71537 <https://github.com/llvm/llvm-project/pull/71537>`_)
89
90* LLD now prefers library paths specified with ``-libpath:`` over the implicitly
91  detected toolchain paths.
92  (`#78039 <https://github.com/llvm/llvm-project/pull/78039>`_)
93
94* Added new options ``-lldemit:llvm`` and ``-lldemit:asm`` for getting
95  the output of LTO compilation as LLVM bitcode or assembly.
96  (`#66964 <https://github.com/llvm/llvm-project/pull/66964>`_)
97  (`#67079 <https://github.com/llvm/llvm-project/pull/67079>`_)
98
99* Added a new option ``-build-id`` for generating a ``.buildid`` section
100  when not generating a PDB. A new symbol ``__buildid`` is generated by
101  the linker, allowing code to reference the build ID of the binary.
102  (`#71433 <https://github.com/llvm/llvm-project/pull/71433>`_)
103  (`#74652 <https://github.com/llvm/llvm-project/pull/74652>`_)
104
105* A new, LLD specific option, ``-lld-allow-duplicate-weak``, was added
106  for allowing duplicate weak symbols.
107  (`#68077 <https://github.com/llvm/llvm-project/pull/68077>`_)
108
109* More correctly handle LTO of files that define ``__imp_`` prefixed dllimport
110  redirections.
111  (`#70777 <https://github.com/llvm/llvm-project/pull/70777>`_)
112  (`#71376 <https://github.com/llvm/llvm-project/pull/71376>`_)
113  (`#72989 <https://github.com/llvm/llvm-project/pull/72989>`_)
114
115* Linking undefined references to weak symbols with LTO now works.
116  (`#70430 <https://github.com/llvm/llvm-project/pull/70430>`_)
117
118* Use the ``SOURCE_DATE_EPOCH`` environment variable for the PE header and
119  debug directory timestamps, if neither the ``/Brepro`` nor ``/timestamp:``
120  options have been specified. This makes the linker output reproducible by
121  setting this environment variable.
122  (`#81326 <https://github.com/llvm/llvm-project/pull/81326>`_)
123
124* Lots of incremental work towards supporting linking ARM64EC binaries.
125
126MinGW Improvements
127------------------
128
129* Added support for many LTO and ThinLTO options (most LTO options supported
130  by the ELF driver, that are implemented by the COFF backend as well,
131  should be supported now).
132  (`D158412 <https://reviews.llvm.org/D158412>`_)
133  (`D158887 <https://reviews.llvm.org/D158887>`_)
134  (`#77387 <https://github.com/llvm/llvm-project/pull/77387>`_)
135  (`#81475 <https://github.com/llvm/llvm-project/pull/81475>`_)
136
137* LLD no longer tries to autodetect and use library paths from MSVC/WinSDK
138  installations when run in MinGW mode; that mode of operation shouldn't
139  ever be needed in MinGW mode, and could be a source of unexpected
140  behaviours.
141  (`D144084 <https://reviews.llvm.org/D144084>`_)
142
143* The ``--icf=safe`` option now works as expected; it was previously a no-op.
144  (`#70037 <https://github.com/llvm/llvm-project/pull/70037>`_)
145
146* The strip flags ``-S`` and ``-s`` now can be used to strip out DWARF debug
147  info and symbol tables while emitting a PDB debug info file.
148  (`#75181 <https://github.com/llvm/llvm-project/pull/75181>`_)
149
150* The option ``--dll`` is handled as an alias for the ``--shared`` option.
151  (`#68575 <https://github.com/llvm/llvm-project/pull/68575>`_)
152
153* The option ``--sort-common`` is ignored now.
154  (`#66336 <https://github.com/llvm/llvm-project/pull/66336>`_)
155
156MachO Improvements
157------------------
158
159WebAssembly Improvements
160------------------------
161
162* Indexes are no longer required on archive files.  Instead symbol information
163  is read from object files within the archive.  This matches the behaviour of
164  the ELF linker.
165
166SystemZ
167-------
168
169* Add target support for SystemZ (s390x).
170
171Fixes
172#####
173