xref: /freebsd/contrib/llvm-project/lld/docs/ReleaseNotes.rst (revision a4a491e2238b12ccd64d3faf9e6401487f6f1f1b)
1===========================
2lld |release| Release Notes
3===========================
4
5.. contents::
6    :local:
7
8Introduction
9============
10
11This document contains the release notes for the lld linker, release |release|.
12Here we describe the status of lld, including major improvements
13from the previous release. All lld releases may be downloaded
14from the `LLVM releases web site <https://llvm.org/releases/>`_.
15
16Non-comprehensive list of changes in this release
17=================================================
18
19ELF Improvements
20----------------
21* ``--package-metadata=`` has been added to create package metadata notes
22  (`D131439 <https://reviews.llvm.org/D131439>`_)
23
24* ``-z pack-relative-relocs`` is now available to support ``DT_RELR`` for glibc 2.36+.
25  (`D120701 <https://reviews.llvm.org/D120701>`_)
26* ``--no-fortran-common`` (pre 12.0.0 behavior) is now the default.
27* ``--load-pass-plugin`` has been added to load a new pass manager plugin.
28  (`D120490 <https://reviews.llvm.org/D120490>`_)
29* ``--android-memtag-{mode=,stack,heap}`` have been added to synthesize SHT_NOTE for memory tags on Android.
30  (`D119384 <https://reviews.llvm.org/D119384>`_)
31* ``FORCE_LLD_DIAGNOSTICS_CRASH`` environment variable is now available to force LLD to crash.
32  (`D128195 <https://reviews.llvm.org/D128195>`_)
33* ``--wrap`` semantics have been refined.
34  (`rG7288b85cc80f1ce5509aeea860e6b4232cd3ca01 <https://reviews.llvm.org/rG7288b85cc80f1ce5509aeea860e6b4232cd3ca01>`_)
35  (`D118756 <https://reviews.llvm.org/D118756>`_)
36  (`D124056 <https://reviews.llvm.org/D124056>`_)
37* ``--build-id={md5,sha1}`` are now implemented with truncated BLAKE3.
38  (`D121531 <https://reviews.llvm.org/D121531>`_)
39* ``--emit-relocs``: ``.rel[a].eh_frame`` relocation offsets are now adjusted.
40  (`D122459 <https://reviews.llvm.org/D122459>`_)
41* ``--emit-relocs``: fixed missing ``STT_SECTION`` when the first input section is synthetic.
42  (`D122463 <https://reviews.llvm.org/D122463>`_)
43* ``(TYPE=<value>)`` can now be used in linker scripts.
44  (`D118840 <https://reviews.llvm.org/D118840>`_)
45* Local symbol initialization is now performed in parallel.
46  (`D119909 <https://reviews.llvm.org/D119909>`_)
47  (`D120626 <https://reviews.llvm.org/D120626>`_)
48
49Breaking changes
50----------------
51
52* Archives are now parsed as ``--start-lib`` object files. If a member is neither
53  an ELF relocatable object file nor an LLVM bitcode file, ld.lld will give a warning.
54  (`D119074 <https://reviews.llvm.org/D119074>`_)
55* The GNU ld incompatible ``--no-define-common`` has been removed.
56* The obscure ``-dc``/``-dp`` options have been removed.
57  (`D119108 <https://reviews.llvm.org/D119108>`_)
58* ``-d`` is now ignored.
59* If a prevailing COMDAT group defines STB_WEAK symbol, having a STB_GLOBAL symbol in a non-prevailing group is now rejected with a diagnostic.
60  (`D120626 <https://reviews.llvm.org/D120626>`_)
61* Support for the legacy ``.zdebug`` format has been removed. Run
62  ``objcopy --decompress-debug-sections`` in case old object files use ``.zdebug``.
63  (`D126793 <https://reviews.llvm.org/D126793>`_)
64* ``--time-trace-file=<file>`` has been removed.
65  Use ``--time-trace=<file>`` instead.
66  (`D128451 <https://reviews.llvm.org/D128451>`_)
67
68COFF Improvements
69-----------------
70
71* Added autodetection of MSVC toolchain, a la clang-cl.  Also added
72  ``/winsysroot:`` support for explicit specification of MSVC toolchain
73  location, similar to clang-cl's ``/winsysroot``. For now,
74  ``/winsysroot:`` requires also passing in an explicit ``/machine:`` flag.
75  (`D118070 <https://reviews.llvm.org/D118070>`_)
76* ...
77
78MinGW Improvements
79------------------
80
81* The ``--disable-reloc-section`` option is now supported.
82  (`D127478 <https://reviews.llvm.org/D127478>`_)
83* The ``--exclude-symbols`` option is now supported.
84  (`D130118 <https://reviews.llvm.org/D130118>`_)
85
86* Support for an entirely new object file directive, ``-exclude-symbols:``,
87  has been implemented. (`D130120 <https://reviews.llvm.org/D130120>`_)
88
89MachO Improvements
90------------------
91
92* We now support proper relocation and pruning of EH frames. **Note:** this
93  comes at some performance overhead on x86_64 builds, and we recommend adding
94  the ``-femit-dwarf-unwind=no-compact-unwind`` compile flag to avoid it.
95  (`D129540 <https://reviews.llvm.org/D129540>`_,
96  `D122258 <https://reviews.llvm.org/D122258>`_)
97
98New flags
99#########
100
101* ``-load_hidden`` and ``-hidden-l`` are now supported.
102  (`D130473 <https://reviews.llvm.org/D130473>`_,
103  `D130529 <https://reviews.llvm.org/D130529>`_)
104* ``-alias`` is now supported. (`D129938 <https://reviews.llvm.org/D129938>`_)
105* ``-no_exported_symbols`` and  ``-exported_symbols_list <empty file>`` are now
106  supported. (`D127562 <https://reviews.llvm.org/D127562>`_)
107* ``-w`` -- to suppress warnings -- is now supported.
108  (`D127564 <https://reviews.llvm.org/D127564>`_)
109* ``-non_global_symbols_strip_list``, ``-non_global_symbols_no_strip_list``, and
110  ``-x`` are now supported. (`D126046 <https://reviews.llvm.org/D126046>`_)
111* ``--icf=safe`` is now supported.
112  (`D128938 <https://reviews.llvm.org/D128938>`_,
113  `D123752 <https://reviews.llvm.org/D123752>`_)
114* ``-why_live`` is now supported.
115  (`D120377 <https://reviews.llvm.org/D120377>`_)
116* ``-pagezero_size`` is now supported.
117  (`D118724 <https://reviews.llvm.org/D118724>`_)
118
119Improvements
120############
121
122* Linker optimization hints are now supported.
123  (`D129427 <https://reviews.llvm.org/D129427>`_,
124  `D129059 <https://reviews.llvm.org/D129059>`_,
125  `D128942 <https://reviews.llvm.org/D128942>`_,
126  `D128093 <https://reviews.llvm.org/D128093>`_)
127* Rebase opcodes are now encoded more compactly.
128  (`D130180 <https://reviews.llvm.org/D130180>`_,
129  `D128798 <https://reviews.llvm.org/D128798>`_)
130* C-strings are now aligned more compactly.
131  (`D121342 <https://reviews.llvm.org/D121342>`_)
132* ``--deduplicate-literals`` (and ``--icf={safe,all}``) now fold the
133  ``__cfstring`` section.
134  (`D130134  <https://reviews.llvm.org/D130134>`_,
135  `D120137 <https://reviews.llvm.org/D120137>`_)
136* ICF now folds the ``__objc_classrefs`` section.
137  (`D121053 <https://reviews.llvm.org/D121053>`_)
138* ICF now folds functions with identical LSDAs.
139  (`D129830 <https://reviews.llvm.org/D129830>`_)
140* STABS entries for folded functions are now omitted.
141  (`D123252 <https://reviews.llvm.org/D123252>`_)
142* ``__objc_imageinfo`` sections are now folded.
143  (`D130125 <https://reviews.llvm.org/D130125>`_)
144* Dylibs with ``LC_DYLD_EXPORTS_TRIE`` can now be read.
145  (`D129430 <https://reviews.llvm.org/D129430>`_)
146* Writing zippered dylibs is now supported.
147  (`D124887 <https://reviews.llvm.org/D124887>`_)
148* C-string literals are now included in the mapfile.
149  (`D118077 <https://reviews.llvm.org/D118077>`_)
150* Symbol names in several more diagnostics are now demangled.
151  (`D130490 <https://reviews.llvm.org/D130490>`_,
152  `D127110 <https://reviews.llvm.org/D127110>`_,
153  `D125732 <https://reviews.llvm.org/D125732>`_)
154* Source information is now included in symbol error messages.
155  (`D128425 <https://reviews.llvm.org/D128425>`_,
156  `D128184 <https://reviews.llvm.org/D128184>`_)
157* Numerous other improvements were made to diagnostic messages.
158  (`D127753 <https://reviews.llvm.org/D127753>`_,
159  `D127696 <https://reviews.llvm.org/D127696>`_,
160  `D127670 <https://reviews.llvm.org/D127670>`_,
161  `D118903 <https://reviews.llvm.org/D118903>`_,
162  `D118798 <https://reviews.llvm.org/D118798>`_)
163* Many performance and memory improvements were made.
164  (`D130000 <https://reviews.llvm.org/D130000>`_,
165  `D128298 <https://reviews.llvm.org/D128298>`_,
166  `D128290 <https://reviews.llvm.org/D128290>`_,
167  `D126800 <https://reviews.llvm.org/D126800>`_,
168  `D126785 <https://reviews.llvm.org/D126785>`_,
169  `D121052 <https://reviews.llvm.org/D121052>`_)
170* Order files and call graph sorting can now be used together.
171  (`D117354 <https://reviews.llvm.org/D117354>`_)
172* Give LTO more precise symbol resolutions, which allows optimizations to be
173  more effective.
174  (`D119506 <https://reviews.llvm.org/D119506>`_,
175  `D119372 <https://reviews.llvm.org/D119372>`_,
176  `D119767 <https://reviews.llvm.org/D119767>`_)
177* Added partial support for linking object files built with DTrace probes.
178  (`D129062 <https://reviews.llvm.org/D129062>`_)
179
180Fixes
181#####
182
183* Programs using Swift linked with the 14.0 SDK but an older deployment target
184  no longer crash at startup when running on older iOS versions. This is because
185  we now correctly support ``$ld$previous`` symbols that contain an explicit
186  symbol name. (`D130725 <https://reviews.llvm.org/D130725>`_)
187* Match ld64's behavior when an archive is specified both via
188  ``LC_LINKER_OPTION`` and via the command line.
189  (`D129556 <https://reviews.llvm.org/D129556>`_)
190* ``-ObjC`` now correctly loads archives with Swift sections.
191  (`D125250 <https://reviews.llvm.org/D125250>`_)
192* ``-lto_object_path`` now accepts a filename (instead of just a directory
193  name.) (`D129705 <https://reviews.llvm.org/D129705>`_)
194* The ``LC_UUID`` hash now includes the output file's name.
195  (`D122843 <https://reviews.llvm.org/D122843>`_)
196* ``-flat_namespace`` now correctly makes all extern symbols in a dylib
197  interposable. (`D119294 <https://reviews.llvm.org/D119294>`_)
198* Fixed compact unwind output when linking on 32-bit hosts.
199  (`D129363 <https://reviews.llvm.org/D129363>`_)
200* Exporting private symbols no longer triggers an assertion.
201  (`D124143 <https://reviews.llvm.org/D124143>`_)
202* MacOS-only ``.tbd`` files are now supported when targeting Catalyst.
203  (`D124336 <https://reviews.llvm.org/D124336>`_)
204* Thunk symbols now have local visibility, avoiding false duplicate symbol
205  errors. (`D122624 <https://reviews.llvm.org/D122624>`_)
206* Fixed handling of relocatable object files within frameworks.
207  (`D114841 <https://reviews.llvm.org/D114841>`_)
208* Fixed the PPC64R2SaveStub to only use non-pc-relative code.
209  (`D129580 <https://reviews.llvm.org/D129580>`_)
210
211WebAssembly Improvements
212------------------------
213
214