Skip Navigation Links | |
Exit Print View | |
SPARC Assembly Language Reference Manual Oracle Solaris 11.1 Information Library |
2. Executable and Linking Format
3. Directives and Pseudo-Operations
3.1.1 Section Control Directives
3.1.2 Symbol Attribute Directives
3.1.4 Data Generating Directives
3.5.1 Example 1: Binding to C Variables
3.5.2 Example 2: Generating Ident Strings
3.5.3 Example 3: Data Alignment, Size, Scope, and Type
3.5.4 Example 4: "Hello World"
6. Writing Functions -- The SPARC ABI
7. Assembler Inline Functions and __asm Code
A. Using the Assembler Command Line
Turns off the effect of the preceding .noalias pseudo-op. (Compiler-generated only.)
Aligns the location counter on a boundary where ((“location counter” mod boundary)==0); boundary may be any power of 2.
.ascii string[, string, ..., string]
Generates the given sequences of ASCII characters.
.asciz string[, string, ..., string]
Generates the given sequences of ASCII characters. This pseudo-op appends a null (zero) byte to each string.
.byte 8bitval[, 8bitval, ..., 8bitval]
Generates (a sequence of) initialized bytes in the current segment.
.common symbol, size[, sect_name][, alignment]
Provides a tentative definition of symbol. Size bytes are allocated for the object represented by symbol.
If the symbol is not defined in the input file and is declared to be local to the file, the symbol is allocated in sect_name and its location is optionally aligned to a multiple of alignment. If sect_name is not given, the symbol is allocated in the uninitialized data section (bss). Currently, only .bss is supported for the section name. (.data is not currently supported.)
If the symbol is not defined in the input file and is declared to be global, the SPARC link editor allocates storage for the symbol, depending on the definition of symbol_name in other files. Global is the default binding for common symbols.
If the symbol is defined in the input file, the definition specifies the location of the symbol and the tentative definition is overridden.
.double 0rfloatval[, 0rfloatval, ..., 0rfloatval]
Generates (a sequence of) initialized double-precision floating-point values in the current segment. floatval is a string acceptable to atof(3); that is, an optional sign followed by a non-empty string of digits with optional decimal point and optional exponent.
Suppresses assembler complaints about the next instruction presence in a delay slot when used in the delay slot of a Control Transfer Instruction (CTI).
Some instructions should not be in the delay slot of a CTI. See the SPARC Architecture Manual for details.
.exported symbol[, symbol, ..., symbol]
Declares each symbol in the list to have exported linker scope. Ensures that these symbols remain global and are visible to all modules. References to them are bound at runtime.This visibility can not be demoted, or eliminated by any other symbol visibility technique. A symbol with STB_LOCAL binding will not have STV_EXPORTED visibility.
Creates a symbol table entry where string is the symbol name and STT_FILE is the symbol table type. string specifies the name of the source file associated with the object file.
.global symbol[, symbol, ..., symbol]
(Spelling .globl is also accepted.) Declares each symbol in the list to be global; that is, each symbol is either defined externally or defined in the input file and accessible in other files; default bindings for the symbol are overridden.
A global symbol definition in one file will satisfy an undefined reference to the same global symbol in another file.
Multiple definitions of a defined global symbol is not allowed. If a defined global symbol has more than one definition, an error will occur.
A global pseudo-op does not need to occur before a definition, or tentative definition, of the specified symbol.
Note - This pseudo-op by itself does not define the symbol.
.group group, section, #comdat
Adds section to a COMDAT group. Refer to the Oracle Solaris Linker and Libraries Guide for information about COMDAT.
.half 16bitval[, 16bitval, ..., 16bitval]
Generates (a sequence of) initialized halfwords in the current segment. The location counter must already be aligned on a halfword boundary (use .align 2).
.hidden symbol[, symbol, ..., symbol]
Declares each symbol in the list to have hidden linker scoping. All references to one of these listed symbols within a dynamic module bind to the definition within that module. These symbols are not visible outside the module, and are given linker scope STV_HIDDEN.
Generates the null terminated string in a comment section. This operation is equivalent to:
.pushsection .comment .asciz string .popsection
.internal symbol[, symbol, ..., symbol]
Same as .hidden
.local symbol[, symbol, ..., symbol]
Declares each symbol in the list to be local; that is, each symbol is defined in the input file and not accessible in other files; default bindings for the symbol are overridden. These symbols take precedence over weak and global symbols.
Since local symbols are not accessible to other files, local symbols of the same name may exist in multiple files.
Note - This pseudo-op by itself does not define the symbol.
Registers %reg1 and %reg2 will not alias each other (that is, point to the same destination) until a .alias pseudo-op is issued. (Compiler-generated only.)
Defines the end of a block of instruction. The instructions in the block may not be permuted. This pseudo-op has no effect if:
The block of instruction has been previously terminated by a Control Transfer Instruction (CTI) or a label
There is no preceding .volatile pseudo-op
.nword 64bitval[, 64bitval, ..., 64bitval]
If assembling with -m32, the assembler interprets the instruction as .word. If -m64 the assembler interprets the instruction as .xword.
Removes the top section from the section stack. The new section on the top of the stack becomes the current section. This pseudo-op and its corresponding .pushsection command allow you to switch back and forth between the named sections.
Signals the beginning of a procedure (that is, a unit of optimization) to the peephole optimizer in the SPARC assembler; n specifies which registers will contain the return value upon return from the procedure. (Compiler-generated only.)
.protected symbol[, symbol, ..., symbol]
Declares each symbol in the list to have protected linker scoping and visible to all external objects. References to these symbols from within the object are bound at link-edit, thus preventing runtime interposition. This visibility scope can be demoted, or eliminated by other symbol visibility techniques. This scope definition has the same affect as a symbol with STV_PROTECTED visibility.
.pushsection sect_name[, attributes]
Moves the named section to the top of the section stack. This new top section then becomes the current section. This pseudo-op and its corresponding .popsection command allow you to switch back and forth between the named sections.
.quad 0rfloatval[, 0rfloatval, ..., 0rfloatval]
Generates (a sequence of) initialized quad-precision floating-point values in the current segment. floatval is a string acceptable to atof(3); that is, an optional sign followed by a non-empty string of digits with optional decimal point and optional exponent.
Note - The .quad command currently generates quad-precision values with only double-precision significance.
.register %g{2|3|6|7}, {#scratch|symbol_name}
With SPARC-V9, the four registers %g2, %g3, %g6, %g7, should not be used unless explicitly declared on a .register pseudo-op. When assembling under -m64, the SPARC assembler will issue an error message if it detects the use of %g2 or %g3 registers without a .register declaration. A .register declaration is not required for %g6 or %g7, but its appearance does invoke checking for proper use of these registers.
Specify the #scratch option when the register is used as a scratch register:
.register %g3, #scratch
Or, declare the global register with a symbolic name, as in:
.register %g2, xyz
A .register declaration must appear before the first use of the register. Linking objects containing conflicting register will cause the linker to issue error messages.
.reserve symbol, size[, sect_name[, alignment]]
Defines symbol, and reserves size bytes of space for it in the sect_name. This operation is equivalent to:
.pushsection sect_name .align alignment symbol: .skip size .popsection
If a section is not specified, space is reserved in the current segment.
.section section_name[, attributes]
Makes the specified section the current section.
The assembler maintains a section stack which is manipulated by the section control directives. The current section is the section that is currently on top of the stack. This pseudo-op changes the top of the section stack.
If section_name does not exist, a new section with the specified name and attributes is created.
If section_name is a non-reserved section, attributes must be included the first time it is specified by the .section directive.
See the sections 2.1.2 Predefined User Sections and 2.1.3 Predefined Non-User Sections for a detailed description of the reserved sections. SeeTable 2-1 for a list of the section attribute flags.
Attributes can be:
#write | #alloc | #execinstr
This pseudo-op is currently supported for compatibility with existing SunOS 4.1 SPARC assembly language programs. This pseudo-op has been replaced by the .section pseudo-op.
Changes the current section to one of the predefined user sections. The assembler will interpret the following SunOS 4.1 SPARC assembly directive: to be the same as the following Oracle Solaris SPARC assembly directive:
.seg text, .seg data, .seg data1, .seg bss, .section .text, .section .data, .section .data1, .section .bss.
Predefined user section names are changed in Oracle Solaris .
.single 0rfloatval[, 0rfloatval, ..., 0rfloatval]
Generates (a sequence of) initialized single-precision floating-point values in the current segment.
Note - This operation does not align automatically.
Declares the symbol size to be expr. expr must be an absolute expression.
Increments the location counter by n, which allocates n bytes of empty space in the current segment.
The pseudo-op is used by Solaris 2.x SPARCompilers only to pass debugging information to the symbolic debuggers.
The pseudo-op is used by Solaris 2.x SPARCompilers only to pass debugging information to the symbolic debuggers.
.symbolic symbol[, symbol, ..., symbol]
Same as .protected
.tls_common symbol, size[, sect_name][, alignment]
Similar to .common, provides a tentative definition of symbol. Size bytes are allocated in thread local storage (TLS) for the object represented by symbol. See .common for details.
.type symbol[, symbol, ..., symbol], type[, visibility]
Declares the type of symbol, where type can be:
#object #tls_object #function #no_type
and where visibility can be one of:
#hidden #protected #eliminate #singleton #exported #internal
.uahalf 16bitval[, 16bitval, ..., 16bitval]
Generates a (sequence of) 16-bit values.
Note - This operation does not align automatically.
.uaword 32bitval[, 32bitval, ..., 32bitval]
Generates a (sequence of) 32-bit values.
Note - This operation does not align automatically.
Identifies the minimum assembler version necessary to assemble the input file. You can use this pseudo-op to ensure assembler-compiler compatibility. If string indicates a newer version of the assembler than this version of the assembler, a fatal error message is displayed and the SPARC assembler exits.
Defines the beginning of a block of instructions in the section that may not be changed. This directive is obsolete and no longer has any affect.
.weak symbol[, symbol, ..., symbol]
Declares each symbol in the list to be defined either externally, or in the input file and accessible to other files; default bindings of the symbol are overridden by this directive.
Note the following:
A weak symbol definition in one file will satisfy an undefined reference to a global symbol of the same name in another file.
Unresolved weak symbols have a default value of zero; the link editor does not resolve these symbols.
If a weak symbol has the same name as a defined global symbol, the weak symbol is ignored and no error results.
Note - This pseudo-op does not itself define the symbol.
.word 32bitval[, 32bitval, ..., 32bitval]
Generates (a sequence of) initialized words in the current segment.
Note - This operation does not align automatically.
.xword 64bitval[, 64bitval, ..., 64bitval]
Generates (a sequence of) initialized 64-bit values in the current segment.
Note - This operation does not align automatically.
The pseudo-op is used by Solaris 2.x SPARCompilers only to pass debugging information to the symbolic debuggers.
Assigns the value of expr to symbol.