[PATCH] D37943: [docs] add Windows examples to ThinLTO.rst

Bob Haarman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 17:17:40 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL313425: [docs] add Windows examples to ThinLTO.rst (authored by inglorion).

Changed prior to commit:
  https://reviews.llvm.org/D37943?vs=115522&id=115524#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D37943

Files:
  cfe/trunk/docs/ThinLTO.rst


Index: cfe/trunk/docs/ThinLTO.rst
===================================================================
--- cfe/trunk/docs/ThinLTO.rst
+++ cfe/trunk/docs/ThinLTO.rst
@@ -63,7 +63,7 @@
 - **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 @@
   % 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 @@
   ``-Wl,-mllvm,-threads=N``
 - lld:
   ``-Wl,--thinlto-jobs=N``
+- lld-link:
+  ``/opt:lldltojobs=N``
 
 Incremental
 -----------
@@ -125,7 +134,7 @@
   ``-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 @@
 
 - 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 @@
    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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37943.115524.patch
Type: text/x-patch
Size: 2541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170916/4efebede/attachment-0001.bin>


More information about the cfe-commits mailing list