[PATCH] __cxa_thread_atexit_impl: Return -1 on allocation failure

Siddhesh Poyarekar siddhesh@sourceware.org
Wed Jul 28 07:26:08 GMT 2021


On 7/28/21 12:44 PM, Florian Weimer wrote:
> * Siddhesh Poyarekar via Libc-alpha:
> 
>> Return -1 in the unlikely event that allocation fails when trying to
>> register a TLS destructor.
> 
> This is bug 18524.  As said on the bug, the interface is broken.  We
> really need to rework C++ global destructor support so that these
> dynamic memory allocations become unnecessary.
> 
> The GCC-generated caller code does not check the return value (and could
> do anything with it anyway).  You probable need to add __libc_fatal.

Hmm, so I started with __libc_fatal and changed it to return -1 when I 
saw that the libstdc++ compat implementation did the same.  Now I see 
that there's no check for return value from the call.  I'll update the 
patch with __libc_fatal and resend.

Thanks,
Siddhesh


More information about the Libc-alpha mailing list