<div dir="ltr">Yeah, that helps - answers some questions I didn't know I had either! :)</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 30, 2018 at 3:56 PM Louis Dionne <<a href="mailto:ldionne@apple.com">ldionne@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><blockquote type="cite"><div>On Oct 30, 2018, at 18:00, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br class="m_8012550945297036741Apple-interchange-newline"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">Awesome!<br><br>What are the new semantics? That this ABI stability guarantee is provided by hiding the functions in each user so they can't be deduplicated with anotehr user's copy? (what about other copies that are from the same build? I guess even those won't get coalesced/collapsed together? Would that be useful to support?)<br></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div>There are currently two modes (in LLVM trunk, and that is the plan for LLVM 8 too):</div><div><br></div><div>1. (the default) All TUs linked together inside the same final linked image need to have use the same libc++ version. Inline functions are ODR-merged across TUs like they normally are. In this mode, we don't use any funny attribute to control linkage (neither always_inline nor internal_linkage).</div><div><br></div><div>2. (can be opted-in) TUs can be linked together even if they use different headers of libc++. This is achieved by using internal_linkage on implementation detail functions of libc++. Those functions are local to a TU and they are NOT ODR-merge across TUs. This results in more code duplication than option (1).</div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div><br></div><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br>I assume this doesn't change the defaults, but does it make it any easier for users who don't need the ABI stability guarantee? (or was it already easy/no change here?)<br></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div>It actually does change the default. However, it depends of what ABI guarantee you're talking about.</div><div><br></div><div>1. The ABI stability of the shared objects is always (and has always been, and will most likely always) be guaranteed. The only way to change that is to explicitly use the _LIBCPP_ABI_UNSTABLE macro, which says "use all the ABI breaking features". This obviously only works if you're also linking against a library that was built to provide that ABI. This ability to use the unstable ABI has been provided for a long time, it wasn't the default, and it still isn't the default -- my change is completely orthogonal to that.</div><div><br></div><div>2. The "ABI stability" of static archives is a different matter. The question here is whether you can link programs against static archives built with different versions of libc++. The answer used to be YES by default, not it is NO by default. If you want to retain that ability, you need to use the `_LIBCPP_HIDE_FROM_ABI_PER_TU` macro. And also please give us a heads up so we know someone is using it.</div><div><br></div><div>Does that answer your questions?</div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div><br></div><div>Louis</div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><br><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 29, 2018 at 2:41 PM Louis Dionne via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Folks,<br><br>Today, I pushed a change that disables the use of always_inline for visibility purposes in libc++. The change was reviewed as<span class="m_8012550945297036741Apple-converted-space"> </span><a href="https://reviews.llvm.org/D52405" rel="noreferrer" target="_blank">https://reviews.llvm.org/D52405</a>. This patch is the culminating point of several discussions about libc++'s visibility annotations.<br><br>This change should have a positive impact on code size for almost any application using the libc++ headers. For example, Eric Fiselier reported a 7% improvement in size for the Chrome binary after applying this patch. We are still in the process of gathering more data like this, but we expect similar gains to be possible in other applications. The debugging experience should also be much improved as we don't inline every function into its caller.<br><br>However, one word of caution: even though we were very careful not to break the ABI or any of libc++'s users ABI, this patch changes things that have been in place in libc++ for a long time. It is possible that we uncover problems with it, although we hope that won't be the case. If you start seeing problems you think are caused by this change, please notify me right away so we can take a look.<br><br>I'll post updates here as we're able to publish more data and observations about the results of this patch.<br><br>Thanks,<br>Louis<br><br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></blockquote></div></div></div></blockquote></div></div></blockquote></div>