By default, gcc compiled by toolchain says that thread model is single. Is it correct? In particular, what’s with TLS (thread local storage), do we need TLS being enabled via —enable-tls option?
I run some programs with TLS support in multi thread environments (golang runtime)... now it have a race when variable which should be in TLS (in accordance with comments, like in getg() current g) sometimes return null. I am not sure - may be this is related to TLS support, may be in locking...
If I try just to add option --enable-threads=posix toolchain compilation stop giving Error
In file included from /home/alexs/genode_test/genode/contrib/gcc-20345a83596fa42a25a85938329aea54bb4b2146/src/noux-pkg/gcc/libgcc/gthr.h:148,
from /home/alexs/genode_test/genode/contrib/gcc-20345a83596fa42a25a85938329aea54bb4b2146/src/noux-pkg/gcc/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:10: fatal error: pthread.h: No such file or directory
#include <pthread.h>
^~~~~~~~~~~
compilation terminated.
Makefile:921: recipe for target '_gcov_dump.o' failed
Any suggestions? Should TLS work in genode over Nova “as it is”?
Hi Alexander,
On 12.12.19 10:58, Alexander Tormasov via users wrote:
By default, gcc compiled by toolchain says that thread model is single. Is it correct? In particular, what’s with TLS (thread local storage), do we need TLS being enabled via —enable-tls option?
There are different ways of using TLS: one is by declaring variables with the '__thread' or 'thread_local' keywords, another one is by using functions like 'pthread_setspecific()'. The first way is related to the toolchain, which currently uses the 'emutls' mechanism to provide the feature [1]. The second way is implemented in [2]. So, in general, TLS should work on Genode. The toolchain still needs to be rebuilt to get thread-safe exceptions (as stated in issue 3418), but this might be unrelated to your problem with the golang runtime.
Christian
[1] https://github.com/genodelabs/genode/issues/3418 [2] https://github.com/genodelabs/genode/blob/master/repos/libports/src/lib/libc...