1*1424dfb3Schristos@c Copyright (C) 1991-2020 Free Software Foundation, Inc. 2*1424dfb3Schristos@c This is part of the GAS manual. 3*1424dfb3Schristos@c For copying conditions, see the file as.texinfo. 4*1424dfb3Schristos@page 5*1424dfb3Schristos@node HPPA-Dependent 6*1424dfb3Schristos@chapter HPPA Dependent Features 7*1424dfb3Schristos 8*1424dfb3Schristos@cindex support 9*1424dfb3Schristos@menu 10*1424dfb3Schristos* HPPA Notes:: Notes 11*1424dfb3Schristos* HPPA Options:: Options 12*1424dfb3Schristos* HPPA Syntax:: Syntax 13*1424dfb3Schristos* HPPA Floating Point:: Floating Point 14*1424dfb3Schristos* HPPA Directives:: HPPA Machine Directives 15*1424dfb3Schristos* HPPA Opcodes:: Opcodes 16*1424dfb3Schristos@end menu 17*1424dfb3Schristos 18*1424dfb3Schristos@node HPPA Notes 19*1424dfb3Schristos@section Notes 20*1424dfb3SchristosAs a back end for @sc{gnu} @sc{cc} @code{@value{AS}} has been thoroughly tested and should 21*1424dfb3Schristoswork extremely well. We have tested it only minimally on hand written assembly 22*1424dfb3Schristoscode and no one has tested it much on the assembly output from the HP 23*1424dfb3Schristoscompilers. 24*1424dfb3Schristos 25*1424dfb3SchristosThe format of the debugging sections has changed since the original 26*1424dfb3Schristos@code{@value{AS}} port (version 1.3X) was released; therefore, 27*1424dfb3Schristosyou must rebuild all HPPA objects and libraries with the new 28*1424dfb3Schristosassembler so that you can debug the final executable. 29*1424dfb3Schristos 30*1424dfb3SchristosThe HPPA @code{@value{AS}} port generates a small subset of the relocations 31*1424dfb3Schristosavailable in the SOM and ELF object file formats. Additional relocation 32*1424dfb3Schristossupport will be added as it becomes necessary. 33*1424dfb3Schristos 34*1424dfb3Schristos@node HPPA Options 35*1424dfb3Schristos@section Options 36*1424dfb3Schristos@code{@value{AS}} has no machine-dependent command-line options for the HPPA. 37*1424dfb3Schristos 38*1424dfb3Schristos@cindex HPPA Syntax 39*1424dfb3Schristos@node HPPA Syntax 40*1424dfb3Schristos@section Syntax 41*1424dfb3SchristosThe assembler syntax closely follows the HPPA instruction set 42*1424dfb3Schristosreference manual; assembler directives and general syntax closely follow the 43*1424dfb3SchristosHPPA assembly language reference manual, with a few noteworthy differences. 44*1424dfb3Schristos 45*1424dfb3SchristosFirst, a colon may immediately follow a label definition. This is 46*1424dfb3Schristossimply for compatibility with how most assembly language programmers 47*1424dfb3Schristoswrite code. 48*1424dfb3Schristos 49*1424dfb3SchristosSome obscure expression parsing problems may affect hand written code which 50*1424dfb3Schristosuses the @code{spop} instructions, or code which makes significant 51*1424dfb3Schristosuse of the @code{!} line separator. 52*1424dfb3Schristos 53*1424dfb3Schristos@code{@value{AS}} is much less forgiving about missing arguments and other 54*1424dfb3Schristossimilar oversights than the HP assembler. @code{@value{AS}} notifies you 55*1424dfb3Schristosof missing arguments as syntax errors; this is regarded as a feature, not a 56*1424dfb3Schristosbug. 57*1424dfb3Schristos 58*1424dfb3SchristosFinally, @code{@value{AS}} allows you to use an external symbol without 59*1424dfb3Schristosexplicitly importing the symbol. @emph{Warning:} in the future this will be 60*1424dfb3Schristosan error for HPPA targets. 61*1424dfb3Schristos 62*1424dfb3SchristosSpecial characters for HPPA targets include: 63*1424dfb3Schristos 64*1424dfb3Schristos@samp{;} is the line comment character. 65*1424dfb3Schristos 66*1424dfb3Schristos@samp{!} can be used instead of a newline to separate statements. 67*1424dfb3Schristos 68*1424dfb3SchristosSince @samp{$} has no special meaning, you may use it in symbol names. 69*1424dfb3Schristos 70*1424dfb3Schristos@node HPPA Floating Point 71*1424dfb3Schristos@section Floating Point 72*1424dfb3Schristos@cindex floating point, HPPA (@sc{ieee}) 73*1424dfb3Schristos@cindex HPPA floating point (@sc{ieee}) 74*1424dfb3SchristosThe HPPA family uses @sc{ieee} floating-point numbers. 75*1424dfb3Schristos 76*1424dfb3Schristos@node HPPA Directives 77*1424dfb3Schristos@section HPPA Assembler Directives 78*1424dfb3Schristos 79*1424dfb3Schristos@code{@value{AS}} for the HPPA supports many additional directives for 80*1424dfb3Schristoscompatibility with the native assembler. This section describes them only 81*1424dfb3Schristosbriefly. For detailed information on HPPA-specific assembler directives, see 82*1424dfb3Schristos@cite{HP9000 Series 800 Assembly Language Reference Manual} (HP 92432-90001). 83*1424dfb3Schristos 84*1424dfb3Schristos@cindex HPPA directives not supported 85*1424dfb3Schristos@code{@value{AS}} does @emph{not} support the following assembler directives 86*1424dfb3Schristosdescribed in the HP manual: 87*1424dfb3Schristos 88*1424dfb3Schristos@example 89*1424dfb3Schristos.endm .liston 90*1424dfb3Schristos.enter .locct 91*1424dfb3Schristos.leave .macro 92*1424dfb3Schristos.listoff 93*1424dfb3Schristos@end example 94*1424dfb3Schristos 95*1424dfb3Schristos@cindex @code{.param} on HPPA 96*1424dfb3SchristosBeyond those implemented for compatibility, @code{@value{AS}} supports one 97*1424dfb3Schristosadditional assembler directive for the HPPA: @code{.param}. It conveys 98*1424dfb3Schristosregister argument locations for static functions. Its syntax closely follows 99*1424dfb3Schristosthe @code{.export} directive. 100*1424dfb3Schristos 101*1424dfb3Schristos@cindex HPPA-only directives 102*1424dfb3SchristosThese are the additional directives in @code{@value{AS}} for the HPPA: 103*1424dfb3Schristos 104*1424dfb3Schristos@table @code 105*1424dfb3Schristos@item .block @var{n} 106*1424dfb3Schristos@itemx .blockz @var{n} 107*1424dfb3SchristosReserve @var{n} bytes of storage, and initialize them to zero. 108*1424dfb3Schristos 109*1424dfb3Schristos@item .call 110*1424dfb3SchristosMark the beginning of a procedure call. Only the special case with @emph{no 111*1424dfb3Schristosarguments} is allowed. 112*1424dfb3Schristos 113*1424dfb3Schristos@item .callinfo [ @var{param}=@var{value}, @dots{} ] [ @var{flag}, @dots{} ] 114*1424dfb3SchristosSpecify a number of parameters and flags that define the environment for a 115*1424dfb3Schristosprocedure. 116*1424dfb3Schristos 117*1424dfb3Schristos@var{param} may be any of @samp{frame} (frame size), @samp{entry_gr} (end of 118*1424dfb3Schristosgeneral register range), @samp{entry_fr} (end of float register range), 119*1424dfb3Schristos@samp{entry_sr} (end of space register range). 120*1424dfb3Schristos 121*1424dfb3SchristosThe values for @var{flag} are @samp{calls} or @samp{caller} (proc has 122*1424dfb3Schristossubroutines), @samp{no_calls} (proc does not call subroutines), @samp{save_rp} 123*1424dfb3Schristos(preserve return pointer), @samp{save_sp} (proc preserves stack pointer), 124*1424dfb3Schristos@samp{no_unwind} (do not unwind this proc), @samp{hpux_int} (proc is interrupt 125*1424dfb3Schristosroutine). 126*1424dfb3Schristos 127*1424dfb3Schristos@item .code 128*1424dfb3SchristosAssemble into the standard section called @samp{$TEXT$}, subsection 129*1424dfb3Schristos@samp{$CODE$}. 130*1424dfb3Schristos 131*1424dfb3Schristos@ifset SOM 132*1424dfb3Schristos@item .copyright "@var{string}" 133*1424dfb3SchristosIn the SOM object format, insert @var{string} into the object code, marked as a 134*1424dfb3Schristoscopyright string. 135*1424dfb3Schristos@end ifset 136*1424dfb3Schristos 137*1424dfb3Schristos@ifset ELF 138*1424dfb3Schristos@item .copyright "@var{string}" 139*1424dfb3SchristosIn the ELF object format, insert @var{string} into the object code, marked as a 140*1424dfb3Schristosversion string. 141*1424dfb3Schristos@end ifset 142*1424dfb3Schristos 143*1424dfb3Schristos@item .enter 144*1424dfb3SchristosNot yet supported; the assembler rejects programs containing this directive. 145*1424dfb3Schristos 146*1424dfb3Schristos@item .entry 147*1424dfb3SchristosMark the beginning of a procedure. 148*1424dfb3Schristos 149*1424dfb3Schristos@item .exit 150*1424dfb3SchristosMark the end of a procedure. 151*1424dfb3Schristos 152*1424dfb3Schristos@item .export @var{name} [ ,@var{typ} ] [ ,@var{param}=@var{r} ] 153*1424dfb3SchristosMake a procedure @var{name} available to callers. @var{typ}, if present, must 154*1424dfb3Schristosbe one of @samp{absolute}, @samp{code} (ELF only, not SOM), @samp{data}, 155*1424dfb3Schristos@samp{entry}, @samp{data}, @samp{entry}, @samp{millicode}, @samp{plabel}, 156*1424dfb3Schristos@samp{pri_prog}, or @samp{sec_prog}. 157*1424dfb3Schristos 158*1424dfb3Schristos@var{param}, if present, provides either relocation information for the 159*1424dfb3Schristosprocedure arguments and result, or a privilege level. @var{param} may be 160*1424dfb3Schristos@samp{argw@var{n}} (where @var{n} ranges from @code{0} to @code{3}, and 161*1424dfb3Schristosindicates one of four one-word arguments); @samp{rtnval} (the procedure's 162*1424dfb3Schristosresult); or @samp{priv_lev} (privilege level). For arguments or the result, 163*1424dfb3Schristos@var{r} specifies how to relocate, and must be one of @samp{no} (not 164*1424dfb3Schristosrelocatable), @samp{gr} (argument is in general register), @samp{fr} (in 165*1424dfb3Schristosfloating point register), or @samp{fu} (upper half of float register). 166*1424dfb3SchristosFor @samp{priv_lev}, @var{r} is an integer. 167*1424dfb3Schristos 168*1424dfb3Schristos@item .half @var{n} 169*1424dfb3SchristosDefine a two-byte integer constant @var{n}; synonym for the portable 170*1424dfb3Schristos@code{@value{AS}} directive @code{.short}. 171*1424dfb3Schristos 172*1424dfb3Schristos@item .import @var{name} [ ,@var{typ} ] 173*1424dfb3SchristosConverse of @code{.export}; make a procedure available to call. The arguments 174*1424dfb3Schristosuse the same conventions as the first two arguments for @code{.export}. 175*1424dfb3Schristos 176*1424dfb3Schristos@item .label @var{name} 177*1424dfb3SchristosDefine @var{name} as a label for the current assembly location. 178*1424dfb3Schristos 179*1424dfb3Schristos@item .leave 180*1424dfb3SchristosNot yet supported; the assembler rejects programs containing this directive. 181*1424dfb3Schristos 182*1424dfb3Schristos@item .origin @var{lc} 183*1424dfb3SchristosAdvance location counter to @var{lc}. Synonym for the @code{@value{AS}} 184*1424dfb3Schristosportable directive @code{.org}. 185*1424dfb3Schristos 186*1424dfb3Schristos@item .param @var{name} [ ,@var{typ} ] [ ,@var{param}=@var{r} ] 187*1424dfb3Schristos@c Not in HP manual; @sc{gnu} HPPA extension 188*1424dfb3SchristosSimilar to @code{.export}, but used for static procedures. 189*1424dfb3Schristos 190*1424dfb3Schristos@item .proc 191*1424dfb3SchristosUse preceding the first statement of a procedure. 192*1424dfb3Schristos 193*1424dfb3Schristos@item .procend 194*1424dfb3SchristosUse following the last statement of a procedure. 195*1424dfb3Schristos 196*1424dfb3Schristos@item @var{label} .reg @var{expr} 197*1424dfb3Schristos@c ?? Not in HP manual (Jan 1988 vn) 198*1424dfb3SchristosSynonym for @code{.equ}; define @var{label} with the absolute expression 199*1424dfb3Schristos@var{expr} as its value. 200*1424dfb3Schristos 201*1424dfb3Schristos@item .space @var{secname} [ ,@var{params} ] 202*1424dfb3SchristosSwitch to section @var{secname}, creating a new section by that name if 203*1424dfb3Schristosnecessary. You may only use @var{params} when creating a new section, not 204*1424dfb3Schristoswhen switching to an existing one. @var{secname} may identify a section by 205*1424dfb3Schristosnumber rather than by name. 206*1424dfb3Schristos 207*1424dfb3SchristosIf specified, the list @var{params} declares attributes of the section, 208*1424dfb3Schristosidentified by keywords. The keywords recognized are @samp{spnum=@var{exp}} 209*1424dfb3Schristos(identify this section by the number @var{exp}, an absolute expression), 210*1424dfb3Schristos@samp{sort=@var{exp}} (order sections according to this sort key when linking; 211*1424dfb3Schristos@var{exp} is an absolute expression), @samp{unloadable} (section contains no 212*1424dfb3Schristosloadable data), @samp{notdefined} (this section defined elsewhere), and 213*1424dfb3Schristos@samp{private} (data in this section not available to other programs). 214*1424dfb3Schristos 215*1424dfb3Schristos@item .spnum @var{secnam} 216*1424dfb3Schristos@c ?? Not in HP manual (Jan 1988) 217*1424dfb3SchristosAllocate four bytes of storage, and initialize them with the section number of 218*1424dfb3Schristosthe section named @var{secnam}. (You can define the section number with the 219*1424dfb3SchristosHPPA @code{.space} directive.) 220*1424dfb3Schristos 221*1424dfb3Schristos@cindex @code{string} directive on HPPA 222*1424dfb3Schristos@item .string "@var{str}" 223*1424dfb3SchristosCopy the characters in the string @var{str} to the object file. 224*1424dfb3Schristos@xref{Strings,,Strings}, for information on escape sequences you can use in 225*1424dfb3Schristos@code{@value{AS}} strings. 226*1424dfb3Schristos 227*1424dfb3Schristos@emph{Warning!} The HPPA version of @code{.string} differs from the 228*1424dfb3Schristosusual @code{@value{AS}} definition: it does @emph{not} write a zero byte 229*1424dfb3Schristosafter copying @var{str}. 230*1424dfb3Schristos 231*1424dfb3Schristos@item .stringz "@var{str}" 232*1424dfb3SchristosLike @code{.string}, but appends a zero byte after copying @var{str} to object 233*1424dfb3Schristosfile. 234*1424dfb3Schristos 235*1424dfb3Schristos@item .subspa @var{name} [ ,@var{params} ] 236*1424dfb3Schristos@itemx .nsubspa @var{name} [ ,@var{params} ] 237*1424dfb3SchristosSimilar to @code{.space}, but selects a subsection @var{name} within the 238*1424dfb3Schristoscurrent section. You may only specify @var{params} when you create a 239*1424dfb3Schristossubsection (in the first instance of @code{.subspa} for this @var{name}). 240*1424dfb3Schristos 241*1424dfb3SchristosIf specified, the list @var{params} declares attributes of the subsection, 242*1424dfb3Schristosidentified by keywords. The keywords recognized are @samp{quad=@var{expr}} 243*1424dfb3Schristos(``quadrant'' for this subsection), @samp{align=@var{expr}} (alignment for 244*1424dfb3Schristosbeginning of this subsection; a power of two), @samp{access=@var{expr}} (value 245*1424dfb3Schristosfor ``access rights'' field), @samp{sort=@var{expr}} (sorting order for this 246*1424dfb3Schristossubspace in link), @samp{code_only} (subsection contains only code), 247*1424dfb3Schristos@samp{unloadable} (subsection cannot be loaded into memory), @samp{comdat} 248*1424dfb3Schristos(subsection is comdat), @samp{common} (subsection is common block), 249*1424dfb3Schristos@samp{dup_comm} (subsection may have duplicate names), or @samp{zero} 250*1424dfb3Schristos(subsection is all zeros, do not write in object file). 251*1424dfb3Schristos 252*1424dfb3Schristos@code{.nsubspa} always creates a new subspace with the given name, even 253*1424dfb3Schristosif one with the same name already exists. 254*1424dfb3Schristos 255*1424dfb3Schristos@samp{comdat}, @samp{common} and @samp{dup_comm} can be used to implement 256*1424dfb3Schristosvarious flavors of one-only support when using the SOM linker. The SOM 257*1424dfb3Schristoslinker only supports specific combinations of these flags. The details 258*1424dfb3Schristosare not documented. A brief description is provided here. 259*1424dfb3Schristos 260*1424dfb3Schristos@samp{comdat} provides a form of linkonce support. It is useful for 261*1424dfb3Schristosboth code and data subspaces. A @samp{comdat} subspace has a key symbol 262*1424dfb3Schristosmarked by the @samp{is_comdat} flag or @samp{ST_COMDAT}. Only the first 263*1424dfb3Schristossubspace for any given key is selected. The key symbol becomes universal 264*1424dfb3Schristosin shared links. This is similar to the behavior of @samp{secondary_def} 265*1424dfb3Schristossymbols. 266*1424dfb3Schristos 267*1424dfb3Schristos@samp{common} provides Fortran named common support. It is only useful 268*1424dfb3Schristosfor data subspaces. Symbols with the flag @samp{is_common} retain this 269*1424dfb3Schristosflag in shared links. Referencing a @samp{is_common} symbol in a shared 270*1424dfb3Schristoslibrary from outside the library doesn't work. Thus, @samp{is_common} 271*1424dfb3Schristossymbols must be output whenever they are needed. 272*1424dfb3Schristos 273*1424dfb3Schristos@samp{common} and @samp{dup_comm} together provide Cobol common support. 274*1424dfb3SchristosThe subspaces in this case must all be the same length. Otherwise, this 275*1424dfb3Schristossupport is similar to the Fortran common support. 276*1424dfb3Schristos 277*1424dfb3Schristos@samp{dup_comm} by itself provides a type of one-only support for code. 278*1424dfb3SchristosOnly the first @samp{dup_comm} subspace is selected. There is a rather 279*1424dfb3Schristoscomplex algorithm to compare subspaces. Code symbols marked with the 280*1424dfb3Schristos@samp{dup_common} flag are hidden. This support was intended for "C++ 281*1424dfb3Schristosduplicate inlines". 282*1424dfb3Schristos 283*1424dfb3SchristosA simplified technique is used to mark the flags of symbols based on 284*1424dfb3Schristosthe flags of their subspace. A symbol with the scope SS_UNIVERSAL and 285*1424dfb3Schristostype ST_ENTRY, ST_CODE or ST_DATA is marked with the corresponding 286*1424dfb3Schristossettings of @samp{comdat}, @samp{common} and @samp{dup_comm} from the 287*1424dfb3Schristossubspace, respectively. This avoids having to introduce additional 288*1424dfb3Schristosdirectives to mark these symbols. The HP assembler sets @samp{is_common} 289*1424dfb3Schristosfrom @samp{common}. However, it doesn't set the @samp{dup_common} from 290*1424dfb3Schristos@samp{dup_comm}. It doesn't have @samp{comdat} support. 291*1424dfb3Schristos 292*1424dfb3Schristos@item .version "@var{str}" 293*1424dfb3SchristosWrite @var{str} as version identifier in object code. 294*1424dfb3Schristos@end table 295*1424dfb3Schristos 296*1424dfb3Schristos@node HPPA Opcodes 297*1424dfb3Schristos@section Opcodes 298*1424dfb3SchristosFor detailed information on the HPPA machine instruction set, see 299*1424dfb3Schristos@cite{PA-RISC Architecture and Instruction Set Reference Manual} 300*1424dfb3Schristos(HP 09740-90039). 301