File: index.rst

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (62 lines) | stat: -rw-r--r-- 2,118 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Mach-O LLD Port
===============

LLD is a linker from the LLVM project that is a drop-in replacement
for system linkers and runs much faster than them. It also provides
features that are useful for toolchain developers. This document
will describe the Mach-O port.

Features
--------

- LLD is a drop-in replacement for Apple's Mach-O linker, ld64, that accepts the
  same command line arguments.

- LLD is very fast. When you link a large program on a multicore
  machine, you can expect that LLD runs more than twice as fast as the ld64
  linker.

Download
--------

LLD is available as a pre-built binary by going to the `latest release <https://github.com/llvm/llvm-project/releases>`_,
downloading the appropriate bundle (``clang+llvm-<version>-<your architecture>-<your platform>.tar.xz``),
decompressing it, and locating the binary at ``bin/ld64.lld``. Note
that if ``ld64.lld`` is moved out of ``bin``, it must still be accompanied
by its sibling file ``lld``, as ``ld64.lld`` is technically a symlink to ``lld``.

Build
-----

The easiest way to build LLD is to
check out the entire LLVM projects/sub-projects from a git mirror and
build that tree. You need ``cmake`` and of course a C++ compiler.

.. code-block:: console

  $ git clone https://github.com/llvm/llvm-project llvm-project
  $ mkdir build
  $ cd build
  $ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='lld' ../llvm-project/llvm
  $ ninja check-lld-macho

Then you can find output binary at ``build/bin/ld64.lld``. Note
that if ``ld64.lld`` is moved out of ``bin``, it must still be accompanied
by its sibling file ``lld``, as ``ld64.lld`` is technically a symlink to ``lld``.

Using LLD
---------

LLD can be used by adding ``-fuse-ld=/path/to/ld64.lld`` to the linker flags.
For Xcode, this can be done by adding it to "Other linker flags" in the build
settings. For Bazel, this can be done with ``--linkopt`` or with
`rules_apple_linker <https://github.com/keith/rules_apple_linker>`_.

.. seealso::

  :doc:`ld64-vs-lld` has more info on the differences between the two linkers.

.. toctree::
   :hidden:

   ld64-vs-lld