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
5Copyright (C) 1991-2021 Free Software Foundation, Inc.
6
7Permission is granted to copy, distribute and/or modify this document
8under the terms of the GNU Free Documentation License, Version 1.3
9or any later version published by the Free Software Foundation;
10with no Invariant Sections, with no Front-Cover Texts, and with no
11Back-Cover Texts.  A copy of the license is included in the
12section entitled "GNU Free Documentation License".
13 -->
14<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
15<head>
16<title>Using as: HPPA Directives</title>
17
18<meta name="description" content="Using as: HPPA Directives">
19<meta name="keywords" content="Using as: HPPA Directives">
20<meta name="resource-type" content="document">
21<meta name="distribution" content="global">
22<meta name="Generator" content="makeinfo">
23<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
24<link href="index.html#Top" rel="start" title="Top">
25<link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
26<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
27<link href="HPPA_002dDependent.html#HPPA_002dDependent" rel="up" title="HPPA-Dependent">
28<link href="HPPA-Opcodes.html#HPPA-Opcodes" rel="next" title="HPPA Opcodes">
29<link href="HPPA-Floating-Point.html#HPPA-Floating-Point" rel="previous" title="HPPA Floating Point">
30<style type="text/css">
31<!--
32a.summary-letter {text-decoration: none}
33blockquote.smallquotation {font-size: smaller}
34div.display {margin-left: 3.2em}
35div.example {margin-left: 3.2em}
36div.indentedblock {margin-left: 3.2em}
37div.lisp {margin-left: 3.2em}
38div.smalldisplay {margin-left: 3.2em}
39div.smallexample {margin-left: 3.2em}
40div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
41div.smalllisp {margin-left: 3.2em}
42kbd {font-style:oblique}
43pre.display {font-family: inherit}
44pre.format {font-family: inherit}
45pre.menu-comment {font-family: serif}
46pre.menu-preformatted {font-family: serif}
47pre.smalldisplay {font-family: inherit; font-size: smaller}
48pre.smallexample {font-size: smaller}
49pre.smallformat {font-family: inherit; font-size: smaller}
50pre.smalllisp {font-size: smaller}
51span.nocodebreak {white-space:nowrap}
52span.nolinebreak {white-space:nowrap}
53span.roman {font-family:serif; font-weight:normal}
54span.sansserif {font-family:sans-serif; font-weight:normal}
55ul.no-bullet {list-style: none}
56-->
57</style>
58
59
60</head>
61
62<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
63<a name="HPPA-Directives"></a>
64<div class="header">
65<p>
66Next: <a href="HPPA-Opcodes.html#HPPA-Opcodes" accesskey="n" rel="next">HPPA Opcodes</a>, Previous: <a href="HPPA-Floating-Point.html#HPPA-Floating-Point" accesskey="p" rel="previous">HPPA Floating Point</a>, Up: <a href="HPPA_002dDependent.html#HPPA_002dDependent" accesskey="u" rel="up">HPPA-Dependent</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>
67</div>
68<hr>
69<a name="HPPA-Assembler-Directives"></a>
70<h4 class="subsection">9.15.5 HPPA Assembler Directives</h4>
71
72<p><code>as</code> for the HPPA supports many additional directives for
73compatibility with the native assembler.  This section describes them only
74briefly.  For detailed information on HPPA-specific assembler directives, see
75<cite>HP9000 Series 800 Assembly Language Reference Manual</cite> (HP 92432-90001).
76</p>
77<a name="index-HPPA-directives-not-supported"></a>
78<p><code>as</code> does <em>not</em> support the following assembler directives
79described in the HP manual:
80</p>
81<div class="example">
82<pre class="example">.endm           .liston
83.enter          .locct
84.leave          .macro
85.listoff
86</pre></div>
87
88<a name="index-_002eparam-on-HPPA"></a>
89<p>Beyond those implemented for compatibility, <code>as</code> supports one
90additional assembler directive for the HPPA: <code>.param</code>.  It conveys
91register argument locations for static functions.  Its syntax closely follows
92the <code>.export</code> directive.
93</p>
94<a name="index-HPPA_002donly-directives"></a>
95<p>These are the additional directives in <code>as</code> for the HPPA:
96</p>
97<dl compact="compact">
98<dt><code>.block <var>n</var></code></dt>
99<dt><code>.blockz <var>n</var></code></dt>
100<dd><p>Reserve <var>n</var> bytes of storage, and initialize them to zero.
101</p>
102</dd>
103<dt><code>.call</code></dt>
104<dd><p>Mark the beginning of a procedure call.  Only the special case with <em>no
105arguments</em> is allowed.
106</p>
107</dd>
108<dt><code>.callinfo [ <var>param</var>=<var>value</var>, &hellip; ]  [ <var>flag</var>, &hellip; ]</code></dt>
109<dd><p>Specify a number of parameters and flags that define the environment for a
110procedure.
111</p>
112<p><var>param</var> may be any of &lsquo;<samp>frame</samp>&rsquo; (frame size), &lsquo;<samp>entry_gr</samp>&rsquo; (end of
113general register range), &lsquo;<samp>entry_fr</samp>&rsquo; (end of float register range),
114&lsquo;<samp>entry_sr</samp>&rsquo; (end of space register range).
115</p>
116<p>The values for <var>flag</var> are &lsquo;<samp>calls</samp>&rsquo; or &lsquo;<samp>caller</samp>&rsquo; (proc has
117subroutines), &lsquo;<samp>no_calls</samp>&rsquo; (proc does not call subroutines), &lsquo;<samp>save_rp</samp>&rsquo;
118(preserve return pointer), &lsquo;<samp>save_sp</samp>&rsquo; (proc preserves stack pointer),
119&lsquo;<samp>no_unwind</samp>&rsquo; (do not unwind this proc), &lsquo;<samp>hpux_int</samp>&rsquo; (proc is interrupt
120routine).
121</p>
122</dd>
123<dt><code>.code</code></dt>
124<dd><p>Assemble into the standard section called &lsquo;<samp>$TEXT$</samp>&rsquo;, subsection
125&lsquo;<samp>$CODE$</samp>&rsquo;.
126</p>
127</dd>
128<dt><code>.copyright &quot;<var>string</var>&quot;</code></dt>
129<dd><p>In the SOM object format, insert <var>string</var> into the object code, marked as a
130copyright string.
131</p>
132</dd>
133<dt><code>.copyright &quot;<var>string</var>&quot;</code></dt>
134<dd><p>In the ELF object format, insert <var>string</var> into the object code, marked as a
135version string.
136</p>
137</dd>
138<dt><code>.enter</code></dt>
139<dd><p>Not yet supported; the assembler rejects programs containing this directive.
140</p>
141</dd>
142<dt><code>.entry</code></dt>
143<dd><p>Mark the beginning of a procedure.
144</p>
145</dd>
146<dt><code>.exit</code></dt>
147<dd><p>Mark the end of a procedure.
148</p>
149</dd>
150<dt><code>.export <var>name</var> [ ,<var>typ</var> ]  [ ,<var>param</var>=<var>r</var> ]</code></dt>
151<dd><p>Make a procedure <var>name</var> available to callers.  <var>typ</var>, if present, must
152be one of &lsquo;<samp>absolute</samp>&rsquo;, &lsquo;<samp>code</samp>&rsquo; (ELF only, not SOM), &lsquo;<samp>data</samp>&rsquo;,
153&lsquo;<samp>entry</samp>&rsquo;, &lsquo;<samp>data</samp>&rsquo;, &lsquo;<samp>entry</samp>&rsquo;, &lsquo;<samp>millicode</samp>&rsquo;, &lsquo;<samp>plabel</samp>&rsquo;,
154&lsquo;<samp>pri_prog</samp>&rsquo;, or &lsquo;<samp>sec_prog</samp>&rsquo;.
155</p>
156<p><var>param</var>, if present, provides either relocation information for the
157procedure arguments and result, or a privilege level.  <var>param</var> may be
158&lsquo;<samp>argw<var>n</var></samp>&rsquo; (where <var>n</var> ranges from <code>0</code> to <code>3</code>, and
159indicates one of four one-word arguments); &lsquo;<samp>rtnval</samp>&rsquo; (the procedure&rsquo;s
160result); or &lsquo;<samp>priv_lev</samp>&rsquo; (privilege level).  For arguments or the result,
161<var>r</var> specifies how to relocate, and must be one of &lsquo;<samp>no</samp>&rsquo; (not
162relocatable), &lsquo;<samp>gr</samp>&rsquo; (argument is in general register), &lsquo;<samp>fr</samp>&rsquo; (in
163floating point register), or &lsquo;<samp>fu</samp>&rsquo; (upper half of float register).
164For &lsquo;<samp>priv_lev</samp>&rsquo;, <var>r</var> is an integer.
165</p>
166</dd>
167<dt><code>.half <var>n</var></code></dt>
168<dd><p>Define a two-byte integer constant <var>n</var>; synonym for the portable
169<code>as</code> directive <code>.short</code>.
170</p>
171</dd>
172<dt><code>.import <var>name</var> [ ,<var>typ</var> ]</code></dt>
173<dd><p>Converse of <code>.export</code>; make a procedure available to call.  The arguments
174use the same conventions as the first two arguments for <code>.export</code>.
175</p>
176</dd>
177<dt><code>.label <var>name</var></code></dt>
178<dd><p>Define <var>name</var> as a label for the current assembly location.
179</p>
180</dd>
181<dt><code>.leave</code></dt>
182<dd><p>Not yet supported; the assembler rejects programs containing this directive.
183</p>
184</dd>
185<dt><code>.origin <var>lc</var></code></dt>
186<dd><p>Advance location counter to <var>lc</var>. Synonym for the <code>as</code>
187portable directive <code>.org</code>.
188</p>
189</dd>
190<dt><code>.param <var>name</var> [ ,<var>typ</var> ]  [ ,<var>param</var>=<var>r</var> ]</code></dt>
191<dd><p>Similar to <code>.export</code>, but used for static procedures.
192</p>
193</dd>
194<dt><code>.proc</code></dt>
195<dd><p>Use preceding the first statement of a procedure.
196</p>
197</dd>
198<dt><code>.procend</code></dt>
199<dd><p>Use following the last statement of a procedure.
200</p>
201</dd>
202<dt><code><var>label</var> .reg <var>expr</var></code></dt>
203<dd><p>Synonym for <code>.equ</code>; define <var>label</var> with the absolute expression
204<var>expr</var> as its value.
205</p>
206</dd>
207<dt><code>.space <var>secname</var> [ ,<var>params</var> ]</code></dt>
208<dd><p>Switch to section <var>secname</var>, creating a new section by that name if
209necessary.  You may only use <var>params</var> when creating a new section, not
210when switching to an existing one.  <var>secname</var> may identify a section by
211number rather than by name.
212</p>
213<p>If specified, the list <var>params</var> declares attributes of the section,
214identified by keywords.  The keywords recognized are &lsquo;<samp>spnum=<var>exp</var></samp>&rsquo;
215(identify this section by the number <var>exp</var>, an absolute expression),
216&lsquo;<samp>sort=<var>exp</var></samp>&rsquo; (order sections according to this sort key when linking;
217<var>exp</var> is an absolute expression), &lsquo;<samp>unloadable</samp>&rsquo; (section contains no
218loadable data), &lsquo;<samp>notdefined</samp>&rsquo; (this section defined elsewhere), and
219&lsquo;<samp>private</samp>&rsquo; (data in this section not available to other programs).
220</p>
221</dd>
222<dt><code>.spnum <var>secnam</var></code></dt>
223<dd><p>Allocate four bytes of storage, and initialize them with the section number of
224the section named <var>secnam</var>.  (You can define the section number with the
225HPPA <code>.space</code> directive.)
226</p>
227<a name="index-string-directive-on-HPPA"></a>
228</dd>
229<dt><code>.string &quot;<var>str</var>&quot;</code></dt>
230<dd><p>Copy the characters in the string <var>str</var> to the object file.
231See <a href="Strings.html#Strings">Strings</a>, for information on escape sequences you can use in
232<code>as</code> strings.
233</p>
234<p><em>Warning!</em> The HPPA version of <code>.string</code> differs from the
235usual <code>as</code> definition: it does <em>not</em> write a zero byte
236after copying <var>str</var>.
237</p>
238</dd>
239<dt><code>.stringz &quot;<var>str</var>&quot;</code></dt>
240<dd><p>Like <code>.string</code>, but appends a zero byte after copying <var>str</var> to object
241file.
242</p>
243</dd>
244<dt><code>.subspa <var>name</var> [ ,<var>params</var> ]</code></dt>
245<dt><code>.nsubspa <var>name</var> [ ,<var>params</var> ]</code></dt>
246<dd><p>Similar to <code>.space</code>, but selects a subsection <var>name</var> within the
247current section.  You may only specify <var>params</var> when you create a
248subsection (in the first instance of <code>.subspa</code> for this <var>name</var>).
249</p>
250<p>If specified, the list <var>params</var> declares attributes of the subsection,
251identified by keywords.  The keywords recognized are &lsquo;<samp>quad=<var>expr</var></samp>&rsquo;
252(&ldquo;quadrant&rdquo; for this subsection), &lsquo;<samp>align=<var>expr</var></samp>&rsquo; (alignment for
253beginning of this subsection; a power of two), &lsquo;<samp>access=<var>expr</var></samp>&rsquo; (value
254for &ldquo;access rights&rdquo; field), &lsquo;<samp>sort=<var>expr</var></samp>&rsquo; (sorting order for this
255subspace in link), &lsquo;<samp>code_only</samp>&rsquo; (subsection contains only code),
256&lsquo;<samp>unloadable</samp>&rsquo; (subsection cannot be loaded into memory), &lsquo;<samp>comdat</samp>&rsquo;
257(subsection is comdat), &lsquo;<samp>common</samp>&rsquo; (subsection is common block),
258&lsquo;<samp>dup_comm</samp>&rsquo; (subsection may have duplicate names), or &lsquo;<samp>zero</samp>&rsquo;
259(subsection is all zeros, do not write in object file).
260</p>
261<p><code>.nsubspa</code> always creates a new subspace with the given name, even
262if one with the same name already exists.
263</p>
264<p>&lsquo;<samp>comdat</samp>&rsquo;, &lsquo;<samp>common</samp>&rsquo; and &lsquo;<samp>dup_comm</samp>&rsquo; can be used to implement
265various flavors of one-only support when using the SOM linker.  The SOM
266linker only supports specific combinations of these flags.  The details
267are not documented.  A brief description is provided here.
268</p>
269<p>&lsquo;<samp>comdat</samp>&rsquo; provides a form of linkonce support.  It is useful for
270both code and data subspaces.  A &lsquo;<samp>comdat</samp>&rsquo; subspace has a key symbol
271marked by the &lsquo;<samp>is_comdat</samp>&rsquo; flag or &lsquo;<samp>ST_COMDAT</samp>&rsquo;.  Only the first
272subspace for any given key is selected.  The key symbol becomes universal
273in shared links.  This is similar to the behavior of &lsquo;<samp>secondary_def</samp>&rsquo;
274symbols.
275</p>
276<p>&lsquo;<samp>common</samp>&rsquo; provides Fortran named common support.  It is only useful
277for data subspaces.  Symbols with the flag &lsquo;<samp>is_common</samp>&rsquo; retain this
278flag in shared links.  Referencing a &lsquo;<samp>is_common</samp>&rsquo; symbol in a shared
279library from outside the library doesn&rsquo;t work.  Thus, &lsquo;<samp>is_common</samp>&rsquo;
280symbols must be output whenever they are needed.
281</p>
282<p>&lsquo;<samp>common</samp>&rsquo; and &lsquo;<samp>dup_comm</samp>&rsquo; together provide Cobol common support.
283The subspaces in this case must all be the same length.  Otherwise, this
284support is similar to the Fortran common support.
285</p>
286<p>&lsquo;<samp>dup_comm</samp>&rsquo; by itself provides a type of one-only support for code.
287Only the first &lsquo;<samp>dup_comm</samp>&rsquo; subspace is selected.  There is a rather
288complex algorithm to compare subspaces.  Code symbols marked with the
289&lsquo;<samp>dup_common</samp>&rsquo; flag are hidden.  This support was intended for &quot;C++
290duplicate inlines&quot;.
291</p>
292<p>A simplified technique is used to mark the flags of symbols based on
293the flags of their subspace.  A symbol with the scope SS_UNIVERSAL and
294type ST_ENTRY, ST_CODE or ST_DATA is marked with the corresponding
295settings of &lsquo;<samp>comdat</samp>&rsquo;, &lsquo;<samp>common</samp>&rsquo; and &lsquo;<samp>dup_comm</samp>&rsquo; from the
296subspace, respectively.  This avoids having to introduce additional
297directives to mark these symbols.  The HP assembler sets &lsquo;<samp>is_common</samp>&rsquo;
298from &lsquo;<samp>common</samp>&rsquo;.  However, it doesn&rsquo;t set the &lsquo;<samp>dup_common</samp>&rsquo; from
299&lsquo;<samp>dup_comm</samp>&rsquo;.  It doesn&rsquo;t have &lsquo;<samp>comdat</samp>&rsquo; support.
300</p>
301</dd>
302<dt><code>.version &quot;<var>str</var>&quot;</code></dt>
303<dd><p>Write <var>str</var> as version identifier in object code.
304</p></dd>
305</dl>
306
307<hr>
308<div class="header">
309<p>
310Next: <a href="HPPA-Opcodes.html#HPPA-Opcodes" accesskey="n" rel="next">HPPA Opcodes</a>, Previous: <a href="HPPA-Floating-Point.html#HPPA-Floating-Point" accesskey="p" rel="previous">HPPA Floating Point</a>, Up: <a href="HPPA_002dDependent.html#HPPA_002dDependent" accesskey="u" rel="up">HPPA-Dependent</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>
311</div>
312
313
314
315</body>
316</html>
317