summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBob Haarman <llvm@inglorion.net>2017-09-16 00:16:13 +0000
committerBob Haarman <llvm@inglorion.net>2017-09-16 00:16:13 +0000
commit893d8dc5ec7eb1ab21cfe1b0c6acaf6429de58b5 (patch)
tree26ca69f2ac527a2f9a7ee56fa1af0f10fc21f386 /docs
parent6d55fdd9ee95cdb0e6fd34df57e044faff8fe5f0 (diff)
[docs] add Windows examples to ThinLTO.rst
Reviewers: pcc, ruiu Reviewed By: ruiu Subscribers: mehdi_amini, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D37943 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313425 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/ThinLTO.rst26
1 files changed, 21 insertions, 5 deletions
diff --git a/docs/ThinLTO.rst b/docs/ThinLTO.rst
index 71b1d5d633..c49779641d 100644
--- a/docs/ThinLTO.rst
+++ b/docs/ThinLTO.rst
@@ -63,7 +63,7 @@ ThinLTO is currently supported for the following linkers:
- **ld64**:
Starting with `Xcode 8 <https://developer.apple.com/xcode/>`_.
- **lld**:
- Starting with r284050 (ELF only).
+ Starting with r284050 for ELF, r298942 for COFF.
Usage
=====
@@ -78,6 +78,13 @@ To utilize ThinLTO, simply add the -flto=thin option to compile and link. E.g.
% clang -flto=thin -O2 file1.c file2.c -c
% clang -flto=thin -O2 file1.o file2.o -o a.out
+When using lld-link, the -flto option need only be added to the compile step:
+
+.. code-block:: console
+
+ % clang-cl -flto=thin -O2 -c file1.c file2.c
+ % lld-link /out:a.exe file1.obj file2.obj
+
As mentioned earlier, by default the linkers will launch the ThinLTO backend
threads in parallel, passing the resulting native object files back to the
linker for the final native link. As such, the usage model the same as
@@ -111,6 +118,8 @@ be reduced to ``N`` via:
``-Wl,-mllvm,-threads=N``
- lld:
``-Wl,--thinlto-jobs=N``
+- lld-link:
+ ``/opt:lldltojobs=N``
Incremental
-----------
@@ -125,7 +134,7 @@ which currently must be enabled through a linker option.
``-Wl,-cache_path_lto,/path/to/cache``
- ELF lld (as of LLVM 5.0):
``-Wl,--thinlto-cache-dir=/path/to/cache``
-- COFF lld (as of LLVM 6.0):
+- COFF lld-link (as of LLVM 6.0):
``/lldltocache:/path/to/cache``
Cache Pruning
@@ -138,7 +147,7 @@ policy string. The cache policy must be specified with a linker option.
- ELF lld (as of LLVM 5.0):
``-Wl,--thinlto-cache-policy,POLICY``
-- COFF lld (as of LLVM 6.0):
+- COFF lld-link (as of LLVM 6.0):
``/lldltocachepolicy:POLICY``
A policy string is a series of key-value pairs separated by ``:`` characters.
@@ -187,13 +196,20 @@ To bootstrap clang/LLVM with ThinLTO, follow these steps:
when configuring the bootstrap compiler build:
* ``-DLLVM_ENABLE_LTO=Thin``
- * ``-DLLVM_PARALLEL_LINK_JOBS=1``
- (since the ThinLTO link invokes parallel backend jobs)
* ``-DCMAKE_C_COMPILER=/path/to/host/clang``
* ``-DCMAKE_CXX_COMPILER=/path/to/host/clang++``
* ``-DCMAKE_RANLIB=/path/to/host/llvm-ranlib``
* ``-DCMAKE_AR=/path/to/host/llvm-ar``
+ Or, on Windows:
+
+ * ``-DLLVM_ENABLE_LTO=Thin``
+ * ``-DCMAKE_C_COMPILER=/path/to/host/clang-cl.exe``
+ * ``-DCMAKE_CXX_COMPILER=/path/to/host/clang-cl.exe``
+ * ``-DCMAKE_LINKER=/path/to/host/lld-link.exe``
+ * ``-DCMAKE_RANLIB=/path/to/host/llvm-ranlib.exe``
+ * ``-DCMAKE_AR=/path/to/host/llvm-ar.exe``
+
#. To use additional linker arguments for controlling the backend
parallelism_ or enabling incremental_ builds of the bootstrap compiler,
after configuring the build, modify the resulting CMakeCache.txt file in the