libc-tls.c 674 B

1234567891011121314151617181920212223242526
  1. /*
  2. * This file is subject to the terms and conditions of the LGPL V2.1
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2020 Kalray Inc.
  7. */
  8. #include <sysdeps/generic/libc-tls.c>
  9. #include <dl-tls.h>
  10. #if defined(USE_TLS) && USE_TLS
  11. /* On kvx, linker optimizations are not required, so __tls_get_addr
  12. can be called even in statically linked binaries. In this case module
  13. must be always 1 and PT_TLS segment exist in the binary, otherwise it
  14. would not link. */
  15. void *
  16. __tls_get_addr (tls_index *ti)
  17. {
  18. dtv_t *dtv = THREAD_DTV ();
  19. return (char *) dtv[1].pointer.val + ti->ti_offset;
  20. }
  21. #endif