[PATCH] D55404: [libcxx] Support building static library with hidden visibility

Louis Dionne via Phabricator reviews at reviews.llvm.org
Thu Dec 20 08:52:08 PST 2018


ldionne added a comment.

In D55404#1328449 <https://reviews.llvm.org/D55404#1328449>, @phosek wrote:

> > 
>
> This makes me think that the name `LIBCXX_HIDDEN_VISIBILITY_IN_STATIC_LIBRARY` I've chosen for this option may be misleading and causing confusion. I should probably change it to `LIBCXX_HERMETIC_STATIC_LIBRARY` to convey the intention. WDYT?


Yes, I think something along the lines of `LIBCXX_HERMETIC_STATIC_LIBRARY` would be better, along with some documentation for what this means and what the intent is.

> 
> 
>> The reason why I'm pushing back on this change as-is is that it makes our build logic even more complex than it already is (and it's way too complex as-is). TBH, I'm fine with the use case but I'd like us to find a better solution than just adding yet another build mode with different options. Finding a way to express this in the source would be better (because the source doesn't depend on a build mode), but like you point out it falls short for marking new and delete as hidden (which might not be a good idea, but whatever). Instead of doing visibility like we do today (in the source), perhaps we could instead have an explicit list of symbols that we export from the shared library? We would get rid of all visibility annotations from the sources and would do it externally, all in the build system. I've been told this is what libstdc++ has been doing and I think they're doing better than libc++ in that area.
> 
> I agree that this is making the build logic more complicated and I can try to to simplify it a bit more. I also agree that your suggestion would be an improvement, but I think it's orthogonal to what we're trying to achieve. If we changed libc++ to use explicit list, then in the hermetic case the list would be empty but we would still want to use `-fvisibility=hidden -fvisibility-global-new-delete-hidden`,

I don't understand this -- I don't think we'd export new and delete if they are not part of the export list, no? I would think that you could build normally (without any flags) and just use an empty list of exported symbols?


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D55404





More information about the libcxx-commits mailing list