You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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-2020 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 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Emulated TLS (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Emulated TLS (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Emulated TLS (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  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.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Emulated-TLS"></a>
  62. <div class="header">
  63. <p>
  64. 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>
  65. </div>
  66. <hr>
  67. <a name="Emulating-TLS"></a>
  68. <h3 class="section">18.25 Emulating TLS</h3>
  69. <a name="index-Emulated-TLS"></a>
  70. <p>For targets whose psABI does not provide Thread Local Storage via
  71. specific relocations and instruction sequences, an emulation layer is
  72. used. A set of target hooks allows this emulation layer to be
  73. configured for the requirements of a particular target. For instance
  74. the psABI may in fact specify TLS support in terms of an emulation
  75. layer.
  76. </p>
  77. <p>The emulation layer works by creating a control object for every TLS
  78. object. To access the TLS object, a lookup function is provided
  79. which, when given the address of the control object, will return the
  80. address of the current thread&rsquo;s instance of the TLS object.
  81. </p>
  82. <dl>
  83. <dt><a name="index-TARGET_005fEMUTLS_005fGET_005fADDRESS"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_GET_ADDRESS</strong></dt>
  84. <dd><p>Contains the name of the helper function that uses a TLS control
  85. object to locate a TLS instance. The default causes libgcc&rsquo;s
  86. emulated TLS helper function to be used.
  87. </p></dd></dl>
  88. <dl>
  89. <dt><a name="index-TARGET_005fEMUTLS_005fREGISTER_005fCOMMON"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_REGISTER_COMMON</strong></dt>
  90. <dd><p>Contains the name of the helper function that should be used at
  91. program startup to register TLS objects that are implicitly
  92. initialized to zero. If this is <code>NULL</code>, all TLS objects will
  93. have explicit initializers. The default causes libgcc&rsquo;s emulated TLS
  94. registration function to be used.
  95. </p></dd></dl>
  96. <dl>
  97. <dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fSECTION"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_VAR_SECTION</strong></dt>
  98. <dd><p>Contains the name of the section in which TLS control variables should
  99. be placed. The default of <code>NULL</code> allows these to be placed in
  100. any section.
  101. </p></dd></dl>
  102. <dl>
  103. <dt><a name="index-TARGET_005fEMUTLS_005fTMPL_005fSECTION"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_TMPL_SECTION</strong></dt>
  104. <dd><p>Contains the name of the section in which TLS initializers should be
  105. placed. The default of <code>NULL</code> allows these to be placed in any
  106. section.
  107. </p></dd></dl>
  108. <dl>
  109. <dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fPREFIX"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_VAR_PREFIX</strong></dt>
  110. <dd><p>Contains the prefix to be prepended to TLS control variable names.
  111. The default of <code>NULL</code> uses a target-specific prefix.
  112. </p></dd></dl>
  113. <dl>
  114. <dt><a name="index-TARGET_005fEMUTLS_005fTMPL_005fPREFIX"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_TMPL_PREFIX</strong></dt>
  115. <dd><p>Contains the prefix to be prepended to TLS initializer objects. The
  116. default of <code>NULL</code> uses a target-specific prefix.
  117. </p></dd></dl>
  118. <dl>
  119. <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>
  120. <dd><p>Specifies a function that generates the FIELD_DECLs for a TLS control
  121. object type. <var>type</var> is the RECORD_TYPE the fields are for and
  122. <var>name</var> should be filled with the structure tag, if the default of
  123. <code>__emutls_object</code> is unsuitable. The default creates a type suitable
  124. for libgcc&rsquo;s emulated TLS function.
  125. </p></dd></dl>
  126. <dl>
  127. <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>
  128. <dd><p>Specifies a function that generates the CONSTRUCTOR to initialize a
  129. TLS control object. <var>var</var> is the TLS control object, <var>decl</var>
  130. is the TLS object and <var>tmpl_addr</var> is the address of the
  131. initializer. The default initializes libgcc&rsquo;s emulated TLS control object.
  132. </p></dd></dl>
  133. <dl>
  134. <dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fALIGN_005fFIXED"></a>Target Hook: <em>bool</em> <strong>TARGET_EMUTLS_VAR_ALIGN_FIXED</strong></dt>
  135. <dd><p>Specifies whether the alignment of TLS control variable objects is
  136. fixed and should not be increased as some backends may do to optimize
  137. single objects. The default is false.
  138. </p></dd></dl>
  139. <dl>
  140. <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>
  141. <dd><p>Specifies whether a DWARF <code>DW_OP_form_tls_address</code> location descriptor
  142. may be used to describe emulated TLS control objects.
  143. </p></dd></dl>
  144. <hr>
  145. <div class="header">
  146. <p>
  147. 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>
  148. </div>
  149. </body>
  150. </html>