PATCH: glibc 2.3.x and errno
weigand at immd1.informatik.uni-erlangen.de
Fri Jan 24 12:10:55 CST 2003
> __errno_location and __h_errno_location are no longer weak symbols
> and so can not be overwritten any longer. The internal glibc systemcall
> wrappers no longer call the functions by reference, but directly.
the real problem is even worse. glibc has switched to using thread-local
storage for errno (i.e. it is declared as 'extern __thread int errno')
when the tool chain supports the __thread keyword.
This means that C source code compiled against the new headers will
result in assembler code that *directly* accesses a thread-local
variable as defined by the TLS ABI. In the case of errno, this
will involve accessing the %gs segment using an offset from the GOT,
without any function call being performed. (errno is defined to use
the initial-exec TLS storage model.)
The __errno_location routine is provided only for backwards
compatibility reasons, it is no longer guaranteed that every
access to errno calls it. Thus, if you overwrite the implementation
of __errno_location, you will only catch *some* errno accesses,
not all of them ...
Ulrich (who has just implemented TLS for s390 ;-/)
Dr. Ulrich Weigand
weigand at informatik.uni-erlangen.de
More information about the wine-patches