88 lines
		
	
	
	
		
			4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
		
		
			
		
	
	
			88 lines
		
	
	
	
		
			4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| 
								 | 
							
								<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.7">
							 | 
						||
| 
								 | 
							
								<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, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002,
							 | 
						||
| 
								 | 
							
								2006, 2007 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.1
							 | 
						||
| 
								 | 
							
								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''.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								man end-->
							 | 
						||
| 
								 | 
							
								<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; } 
							 | 
						||
| 
								 | 
							
								--></style>
							 | 
						||
| 
								 | 
							
								</head>
							 | 
						||
| 
								 | 
							
								<body>
							 | 
						||
| 
								 | 
							
								<div class="node">
							 | 
						||
| 
								 | 
							
								<p>
							 | 
						||
| 
								 | 
							
								<a name="Literal-Position-Directive"></a>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><br>
							 | 
						||
| 
								 | 
							
								</div>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<h5 class="subsubsection">9.36.5.5 literal_position</h5>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<p><a name="index-_0040code_007bliteral_005fposition_007d-directive-1891"></a>
							 | 
						||
| 
								 | 
							
								When using <span class="samp">--text-section-literals</span> 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
							 | 
						||
| 
								 | 
							
								<span class="samp">--text-section-literals</span> 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 <span class="samp">M</span> 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>
							 | 
						||
| 
								 | 
							
								
							 |