Skip to content

[docs][NFC] Add usage instructions for FatLTO #75853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 19, 2023
Merged

Conversation

ilovepi
Copy link
Contributor

@ilovepi ilovepi commented Dec 18, 2023

We included these in the commit message when we added -ffat-lto-objects, but they should be in the documentation as well.

We included these in the commit message when we added
`-ffat-lto-objects`, but they should be in the documentation as well.

.. code-block:: console

$ clang -fno-lto -ffat-lto-objects -fuse-ld=lld foo.c
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a nit, but would it be possible to use example.c instead of foo.c here and below?

no effect.


Compile and link. Use the object code from the fat object without LTO.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure these "compile and link" examples make a lot of sense. I think fat LTO is only meaningful if compile and link is separate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll revise the examples to have a common first compile step and then different link steps.


.. code-block:: console

$ clang -flto=thin -ffat-lto-objects -funified-lto -fuse-ld=lld foo.c
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point. Thanks.

Rename foo.c to example.c

Remove UnifiedLTO examples, since FatLTO always uses that pipeline now.
@@ -76,3 +76,40 @@ 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
===========
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shorten ===========?


.. code-block:: console

$ clang -flto -ffat-lto-objects example.c -o example.o
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing -c

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thank you!


.. code-block:: console

$ clang -fno-lto -ffat-lto-objects -fuse-ld=lld example.o
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description can state that -ffat-lto-objects is a no-op for linking when -fno-lto is specified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Usage
===========

Users are expected to pass ``-ffat-lto-objects`` to clang in addition to one of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clang users can specify -ffat-lto-objects along with -flto or -flto=thin. Without the -flto flag, -ffat-lto-objects has no effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ilovepi ilovepi merged commit 8190e09 into llvm:main Dec 19, 2023
@ilovepi ilovepi deleted the fatlto_docs branch December 19, 2023 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants