Reputation: 263
I noticed that in Glibc the macro "errno" got expanded to an invocation of "__errno_location". However, there are two different definitions of "__errno_location":
The one defined in "csu/errno-loc.c" and hence in "libc.a" returns the address of the thread-local variable "__libc_errno";
Another one defined in "nptl/errno-loc.c" and hence in "libpthread.a" returns the address of the thread-local variable "errno".
What are the differences between these two definitions and which one is used when my C code expands the macro "errno"?
Upvotes: 0
Views: 101
Reputation: 263
Just noticed the following declaration in csu/errno.c
extern __thread int __libc_errno __attribute__ ((alias ("errno")))
attribute_hidden;
The two __errno_location definitions return the same address.
Upvotes: 0