From 19ce92e20cd799c55a597d9b6fdb3560e7bf8a01 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sun, 26 Feb 2017 00:20:42 +0000 Subject: [PATCH] Add a section about how to use ld.lld. llvm-svn: 296278 --- lld/docs/index.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lld/docs/index.rst b/lld/docs/index.rst index cc9f90dd0f44..be7ec92cc538 100644 --- a/lld/docs/index.rst +++ b/lld/docs/index.rst @@ -109,6 +109,29 @@ build that tree. You need `cmake` and of course a C++ compiler. $ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=lld -DCMAKE_INSTALL_PREFIX=/usr/local ../llvm-project/llvm $ make install +Using LLD +--------- + +LLD is installed as ``ld.lld``. On Unix, linkers are invoked by +compiler drivers, so you are not expected to use that command +directly. There are a few ways to tell compiler drivers to use ld.lld +instead of the default linker. + +The easiest way to do that is to overwrite the default linker. After +installing LLD to somewhere on your disk, you can create a symbolic +link by doing ``ld -s /path/to/ld.lld /usr/bin/ld`` so that +``/usr/bin/ld`` is resolved to LLD. + +If you don't want to change the system setting, you can use clang's +``-fuse-ld`` option. In this way, you want to set ``-fuse-ld=lld`` to +LDFLAGS when building your programs. + +LLD leaves its name and version number to a ``.comment`` section in an +output. If you are in doubt whether you are successfully using LLD or +not, run ``objdump -s -j .comment `` and examine the +output. If the string "Linker: LLD" is included in the output, you are +using LLD. + History -------