Emulated-TLS.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU Compiler Collection (GCC) Internals: Emulated TLS</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Emulated TLS">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Emulated TLS">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Target-Macros.html#Target-Macros" rel="up" title="Target Macros">
  30. <link href="MIPS-Coprocessors.html#MIPS-Coprocessors" rel="next" title="MIPS Coprocessors">
  31. <link href="Target-Attributes.html#Target-Attributes" rel="prev" title="Target Attributes">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Emulated-TLS"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="MIPS-Coprocessors.html#MIPS-Coprocessors" accesskey="n" rel="next">MIPS Coprocessors</a>, Previous: <a href="Target-Attributes.html#Target-Attributes" accesskey="p" rel="prev">Target Attributes</a>, Up: <a href="Target-Macros.html#Target-Macros" accesskey="u" rel="up">Target Macros</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="Emulating-TLS"></a>
  69. <h3 class="section">17.25 Emulating TLS</h3>
  70. <a name="index-Emulated-TLS"></a>
  71. <p>For targets whose psABI does not provide Thread Local Storage via
  72. specific relocations and instruction sequences, an emulation layer is
  73. used. A set of target hooks allows this emulation layer to be
  74. configured for the requirements of a particular target. For instance
  75. the psABI may in fact specify TLS support in terms of an emulation
  76. layer.
  77. </p>
  78. <p>The emulation layer works by creating a control object for every TLS
  79. object. To access the TLS object, a lookup function is provided
  80. which, when given the address of the control object, will return the
  81. address of the current thread&rsquo;s instance of the TLS object.
  82. </p>
  83. <dl>
  84. <dt><a name="index-TARGET_005fEMUTLS_005fGET_005fADDRESS"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_GET_ADDRESS</strong></dt>
  85. <dd><p>Contains the name of the helper function that uses a TLS control
  86. object to locate a TLS instance. The default causes libgcc&rsquo;s
  87. emulated TLS helper function to be used.
  88. </p></dd></dl>
  89. <dl>
  90. <dt><a name="index-TARGET_005fEMUTLS_005fREGISTER_005fCOMMON"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_REGISTER_COMMON</strong></dt>
  91. <dd><p>Contains the name of the helper function that should be used at
  92. program startup to register TLS objects that are implicitly
  93. initialized to zero. If this is <code>NULL</code>, all TLS objects will
  94. have explicit initializers. The default causes libgcc&rsquo;s emulated TLS
  95. registration function to be used.
  96. </p></dd></dl>
  97. <dl>
  98. <dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fSECTION"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_VAR_SECTION</strong></dt>
  99. <dd><p>Contains the name of the section in which TLS control variables should
  100. be placed. The default of <code>NULL</code> allows these to be placed in
  101. any section.
  102. </p></dd></dl>
  103. <dl>
  104. <dt><a name="index-TARGET_005fEMUTLS_005fTMPL_005fSECTION"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_TMPL_SECTION</strong></dt>
  105. <dd><p>Contains the name of the section in which TLS initializers should be
  106. placed. The default of <code>NULL</code> allows these to be placed in any
  107. section.
  108. </p></dd></dl>
  109. <dl>
  110. <dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fPREFIX"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_VAR_PREFIX</strong></dt>
  111. <dd><p>Contains the prefix to be prepended to TLS control variable names.
  112. The default of <code>NULL</code> uses a target-specific prefix.
  113. </p></dd></dl>
  114. <dl>
  115. <dt><a name="index-TARGET_005fEMUTLS_005fTMPL_005fPREFIX"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_TMPL_PREFIX</strong></dt>
  116. <dd><p>Contains the prefix to be prepended to TLS initializer objects. The
  117. default of <code>NULL</code> uses a target-specific prefix.
  118. </p></dd></dl>
  119. <dl>
  120. <dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fFIELDS"></a>Target Hook: <em>tree</em> <strong>TARGET_EMUTLS_VAR_FIELDS</strong> <em>(tree <var>type</var>, tree *<var>name</var>)</em></dt>
  121. <dd><p>Specifies a function that generates the FIELD_DECLs for a TLS control
  122. object type. <var>type</var> is the RECORD_TYPE the fields are for and
  123. <var>name</var> should be filled with the structure tag, if the default of
  124. <code>__emutls_object</code> is unsuitable. The default creates a type suitable
  125. for libgcc&rsquo;s emulated TLS function.
  126. </p></dd></dl>
  127. <dl>
  128. <dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fINIT"></a>Target Hook: <em>tree</em> <strong>TARGET_EMUTLS_VAR_INIT</strong> <em>(tree <var>var</var>, tree <var>decl</var>, tree <var>tmpl_addr</var>)</em></dt>
  129. <dd><p>Specifies a function that generates the CONSTRUCTOR to initialize a
  130. TLS control object. <var>var</var> is the TLS control object, <var>decl</var>
  131. is the TLS object and <var>tmpl_addr</var> is the address of the
  132. initializer. The default initializes libgcc&rsquo;s emulated TLS control object.
  133. </p></dd></dl>
  134. <dl>
  135. <dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fALIGN_005fFIXED"></a>Target Hook: <em>bool</em> <strong>TARGET_EMUTLS_VAR_ALIGN_FIXED</strong></dt>
  136. <dd><p>Specifies whether the alignment of TLS control variable objects is
  137. fixed and should not be increased as some backends may do to optimize
  138. single objects. The default is false.
  139. </p></dd></dl>
  140. <dl>
  141. <dt><a name="index-TARGET_005fEMUTLS_005fDEBUG_005fFORM_005fTLS_005fADDRESS"></a>Target Hook: <em>bool</em> <strong>TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS</strong></dt>
  142. <dd><p>Specifies whether a DWARF <code>DW_OP_form_tls_address</code> location descriptor
  143. may be used to describe emulated TLS control objects.
  144. </p></dd></dl>
  145. <hr>
  146. <div class="header">
  147. <p>
  148. Next: <a href="MIPS-Coprocessors.html#MIPS-Coprocessors" accesskey="n" rel="next">MIPS Coprocessors</a>, Previous: <a href="Target-Attributes.html#Target-Attributes" accesskey="p" rel="prev">Target Attributes</a>, Up: <a href="Target-Macros.html#Target-Macros" accesskey="u" rel="up">Target Macros</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  149. </div>
  150. </body>
  151. </html>