[PATCH] D12394: [compiler-rt] [tsan] Fix GetTls for aarch64

Adhemerval Zanella via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 05:00:32 PDT 2015


zatrazz added a comment.

To give you more context on GLIBC code for aarch64:

sysdeps/aarch64/nptl/tls.h:
 49 /* The TP points to the start of the thread blocks.  */                                 
 50 # define TLS_DTV_AT_TP  1
 51 # define TLS_TCB_AT_TP  0

93 # define TLS_INIT_TP(tcbp) \
 94   ({ __asm __volatile ("msr tpidr_el0, %0" : : "r" (tcbp)); NULL; })

And on:

csu/libc-tls.c:

  /* Initialize the thread pointer.  */

#if TLS_TCB_AT_TP

  INSTALL_DTV ((char *) tlsblock + tcb_offset, _dl_static_dtv);
  
  const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset);

#elif TLS_DTV_AT_TP

  INSTALL_DTV (tlsblock, _dl_static_dtv);
  const char *lossage = TLS_INIT_TP (tlsblock);

So different than x86_64 (which defines TLS_TCB_AT_TP), aarch64 set the thread register pointers as the TLS allocated block.


http://reviews.llvm.org/D12394





More information about the llvm-commits mailing list