mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-08 07:42:09 +03:00
add hidden version of &errno accessor function
this significantly improves codegen in functions that need to access errno but otherwise have no need for a GOT pointer. we could probably improve it much more by including an inline version of the &errno accessor function, but that depends on having the definitions of struct __pthread and __pthread_self(), which at present would expose a lot more than is appropriate. moving them to a small tls.h later might make this more reasonable.
This commit is contained in:
parent
da55d4884b
commit
e13063aad7
@ -5,3 +5,5 @@ int *__errno_location(void)
|
|||||||
{
|
{
|
||||||
return &__pthread_self()->errno_val;
|
return &__pthread_self()->errno_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
weak_alias(__errno_location, ___errno_location);
|
||||||
|
11
src/include/errno.h
Normal file
11
src/include/errno.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef ERRNO_H
|
||||||
|
#define ERRNO_H
|
||||||
|
|
||||||
|
#include "../../include/errno.h"
|
||||||
|
|
||||||
|
hidden int *___errno_location(void);
|
||||||
|
|
||||||
|
#undef errno
|
||||||
|
#define errno (*___errno_location())
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user