Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

163 lines
8.2KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>Literal Directive (Using as)</title>
  16. <meta name="description" content="Literal Directive (Using as)">
  17. <meta name="keywords" content="Literal Directive (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="Xtensa-Directives.html#Xtensa-Directives" rel="up" title="Xtensa Directives">
  25. <link href="Literal-Position-Directive.html#Literal-Position-Directive" rel="next" title="Literal Position Directive">
  26. <link href="Transform-Directive.html#Transform-Directive" rel="prev" title="Transform Directive">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="Literal-Directive"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="Literal-Position-Directive.html#Literal-Position-Directive" accesskey="n" rel="next">Literal Position Directive</a>, Previous: <a href="Transform-Directive.html#Transform-Directive" accesskey="p" rel="prev">Transform Directive</a>, Up: <a href="Xtensa-Directives.html#Xtensa-Directives" accesskey="u" rel="up">Xtensa Directives</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="literal"></a>
  63. <h4 class="subsubsection">9.55.5.4 literal</h4>
  64. <a name="index-literal-directive"></a>
  65. <p>The <code>.literal</code> directive is used to define literal pool data, i.e.,
  66. read-only 32-bit data accessed via <code>L32R</code> instructions.
  67. </p>
  68. <div class="smallexample">
  69. <pre class="smallexample"> .literal <var>label</var>, <var>value</var>[, <var>value</var>&hellip;]
  70. </pre></div>
  71. <p>This directive is similar to the standard <code>.word</code> directive, except
  72. that the actual location of the literal data is determined by the
  73. assembler and linker, not by the position of the <code>.literal</code>
  74. directive. Using this directive gives the assembler freedom to locate
  75. the literal data in the most appropriate place and possibly to combine
  76. identical literals. For example, the code:
  77. </p>
  78. <div class="smallexample">
  79. <pre class="smallexample"> entry sp, 40
  80. .literal .L1, sym
  81. l32r a4, .L1
  82. </pre></div>
  83. <p>can be used to load a pointer to the symbol <code>sym</code> into register
  84. <code>a4</code>. The value of <code>sym</code> will not be placed between the
  85. <code>ENTRY</code> and <code>L32R</code> instructions; instead, the assembler puts
  86. the data in a literal pool.
  87. </p>
  88. <p>Literal pools are placed by default in separate literal sections;
  89. however, when using the &lsquo;<samp>--text-section-literals</samp>&rsquo;
  90. option (see <a href="Xtensa-Options.html#Xtensa-Options">Command-line Options</a>), the literal
  91. pools for PC-relative mode <code>L32R</code> instructions
  92. are placed in the current section.<a name="DOCF3" href="#FOOT3"><sup>3</sup></a>
  93. These text section literal
  94. pools are created automatically before <code>ENTRY</code> instructions and
  95. manually after &lsquo;<samp>.literal_position</samp>&rsquo; directives (see <a href="Literal-Position-Directive.html#Literal-Position-Directive">literal_position</a>). If there are no preceding
  96. <code>ENTRY</code> instructions, explicit <code>.literal_position</code> directives
  97. must be used to place the text section literal pools; otherwise,
  98. <code>as</code> will report an error.
  99. </p>
  100. <p>When literals are placed in separate sections, the literal section names
  101. are derived from the names of the sections where the literals are
  102. defined. The base literal section names are <code>.literal</code> for
  103. PC-relative mode <code>L32R</code> instructions and <code>.lit4</code> for absolute
  104. mode <code>L32R</code> instructions (see <a href="Absolute-Literals-Directive.html#Absolute-Literals-Directive">absolute-literals</a>). These base names are used for literals defined in
  105. the default <code>.text</code> section. For literals defined in other
  106. sections or within the scope of a <code>literal_prefix</code> directive
  107. (see <a href="Literal-Prefix-Directive.html#Literal-Prefix-Directive">literal_prefix</a>), the following rules
  108. determine the literal section name:
  109. </p>
  110. <ol>
  111. <li> If the current section is a member of a section group, the literal
  112. section name includes the group name as a suffix to the base
  113. <code>.literal</code> or <code>.lit4</code> name, with a period to separate the base
  114. name and group name. The literal section is also made a member of the
  115. group.
  116. </li><li> If the current section name (or <code>literal_prefix</code> value) begins with
  117. &ldquo;<code>.gnu.linkonce.<var>kind</var>.</code>&rdquo;, the literal section name is formed
  118. by replacing &ldquo;<code>.<var>kind</var></code>&rdquo; with the base <code>.literal</code> or
  119. <code>.lit4</code> name. For example, for literals defined in a section named
  120. <code>.gnu.linkonce.t.func</code>, the literal section will be
  121. <code>.gnu.linkonce.literal.func</code> or <code>.gnu.linkonce.lit4.func</code>.
  122. </li><li> If the current section name (or <code>literal_prefix</code> value) ends with
  123. <code>.text</code>, the literal section name is formed by replacing that
  124. suffix with the base <code>.literal</code> or <code>.lit4</code> name. For example,
  125. for literals defined in a section named <code>.iram0.text</code>, the literal
  126. section will be <code>.iram0.literal</code> or <code>.iram0.lit4</code>.
  127. </li><li> If none of the preceding conditions apply, the literal section name is
  128. formed by adding the base <code>.literal</code> or <code>.lit4</code> name as a
  129. suffix to the current section name (or <code>literal_prefix</code> value).
  130. </li></ol>
  131. <div class="footnote">
  132. <hr>
  133. <h4 class="footnotes-heading">Footnotes</h4>
  134. <h3><a name="FOOT3" href="#DOCF3">(3)</a></h3>
  135. <p>Literals for the
  136. <code>.init</code> and <code>.fini</code> sections are always placed in separate
  137. sections, even when &lsquo;<samp>--text-section-literals</samp>&rsquo; is enabled.</p>
  138. </div>
  139. <hr>
  140. <div class="header">
  141. <p>
  142. Next: <a href="Literal-Position-Directive.html#Literal-Position-Directive" accesskey="n" rel="next">Literal Position Directive</a>, Previous: <a href="Transform-Directive.html#Transform-Directive" accesskey="p" rel="prev">Transform Directive</a>, Up: <a href="Xtensa-Directives.html#Xtensa-Directives" accesskey="u" rel="up">Xtensa Directives</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  143. </div>
  144. </body>
  145. </html>