libc-tls.c 670 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Thread-local storage handling in statically linked binaries.
  3. * Copyright (C) 2009 Free Software Foundation, Inc.
  4. *
  5. * Based on GNU C Library (file: libc/sysdeps/sh/libc-tls.c)
  6. *
  7. * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
  8. * Copyright (C) 2010 STMicroelectronics Ltd.
  9. *
  10. * Author: Filippo Arcidiacono <filippo.arcidiacono@st.com>
  11. *
  12. * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
  13. */
  14. #include <sysdeps/generic/libc-tls.c>
  15. #include <dl-tls.h>
  16. #if defined(USE_TLS) && USE_TLS
  17. void *
  18. __tls_get_addr (tls_index *ti)
  19. {
  20. dtv_t *dtv = THREAD_DTV ();
  21. return (char *) dtv[1].pointer.val + ti->ti_offset;
  22. }
  23. #endif