231 lines
		
	
	
	
		
			14 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
		
		
			
		
	
	
			231 lines
		
	
	
	
		
			14 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| 
								 | 
							
								<html lang="en">
							 | 
						||
| 
								 | 
							
								<head>
							 | 
						||
| 
								 | 
							
								<title>HPPA Directives - 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="HPPA_002dDependent.html#HPPA_002dDependent" title="HPPA-Dependent">
							 | 
						||
| 
								 | 
							
								<link rel="prev" href="HPPA-Floating-Point.html#HPPA-Floating-Point" title="HPPA Floating Point">
							 | 
						||
| 
								 | 
							
								<link rel="next" href="HPPA-Opcodes.html#HPPA-Opcodes" title="HPPA Opcodes">
							 | 
						||
| 
								 | 
							
								<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="HPPA-Directives"></a>Next: <a rel="next" accesskey="n" href="HPPA-Opcodes.html#HPPA-Opcodes">HPPA Opcodes</a>,
							 | 
						||
| 
								 | 
							
								Previous: <a rel="previous" accesskey="p" href="HPPA-Floating-Point.html#HPPA-Floating-Point">HPPA Floating Point</a>,
							 | 
						||
| 
								 | 
							
								Up: <a rel="up" accesskey="u" href="HPPA_002dDependent.html#HPPA_002dDependent">HPPA-Dependent</a>
							 | 
						||
| 
								 | 
							
								<hr><br>
							 | 
						||
| 
								 | 
							
								</div>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<h4 class="subsection">9.11.5 HPPA Assembler Directives</h4>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<p><code>as</code> for the HPPA supports many additional directives for
							 | 
						||
| 
								 | 
							
								compatibility with the native assembler.  This section describes them only
							 | 
						||
| 
								 | 
							
								briefly.  For detailed information on HPPA-specific assembler directives, see
							 | 
						||
| 
								 | 
							
								<cite>HP9000 Series 800 Assembly Language Reference Manual</cite> (HP 92432-90001).
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								   <p><a name="index-HPPA-directives-not-supported-804"></a><code>as</code> does <em>not</em> support the following assembler directives
							 | 
						||
| 
								 | 
							
								described in the HP manual:
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<pre class="example">     .endm           .liston
							 | 
						||
| 
								 | 
							
								     .enter          .locct
							 | 
						||
| 
								 | 
							
								     .leave          .macro
							 | 
						||
| 
								 | 
							
								     .listoff
							 | 
						||
| 
								 | 
							
								</pre>
							 | 
						||
| 
								 | 
							
								   <p><a name="index-_0040code_007b_002eparam_007d-on-HPPA-805"></a>Beyond those implemented for compatibility, <code>as</code> supports one
							 | 
						||
| 
								 | 
							
								additional assembler directive for the HPPA: <code>.param</code>.  It conveys
							 | 
						||
| 
								 | 
							
								register argument locations for static functions.  Its syntax closely follows
							 | 
						||
| 
								 | 
							
								the <code>.export</code> directive.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								   <p><a name="index-HPPA_002donly-directives-806"></a>These are the additional directives in <code>as</code> for the HPPA:
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <dl>
							 | 
						||
| 
								 | 
							
								<dt><code>.block </code><var>n</var><dt><code>.blockz </code><var>n</var><dd>Reserve <var>n</var> bytes of storage, and initialize them to zero.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.call</code><dd>Mark the beginning of a procedure call.  Only the special case with <em>no
							 | 
						||
| 
								 | 
							
								arguments</em> is allowed.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.callinfo [ </code><var>param</var><code>=</code><var>value</var><code>, ... ]  [ </code><var>flag</var><code>, ... ]</code><dd>Specify a number of parameters and flags that define the environment for a
							 | 
						||
| 
								 | 
							
								procedure.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p><var>param</var> may be any of <span class="samp">frame</span> (frame size), <span class="samp">entry_gr</span> (end of
							 | 
						||
| 
								 | 
							
								general register range), <span class="samp">entry_fr</span> (end of float register range),
							 | 
						||
| 
								 | 
							
								<span class="samp">entry_sr</span> (end of space register range).
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p>The values for <var>flag</var> are <span class="samp">calls</span> or <span class="samp">caller</span> (proc has
							 | 
						||
| 
								 | 
							
								subroutines), <span class="samp">no_calls</span> (proc does not call subroutines), <span class="samp">save_rp</span>
							 | 
						||
| 
								 | 
							
								(preserve return pointer), <span class="samp">save_sp</span> (proc preserves stack pointer),
							 | 
						||
| 
								 | 
							
								<span class="samp">no_unwind</span> (do not unwind this proc), <span class="samp">hpux_int</span> (proc is interrupt
							 | 
						||
| 
								 | 
							
								routine).
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.code</code><dd>Assemble into the standard section called <span class="samp">$TEXT$</span>, subsection
							 | 
						||
| 
								 | 
							
								<span class="samp">$CODE$</span>.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.copyright "</code><var>string</var><code>"</code><dd>In the SOM object format, insert <var>string</var> into the object code, marked as a
							 | 
						||
| 
								 | 
							
								copyright string.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.copyright "</code><var>string</var><code>"</code><dd>In the ELF object format, insert <var>string</var> into the object code, marked as a
							 | 
						||
| 
								 | 
							
								version string.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.enter</code><dd>Not yet supported; the assembler rejects programs containing this directive.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.entry</code><dd>Mark the beginning of a procedure.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.exit</code><dd>Mark the end of a procedure.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.export </code><var>name</var><code> [ ,</code><var>typ</var><code> ]  [ ,</code><var>param</var><code>=</code><var>r</var><code> ]</code><dd>Make a procedure <var>name</var> available to callers.  <var>typ</var>, if present, must
							 | 
						||
| 
								 | 
							
								be one of <span class="samp">absolute</span>, <span class="samp">code</span> (ELF only, not SOM), <span class="samp">data</span>,
							 | 
						||
| 
								 | 
							
								<span class="samp">entry</span>, <span class="samp">data</span>, <span class="samp">entry</span>, <span class="samp">millicode</span>, <span class="samp">plabel</span>,
							 | 
						||
| 
								 | 
							
								<span class="samp">pri_prog</span>, or <span class="samp">sec_prog</span>.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p><var>param</var>, if present, provides either relocation information for the
							 | 
						||
| 
								 | 
							
								procedure arguments and result, or a privilege level.  <var>param</var> may be
							 | 
						||
| 
								 | 
							
								<span class="samp">argw</span><var>n</var> (where <var>n</var> ranges from <code>0</code> to <code>3</code>, and
							 | 
						||
| 
								 | 
							
								indicates one of four one-word arguments); <span class="samp">rtnval</span> (the procedure's
							 | 
						||
| 
								 | 
							
								result); or <span class="samp">priv_lev</span> (privilege level).  For arguments or the result,
							 | 
						||
| 
								 | 
							
								<var>r</var> specifies how to relocate, and must be one of <span class="samp">no</span> (not
							 | 
						||
| 
								 | 
							
								relocatable), <span class="samp">gr</span> (argument is in general register), <span class="samp">fr</span> (in
							 | 
						||
| 
								 | 
							
								floating point register), or <span class="samp">fu</span> (upper half of float register). 
							 | 
						||
| 
								 | 
							
								For <span class="samp">priv_lev</span>, <var>r</var> is an integer.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.half </code><var>n</var><dd>Define a two-byte integer constant <var>n</var>; synonym for the portable
							 | 
						||
| 
								 | 
							
								<code>as</code> directive <code>.short</code>.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.import </code><var>name</var><code> [ ,</code><var>typ</var><code> ]</code><dd>Converse of <code>.export</code>; make a procedure available to call.  The arguments
							 | 
						||
| 
								 | 
							
								use the same conventions as the first two arguments for <code>.export</code>.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.label </code><var>name</var><dd>Define <var>name</var> as a label for the current assembly location.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.leave</code><dd>Not yet supported; the assembler rejects programs containing this directive.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.origin </code><var>lc</var><dd>Advance location counter to <var>lc</var>. Synonym for the <code>as</code>
							 | 
						||
| 
								 | 
							
								portable directive <code>.org</code>.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.param </code><var>name</var><code> [ ,</code><var>typ</var><code> ]  [ ,</code><var>param</var><code>=</code><var>r</var><code> ]</code><dd><!-- Not in HP manual; @sc{gnu} HPPA extension -->
							 | 
						||
| 
								 | 
							
								Similar to <code>.export</code>, but used for static procedures.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.proc</code><dd>Use preceding the first statement of a procedure.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.procend</code><dd>Use following the last statement of a procedure.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><var>label</var><code> .reg </code><var>expr</var><dd><!-- ?? Not in HP manual (Jan 1988 vn) -->
							 | 
						||
| 
								 | 
							
								Synonym for <code>.equ</code>; define <var>label</var> with the absolute expression
							 | 
						||
| 
								 | 
							
								<var>expr</var> as its value.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.space </code><var>secname</var><code> [ ,</code><var>params</var><code> ]</code><dd>Switch to section <var>secname</var>, creating a new section by that name if
							 | 
						||
| 
								 | 
							
								necessary.  You may only use <var>params</var> when creating a new section, not
							 | 
						||
| 
								 | 
							
								when switching to an existing one.  <var>secname</var> may identify a section by
							 | 
						||
| 
								 | 
							
								number rather than by name.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p>If specified, the list <var>params</var> declares attributes of the section,
							 | 
						||
| 
								 | 
							
								identified by keywords.  The keywords recognized are <span class="samp">spnum=</span><var>exp</var>
							 | 
						||
| 
								 | 
							
								(identify this section by the number <var>exp</var>, an absolute expression),
							 | 
						||
| 
								 | 
							
								<span class="samp">sort=</span><var>exp</var> (order sections according to this sort key when linking;
							 | 
						||
| 
								 | 
							
								<var>exp</var> is an absolute expression), <span class="samp">unloadable</span> (section contains no
							 | 
						||
| 
								 | 
							
								loadable data), <span class="samp">notdefined</span> (this section defined elsewhere), and
							 | 
						||
| 
								 | 
							
								<span class="samp">private</span> (data in this section not available to other programs).
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.spnum </code><var>secnam</var><dd><!-- ?? Not in HP manual (Jan 1988) -->
							 | 
						||
| 
								 | 
							
								Allocate four bytes of storage, and initialize them with the section number of
							 | 
						||
| 
								 | 
							
								the section named <var>secnam</var>.  (You can define the section number with the
							 | 
						||
| 
								 | 
							
								HPPA <code>.space</code> directive.)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p><a name="index-_0040code_007bstring_007d-directive-on-HPPA-807"></a><br><dt><code>.string "</code><var>str</var><code>"</code><dd>Copy the characters in the string <var>str</var> to the object file. 
							 | 
						||
| 
								 | 
							
								See <a href="Strings.html#Strings">Strings</a>, for information on escape sequences you can use in
							 | 
						||
| 
								 | 
							
								<code>as</code> strings.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p><em>Warning!</em> The HPPA version of <code>.string</code> differs from the
							 | 
						||
| 
								 | 
							
								usual <code>as</code> definition: it does <em>not</em> write a zero byte
							 | 
						||
| 
								 | 
							
								after copying <var>str</var>.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.stringz "</code><var>str</var><code>"</code><dd>Like <code>.string</code>, but appends a zero byte after copying <var>str</var> to object
							 | 
						||
| 
								 | 
							
								file.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.subspa </code><var>name</var><code> [ ,</code><var>params</var><code> ]</code><dt><code>.nsubspa </code><var>name</var><code> [ ,</code><var>params</var><code> ]</code><dd>Similar to <code>.space</code>, but selects a subsection <var>name</var> within the
							 | 
						||
| 
								 | 
							
								current section.  You may only specify <var>params</var> when you create a
							 | 
						||
| 
								 | 
							
								subsection (in the first instance of <code>.subspa</code> for this <var>name</var>).
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p>If specified, the list <var>params</var> declares attributes of the subsection,
							 | 
						||
| 
								 | 
							
								identified by keywords.  The keywords recognized are <span class="samp">quad=</span><var>expr</var>
							 | 
						||
| 
								 | 
							
								(“quadrant” for this subsection), <span class="samp">align=</span><var>expr</var> (alignment for
							 | 
						||
| 
								 | 
							
								beginning of this subsection; a power of two), <span class="samp">access=</span><var>expr</var> (value
							 | 
						||
| 
								 | 
							
								for “access rights” field), <span class="samp">sort=</span><var>expr</var> (sorting order for this
							 | 
						||
| 
								 | 
							
								subspace in link), <span class="samp">code_only</span> (subsection contains only code),
							 | 
						||
| 
								 | 
							
								<span class="samp">unloadable</span> (subsection cannot be loaded into memory), <span class="samp">comdat</span>
							 | 
						||
| 
								 | 
							
								(subsection is comdat), <span class="samp">common</span> (subsection is common block),
							 | 
						||
| 
								 | 
							
								<span class="samp">dup_comm</span> (subsection may have duplicate names), or <span class="samp">zero</span>
							 | 
						||
| 
								 | 
							
								(subsection is all zeros, do not write in object file).
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p><code>.nsubspa</code> always creates a new subspace with the given name, even
							 | 
						||
| 
								 | 
							
								if one with the same name already exists.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p><span class="samp">comdat</span>, <span class="samp">common</span> and <span class="samp">dup_comm</span> can be used to implement
							 | 
						||
| 
								 | 
							
								various flavors of one-only support when using the SOM linker.  The SOM
							 | 
						||
| 
								 | 
							
								linker only supports specific combinations of these flags.  The details
							 | 
						||
| 
								 | 
							
								are not documented.  A brief description is provided here.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p><span class="samp">comdat</span> provides a form of linkonce support.  It is useful for
							 | 
						||
| 
								 | 
							
								both code and data subspaces.  A <span class="samp">comdat</span> subspace has a key symbol
							 | 
						||
| 
								 | 
							
								marked by the <span class="samp">is_comdat</span> flag or <span class="samp">ST_COMDAT</span>.  Only the first
							 | 
						||
| 
								 | 
							
								subspace for any given key is selected.  The key symbol becomes universal
							 | 
						||
| 
								 | 
							
								in shared links.  This is similar to the behavior of <span class="samp">secondary_def</span>
							 | 
						||
| 
								 | 
							
								symbols.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p><span class="samp">common</span> provides Fortran named common support.  It is only useful
							 | 
						||
| 
								 | 
							
								for data subspaces.  Symbols with the flag <span class="samp">is_common</span> retain this
							 | 
						||
| 
								 | 
							
								flag in shared links.  Referencing a <span class="samp">is_common</span> symbol in a shared
							 | 
						||
| 
								 | 
							
								library from outside the library doesn't work.  Thus, <span class="samp">is_common</span>
							 | 
						||
| 
								 | 
							
								symbols must be output whenever they are needed.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p><span class="samp">common</span> and <span class="samp">dup_comm</span> together provide Cobol common support. 
							 | 
						||
| 
								 | 
							
								The subspaces in this case must all be the same length.  Otherwise, this
							 | 
						||
| 
								 | 
							
								support is similar to the Fortran common support.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p><span class="samp">dup_comm</span> by itself provides a type of one-only support for code. 
							 | 
						||
| 
								 | 
							
								Only the first <span class="samp">dup_comm</span> subspace is selected.  There is a rather
							 | 
						||
| 
								 | 
							
								complex algorithm to compare subspaces.  Code symbols marked with the
							 | 
						||
| 
								 | 
							
								<span class="samp">dup_common</span> flag are hidden.  This support was intended for "C++
							 | 
						||
| 
								 | 
							
								duplicate inlines".
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <p>A simplified technique is used to mark the flags of symbols based on
							 | 
						||
| 
								 | 
							
								the flags of their subspace.  A symbol with the scope SS_UNIVERSAL and
							 | 
						||
| 
								 | 
							
								type ST_ENTRY, ST_CODE or ST_DATA is marked with the corresponding
							 | 
						||
| 
								 | 
							
								settings of <span class="samp">comdat</span>, <span class="samp">common</span> and <span class="samp">dup_comm</span> from the
							 | 
						||
| 
								 | 
							
								subspace, respectively.  This avoids having to introduce additional
							 | 
						||
| 
								 | 
							
								directives to mark these symbols.  The HP assembler sets <span class="samp">is_common</span>
							 | 
						||
| 
								 | 
							
								from <span class="samp">common</span>.  However, it doesn't set the <span class="samp">dup_common</span> from
							 | 
						||
| 
								 | 
							
								<span class="samp">dup_comm</span>.  It doesn't have <span class="samp">comdat</span> support.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								     <br><dt><code>.version "</code><var>str</var><code>"</code><dd>Write <var>str</var> as version identifier in object code. 
							 | 
						||
| 
								 | 
							
								</dl>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								   </body></html>
							 | 
						||
| 
								 | 
							
								
							 |