HPPA-Directives.html 16 KB

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