This is the mail archive of the
mailing list for the glibc project.
Re: [RFC] Should we declare errno with __thread on x86?
- From: Florian Weimer <fweimer at redhat dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 13 Apr 2016 11:20:39 +0200
- Subject: Re: [RFC] Should we declare errno with __thread on x86?
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOrb8XPsTUKHMw7F-+iy7D=UH=5XP_K06wDAwka+RRDCgw at mail dot gmail dot com>
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;
# 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.