[PATCH] D82733: [clang][docs] Add note about using `-flto` with `-g` on macOS

Philippe Blain via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 29 16:39:12 PDT 2020


phil-blain updated this revision to Diff 274286.
phil-blain added a comment.

Use `note::` Sphinx directive

Also:

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


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82733/new/

https://reviews.llvm.org/D82733

Files:
  clang/docs/CommandGuide/clang.rst


Index: clang/docs/CommandGuide/clang.rst
===================================================================
--- clang/docs/CommandGuide/clang.rst
+++ clang/docs/CommandGuide/clang.rst
@@ -474,6 +474,16 @@
   optimization. With "thin", :doc:`ThinLTO <../ThinLTO>`
   compilation is invoked instead.
 
+  .. note::
+
+     On Darwin, when using :option:`-flto` along with :option:`-g` and
+     compiling and linking in separate steps, you also need to pass
+     ``-Wl,-object_path_lto,<lto-filename>.o`` at the linking step to instruct the
+     ld64 linker not to delete the temporary object file generated during Link
+     Time Optimization (this flag is automatically passed to the linker by Clang
+     if compilation and linking are done in a single step). This allows debugging
+     the executable as well as generating the ``.dSYM`` bundle using :manpage:`dsymutil(1)`.
+
 Driver Options
 ~~~~~~~~~~~~~~
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82733.274286.patch
Type: text/x-patch
Size: 916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200629/4cf63611/attachment.bin>


More information about the cfe-commits mailing list