c-hppa.texi 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. @c Copyright (C) 1991-2022 Free Software Foundation, Inc.
  2. @c This is part of the GAS manual.
  3. @c For copying conditions, see the file as.texinfo.
  4. @page
  5. @node HPPA-Dependent
  6. @chapter HPPA Dependent Features
  7. @cindex support
  8. @menu
  9. * HPPA Notes:: Notes
  10. * HPPA Options:: Options
  11. * HPPA Syntax:: Syntax
  12. * HPPA Floating Point:: Floating Point
  13. * HPPA Directives:: HPPA Machine Directives
  14. * HPPA Opcodes:: Opcodes
  15. @end menu
  16. @node HPPA Notes
  17. @section Notes
  18. As a back end for @sc{gnu} @sc{cc} @code{@value{AS}} has been thoroughly tested and should
  19. work extremely well. We have tested it only minimally on hand written assembly
  20. code and no one has tested it much on the assembly output from the HP
  21. compilers.
  22. The format of the debugging sections has changed since the original
  23. @code{@value{AS}} port (version 1.3X) was released; therefore,
  24. you must rebuild all HPPA objects and libraries with the new
  25. assembler so that you can debug the final executable.
  26. The HPPA @code{@value{AS}} port generates a small subset of the relocations
  27. available in the SOM and ELF object file formats. Additional relocation
  28. support will be added as it becomes necessary.
  29. @node HPPA Options
  30. @section Options
  31. @code{@value{AS}} has no machine-dependent command-line options for the HPPA.
  32. @cindex HPPA Syntax
  33. @node HPPA Syntax
  34. @section Syntax
  35. The assembler syntax closely follows the HPPA instruction set
  36. reference manual; assembler directives and general syntax closely follow the
  37. HPPA assembly language reference manual, with a few noteworthy differences.
  38. First, a colon may immediately follow a label definition. This is
  39. simply for compatibility with how most assembly language programmers
  40. write code.
  41. Some obscure expression parsing problems may affect hand written code which
  42. uses the @code{spop} instructions, or code which makes significant
  43. use of the @code{!} line separator.
  44. @code{@value{AS}} is much less forgiving about missing arguments and other
  45. similar oversights than the HP assembler. @code{@value{AS}} notifies you
  46. of missing arguments as syntax errors; this is regarded as a feature, not a
  47. bug.
  48. Finally, @code{@value{AS}} allows you to use an external symbol without
  49. explicitly importing the symbol. @emph{Warning:} in the future this will be
  50. an error for HPPA targets.
  51. Special characters for HPPA targets include:
  52. @samp{;} is the line comment character.
  53. @samp{!} can be used instead of a newline to separate statements.
  54. Since @samp{$} has no special meaning, you may use it in symbol names.
  55. @node HPPA Floating Point
  56. @section Floating Point
  57. @cindex floating point, HPPA (@sc{ieee})
  58. @cindex HPPA floating point (@sc{ieee})
  59. The HPPA family uses @sc{ieee} floating-point numbers.
  60. @node HPPA Directives
  61. @section HPPA Assembler Directives
  62. @code{@value{AS}} for the HPPA supports many additional directives for
  63. compatibility with the native assembler. This section describes them only
  64. briefly. For detailed information on HPPA-specific assembler directives, see
  65. @cite{HP9000 Series 800 Assembly Language Reference Manual} (HP 92432-90001).
  66. @cindex HPPA directives not supported
  67. @code{@value{AS}} does @emph{not} support the following assembler directives
  68. described in the HP manual:
  69. @example
  70. .endm .liston
  71. .enter .locct
  72. .leave .macro
  73. .listoff
  74. @end example
  75. @cindex @code{.param} on HPPA
  76. Beyond those implemented for compatibility, @code{@value{AS}} supports one
  77. additional assembler directive for the HPPA: @code{.param}. It conveys
  78. register argument locations for static functions. Its syntax closely follows
  79. the @code{.export} directive.
  80. @cindex HPPA-only directives
  81. These are the additional directives in @code{@value{AS}} for the HPPA:
  82. @table @code
  83. @item .block @var{n}
  84. @itemx .blockz @var{n}
  85. Reserve @var{n} bytes of storage, and initialize them to zero.
  86. @item .call
  87. Mark the beginning of a procedure call. Only the special case with @emph{no
  88. arguments} is allowed.
  89. @item .callinfo [ @var{param}=@var{value}, @dots{} ] [ @var{flag}, @dots{} ]
  90. Specify a number of parameters and flags that define the environment for a
  91. procedure.
  92. @var{param} may be any of @samp{frame} (frame size), @samp{entry_gr} (end of
  93. general register range), @samp{entry_fr} (end of float register range),
  94. @samp{entry_sr} (end of space register range).
  95. The values for @var{flag} are @samp{calls} or @samp{caller} (proc has
  96. subroutines), @samp{no_calls} (proc does not call subroutines), @samp{save_rp}
  97. (preserve return pointer), @samp{save_sp} (proc preserves stack pointer),
  98. @samp{no_unwind} (do not unwind this proc), @samp{hpux_int} (proc is interrupt
  99. routine).
  100. @item .code
  101. Assemble into the standard section called @samp{$TEXT$}, subsection
  102. @samp{$CODE$}.
  103. @ifset SOM
  104. @item .copyright "@var{string}"
  105. In the SOM object format, insert @var{string} into the object code, marked as a
  106. copyright string.
  107. @end ifset
  108. @ifset ELF
  109. @item .copyright "@var{string}"
  110. In the ELF object format, insert @var{string} into the object code, marked as a
  111. version string.
  112. @end ifset
  113. @item .enter
  114. Not yet supported; the assembler rejects programs containing this directive.
  115. @item .entry
  116. Mark the beginning of a procedure.
  117. @item .exit
  118. Mark the end of a procedure.
  119. @item .export @var{name} [ ,@var{typ} ] [ ,@var{param}=@var{r} ]
  120. Make a procedure @var{name} available to callers. @var{typ}, if present, must
  121. be one of @samp{absolute}, @samp{code} (ELF only, not SOM), @samp{data},
  122. @samp{entry}, @samp{data}, @samp{entry}, @samp{millicode}, @samp{plabel},
  123. @samp{pri_prog}, or @samp{sec_prog}.
  124. @var{param}, if present, provides either relocation information for the
  125. procedure arguments and result, or a privilege level. @var{param} may be
  126. @samp{argw@var{n}} (where @var{n} ranges from @code{0} to @code{3}, and
  127. indicates one of four one-word arguments); @samp{rtnval} (the procedure's
  128. result); or @samp{priv_lev} (privilege level). For arguments or the result,
  129. @var{r} specifies how to relocate, and must be one of @samp{no} (not
  130. relocatable), @samp{gr} (argument is in general register), @samp{fr} (in
  131. floating point register), or @samp{fu} (upper half of float register).
  132. For @samp{priv_lev}, @var{r} is an integer.
  133. @item .half @var{n}
  134. Define a two-byte integer constant @var{n}; synonym for the portable
  135. @code{@value{AS}} directive @code{.short}.
  136. @item .import @var{name} [ ,@var{typ} ]
  137. Converse of @code{.export}; make a procedure available to call. The arguments
  138. use the same conventions as the first two arguments for @code{.export}.
  139. @item .label @var{name}
  140. Define @var{name} as a label for the current assembly location.
  141. @item .leave
  142. Not yet supported; the assembler rejects programs containing this directive.
  143. @item .origin @var{lc}
  144. Advance location counter to @var{lc}. Synonym for the @code{@value{AS}}
  145. portable directive @code{.org}.
  146. @item .param @var{name} [ ,@var{typ} ] [ ,@var{param}=@var{r} ]
  147. @c Not in HP manual; @sc{gnu} HPPA extension
  148. Similar to @code{.export}, but used for static procedures.
  149. @item .proc
  150. Use preceding the first statement of a procedure.
  151. @item .procend
  152. Use following the last statement of a procedure.
  153. @item @var{label} .reg @var{expr}
  154. @c ?? Not in HP manual (Jan 1988 vn)
  155. Synonym for @code{.equ}; define @var{label} with the absolute expression
  156. @var{expr} as its value.
  157. @item .space @var{secname} [ ,@var{params} ]
  158. Switch to section @var{secname}, creating a new section by that name if
  159. necessary. You may only use @var{params} when creating a new section, not
  160. when switching to an existing one. @var{secname} may identify a section by
  161. number rather than by name.
  162. If specified, the list @var{params} declares attributes of the section,
  163. identified by keywords. The keywords recognized are @samp{spnum=@var{exp}}
  164. (identify this section by the number @var{exp}, an absolute expression),
  165. @samp{sort=@var{exp}} (order sections according to this sort key when linking;
  166. @var{exp} is an absolute expression), @samp{unloadable} (section contains no
  167. loadable data), @samp{notdefined} (this section defined elsewhere), and
  168. @samp{private} (data in this section not available to other programs).
  169. @item .spnum @var{secnam}
  170. @c ?? Not in HP manual (Jan 1988)
  171. Allocate four bytes of storage, and initialize them with the section number of
  172. the section named @var{secnam}. (You can define the section number with the
  173. HPPA @code{.space} directive.)
  174. @cindex @code{string} directive on HPPA
  175. @item .string "@var{str}"
  176. Copy the characters in the string @var{str} to the object file.
  177. @xref{Strings,,Strings}, for information on escape sequences you can use in
  178. @code{@value{AS}} strings.
  179. @emph{Warning!} The HPPA version of @code{.string} differs from the
  180. usual @code{@value{AS}} definition: it does @emph{not} write a zero byte
  181. after copying @var{str}.
  182. @item .stringz "@var{str}"
  183. Like @code{.string}, but appends a zero byte after copying @var{str} to object
  184. file.
  185. @item .subspa @var{name} [ ,@var{params} ]
  186. @itemx .nsubspa @var{name} [ ,@var{params} ]
  187. Similar to @code{.space}, but selects a subsection @var{name} within the
  188. current section. You may only specify @var{params} when you create a
  189. subsection (in the first instance of @code{.subspa} for this @var{name}).
  190. If specified, the list @var{params} declares attributes of the subsection,
  191. identified by keywords. The keywords recognized are @samp{quad=@var{expr}}
  192. (``quadrant'' for this subsection), @samp{align=@var{expr}} (alignment for
  193. beginning of this subsection; a power of two), @samp{access=@var{expr}} (value
  194. for ``access rights'' field), @samp{sort=@var{expr}} (sorting order for this
  195. subspace in link), @samp{code_only} (subsection contains only code),
  196. @samp{unloadable} (subsection cannot be loaded into memory), @samp{comdat}
  197. (subsection is comdat), @samp{common} (subsection is common block),
  198. @samp{dup_comm} (subsection may have duplicate names), or @samp{zero}
  199. (subsection is all zeros, do not write in object file).
  200. @code{.nsubspa} always creates a new subspace with the given name, even
  201. if one with the same name already exists.
  202. @samp{comdat}, @samp{common} and @samp{dup_comm} can be used to implement
  203. various flavors of one-only support when using the SOM linker. The SOM
  204. linker only supports specific combinations of these flags. The details
  205. are not documented. A brief description is provided here.
  206. @samp{comdat} provides a form of linkonce support. It is useful for
  207. both code and data subspaces. A @samp{comdat} subspace has a key symbol
  208. marked by the @samp{is_comdat} flag or @samp{ST_COMDAT}. Only the first
  209. subspace for any given key is selected. The key symbol becomes universal
  210. in shared links. This is similar to the behavior of @samp{secondary_def}
  211. symbols.
  212. @samp{common} provides Fortran named common support. It is only useful
  213. for data subspaces. Symbols with the flag @samp{is_common} retain this
  214. flag in shared links. Referencing a @samp{is_common} symbol in a shared
  215. library from outside the library doesn't work. Thus, @samp{is_common}
  216. symbols must be output whenever they are needed.
  217. @samp{common} and @samp{dup_comm} together provide Cobol common support.
  218. The subspaces in this case must all be the same length. Otherwise, this
  219. support is similar to the Fortran common support.
  220. @samp{dup_comm} by itself provides a type of one-only support for code.
  221. Only the first @samp{dup_comm} subspace is selected. There is a rather
  222. complex algorithm to compare subspaces. Code symbols marked with the
  223. @samp{dup_common} flag are hidden. This support was intended for "C++
  224. duplicate inlines".
  225. A simplified technique is used to mark the flags of symbols based on
  226. the flags of their subspace. A symbol with the scope SS_UNIVERSAL and
  227. type ST_ENTRY, ST_CODE or ST_DATA is marked with the corresponding
  228. settings of @samp{comdat}, @samp{common} and @samp{dup_comm} from the
  229. subspace, respectively. This avoids having to introduce additional
  230. directives to mark these symbols. The HP assembler sets @samp{is_common}
  231. from @samp{common}. However, it doesn't set the @samp{dup_common} from
  232. @samp{dup_comm}. It doesn't have @samp{comdat} support.
  233. @item .version "@var{str}"
  234. Write @var{str} as version identifier in object code.
  235. @end table
  236. @node HPPA Opcodes
  237. @section Opcodes
  238. For detailed information on the HPPA machine instruction set, see
  239. @cite{PA-RISC Architecture and Instruction Set Reference Manual}
  240. (HP 09740-90039).