toolchain/gcc-linaro-6.3.1-2017.02-x8.../share/doc/gccint/Emulated-TLS.html

175 lines
8.5 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2016 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below). A copy of the license is included in the section entitled
"GNU Free Documentation License".
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development. -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU Compiler Collection (GCC) Internals: Emulated TLS</title>
<meta name="description" content="GNU Compiler Collection (GCC) Internals: Emulated TLS">
<meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Emulated TLS">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Target-Macros.html#Target-Macros" rel="up" title="Target Macros">
<link href="MIPS-Coprocessors.html#MIPS-Coprocessors" rel="next" title="MIPS Coprocessors">
<link href="Target-Attributes.html#Target-Attributes" rel="prev" title="Target Attributes">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Emulated-TLS"></a>
<div class="header">
<p>
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>
</div>
<hr>
<a name="Emulating-TLS"></a>
<h3 class="section">17.25 Emulating TLS</h3>
<a name="index-Emulated-TLS"></a>
<p>For targets whose psABI does not provide Thread Local Storage via
specific relocations and instruction sequences, an emulation layer is
used. A set of target hooks allows this emulation layer to be
configured for the requirements of a particular target. For instance
the psABI may in fact specify TLS support in terms of an emulation
layer.
</p>
<p>The emulation layer works by creating a control object for every TLS
object. To access the TLS object, a lookup function is provided
which, when given the address of the control object, will return the
address of the current thread&rsquo;s instance of the TLS object.
</p>
<dl>
<dt><a name="index-TARGET_005fEMUTLS_005fGET_005fADDRESS"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_GET_ADDRESS</strong></dt>
<dd><p>Contains the name of the helper function that uses a TLS control
object to locate a TLS instance. The default causes libgcc&rsquo;s
emulated TLS helper function to be used.
</p></dd></dl>
<dl>
<dt><a name="index-TARGET_005fEMUTLS_005fREGISTER_005fCOMMON"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_REGISTER_COMMON</strong></dt>
<dd><p>Contains the name of the helper function that should be used at
program startup to register TLS objects that are implicitly
initialized to zero. If this is <code>NULL</code>, all TLS objects will
have explicit initializers. The default causes libgcc&rsquo;s emulated TLS
registration function to be used.
</p></dd></dl>
<dl>
<dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fSECTION"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_VAR_SECTION</strong></dt>
<dd><p>Contains the name of the section in which TLS control variables should
be placed. The default of <code>NULL</code> allows these to be placed in
any section.
</p></dd></dl>
<dl>
<dt><a name="index-TARGET_005fEMUTLS_005fTMPL_005fSECTION"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_TMPL_SECTION</strong></dt>
<dd><p>Contains the name of the section in which TLS initializers should be
placed. The default of <code>NULL</code> allows these to be placed in any
section.
</p></dd></dl>
<dl>
<dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fPREFIX"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_VAR_PREFIX</strong></dt>
<dd><p>Contains the prefix to be prepended to TLS control variable names.
The default of <code>NULL</code> uses a target-specific prefix.
</p></dd></dl>
<dl>
<dt><a name="index-TARGET_005fEMUTLS_005fTMPL_005fPREFIX"></a>Target Hook: <em>const char *</em> <strong>TARGET_EMUTLS_TMPL_PREFIX</strong></dt>
<dd><p>Contains the prefix to be prepended to TLS initializer objects. The
default of <code>NULL</code> uses a target-specific prefix.
</p></dd></dl>
<dl>
<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>
<dd><p>Specifies a function that generates the FIELD_DECLs for a TLS control
object type. <var>type</var> is the RECORD_TYPE the fields are for and
<var>name</var> should be filled with the structure tag, if the default of
<code>__emutls_object</code> is unsuitable. The default creates a type suitable
for libgcc&rsquo;s emulated TLS function.
</p></dd></dl>
<dl>
<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>
<dd><p>Specifies a function that generates the CONSTRUCTOR to initialize a
TLS control object. <var>var</var> is the TLS control object, <var>decl</var>
is the TLS object and <var>tmpl_addr</var> is the address of the
initializer. The default initializes libgcc&rsquo;s emulated TLS control object.
</p></dd></dl>
<dl>
<dt><a name="index-TARGET_005fEMUTLS_005fVAR_005fALIGN_005fFIXED"></a>Target Hook: <em>bool</em> <strong>TARGET_EMUTLS_VAR_ALIGN_FIXED</strong></dt>
<dd><p>Specifies whether the alignment of TLS control variable objects is
fixed and should not be increased as some backends may do to optimize
single objects. The default is false.
</p></dd></dl>
<dl>
<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>
<dd><p>Specifies whether a DWARF <code>DW_OP_form_tls_address</code> location descriptor
may be used to describe emulated TLS control objects.
</p></dd></dl>
<hr>
<div class="header">
<p>
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>
</div>
</body>
</html>