dl-tls.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Thread-local storage handling in the ELF dynamic linker. M68K version.
  2. Copyright (C) 2010-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library. If not, see
  15. <http://www.gnu.org/licenses/>. */
  16. /* Type used for the representation of TLS information in the GOT. */
  17. typedef struct
  18. {
  19. unsigned long int ti_module;
  20. unsigned long int ti_offset;
  21. } tls_index;
  22. /* The thread pointer points 0x7000 past the first static TLS block. */
  23. #define TLS_TP_OFFSET 0x7000
  24. /* Dynamic thread vector pointers point 0x8000 past the start of each
  25. TLS block. */
  26. #define TLS_DTV_OFFSET 0x8000
  27. /* Compute the value for a TPREL reloc. */
  28. #define TLS_TPREL_VALUE(sym_map, sym, reloc) \
  29. ((sym_map)->l_tls_offset + (sym)->st_value + (reloc)->r_addend \
  30. - TLS_TP_OFFSET)
  31. /* Compute the value for a DTPREL reloc. */
  32. #define TLS_DTPREL_VALUE(sym, reloc) \
  33. ((sym)->st_value + (reloc)->r_addend - TLS_DTV_OFFSET)
  34. extern void *__tls_get_addr (tls_index *ti);
  35. #define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
  36. #define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)