[libcxx] r196411 - Give all members of exception types default visibility. Lack of this is causing some illegal code relocations rare and hard to reproduce cases.

Howard Hinnant via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 8 16:57:57 PST 2016


On Jan 8, 2016, at 7:50 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> 
> [re-send to lists.llvm.org]
> [necromancy]
> 
> This is causing some strangeness for users of libc++ headers that
> ship dylibs and build with -fno-rtti and -fvisibility=hidden.
> 
> Strangely, -fno-rtti does *not* imply -fno-exceptions; the type info
> needed for exceptions is generated on-the-fly.  This means that each
> translation unit generates a linkonce_odr copy of the std::exception
> type info -- weird, but kind of reasonable?
> 
> Because of this commit, the (non-canonical) type info from these
> other dylibs is getting exported, even though they compile with
> -fvisibility=hidden.  On Darwin, this means that a link line like
> this:
> --
> $ ld -o a.out a.o -library-without-rtti -lc++
> --
> will find the type info in libibrary-without-rtti.dylib instead of
> libc++.1.dylib.  That doesn't seem reasonable.
> 
> The request I've had from such dylib owners is to effectively revert
> this commit, so that their copy of std::exception type info isn't
> exported when they use -fvisibility=hidden.  However, then their
> copy of the type info won't get coalesced with libc++.1.dylib's.
> 
> Does anyone have an opinion on this?  Should we care about the
> visibility of std::exception type info when -fno-rtti?  (Note that
> when RTTI is on, clang correctly does not generate the type info
> for std::exception and friends.)
> 
> Howard, any chance you remember more about the problems this fixed?

Sorry, nope.

I have no opinion on this.  The only thing I would have to say in this area is that if Nick says it, you can take it to the bank.

Howard

> 
>> On 2013-Dec-04, at 13:03, Howard Hinnant <hhinnant at apple.com> wrote:
>> 
>> Author: hhinnant
>> Date: Wed Dec  4 15:03:23 2013
>> New Revision: 196411
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=196411&view=rev
>> Log:
>> Give all members of exception types default visibility.  Lack of this is causing some illegal code relocations rare and hard to reproduce cases.
>> 
>> Modified:
>>  libcxx/trunk/include/__config
>> 
>> Modified: libcxx/trunk/include/__config
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=196411&r1=196410&r2=196411&view=diff
>> ==============================================================================
>> --- libcxx/trunk/include/__config (original)
>> +++ libcxx/trunk/include/__config Wed Dec  4 15:03:23 2013
>> @@ -194,7 +194,7 @@
>> #endif
>> 
>> #ifndef _LIBCPP_EXCEPTION_ABI
>> -#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
>> +#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
>> #endif
>> 
>> #ifndef _LIBCPP_ALWAYS_INLINE
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
> 



More information about the cfe-commits mailing list