[PATCH] D48680: Add missing visibility annotation for __base

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 27 16:47:03 PDT 2018


pcc added a comment.

This change ensures that __func receives public LTO visibilty:
https://clang.llvm.org/docs/LTOVisibility.html
if a translation unit is compiled with `-fvisibility=hidden` and without `_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS` defined (i.e. dynamically linking against libc++).

What that means is that the control flow integrity and whole-program devirtualization features are disabled on the virtual calls on __func that are used to implement operator() on std::function. Enabling those features would be incorrect because libc++ is being linked dynamically and therefore the compiler does not have full visibility of all derived classes of __func and the calls cannot be devirtualized.


Repository:
  rCXX libc++

https://reviews.llvm.org/D48680





More information about the cfe-commits mailing list