<div dir="ltr">We know that in C++, the constructor of a static member will get called when the program starts up. I checked the generated IR code and found this is implemented by defining a __cxx_global_var_init() function and marked it as section ".text.startup" and assign it to @llvm.global_ctors.<div><br></div><div>We also know that in C++, the constructor of a static thread_local member will <b>not</b> get called when the program starts, but the first time this member is used, I also checked the IR code, this is implemented by calling it's constructor at the usage, and then call __cxa_thread_atexit to register it's destructor.</div><div><br></div><div>Now I want to add thread_local feature to my own language, and I want my thread_local member acts simlar like a static member, that is,  when a new thread is created, the constructors of thread_local members will automatically get called, instead get called when used?</div><div><br></div><div>I read the LLVM Language Reference Manual, but it doesn't talk much in Thread Local Storage Models. </div></div>