This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Apply namespace-scope hidden visibility to libc++
AbandonedPublic

Authored by ldionne on Nov 21 2018, 1:28 PM.

Details

Reviewers
EricWF
Summary

This is technically not a functional change because all symbols that
should be exported from the shared library are already marked with
explicit visibility annotations. However, applying this attribute
at the namespace scope will allow us to drop many visibility
annotations in the future, which is a nice simplification.

This commit also solves the problem of different symbols being exported
depending on the build mode in use (see PR38138). With this change, stray
symbols are not exported from the dylib due to implicit instantiations,
and as a result we export the same symbols in Debug and Release modes.

Event Timeline

ldionne created this revision.Nov 21 2018, 1:28 PM

Would it make sense to remove the -fvisibility-inlines-hidden from the build at the same time? Currently doing so causes 37 previously hidden functions to be exported.

Would it make sense to remove the -fvisibility-inlines-hidden from the build at the same time?

Yes, it would.

Currently doing so causes 37 previously hidden functions to be exported.

Argh. I'll look into that tomorrow. Note that this also checks out with previous experiments I've done where removing hidden visibility attributes on some functions after making the whole namespace hidden result in similar problems.

ldionne abandoned this revision.Aug 15 2019, 10:43 AM

Abandoning since we should use #pragma clang attribute push with a visibility attribute instead.