thread-local-storage.ld 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* SPDX-License-Identifier: Apache-2.0 */
  2. #ifdef CONFIG_THREAD_LOCAL_STORAGE
  3. SECTION_DATA_PROLOGUE(tdata,,)
  4. {
  5. *(.tdata .tdata.* .gnu.linkonce.td.*);
  6. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  7. SECTION_DATA_PROLOGUE(tbss,,)
  8. {
  9. *(.tbss .tbss.* .gnu.linkonce.tb.* .tcommon);
  10. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  11. /*
  12. * These needs to be outside of the tdata/tbss
  13. * sections or else they would be considered
  14. * thread-local variables, and the code would use
  15. * the wrong values.
  16. */
  17. #ifdef CONFIG_XIP
  18. /* The "master copy" of tdata should be only in flash on XIP systems */
  19. PROVIDE(__tdata_start = LOADADDR(tdata));
  20. #else
  21. PROVIDE(__tdata_start = ADDR(tdata));
  22. #endif
  23. PROVIDE(__tdata_size = SIZEOF(tdata));
  24. PROVIDE(__tdata_end = __tdata_start + __tdata_size);
  25. PROVIDE(__tdata_align = ALIGNOF(tdata));
  26. PROVIDE(__tbss_start = ADDR(tbss));
  27. PROVIDE(__tbss_size = SIZEOF(tbss));
  28. PROVIDE(__tbss_end = __tbss_start + __tbss_size);
  29. PROVIDE(__tbss_align = ALIGNOF(tbss));
  30. PROVIDE(__tls_start = __tdata_start);
  31. PROVIDE(__tls_end = __tbss_end);
  32. PROVIDE(__tls_size = __tbss_end - __tdata_start);
  33. #endif /* CONFIG_THREAD_LOCAL_STORAGE */