x86 Assembly Language Reference Manual

Pseudo Operations

The pseudo-operations listed in this section are supported by the x86 assembler.

General Pseudo Operations

Below is a list of the pseudo operations supported by the assembler. This is followed by a separate listing of pseudo operations included for the benefit of the debuggers (dbx(1)).


.align val

The align pseudo op causes the next data generated to be aligned modulo val. val should be a positive integer value.


.bcd val

The .bcd pseudo op generates a packed decimal (80-bit) value into the current section. This is not valid for the .bss section. val is a nonfloating-point constant.


.bss

The .bss pseudo op changes the current section to .bss.


.bss tag, bytes

Define symbol tag in the .bss section and add bytes to the value of dot for .bss. This does not change the current section to .bss. bytes must be a positive integer value.


.byte val [, val]

The .byte pseudo op generates initialized bytes into the current section. This is not valid for .bss. Each val must be an 8-bit value.


.comm name, expr [, alignment]

The .comm pseudo op allocates storage in the .data section. The storage is referenced by the symbol name, and has a size in bytes of expr. expr must be a positive integer. name cannot be predefined. If the alignment is given, the address of the name is aligned to a multiple of alignments.


.data

The data pseudo op changes the current section to .data.


.double val

The .double pseudo op generates an 80387 64 bit floating-point constant (IEEE 754) into the current section. Not valid in the .bss section. val is a floating-point constant. val 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.


.even

The .even pseudo op aligns the current program counter (.) to an even boundary.


.file "string"

The .file op 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.


.float val

The .float pseudo op generates an 80387 32 bit floating-point constant (IEEE 754) into the current section. This is not valid in the .bss section. val is a floating-point constant. val 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.


.globl symbol [, symbol]*

The globl op 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 satisfies 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 occurs.


Note -

This pseudo-op by itself does not define the symbol.



.ident "string"

The .ident pseudo op creates an entry in the comment section containing string. string is any sequence of characters, not including the double quote (").


.lcomm name, expr

The .lcomm pseudo op allocates storage in the .bss section. The storage is referenced by the symbol name, and has a size of expr. name cannot be predefined, and expr must be a positive integer type. If the alignment is given, the address of name is aligned to a multiple of alignment.


.local 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.

Because 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.



.long val

The .long pseudo op generates a long integer (32-bit, two's complement value) into the current section. This pseudo op is not valid for the .bss section. val is a nonfloating-point constant.


.nonvolatile

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


.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.


.set name, expr

The .set pseudo op sets the value of symbol name to expr. This is equivalent to an assignment.


.string "str"

This pseudo op places the characters in str into the object module at the current location and terminates the string with a null. The string must be enclosed in double quotes (""). This pseudo op is not valid for the .bss section.


.text

The .text pseudo op defines the current section as .text.


.value expr [,expr]

The .value pseudo op is used to generate an initialized word (16-bit, two's complement value) into the current section. This pseudo op is not valid in the .bss section. Each expr must be a 16-bit value.


.version string

The .version pseudo op puts the C compiler version number into the .comment section.


.volatile

Defines the beginning of a block of instruction. The instructions in the section may not be changed. The block of instruction should end at a .nonvolatile pseudo-op and should not contain any Control Transfer Instructions (CTI) or labels. The volatile block of instructions is terminated after the last instruction preceding a CTI or label.


.weak 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.

  • A weak symbol definition in one file satisfies 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.



symbol =expr

Assigns the value of expr to symbol.

Symbol Definition Pseudo Operations


.def name

The .def pseudo op starts a symbolic description for symbol name. See endef. name is a symbol name.


.dim expr [,expr]

The .dim pseudo op is used with the .def pseudo op. If the name of a .def is an array, the expressions give the dimensions; up to four dimensions are accepted. The type of each expression should be positive.


.endef

The .endef pseudo op is the ending bracket for a .def.


.file name

The .file pseudo op is the source file name. Only one is allowed per source file. This must be the first line in an assembly file.


.line expr

The .line pseudo op is used with the .def pseudo op. It defines the source line number of the definition of symbol name in the .def. expr should yield a positive value.


.ln line [,addr]

This pseudo op provides the relative source line number to the beginning of a function. It is used to pass information through to sdb.


.scl expr

The .scl pseudo op is used with the .def pseudo op. Within the .def it gives name the storage class of expr. The type of expr should be positive.


.size expr

The .size pseudo op is used with the .def pseudo op. If the name of a .def is an object such as a structure or an array, this gives it a total size of expr. expr must be a positive integer.


.stabs name type 0 desc value


.stabn type 0 desc value

The .stabs and .stabn pseudo ops are debugger directives generated by the C compiler when the -g option are used. name provides the symbol table name and type structure. type identifies the type of symbolic information (i.e., source file, global symbol, or source line). desc specifies the number of bytes occupied by a variable or type, or the nesting level for a scope symbol. value specifies an address or an offset.


.tag str

The .tag pseudo op is used in conjunction with a previously defined .def pseudo op. If the name of a .def is a structure or a union, str should be the name of that structure or union tag defined in a previous .def-.endef pair.


.type expr

The .type pseudo op is used within a .def-.endef pair. It gives name the C compiler type representation expr.


.val expr

The .val pseudo op is used with a .def-.endef pair. It gives name (in the .def) the value of expr. The type of expr determines the section for name.