xref: /freebsd/contrib/llvm-project/lld/docs/ReleaseNotes.rst (revision d65cd7a57bf0600b722afc770838a5d0c1c3a8e1)
1========================
2lld 10.0.0 Release Notes
3========================
4
5.. contents::
6    :local:
7
8
9Introduction
10============
11
12This document contains the release notes for the lld linker, release 10.0.0.
13Here we describe the status of lld, including major improvements
14from the previous release. All lld releases may be downloaded
15from the `LLVM releases web site <https://llvm.org/releases/>`_.
16
17Non-comprehensive list of changes in this release
18=================================================
19
20ELF Improvements
21----------------
22
23* Glob pattern, which you can use in linker scripts or version scripts,
24  now supports `\` and `[!...]`. Except character classes
25  (e.g. `[[:digit:]]`), lld's glob pattern should be fully compatible
26  with GNU now. (`r375051
27  <https://github.com/llvm/llvm-project/commit/48993d5ab9413f0e5b94dfa292a233ce55b09e3e>`_)
28
29* New ``elf32btsmipn32_fbsd`` and ``elf32ltsmipn32_fbsd`` emulations
30  are supported.
31
32* Relax MIPS ``jalr`` and ``jr`` instructions marked by the ``R_MIPS_JALR``
33  relocation.
34* For certain "undefined symbol" errors, a definition with a close spelling will be suggested.
35  (`D67039 <https://reviews.llvm.org/D67039>`_)
36* ``extern "C"`` is suggested if an undefined reference is mangled(unmangled) while there
37  is a likely unmangled(mangled) definition.
38  (`D69592 <https://reviews.llvm.org/D69592>`_ `D69650 <https://reviews.llvm.org/D69650>`_)
39* New ``-z noseparate-code``, ``-z separate-code`` and ``-z separate-loadable-segments``.
40  ``-z noseparate-code`` is the default, which can reduce sizes of linked binaries by up to
41  3 times maxpagesize.
42  (`D64903 <https://reviews.llvm.org/D64903>`_ `D67481 <https://reviews.llvm.org/D67481>`_)
43* ``-z force-bti`` and ``-z pac-plt`` are added for AArch64 Branch Target Identification and Pointer Authentication.
44  (`D62609 <https://reviews.llvm.org/D62609>`_)
45* ``--fix-cortex-a8`` is added to fix erratum 657417.
46  (`D67284 <https://reviews.llvm.org/D67284>`_)
47* ``-z force-ibt`` and ``-z shstk`` are added for Intel Control-flow Enforcement Technology.
48  (`D59780 <https://reviews.llvm.org/D59780>`_)
49* ``PT_GNU_PROPERTY`` is added to help loaders locate the ``.note.gnu.property`` section.
50  It may be used by a future Linux kernel.
51  (`D70961 <https://reviews.llvm.org/D70961>`_)
52* For ``--compress-debug-sections=zlib``, ``-O0`` and ``-O1`` enable compression level 1
53  while ``-O2`` enables compression level 6. ``-O1`` (default) is faster than before.
54  (`D70658 <https://reviews.llvm.org/D70658>`_)
55* Range extension thunks with addends are implemented for AArch64, PowerPC32 and PowerPC64.
56  (`D70637 <https://reviews.llvm.org/D70637>`_ `D70937 <https://reviews.llvm.org/D70937>`_
57  `D73424 <https://reviews.llvm.org/D73424>`_)
58* ``R_RISCV_ALIGN`` will be errored because linker relaxation for RISC-V is not supported.
59  Pass ``-mno-relax`` to disable ``R_RISCV_ALIGN``.
60  (`D71820 <https://reviews.llvm.org/D71820>`_)
61* The ARM port will no longer insert interworking thunks for non STT_FUNC symbols.
62  (`D73474 <https://reviews.llvm.org/D73474>`_)
63* The quality of PowerPC32 port has been greatly improved (canonical PLT, copy
64  relocations, non-preemptible IFUNC, range extension thunks with addends).
65  It can link FreeBSD 13.0 userland.
66* The PowerPC64 port supports non-preemptible IFUNC.
67  (`D71509 <https://reviews.llvm.org/D71509>`_)
68* lld creates a RO PT_LOAD and a RX PT_LOAD without a linker script.
69  lld creates a unified RX PT_LOAD with a linker script.
70  A future release will eliminate this difference and use a RO PT_LOAD and a RX PT_LOAD by default.
71  The linker script case will require ``--no-rosegment`` to restore the current behavior.
72* GNU style compressed debug sections ``.zdebug`` (obsoleted by ``SHF_COMPRESSED``)
73  are supported for input files, but not for the output.
74  A future release may drop ``.zdebug`` support.
75
76Breaking changes
77----------------
78
79* ``-Ttext=$base`` (base is usually 0) is no longer supported.
80  If PT_PHDR is needed, use ``--image-base=$base`` instead.
81  If PT_PHDR is not needed, use a linker script with `.text 0 : { *(.text*) }` as the first
82  output section description.
83  See https://bugs.llvm.org/show_bug.cgi?id=44715 for more information.
84  (`D67325 <https://reviews.llvm.org/D67325>`_)
85* ``-Ttext-segment`` is no longer supported. Its meaning was different from GNU ld's and
86  could cause subtle bugs.
87  (`D70468 <https://reviews.llvm.org/D70468>`_)
88
89
90MinGW Improvements
91------------------
92
93* Allow using custom .edata sections from input object files (for use
94  by Wine)
95  (`dadc6f248868 <https://reviews.llvm.org/rGdadc6f248868>`_)
96
97* Don't implicitly create import libraries unless requested
98  (`6540e55067e3 <https://reviews.llvm.org/rG6540e55067e3>`_)
99
100* Support merging multiple resource object files
101  (`3d3a9b3b413d <https://reviews.llvm.org/rG3d3a9b3b413d>`_)
102  and properly handle the default manifest object files that GCC can pass
103  (`d581dd501381 <https://reviews.llvm.org/rGd581dd501381>`_)
104
105* Demangle itanium symbol names in warnings/error messages
106  (`a66fc1c99f3e <https://reviews.llvm.org/rGa66fc1c99f3e>`_)
107
108* Print source locations for undefined references and duplicate symbols,
109  if possible
110  (`1d06d48bb346 <https://reviews.llvm.org/rG1d06d48bb346>`_)
111  and
112  (`b38f577c015c <https://reviews.llvm.org/rGb38f577c015c>`_)
113
114* Look for more filename patterns when resolving ``-l`` options
115  (`0226c35262df <https://reviews.llvm.org/rG0226c35262df>`_)
116
117* Don't error out on duplicate absolute symbols with the same value
118  (which can happen for the default-null symbol for weak symbols)
119  (`1737cc750c46 <https://reviews.llvm.org/rG1737cc750c46>`_)
120
121
122WebAssembly Improvements
123------------------------
124
125* `__data_end` and `__heap_base` are no longer exported by default,
126  as it's best to keep them internal when possible. They can be
127  explicitly exported with `--export=__data_end` and
128  `--export=__heap_base`, respectively.
129* wasm-ld now elides .bss sections when the memory is not imported
130