337 lines
12 KiB
HTML
337 lines
12 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<!-- This HTML file has been created by texi2html 1.52
|
|
from ../texi/as.texinfo on 24 April 1999 -->
|
|
|
|
<TITLE>Using as - HPPA Dependent Features</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
Go to the <A HREF="as_1.html">first</A>, <A HREF="as_14.html">previous</A>, <A HREF="as_16.html">next</A>, <A HREF="as_27.html">last</A> section, <A HREF="as_toc.html">table of contents</A>.
|
|
<P><HR><P>
|
|
|
|
|
|
<H1><A NAME="SEC189" HREF="as_toc.html#TOC189">HPPA Dependent Features</A></H1>
|
|
|
|
<P>
|
|
<A NAME="IDX569"></A>
|
|
|
|
</P>
|
|
|
|
|
|
<H2><A NAME="SEC190" HREF="as_toc.html#TOC190">Notes</A></H2>
|
|
<P>
|
|
As a back end for GNU CC <CODE>as</CODE> has been throughly tested and should
|
|
work extremely well. We have tested it only minimally on hand written assembly
|
|
code and no one has tested it much on the assembly output from the HP
|
|
compilers.
|
|
|
|
</P>
|
|
<P>
|
|
The format of the debugging sections has changed since the original
|
|
<CODE>as</CODE> port (version 1.3X) was released; therefore,
|
|
you must rebuild all HPPA objects and libraries with the new
|
|
assembler so that you can debug the final executable.
|
|
|
|
</P>
|
|
<P>
|
|
The HPPA <CODE>as</CODE> port generates a small subset of the relocations
|
|
available in the SOM and ELF object file formats. Additional relocation
|
|
support will be added as it becomes necessary.
|
|
|
|
</P>
|
|
|
|
|
|
<H2><A NAME="SEC191" HREF="as_toc.html#TOC191">Options</A></H2>
|
|
<P>
|
|
<CODE>as</CODE> has no machine-dependent command-line options for the HPPA.
|
|
|
|
</P>
|
|
<P>
|
|
<A NAME="IDX570"></A>
|
|
|
|
|
|
<H2><A NAME="SEC192" HREF="as_toc.html#TOC192">Syntax</A></H2>
|
|
<P>
|
|
The assembler syntax closely follows the HPPA instruction set
|
|
reference manual; assembler directives and general syntax closely follow the
|
|
HPPA assembly language reference manual, with a few noteworthy differences.
|
|
|
|
</P>
|
|
<P>
|
|
First, a colon may immediately follow a label definition. This is
|
|
simply for compatibility with how most assembly language programmers
|
|
write code.
|
|
|
|
</P>
|
|
<P>
|
|
Some obscure expression parsing problems may affect hand written code which
|
|
uses the <CODE>spop</CODE> instructions, or code which makes significant
|
|
use of the <CODE>!</CODE> line separator.
|
|
|
|
</P>
|
|
<P>
|
|
<CODE>as</CODE> is much less forgiving about missing arguments and other
|
|
similar oversights than the HP assembler. <CODE>as</CODE> notifies you
|
|
of missing arguments as syntax errors; this is regarded as a feature, not a
|
|
bug.
|
|
|
|
</P>
|
|
<P>
|
|
Finally, <CODE>as</CODE> allows you to use an external symbol without
|
|
explicitly importing the symbol. <EM>Warning:</EM> in the future this will be
|
|
an error for HPPA targets.
|
|
|
|
</P>
|
|
<P>
|
|
Special characters for HPPA targets include:
|
|
|
|
</P>
|
|
<P>
|
|
<SAMP>`;'</SAMP> is the line comment character.
|
|
|
|
</P>
|
|
<P>
|
|
<SAMP>`!'</SAMP> can be used instead of a newline to separate statements.
|
|
|
|
</P>
|
|
<P>
|
|
Since <SAMP>`$'</SAMP> has no special meaning, you may use it in symbol names.
|
|
|
|
</P>
|
|
|
|
|
|
<H2><A NAME="SEC193" HREF="as_toc.html#TOC193">Floating Point</A></H2>
|
|
<P>
|
|
<A NAME="IDX571"></A>
|
|
<A NAME="IDX572"></A>
|
|
The HPPA family uses IEEE floating-point numbers.
|
|
|
|
</P>
|
|
|
|
|
|
<H2><A NAME="SEC194" HREF="as_toc.html#TOC194">HPPA Assembler Directives</A></H2>
|
|
|
|
<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>
|
|
<P>
|
|
<A NAME="IDX573"></A>
|
|
<CODE>as</CODE> does <EM>not</EM> support the following assembler directives
|
|
described in the HP manual:
|
|
|
|
</P>
|
|
|
|
<PRE>
|
|
.endm .liston
|
|
.enter .locct
|
|
.leave .macro
|
|
.listoff
|
|
</PRE>
|
|
|
|
<P>
|
|
<A NAME="IDX574"></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>
|
|
<P>
|
|
<A NAME="IDX575"></A>
|
|
These are the additional directives in <CODE>as</CODE> for the HPPA:
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>.block <VAR>n</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>.blockz <VAR>n</VAR></CODE>
|
|
<DD>
|
|
Reserve <VAR>n</VAR> bytes of storage, and initialize them to zero.
|
|
|
|
<DT><CODE>.call</CODE>
|
|
<DD>
|
|
Mark the beginning of a procedure call. Only the special case with <EM>no
|
|
arguments</EM> is allowed.
|
|
|
|
<DT><CODE>.callinfo [ <VAR>param</VAR>=<VAR>value</VAR>, ... ] [ <VAR>flag</VAR>, ... ]</CODE>
|
|
<DD>
|
|
Specify a number of parameters and flags that define the environment for a
|
|
procedure.
|
|
|
|
<VAR>param</VAR> may be any of <SAMP>`frame'</SAMP> (frame size), <SAMP>`entry_gr'</SAMP> (end of
|
|
general register range), <SAMP>`entry_fr'</SAMP> (end of float register range),
|
|
<SAMP>`entry_sr'</SAMP> (end of space register range).
|
|
|
|
The values for <VAR>flag</VAR> are <SAMP>`calls'</SAMP> or <SAMP>`caller'</SAMP> (proc has
|
|
subroutines), <SAMP>`no_calls'</SAMP> (proc does not call subroutines), <SAMP>`save_rp'</SAMP>
|
|
(preserve return pointer), <SAMP>`save_sp'</SAMP> (proc preserves stack pointer),
|
|
<SAMP>`no_unwind'</SAMP> (do not unwind this proc), <SAMP>`hpux_int'</SAMP> (proc is interrupt
|
|
routine).
|
|
|
|
<DT><CODE>.code</CODE>
|
|
<DD>
|
|
Assemble into the standard section called <SAMP>`$TEXT$'</SAMP>, subsection
|
|
<SAMP>`$CODE$'</SAMP>.
|
|
|
|
<DT><CODE>.copyright "<VAR>string</VAR>"</CODE>
|
|
<DD>
|
|
In the SOM object format, insert <VAR>string</VAR> into the object code, marked as a
|
|
copyright string.
|
|
|
|
<DT><CODE>.copyright "<VAR>string</VAR>"</CODE>
|
|
<DD>
|
|
In the ELF object format, insert <VAR>string</VAR> into the object code, marked as a
|
|
version string.
|
|
|
|
<DT><CODE>.enter</CODE>
|
|
<DD>
|
|
Not yet supported; the assembler rejects programs containing this directive.
|
|
|
|
<DT><CODE>.entry</CODE>
|
|
<DD>
|
|
Mark the beginning of a procedure.
|
|
|
|
<DT><CODE>.exit</CODE>
|
|
<DD>
|
|
Mark the end of a procedure.
|
|
|
|
<DT><CODE>.export <VAR>name</VAR> [ ,<VAR>typ</VAR> ] [ ,<VAR>param</VAR>=<VAR>r</VAR> ]</CODE>
|
|
<DD>
|
|
Make a procedure <VAR>name</VAR> available to callers. <VAR>typ</VAR>, if present, must
|
|
be one of <SAMP>`absolute'</SAMP>, <SAMP>`code'</SAMP> (ELF only, not SOM), <SAMP>`data'</SAMP>,
|
|
<SAMP>`entry'</SAMP>, <SAMP>`data'</SAMP>, <SAMP>`entry'</SAMP>, <SAMP>`millicode'</SAMP>, <SAMP>`plabel'</SAMP>,
|
|
<SAMP>`pri_prog'</SAMP>, or <SAMP>`sec_prog'</SAMP>.
|
|
|
|
<VAR>param</VAR>, if present, provides either relocation information for the
|
|
procedure arguments and result, or a privilege level. <VAR>param</VAR> may be
|
|
<SAMP>`argw<VAR>n</VAR>'</SAMP> (where <VAR>n</VAR> ranges from <CODE>0</CODE> to <CODE>3</CODE>, and
|
|
indicates one of four one-word arguments); <SAMP>`rtnval'</SAMP> (the procedure's
|
|
result); or <SAMP>`priv_lev'</SAMP> (privilege level). For arguments or the result,
|
|
<VAR>r</VAR> specifies how to relocate, and must be one of <SAMP>`no'</SAMP> (not
|
|
relocatable), <SAMP>`gr'</SAMP> (argument is in general register), <SAMP>`fr'</SAMP> (in
|
|
floating point register), or <SAMP>`fu'</SAMP> (upper half of float register).
|
|
For <SAMP>`priv_lev'</SAMP>, <VAR>r</VAR> is an integer.
|
|
|
|
<DT><CODE>.half <VAR>n</VAR></CODE>
|
|
<DD>
|
|
Define a two-byte integer constant <VAR>n</VAR>; synonym for the portable
|
|
<CODE>as</CODE> directive <CODE>.short</CODE>.
|
|
|
|
<DT><CODE>.import <VAR>name</VAR> [ ,<VAR>typ</VAR> ]</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>.
|
|
|
|
<DT><CODE>.label <VAR>name</VAR></CODE>
|
|
<DD>
|
|
Define <VAR>name</VAR> as a label for the current assembly location.
|
|
|
|
<DT><CODE>.leave</CODE>
|
|
<DD>
|
|
Not yet supported; the assembler rejects programs containing this directive.
|
|
|
|
<DT><CODE>.origin <VAR>lc</VAR></CODE>
|
|
<DD>
|
|
Advance location counter to <VAR>lc</VAR>. Synonym for the <CODE></CODE>
|
|
portable directive <CODE>.org</CODE>.
|
|
|
|
<DT><CODE>.param <VAR>name</VAR> [ ,<VAR>typ</VAR> ] [ ,<VAR>param</VAR>=<VAR>r</VAR> ]</CODE>
|
|
<DD>
|
|
Similar to <CODE>.export</CODE>, but used for static procedures.
|
|
|
|
<DT><CODE>.proc</CODE>
|
|
<DD>
|
|
Use preceding the first statement of a procedure.
|
|
|
|
<DT><CODE>.procend</CODE>
|
|
<DD>
|
|
Use following the last statement of a procedure.
|
|
|
|
<DT><CODE><VAR>label</VAR> .reg <VAR>expr</VAR></CODE>
|
|
<DD>
|
|
Synonym for <CODE>.equ</CODE>; define <VAR>label</VAR> with the absolute expression
|
|
<VAR>expr</VAR> as its value.
|
|
|
|
<DT><CODE>.space <VAR>secname</VAR> [ ,<VAR>params</VAR> ]</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.
|
|
|
|
If specified, the list <VAR>params</VAR> declares attributes of the section,
|
|
identified by keywords. The keywords recognized are <SAMP>`spnum=<VAR>exp</VAR>'</SAMP>
|
|
(identify this section by the number <VAR>exp</VAR>, an absolute expression),
|
|
<SAMP>`sort=<VAR>exp</VAR>'</SAMP> (order sections according to this sort key when linking;
|
|
<VAR>exp</VAR> is an absolute expression), <SAMP>`unloadable'</SAMP> (section contains no
|
|
loadable data), <SAMP>`notdefined'</SAMP> (this section defined elsewhere), and
|
|
<SAMP>`private'</SAMP> (data in this section not available to other programs).
|
|
|
|
<DT><CODE>.spnum <VAR>secnam</VAR></CODE>
|
|
<DD>
|
|
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.)
|
|
|
|
<A NAME="IDX576"></A>
|
|
<DT><CODE>.string "<VAR>str</VAR>"</CODE>
|
|
<DD>
|
|
Copy the characters in the string <VAR>str</VAR> to the object file.
|
|
See section <A HREF="as_3.html#SEC33">Strings</A>, for information on escape sequences you can use in
|
|
<CODE>as</CODE> strings.
|
|
|
|
<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>.
|
|
|
|
<DT><CODE>.stringz "<VAR>str</VAR>"</CODE>
|
|
<DD>
|
|
Like <CODE>.string</CODE>, but appends a zero byte after copying <VAR>str</VAR> to object
|
|
file.
|
|
|
|
<DT><CODE>.subspa <VAR>name</VAR> [ ,<VAR>params</VAR> ]</CODE>
|
|
<DD>
|
|
<DT><CODE>.nsubspa <VAR>name</VAR> [ ,<VAR>params</VAR> ]</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>).
|
|
|
|
If specified, the list <VAR>params</VAR> declares attributes of the subsection,
|
|
identified by keywords. The keywords recognized are <SAMP>`quad=<VAR>expr</VAR>'</SAMP>
|
|
("quadrant" for this subsection), <SAMP>`align=<VAR>expr</VAR>'</SAMP> (alignment for
|
|
beginning of this subsection; a power of two), <SAMP>`access=<VAR>expr</VAR>'</SAMP> (value
|
|
for "access rights" field), <SAMP>`sort=<VAR>expr</VAR>'</SAMP> (sorting order for this
|
|
subspace in link), <SAMP>`code_only'</SAMP> (subsection contains only code),
|
|
<SAMP>`unloadable'</SAMP> (subsection cannot be loaded into memory), <SAMP>`common'</SAMP>
|
|
(subsection is common block), <SAMP>`dup_comm'</SAMP> (initialized data may have
|
|
duplicate names), or <SAMP>`zero'</SAMP> (subsection is all zeros, do not write in
|
|
object file).
|
|
|
|
<CODE>.nsubspa</CODE> always creates a new subspace with the given name, even
|
|
if one with the same name already exists.
|
|
|
|
<DT><CODE>.version "<VAR>str</VAR>"</CODE>
|
|
<DD>
|
|
Write <VAR>str</VAR> as version identifier in object code.
|
|
</DL>
|
|
|
|
|
|
|
|
<H2><A NAME="SEC195" HREF="as_toc.html#TOC195">Opcodes</A></H2>
|
|
<P>
|
|
For detailed information on the HPPA machine instruction set, see
|
|
<CITE>PA-RISC Architecture and Instruction Set Reference Manual</CITE>
|
|
(HP 09740-90039).
|
|
|
|
</P>
|
|
<P><HR><P>
|
|
Go to the <A HREF="as_1.html">first</A>, <A HREF="as_14.html">previous</A>, <A HREF="as_16.html">next</A>, <A HREF="as_27.html">last</A> section, <A HREF="as_toc.html">table of contents</A>.
|
|
</BODY>
|
|
</HTML>
|