[PATCH] D75655: [Docs] Document -lto-whole-program-visibility

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 15:46:27 PST 2020


tejohnson created this revision.
tejohnson added a reviewer: pcc.
Herald added subscribers: dexonsmith, steven_wu, hiraditya, inglorion.
Herald added a project: clang.

Documents interaction of linker option added in D71913 <https://reviews.llvm.org/D71913> with LTO
visibility.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75655

Files:
  clang/docs/LTOVisibility.rst


Index: clang/docs/LTOVisibility.rst
===================================================================
--- clang/docs/LTOVisibility.rst
+++ clang/docs/LTOVisibility.rst
@@ -35,6 +35,16 @@
 (e.g. classes declared in unnamed namespaces) also receive hidden LTO
 visibility.
 
+During the LTO link, all classes with public LTO visibility will be refined
+to hidden LTO visibility when the ``-lto-whole-program-visibility`` lld linker
+option is applied (``-plugin-opt=whole_program_visibility`` for gold). This
+can be used when it is known that the LTO link has whole program visibility,
+because we are LTO linking all translation units as bitcode, except certain
+(e.g.  system) libraries or other native objects known to be safe by the user or
+build system, and the binary will not dlopen any libraries deriving from the
+binary’s classes. This is useful in situations where it is not safe to specify
+``-fvisibility=hidden`` at compile time.
+
 A class defined in a translation unit built without LTO receives public
 LTO visibility regardless of its object file visibility, linkage or other
 attributes.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75655.248347.patch
Type: text/x-patch
Size: 1111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200304/a05b1751/attachment.bin>


More information about the cfe-commits mailing list