xref: /freebsd/contrib/llvm-project/lld/docs/ReleaseNotes.rst (revision d38c30c092828f4882ce13b08d0bd3fd6dc7afb5)
1=======================
2lld 9.0.0 Release Notes
3=======================
4
5.. contents::
6    :local:
7
8Introduction
9============
10
11lld is a high-performance linker that supports ELF (Unix), COFF
12(Windows), Mach-O (macOS), MinGW and WebAssembly. lld is
13command-line-compatible with GNU linkers and Microsoft link.exe and is
14significantly faster than the system default linkers.
15
16lld 9 has lots of feature improvements and bug fixes.
17
18Non-comprehensive list of changes in this release
19=================================================
20
21ELF Improvements
22----------------
23
24* ld.lld now has typo suggestions for flags:
25  ``$ ld.lld --call-shared`` now prints
26  ``unknown argument '--call-shared', did you mean '--call_shared'``.
27  (`r361518 <https://reviews.llvm.org/rL361518>`_)
28
29* ``--allow-shlib-undefined`` and ``--no-allow-shlib-undefined``
30  options are added. ``--no-allow-shlib-undefined`` is the default for
31  executables.
32  (`r352826 <https://reviews.llvm.org/rL352826>`_)
33
34* ``-nmagic`` and ``-omagic`` options are fully supported.
35  (`r360593 <https://reviews.llvm.org/rL360593>`_)
36
37* Segment layout has changed. PT_GNU_RELRO, which was previously
38  placed in the middle of readable/writable PT_LOAD segments, is now
39  placed at the beginning of them. This change permits lld-produced
40  ELF files to be read correctly by GNU strip older than 2.31, which
41  has a bug to discard a PT_GNU_RELRO in the former layout.
42
43* ``-z common-page-size`` is supported.
44  (`r360593 <https://reviews.llvm.org/rL360593>`_)
45
46* Diagnostics messages have improved. A new flag ``--vs-diagnostics``
47  alters the format of diagnostic output to enable source hyperlinks
48  in Microsoft Visual Studio IDE.
49
50* Linker script compatibility with GNU BFD linker has generally improved.
51
52* The clang ``--dependent-library`` form of autolinking is supported.
53
54  This feature is added to implement the Windows-style autolinking for
55  Unix. On Unix, in order to use a library, you usually have to
56  include a header file provided by the library and then explicitly
57  link the library with the linker ``-l`` option. On Windows, header
58  files usually contain pragmas that list needed libraries. Compilers
59  copy that information to object files, so that linkers can
60  automatically link needed libraries. ``--dependent-library`` is
61  added for implementing that Windows semantics on Unix.
62  (`r360984 <https://reviews.llvm.org/rL360984>`_)
63
64* AArch64 BTI and PAC are supported.
65  (`r362793 <https://reviews.llvm.org/rL362793>`_)
66
67* lld now supports replacing ``JAL`` with ``JALX`` instructions in case
68  of MIPS-microMIPS cross-mode jumps.
69  (`r354311 <https://reviews.llvm.org/rL354311>`_)
70
71* lld now creates LA25 thunks for MIPS R6 code.
72  (`r354312 <https://reviews.llvm.org/rL354312>`_)
73
74* Put MIPS-specific .reginfo, .MIPS.options, and .MIPS.abiflags sections
75  into corresponding PT_MIPS_REGINFO, PT_MIPS_OPTIONS, and PT_MIPS_ABIFLAGS
76  segments.
77
78* The quality of RISC-V and PowerPC ports have greatly improved. Many
79  applications can now be linked by lld. PowerPC64 is now almost
80  production ready.
81
82* The Linux kernel for arm32_7, arm64, ppc64le and x86_64 can now be
83  linked by lld.
84
85* x86-64 TLSDESC is supported.
86  (`r361911 <https://reviews.llvm.org/rL361911>`_,
87  `r362078 <https://reviews.llvm.org/rL362078>`_)
88
89* DF_STATIC_TLS flag is set for i386 and x86-64 when needed.
90  (`r353293 <https://reviews.llvm.org/rL353293>`_,
91  `r353378 <https://reviews.llvm.org/rL353378>`_)
92
93* The experimental partitioning feature is added to allow a program to
94  be split into multiple pieces.
95
96  The feature allows you to semi-automatically split a single program
97  into multiple ELF files called "partitions". Since all partitions
98  share the same memory address space and don't use PLT/GOT, split
99  programs run as fast as regular programs.
100
101  With the mechanism, you can start a program only with a "main"
102  partition and load remaining partitions on-demand. For example, you
103  can split a web browser into a main partition and a PDF reader
104  sub-partition and load the PDF reader partition only when a user
105  tries to open a PDF file.
106
107  See `the documentation <Partitions.html>`_ for more information.
108
109* If "-" is given as an output filename, lld writes the final result
110  to the standard output. Previously, it created a file "-" in the
111  current directory.
112  (`r351852 <https://reviews.llvm.org/rL351852>`_)
113
114* ``-z ifunc-noplt`` option is added to reduce IFunc function call
115  overhead in a freestanding environment such as the OS kernel.
116
117  Functions resolved by the IFunc mechanism are usually dispatched via
118  PLT and thus slower than regular functions because of the cost of
119  indirection. With ``-z ifunc-noplt``, you can eliminate it by doing
120  text relocations at load-time. You need a special loader to utilize
121  this feature. This feature is added for the FreeBSD kernel but can
122  be used by any operating systems.
123  (`r360685 <https://reviews.llvm.org/rL360685>`_)
124
125* ``--undefined-glob`` option is added. The new option is an extension
126  to ``--undefined`` to take a glob pattern instead of a single symbol
127  name.
128  (`r363396 <https://reviews.llvm.org/rL363396>`_)
129
130
131COFF Improvements
132-----------------
133
134* Like the ELF driver, lld-link now has typo suggestions for flags.
135  (`r361518 <https://reviews.llvm.org/rL361518>`_)
136
137* lld-link now correctly reports duplicate symbol errors for object
138  files that were compiled with ``/Gy``.
139  (`r352590 <https://reviews.llvm.org/rL352590>`_)
140
141* lld-link now correctly reports duplicate symbol errors when several
142  resource (.res) input files define resources with the same type,
143  name and language.  This can be demoted to a warning using
144  ``/force:multipleres``.
145  (`r359829 <https://reviews.llvm.org/rL359829>`_)
146
147* lld-link now rejects more than one resource object input files,
148  matching link.exe. Previously, lld-link would silently ignore all
149  but one.  If you hit this: Don't pass resource object files to the
150  linker, instead pass res files to the linker directly. Don't put
151  resource files in static libraries, pass them on the command line.
152  (`r359749 <https://reviews.llvm.org/rL359749>`_)
153
154* Having more than two ``/natvis:`` now works correctly; it used to not
155  work for larger binaries before.
156  (`r359515 <https://reviews.llvm.org/rL359515>`_)
157
158* Undefined symbols are now printed only in demangled form. Pass
159  ``/demangle:no`` to see raw symbol names instead.
160  (`r355878 <https://reviews.llvm.org/rL355878>`_)
161
162* Several speed and memory usage improvements.
163
164* lld-link now supports resource object files created by GNU windres and
165  MS cvtres, not only llvm-cvtres.
166
167* The generated thunks for delayimports now share the majority of code
168  among thunks, significantly reducing the overhead of using delayimport.
169  (`r365823 <https://reviews.llvm.org/rL365823>`_)
170
171* ``IMAGE_REL_ARM{,64}_REL32`` relocations are supported.
172  (`r352325 <https://reviews.llvm.org/rL352325>`_)
173
174* Range extension thunks for AArch64 are now supported, so lld can
175  create large executables for Windows/ARM64.
176  (`r352929 <https://reviews.llvm.org/rL352929>`_)
177
178* The following flags have been added:
179  ``/functionpadmin`` (`r354716 <https://reviews.llvm.org/rL354716>`_),
180  ``/swaprun:`` (`r359192 <https://reviews.llvm.org/rL359192>`_),
181  ``/threads:no`` (`r355029 <https://reviews.llvm.org/rL355029>`_),
182  ``/filealign`` (`r361634 <https://reviews.llvm.org/rL361634>`_)
183
184WebAssembly Improvements
185------------------------
186
187* Imports from custom module names are supported.
188  (`r352828 <https://reviews.llvm.org/rL352828>`_)
189
190* Symbols that are in llvm.used are now exported by default.
191  (`r353364 <https://reviews.llvm.org/rL353364>`_)
192
193* Initial support for PIC and dynamic linking has landed.
194  (`r357022 <https://reviews.llvm.org/rL357022>`_)
195
196* wasm-ld now add ``__start_``/``__stop_`` symbols for data sections.
197  (`r361236 <https://reviews.llvm.org/rL361236>`_)
198
199* wasm-ld now doesn't report an error on archives without a symbol index.
200  (`r364338 <https://reviews.llvm.org/rL364338>`_)
201
202* The following flags have been added:
203  ``--emit-relocs`` (`r361635 <https://reviews.llvm.org/rL361635>`_),
204  ``--wrap`` (`r361639 <https://reviews.llvm.org/rL361639>`_),
205  ``--trace`` and ``--trace-symbol``
206  (`r353264 <https://reviews.llvm.org/rL353264>`_).
207
208
209MinGW Improvements
210------------------
211
212* lld now correctly links crtend.o as the last object file, handling
213  terminators for the sections such as .eh_frame properly, fixing
214  DWARF exception handling with libgcc and gcc's crtend.o.
215
216* lld now also handles DWARF unwind info generated by GCC, when linking
217  with libgcc.
218
219* PDB output can be requested without manually specifying the PDB file
220  name, with the new option ``-pdb=`` with an empty value to the option.
221  (The old existing syntax ``-pdb <filename>`` was more cumbersome to use
222  with an empty parameter value.)
223
224* ``--no-insert-timestamp`` option is added as an alias to ``/timestamp:0``.
225  (`r353145 <https://reviews.llvm.org/rL353145>`_)
226
227* Many more GNU ld options are now supported, which e.g. allows the lld
228  MinGW frontend to be called by GCC.
229
230* The following options are added: ``--exclude-all-symbols``,
231  ``--appcontainer``, ``--undefined``
232