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