Implementation of IO with Panama
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Fri Apr 16 14:30:56 UTC 2021
On 16/04/2021 15:10, Radosław Smogura wrote:
> I could grab address for it just looking for symbol from CLinker.
>
> But, AFIK, errno is thread local variable so maybe I should double check how this should be handled.
Interesting reading from man page:
```
errno is defined by the ISO C standard to be a modifiable lvalue of
type int, and must not be explicitly declared; errno may be a
macro.
errno is thread-local; setting it in one thread does not
affect its
value in any other thread.
```
this is subtle - it's an lvalue (e.g. can used e.g. for assignment) but
is not explicitly declared - meaning it's not a variable in the proper
sense.
At this point I'm not sure that linking to it gives the expected results.
In fact, firing up Godbolt shows that gcc uses __errno_location under
the hood:
https://godbolt.org/z/rcMPTKxva
Maurizio
More information about the panama-dev
mailing list