chh added a comment. So in IR, a global variable can have string attributes like thread_local emulated-tls thread_local(localdynamic) emulated-tls thread_local(initialexec) emulated-tls thread_local(localexec) emulated-tls I can give it a try. Not sure yet if that will have shorter or longer patch. http://reviews.llvm.org/D10524