[RFC] Should we declare errno with __thread on x86?

Florian Weimer fweimer@redhat.com
Wed Apr 13 09:20:00 GMT 2016


On 03/18/2016 10:42 PM, H.J. Lu wrote:
> errno is defined in glibc as an TLS variable on x86,  Shouldn't we
> declare it as
>
> extern __thread int errno;
>
> instead of
>
> #   define errno (*__errno_location ())
>
> to avoid function call overhead?

Considering that errno is mostly accessed on error paths, I think more 
compact code is better.  It's not obvious that TLS variable access is a 
win in all cases according to that metric.

Florian



More information about the Libc-alpha mailing list