r194296 - Use rauw for all discardable aliases, not just linkonce_odr.

Howard Hinnant hhinnant at apple.com
Thu Nov 21 17:46:12 PST 2013


On Nov 21, 2013, at 3:16 PM, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:

> On Thu, Nov 21, 2013 at 01:53:17PM +0100, Joerg Sonnenberger wrote:
>> On Fri, Nov 08, 2013 at 11:46:20PM -0000, Rafael Espindola wrote:
>>> Author: rafael
>>> Date: Fri Nov  8 17:46:20 2013
>>> New Revision: 194296
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=194296&view=rev
>>> Log:
>>> Use rauw for all discardable aliases, not just linkonce_odr.
>> 
>> This breaks boost::locale and possibly other things. Attached is a test
>> case. Compile with -O2 -std=c++11 before and after and look for
>>    std::__1::moneypunct_byname<char, false>::~moneypunct_byname
>> in the nm -C output.
> 
> So the short version is that ~moneypunct_byname gets emitted as weak-odr
> hidden in libc++'s locale.c. Whether LLVM uses the (trivial) destructor
> or not depends on optimisation and I don't see any fundamental change
> from this revision, even though it breaks the test case.
> 
> Howard -- should ~moneypunct_byname be part of libc++ or not? It
> currently isn't and that seems to break when LLVM wants to use it.
> 
> Joerg

Right now ~moneypunct_byname() is attributed with __always_inline__, meaning it should never be part of libc++.dylib.  That being said, moneypunct_byname is also extern templates for the required instantiations, and there is a poorly understood bad interaction between __always_inline__ and extern template.  That could very well be at the base of this problem here.

If I'm remembering correctly, it goes something like:  If something is marked __always_inline__, it doesn't get outlined when the templated is explicitly instantiated into a source (which I believe is correct behavior).  However when the client needs an __always_inline__ and the type is marked extern template, the client assumes it can find the symbol outlined elsewhere (which I believe is incorrect behavior).

I may be remembering incorrectly...

Howard




More information about the cfe-commits mailing list