devnexen added a comment. @krytarowski What do you think of this approach ? I ve tried several approaches to keep pthread_key_create/pthread_getspecific/pthread_setspecific but did not work out. https://reviews.llvm.org/D47448