[llvm] [docs][NFC] Add usage instructions for FatLTO (PR #75853)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 13:31:26 PST 2023


================
@@ -76,3 +76,56 @@ Supported File Formats
 The current implementation only supports ELF files. At time of writing, it is
 unclear if it will be useful to support other object file formats like ``COFF``
 or ``Mach-O``.
+
+Usage
+===========
+
+Users are expected to pass ``-ffat-lto-objects`` to clang in addition to one of
+the ``-flto`` variants. Without the ``-flto`` flag, ``-ffat-lto-objects`` has
+no effect.
+
+
+Compile and link. Use the object code from the fat object without LTO.
+
+.. code-block:: console
+
+   $ clang -fno-lto -ffat-lto-objects -fuse-ld=lld foo.c
+
+Compile and link. Select full LTO at link time.
+
+.. code-block:: console
+
+   $ clang -flto -ffat-lto-objects -fuse-ld=lld foo.c
+
+Compile and link. Select ThinLTO at link time.
+
+.. code-block:: console
+
+   $ clang -flto=thin -ffat-lto-objects -fuse-ld=lld foo.c
+
+Compile and link. Use ThinLTO with the UnifiedLTO pipeline.
+
+.. code-block:: console
+
+   $ clang -flto=thin -ffat-lto-objects -funified-lto -fuse-ld=lld foo.c
----------------
nikic wrote:

Isn't `-funified-lto` the default/required for fat LTO now? I'd expect the flag to have no additional effect.

https://github.com/llvm/llvm-project/pull/75853


More information about the llvm-commits mailing list