Initial revision
[binutils.git] / gas / doc / c-hppa.texi
blob5fa535fd7834ea410ce21adf93f10225ccf797fd
1 @c Copyright (C) 1991, 1992, 1993, 1994, 1995 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
8 @cindex  support
9 @menu
10 * HPPA Notes::                Notes
11 * HPPA Options::              Options
12 * HPPA Syntax::               Syntax
13 * HPPA Floating Point::       Floating Point
14 * HPPA Directives::           HPPA Machine Directives
15 * HPPA Opcodes::              Opcodes
16 @end menu
18 @node HPPA Notes
19 @section Notes
20 As a back end for @sc{gnu} @sc{cc} @code{@value{AS}} has been throughly tested and should
21 work extremely well.  We have tested it only minimally on hand written assembly
22 code and no one has tested it much on the assembly output from the HP
23 compilers.
25 The format of the debugging sections has changed since the original
26 @code{@value{AS}} port (version 1.3X) was released; therefore,
27 you must rebuild all HPPA objects and libraries with the new 
28 assembler so that you can debug the final executable.
30 The HPPA @code{@value{AS}} port generates a small subset of the relocations
31 available in the SOM and ELF object file formats.  Additional relocation
32 support will be added as it becomes necessary.  
34 @node HPPA Options
35 @section Options
36 @code{@value{AS}} has no machine-dependent command-line options for the HPPA.
38 @cindex HPPA Syntax
39 @node HPPA Syntax
40 @section Syntax
41 The assembler syntax closely follows the HPPA instruction set
42 reference manual; assembler directives and general syntax closely follow the
43 HPPA assembly language reference manual, with a few noteworthy differences.
45 First, a colon may immediately follow a label definition.  This is
46 simply for compatibility with how most assembly language programmers
47 write code.
49 Some obscure expression parsing problems may affect hand written code which
50 uses the @code{spop} instructions, or code which makes significant
51 use of the @code{!} line separator.
53 @code{@value{AS}} is much less forgiving about missing arguments and other
54 similar oversights than the HP assembler.  @code{@value{AS}} notifies you
55 of missing arguments as syntax errors; this is regarded as a feature, not a
56 bug.
58 Finally, @code{@value{AS}} allows you to use an external symbol without
59 explicitly importing the symbol.  @emph{Warning:} in the future this will be
60 an error for HPPA targets.
62 Special characters for HPPA targets include:
64 @samp{;} is the line comment character.
66 @samp{!} can be used instead of a newline to separate statements.
68 Since @samp{$} has no special meaning, you may use it in symbol names.
70 @node HPPA Floating Point
71 @section Floating Point
72 @cindex floating point, HPPA (@sc{ieee})
73 @cindex HPPA floating point (@sc{ieee})
74 The HPPA family uses @sc{ieee} floating-point numbers.
76 @node HPPA Directives
77 @section HPPA Assembler Directives
79 @code{@value{AS}} for the HPPA supports many additional directives for
80 compatibility with the native assembler.  This section describes them only
81 briefly.  For detailed information on HPPA-specific assembler directives, see
82 @cite{HP9000 Series 800 Assembly Language Reference Manual} (HP 92432-90001).
84 @cindex HPPA directives not supported
85 @code{@value{AS}} does @emph{not} support the following assembler directives
86 described in the HP manual:
88 @example
89 .endm           .liston
90 .enter          .locct
91 .leave          .macro  
92 .listoff
93 @end example
95 @cindex @code{.param} on HPPA
96 Beyond those implemented for compatibility, @code{@value{AS}} supports one
97 additional assembler directive for the HPPA: @code{.param}.  It conveys
98 register argument locations for static functions.  Its syntax closely follows
99 the @code{.export} directive.
101 @cindex HPPA-only directives
102 These are the additional directives in @code{@value{AS}} for the HPPA:
104 @table @code
105 @item .block @var{n}
106 @itemx .blockz @var{n}
107 Reserve @var{n} bytes of storage, and initialize them to zero.
109 @item .call 
110 Mark the beginning of a procedure call.  Only the special case with @emph{no
111 arguments} is allowed.
113 @item .callinfo [ @var{param}=@var{value}, @dots{} ]  [ @var{flag}, @dots{} ]
114 Specify a number of parameters and flags that define the environment for a
115 procedure.
117 @var{param} may be any of @samp{frame} (frame size), @samp{entry_gr} (end of
118 general register range), @samp{entry_fr} (end of float register range),
119 @samp{entry_sr} (end of space register range).
121 The values for @var{flag} are @samp{calls} or @samp{caller} (proc has
122 subroutines), @samp{no_calls} (proc does not call subroutines), @samp{save_rp}
123 (preserve return pointer), @samp{save_sp} (proc preserves stack pointer),
124 @samp{no_unwind} (do not unwind this proc), @samp{hpux_int} (proc is interrupt
125 routine).
127 @item .code
128 Assemble into the standard section called @samp{$TEXT$}, subsection
129 @samp{$CODE$}.
131 @ifset SOM
132 @item .copyright "@var{string}"
133 In the SOM object format, insert @var{string} into the object code, marked as a
134 copyright string.
135 @end ifset
137 @ifset ELF
138 @item .copyright "@var{string}"
139 In the ELF object format, insert @var{string} into the object code, marked as a
140 version string.
141 @end ifset
143 @item .enter
144 Not yet supported; the assembler rejects programs containing this directive.
146 @item .entry
147 Mark the beginning of a procedure.
149 @item .exit
150 Mark the end of a procedure.
152 @item .export @var{name} [ ,@var{typ} ]  [ ,@var{param}=@var{r} ]
153 Make a procedure @var{name} available to callers.  @var{typ}, if present, must
154 be one of @samp{absolute}, @samp{code} (ELF only, not SOM), @samp{data},
155 @samp{entry}, @samp{data}, @samp{entry}, @samp{millicode}, @samp{plabel},
156 @samp{pri_prog}, or @samp{sec_prog}.
158 @var{param}, if present, provides either relocation information for the
159 procedure arguments and result, or a privilege level.  @var{param} may be
160 @samp{argw@var{n}} (where @var{n} ranges from @code{0} to @code{3}, and
161 indicates one of four one-word arguments); @samp{rtnval} (the procedure's
162 result); or @samp{priv_lev} (privilege level).  For arguments or the result,
163 @var{r} specifies how to relocate, and must be one of @samp{no} (not
164 relocatable), @samp{gr} (argument is in general register), @samp{fr} (in
165 floating point register), or @samp{fu} (upper half of float register).
166 For @samp{priv_lev}, @var{r} is an integer.
168 @item .half @var{n}
169 Define a two-byte integer constant @var{n}; synonym for the portable
170 @code{@value{AS}} directive @code{.short}.
172 @item .import @var{name} [ ,@var{typ} ]
173 Converse of @code{.export}; make a procedure available to call.  The arguments
174 use the same conventions as the first two arguments for @code{.export}.
176 @item .label @var{name}
177 Define @var{name} as a label for the current assembly location.
179 @item .leave
180 Not yet supported; the assembler rejects programs containing this directive.
182 @item .origin @var{lc}
183 Advance location counter to @var{lc}. Synonym for the @code{@value{as}}
184 portable directive @code{.org}.
186 @item .param @var{name} [ ,@var{typ} ]  [ ,@var{param}=@var{r} ]
187 @c Not in HP manual; @sc{gnu} HPPA extension
188 Similar to @code{.export}, but used for static procedures.
190 @item .proc
191 Use preceding the first statement of a procedure.
193 @item .procend
194 Use following the last statement of a procedure.
196 @item @var{label} .reg @var{expr}
197 @c ?? Not in HP manual (Jan 1988 vn)
198 Synonym for @code{.equ}; define @var{label} with the absolute expression
199 @var{expr} as its value.
201 @item .space @var{secname} [ ,@var{params} ]
202 Switch to section @var{secname}, creating a new section by that name if
203 necessary.  You may only use @var{params} when creating a new section, not
204 when switching to an existing one.  @var{secname} may identify a section by
205 number rather than by name.
207 If specified, the list @var{params} declares attributes of the section,
208 identified by keywords.  The keywords recognized are @samp{spnum=@var{exp}}
209 (identify this section by the number @var{exp}, an absolute expression),
210 @samp{sort=@var{exp}} (order sections according to this sort key when linking;
211 @var{exp} is an absolute expression), @samp{unloadable} (section contains no
212 loadable data), @samp{notdefined} (this section defined elsewhere), and
213 @samp{private} (data in this section not available to other programs).
215 @item .spnum @var{secnam}
216 @c ?? Not in HP manual (Jan 1988)
217 Allocate four bytes of storage, and initialize them with the section number of
218 the section named @var{secnam}.  (You can define the section number with the
219 HPPA @code{.space} directive.)
221 @cindex @code{string} directive on HPPA
222 @item .string "@var{str}"
223 Copy the characters in the string @var{str} to the object file.
224 @xref{Strings,,Strings}, for information on escape sequences you can use in
225 @code{@value{AS}} strings.
227 @emph{Warning!} The HPPA version of @code{.string} differs from the
228 usual @code{@value{AS}} definition: it does @emph{not} write a zero byte
229 after copying @var{str}.
231 @item .stringz "@var{str}"
232 Like @code{.string}, but appends a zero byte after copying @var{str} to object
233 file.
235 @item .subspa @var{name} [ ,@var{params} ]
236 @itemx .nsubspa @var{name} [ ,@var{params} ]
237 Similar to @code{.space}, but selects a subsection @var{name} within the
238 current section.  You may only specify @var{params} when you create a
239 subsection (in the first instance of @code{.subspa} for this @var{name}).
241 If specified, the list @var{params} declares attributes of the subsection,
242 identified by keywords.  The keywords recognized are @samp{quad=@var{expr}}
243 (``quadrant'' for this subsection), @samp{align=@var{expr}} (alignment for
244 beginning of this subsection; a power of two), @samp{access=@var{expr}} (value
245 for ``access rights'' field), @samp{sort=@var{expr}} (sorting order for this
246 subspace in link), @samp{code_only} (subsection contains only code),
247 @samp{unloadable} (subsection cannot be loaded into memory), @samp{common}
248 (subsection is common block), @samp{dup_comm} (initialized data may have
249 duplicate names), or @samp{zero} (subsection is all zeros, do not write in
250 object file).
252 @code{.nsubspa} always creates a new subspace with the given name, even
253 if one with the same name already exists.
255 @item .version "@var{str}"
256 Write @var{str} as version identifier in object code.
257 @end table
259 @node HPPA Opcodes
260 @section Opcodes
261 For detailed information on the HPPA machine instruction set, see
262 @cite{PA-RISC Architecture and Instruction Set Reference Manual} 
263 (HP 09740-90039).