This is an archive of the discontinued LLVM Phabricator instance.

[clang][docs] Add note about using `-flto` with `-g` on macOS
ClosedPublic

Authored by phil-blain on Jun 28 2020, 5:08 PM.

Details

Summary

If -Wl,object_path_lto,<lto-filename>.o is not passed at link time
when compiling and linking in separate steps with -flto and -g, the
temporary file used for Link Time Optimization is deleted by the linker,
so the executable is missing debug symbols and can't be easily debugged,
and dsymutil can't be run.

Document this behaviour.

Diff Detail

Event Timeline

phil-blain created this revision.Jun 28 2020, 5:08 PM
Herald added a project: Restricted Project. · View Herald Transcript
JDevlieghere added inline comments.Jun 29 2020, 10:52 AM
clang/docs/CommandGuide/clang.rst
477
phil-blain added inline comments.Jun 29 2020, 11:24 AM
clang/docs/CommandGuide/clang.rst
477

None, appart from my limited knowledge of Sphinx directives ;)

I'll fix that for v2.

Use note:: Sphinx directive

Also:

  • Fix Sphinx formatting for preformatted text
  • Correctly pass the linker argument (initial '-' was missing)

I tested the sphinx build for the man and html targets. Any other targets I should check ?

JDevlieghere accepted this revision.Jun 29 2020, 5:09 PM

LGTM. Thank you for adding this!

I tested the sphinx build for the man and html targets. Any other targets I should check ?

No, that sounds good.

This revision is now accepted and ready to land.Jun 29 2020, 5:09 PM

Great, thanks ! Note that I don't have commit access.

This revision was automatically updated to reflect the committed changes.