aarch64: Use PTR_REG macro to fix ILP32 bug and make code consistent
[glibc.git] / include / errno.h
blob3c3d2288c8bb2a8dab9f1b49e36b7e06463a3ff1
1 #ifndef _ERRNO_H
2 #include <stdlib/errno.h>
3 #if !defined _ISOMAC && !defined __ASSEMBLER__
5 # if IS_IN (rtld)
6 # include <dl-sysdep.h>
7 # ifndef RTLD_PRIVATE_ERRNO
8 # error "dl-sysdep.h must define RTLD_PRIVATE_ERRNO!"
9 # endif
10 # else
11 # define RTLD_PRIVATE_ERRNO 0
12 # endif
14 # if RTLD_PRIVATE_ERRNO
15 /* The dynamic linker uses its own private errno variable.
16 All access to errno inside the dynamic linker is serialized,
17 so a single (hidden) global variable is all it needs. */
19 # undef errno
20 # define errno rtld_errno
21 extern int rtld_errno attribute_hidden;
23 # elif IS_IN_LIB
25 # include <tls.h>
27 # undef errno
28 # if IS_IN (libc)
29 # define errno __libc_errno
30 # else
31 # define errno errno /* For #ifndef errno tests. */
32 # endif
33 extern __thread int errno attribute_tls_model_ie;
35 # endif /* IS_IN_LIB */
37 # define __set_errno(val) (errno = (val))
39 extern int *__errno_location (void) __THROW __attribute_const__
40 # if RTLD_PRIVATE_ERRNO
41 attribute_hidden
42 # endif
44 libc_hidden_proto (__errno_location)
46 #endif /* !_ISOMAC && !__ASSEMBLER__ */
47 #endif /* !_ERRNO_H */