r313425 - [docs] add Windows examples to ThinLTO.rst
Bob Haarman via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 15 17:16:14 PDT 2017
Author: inglorion
Date: Fri Sep 15 17:16:13 2017
New Revision: 313425
URL: http://llvm.org/viewvc/llvm-project?rev=313425&view=rev
Log:
[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
Modified:
cfe/trunk/docs/ThinLTO.rst
Modified: cfe/trunk/docs/ThinLTO.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ThinLTO.rst?rev=313425&r1=313424&r2=313425&view=diff
==============================================================================
--- cfe/trunk/docs/ThinLTO.rst (original)
+++ cfe/trunk/docs/ThinLTO.rst Fri Sep 15 17:16:13 2017
@@ -63,7 +63,7 @@ ThinLTO is currently supported for the f
- **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
% 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
``-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
- 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, fo
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
More information about the cfe-commits
mailing list