1======================== 2lld 11.0.0 Release Notes 3======================== 4 5.. contents:: 6 :local: 7 8Introduction 9============ 10 11This document contains the release notes for the lld linker, release 11.0.0. 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 22* ``--lto-emit-asm`` is added to emit assembly output for debugging purposes. 23 (`D77231 <https://reviews.llvm.org/D77231>`_) 24* ``--lto-whole-program-visibility`` is added to specify that classes have hidden LTO visibility in LTO and ThinLTO links of source files compiled with ``-fwhole-program-vtables``. See `LTOVisibility <https://clang.llvm.org/docs/LTOVisibility.html>`_ for details. 25 (`D71913 <https://reviews.llvm.org/D71913>`_) 26* ``--print-archive-stats=`` is added to print the number of members and the number of fetched members for each archive. 27 The feature is similar to GNU gold's ``--print-symbol-counts=``. 28 (`D78983 <https://reviews.llvm.org/D78983>`_) 29* ``--shuffle-sections=`` is added to introduce randomization in the output to help reduce measurement bias and detect static initialization order fiasco. 30 (`D74791 <https://reviews.llvm.org/D74791>`_) 31 (`D74887 <https://reviews.llvm.org/D74887>`_) 32* ``--time-trace`` is added. It records a time trace file that can be viewed in 33 chrome://tracing. The file can be specified with ``--time-trace-file``. 34 Trace granularity can be specified with ``--time-trace-granularity``. 35 (`D71060 <https://reviews.llvm.org/D71060>`_) 36* ``--thinlto-single-module`` is added to compile a subset of modules in ThinLTO for debugging purposes. 37 (`D80406 <https://reviews.llvm.org/D80406>`_) 38* ``--unique`` is added to create separate output sections for orphan sections. 39 (`D75536 <https://reviews.llvm.org/D75536>`_) 40* ``--warn-backrefs`` has been improved to emulate GNU ld's archive semantics. 41 If a link passes with warnings from ``--warn-backrefs``, it almost assuredly 42 means that the link will fail with GNU ld, or the symbol will get different 43 resolutions in GNU ld and LLD. ``--warn-backrefs-exclude=`` is added to 44 exclude known issues. 45 (`D77522 <https://reviews.llvm.org/D77522>`_) 46 (`D77630 <https://reviews.llvm.org/D77630>`_) 47 (`D77512 <https://reviews.llvm.org/D77512>`_) 48* ``--no-relax`` is accepted but ignored. The Linux kernel's RISC-V port uses this option. 49 (`D81359 <https://reviews.llvm.org/D81359>`_) 50* ``--rosegment`` (default) is added to complement ``--no-rosegment``. 51 GNU gold from 2.35 onwards support both options. 52* ``--threads=N`` is added. The default uses all threads. 53 (`D76885 <https://reviews.llvm.org/D76885>`_) 54* ``--wrap`` has better compatibility with GNU ld. 55* ``-z dead-reloc-in-nonalloc=<section_glob>=<value>`` is added to resolve an absolute relocation 56 referencing a discarded symbol. 57 (`D83264 <https://reviews.llvm.org/D83264>`_) 58* Changed tombstone values to (``.debug_ranges``/``.debug_loc``) 1 and (other ``.debug_*``) 0. 59 A tombstone value is the computed value of a relocation referencing a discarded symbol (``--gc-sections``, ICF or ``/DISCARD/``). 60 (`D84825 <https://reviews.llvm.org/D84825>`_) 61 In the future many .debug_* may switch to 0xffffffff/0xffffffffffffffff as the tombstone value. 62* ``-z keep-text-section-prefix`` moves ``.text.unknown.*`` input sections to ``.text.unknown``. 63* ``-z rel`` and ``-z rela`` are added to select the REL/RELA format for dynamic relocations. 64 The default is target specific and typically matches the form used in relocatable objects. 65* ``-z start-stop-visibility={default,protected,internal,hidden}`` is added. 66 GNU ld/gold from 2.35 onwards support this option. 67 (`D55682 <https://reviews.llvm.org/D55682>`_) 68* When ``-r`` or ``--emit-relocs`` is specified, the GNU ld compatible 69 ``--discard-all`` and ``--discard-locals`` semantics are implemented. 70 (`D77807 <https://reviews.llvm.org/D77807>`_) 71* ``--emit-relocs --strip-debug`` can now be used together. 72 (`D74375 <https://reviews.llvm.org/D74375>`_) 73* ``--gdb-index`` supports DWARF v5. 74 (`D79061 <https://reviews.llvm.org/D79061>`_) 75 (`D85579 <https://reviews.llvm.org/D85579>`_) 76* ``-r`` allows SHT_X86_64_UNWIND to be merged into SHT_PROGBITS. 77 This allows clang/GCC produced object files to be mixed together. 78 (`D85785 <https://reviews.llvm.org/D85785>`_) 79* Better linker script support related to output section alignments and LMA regions. 80 (`D74286 <https://reviews.llvm.org/D75724>`_) 81 (`D74297 <https://reviews.llvm.org/D75724>`_) 82 (`D75724 <https://reviews.llvm.org/D75724>`_) 83 (`D81986 <https://reviews.llvm.org/D81986>`_) 84* In a input section description, the filename can be specified in double quotes. 85 ``archive:file`` syntax is added. 86 (`D72517 <https://reviews.llvm.org/D72517>`_) 87 (`D75100 <https://reviews.llvm.org/D75100>`_) 88* Linker script specified empty ``(.init|.preinit|.fini)_array`` are allowed with RELRO. 89 (`D76915 <https://reviews.llvm.org/D76915>`_) 90* ``INSERT AFTER`` and ``INSERT BEFORE`` work for orphan sections now. 91 (`D74375 <https://reviews.llvm.org/D74375>`_) 92* ``INPUT_SECTION_FLAGS`` is supported in linker scripts. 93 (`D72745 <https://reviews.llvm.org/D72745>`_) 94* ``DF_1_PIE`` is set for position-independent executables. 95 (`D80872 <https://reviews.llvm.org/D80872>`_) 96* For a symbol assignment ``alias = aliasee;``, ``alias`` inherits the ``aliasee``'s symbol type. 97 (`D86263 <https://reviews.llvm.org/D86263>`_) 98* ``SHT_GNU_verneed`` in shared objects are parsed, and versioned undefined symbols in shared objects are respected. 99 (`D80059 <https://reviews.llvm.org/D80059>`_) 100* SHF_LINK_ORDER and non-SHF_LINK_ORDER sections can be mixed along as the SHF_LINK_ORDER components are contiguous. 101 (`D77007 <https://reviews.llvm.org/D77007>`_) 102* An out-of-range relocation diagnostic mentions the referenced symbol now. 103 (`D73518 <https://reviews.llvm.org/D73518>`_) 104* AArch64: ``R_AARCH64_PLT32`` is supported. 105 (`D81184 <https://reviews.llvm.org/D81184>`_) 106* ARM: SBREL type relocations are supported. 107 (`D74375 <https://reviews.llvm.org/D74375>`_) 108* ARM: ``R_ARM_ALU_PC_G0``, ``R_ARM_LDR_PC_G0``, ``R_ARM_THUMB_PC8`` and ``R_ARM_THUMB__PC12`` are supported. 109 (`D75349 <https://reviews.llvm.org/D75349>`_) 110 (`D77200 <https://reviews.llvm.org/D77200>`_) 111* ARM: various improvements to .ARM.exidx: ``/DISCARD/`` support for a subset, out-of-range handling, support for non monotonic section order. 112 (`PR44824 <https://llvm.org/PR44824>`_) 113* AVR: many relocation types are supported. 114 (`D78741 <https://reviews.llvm.org/D78741>`_) 115* Hexagon: General Dynamic and some other relocation types are supported. 116* PPC: Canonical PLT and range extension thunks with addends are supported. 117 (`D73399 <https://reviews.llvm.org/D73399>`_) 118 (`D73424 <https://reviews.llvm.org/D73424>`_) 119 (`D75394 <https://reviews.llvm.org/D75394>`_) 120* PPC and PPC64: copy relocations. 121 (`D73255 <https://reviews.llvm.org/D73255>`_) 122* PPC64: ``_savegpr[01]_{14..31}`` and ``_restgpr[01]_{14..31}`` can be synthesized. 123 (`D79977 <https://reviews.llvm.org/D79977>`_) 124* PPC64: ``R_PPC64_GOT_PCREL34`` and ``R_PPC64_REL24_NOTOC`` are supported. r2 save stub is supported. 125 (`D81948 <https://reviews.llvm.org/D81948>`_) 126 (`D82950 <https://reviews.llvm.org/D82950>`_) 127 (`D82816 <https://reviews.llvm.org/D82816>`_) 128* RISC-V: ``R_RISCV_IRELATIVE`` is supported. 129 (`D74022 <https://reviews.llvm.org/D74022>`_) 130* RISC-V: ``R_RISCV_ALIGN`` is errored because GNU ld style linker relaxation is not supported. 131 (`D71820 <https://reviews.llvm.org/D71820>`_) 132* SPARCv9: more relocation types are supported. 133 (`D77672 <https://reviews.llvm.org/D77672>`_) 134 135Breaking changes 136---------------- 137 138* One-dash form of some long option (``--thinlto-*``, ``--lto-*``, ``--shuffle-sections=``) 139 are no longer supported. 140 (`D79371 <https://reviews.llvm.org/D79371>`_) 141* ``--export-dynamic-symbol`` no longer implies ``-u``. 142 The new behavior matches GNU ld from binutils 2.35 onwards. 143 (`D80487 <https://reviews.llvm.org/D80487>`_) 144* ARM: the default max page size was increased from 4096 to 65536. 145 This increases compatibility with systems where a non standard page 146 size was configured. This also is inline with GNU ld defaults. 147 (`D77330 <https://reviews.llvm.org/D77330>`_) 148* ARM: for non-STT_FUNC symbols, Thumb interworking thunks are not added and BL/BLX are not substituted. 149 (`D73474 <https://reviews.llvm.org/D73474>`_) 150 (`D73542 <https://reviews.llvm.org/D73542>`_) 151* AArch64: ``--force-bti`` is renamed to ``-z force-bti`. ``--pac-plt`` is renamed to ``-z pac-plt``. 152 This change is compatibile with GNU ld. 153* A readonly ``PT_LOAD`` is created in the presence of a ``SECTIONS`` command. 154 The new behavior is consistent with the longstanding behavior in the absence of a SECTIONS command. 155* Orphan section names like ``.rodata.foo`` and ``.text.foo`` are not grouped into ``.rodata`` and ``.text`` in the presence of a ``SECTIONS`` command. 156 The new behavior matches GNU ld. 157 (`D75225 <https://reviews.llvm.org/D75225>`_) 158* ``--no-threads`` is removed. Use ``--threads=1`` instead. ``--threads`` (no-op) is removed. 159 160COFF Improvements 161----------------- 162 163* Fixed exporting symbols whose names contain a period (``.``), which was 164 a regression in lld 7. 165 166MinGW Improvements 167------------------ 168 169* Implemented new options for disabling auto import and runtime pseudo 170 relocations (``--disable-auto-import`` and 171 ``--disable-runtime-pseudo-reloc``), the ``--no-seh`` flag and options 172 for selecting file and section alignment (``--file-alignment`` and 173 ``--section-alignment``). 174