| <html lang="en"> |
| <head> |
| <title>Literal Position Directive - Using as</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Using as"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Xtensa-Directives.html#Xtensa-Directives" title="Xtensa Directives"> |
| <link rel="prev" href="Literal-Directive.html#Literal-Directive" title="Literal Directive"> |
| <link rel="next" href="Literal-Prefix-Directive.html#Literal-Prefix-Directive" title="Literal Prefix Directive"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| This file documents the GNU Assembler "as". |
| |
| Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 2000, 2001, 2002, 2006, 2007, 2008, 2009, 2010 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 no Invariant Sections, with no Front-Cover Texts, and with no |
| Back-Cover Texts. A copy of the license is included in the |
| section entitled ``GNU Free Documentation License''. |
| |
| --> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| <link rel="stylesheet" type="text/css" href="../cs.css"> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="Literal-Position-Directive"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="Literal-Prefix-Directive.html#Literal-Prefix-Directive">Literal Prefix Directive</a>, |
| Previous: <a rel="previous" accesskey="p" href="Literal-Directive.html#Literal-Directive">Literal Directive</a>, |
| Up: <a rel="up" accesskey="u" href="Xtensa-Directives.html#Xtensa-Directives">Xtensa Directives</a> |
| <hr> |
| </div> |
| |
| <h5 class="subsubsection">9.42.5.5 literal_position</h5> |
| |
| <p><a name="index-g_t_0040code_007bliteral_005fposition_007d-directive-2052"></a> |
| When using ‘<samp><span class="samp">--text-section-literals</span></samp>’ to place literals inline |
| in the section being assembled, the <code>.literal_position</code> directive |
| can be used to mark a potential location for a literal pool. |
| |
| <pre class="smallexample"> .literal_position |
| </pre> |
| <p>The <code>.literal_position</code> directive is ignored when the |
| ‘<samp><span class="samp">--text-section-literals</span></samp>’ option is not used or when |
| <code>L32R</code> instructions use the absolute addressing mode. |
| |
| <p>The assembler will automatically place text section literal pools |
| before <code>ENTRY</code> instructions, so the <code>.literal_position</code> |
| directive is only needed to specify some other location for a literal |
| pool. You may need to add an explicit jump instruction to skip over an |
| inline literal pool. |
| |
| <p>For example, an interrupt vector does not begin with an <code>ENTRY</code> |
| instruction so the assembler will be unable to automatically find a good |
| place to put a literal pool. Moreover, the code for the interrupt |
| vector must be at a specific starting address, so the literal pool |
| cannot come before the start of the code. The literal pool for the |
| vector must be explicitly positioned in the middle of the vector (before |
| any uses of the literals, due to the negative offsets used by |
| PC-relative <code>L32R</code> instructions). The <code>.literal_position</code> |
| directive can be used to do this. In the following code, the literal |
| for ‘<samp><span class="samp">M</span></samp>’ will automatically be aligned correctly and is placed after |
| the unconditional jump. |
| |
| <pre class="smallexample"> .global M |
| code_start: |
| j continue |
| .literal_position |
| .align 4 |
| continue: |
| movi a4, M |
| </pre> |
| </body></html> |
| |