Skip to content

Commit c129d65

Browse files
authored
[DTLTO][Clang][Docs] Update for COFF support (llvm#149988)
As the COFF linker is usually invoked independently, update the Clang DTLTO section to show an example. This follows what is done earlier in the document. Also some minor fixes and improvements: - Use generic distributor names to avoid implying anything about what an Incredibuild distributor may or should support. - Use subheadings for readability. - Correct a mis-cased hyperlink.
1 parent f9b258c commit c129d65

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

clang/docs/ThinLTO.rst

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ during the traditional link step.
249249

250250
The implementation is documented here: https://llvm.org/docs/DTLTO.html.
251251

252+
Command-Line Options
253+
^^^^^^^^^^^^^^^^^^^^
254+
252255
DTLTO requires the LLD linker (``-fuse-ld=lld``).
253256

254257
``-fthinlto-distributor=<path>``
@@ -260,17 +263,29 @@ DTLTO requires the LLD linker (``-fuse-ld=lld``).
260263
- Can be specified multiple times to pass multiple options.
261264
- Multiple options can also be specified by separating them with commas.
262265

263-
Examples:
264-
- ``clang -flto=thin -fthinlto-distributor=incredibuild.exe -Xthinlto-distributor=--verbose,--j10 -fuse-ld=lld``
265-
- ``clang -flto=thin -fthinlto-distributor=$(which python) -Xthinlto-distributor=incredibuild.py -fuse-ld=lld``
266-
267266
If ``-fthinlto-distributor=`` is specified, Clang supplies the path to a
268267
compiler to be executed remotely to perform the ThinLTO backend
269268
compilations. Currently, this is Clang itself.
270269

270+
Usage
271+
^^^^^
272+
273+
Compilation is unchanged from ThinLTO. DTLTO options need to supplied for the link step:
274+
275+
.. code-block:: console
276+
277+
% clang -flto=thin -fthinlto-distributor=distribute.sh -Xthinlto-distributor=--verbose,--j10 -fuse-ld=lld file1.o file2.o
278+
% clang -flto=thin -fthinlto-distributor=$(which python) -Xthinlto-distributor=distribute.py -fuse-ld=lld file1.o file2.o
279+
280+
When using lld-link:
281+
282+
.. code-block:: console
283+
284+
% lld-link /out:a.exe file1.obj file2.obj /thinlto-distributor:distribute.exe /thinlto-remote-compiler:${LLVM}\bin\clang.exe /thinlto-distributor-arg:--verbose
285+
271286
Note that currently, DTLTO is only supported in some LLD flavors. Support can
272287
be added to other LLD flavours in the future.
273-
See `DTLTO <https://lld.llvm.org/dtlto.html>`_ for more information.
288+
See `DTLTO <https://lld.llvm.org/DTLTO.html>`_ for more information.
274289

275290
More Information
276291
================

0 commit comments

Comments
 (0)