* Sergey Bugaev:

>> If you need async cancellation support, the core cancellation routine
>> could be made weak, so that it is linked into the executable only if
>> pthread_cancel is ever called.
>
> Could you please expand on how this all (unwinding, async
> cancellation) is relevant? Clearly calling error () in a
> PTHREAD_CANCEL_ASYNCHRONOUS context is undefined behavior since error
> () is not async-cancel-safe.

I'd expect __pthread_setcancelstate to act on asynchronous cancellation
if it is enabled.  Once you implement that and have a strong symbol
reference to __pthread_setcancelstate, you'd pull in the cancellation
unwinder without additional measures, and this would into every program.
You probably don't want that.  So the reference to the core cancellation
had better be weak (or use the __libc_ptf_call indirection).

Does this answer your question?  Sorry, these static linking size
optimizations are tricky.

Thanks,
Florian


Reply via email to