x86 Assembly Language Reference Manual

Values and Symbol Types

This section presents the values and symbol types that the assembler uses.

Values

Values are represented in the assembler by numerals which can be faithfully represented in standard two's complement binary positional notation using 32 bits. All integer arithmetic is performed using 32 bits of precision. Note, however, that the values used in an x86 instruction may require 8, 16, or 32 bits.

Symbols

A symbol has a value and a symbol type, each of which is either specified explicitly by an assignment statement or implicitly from context. Refer to the next section for the regular definition of the expressions of a symbol.

The following symbols are reserved by the assembler:

.Commonly referred to as dot. This is the location counter while assembling a program. It takes on the current location in the text, data, or bss section.


.text

This symbol is of type text. It is used to label the beginning of a .text section in the program being assembled.


.data

This symbol is of type data. It is used to label the beginning of a data section in the program being assembled.


.bss

This symbol is of type bss. It is used to label the beginning of a .bss section in the program being assembled.


.init

This is used with C++ programs which require constructors.


.fini

This is used with C++ programs which require destructors.

Symbol Types

Symbol type is one of the following:


undefined

A value is of undefined symbol type if it has not yet been defined. Example instances of undefined symbol types are forward references and externals.


absolute

A value is of absolute symbol type it does not change with relocation. Example instances of absolute symbol types are numeric constants and expressions whose proper sub-expressions are themselves all absolute.


text

A value is of text symbol type if it is relative to the .text section.


data

A value is of data symbol type if it is relative to the .data section.


bss

A value is of bss symbol type if it is relative to the .bss section.

You can give any of these symbol types the attribute EXTERNAL.

Sections

Five of the symbol types are defined with respect to certain sections of the object file into which the assembler translates the source file. This section describes symbol types.

If the assembler translates a particular assembly language statement into a machine language instruction or into a data allocation, the translation is associated with one of the following five sections of the object file into which the assembler is translating the source file:

Table 1-1 Translations and their Associations

Section 

Purpose 

text

This is an initialized section. Normally, it is read-only and contains code from a program. It may also contain read-only tables 

data

This is an initialized section. Normally, it is readable and writable. It contains initialized data. These can be scalars or tables. 

bss

This is an initialized section. Space is not allocated for this segment in the object file. 

init

This is used with C++ programs that require constructors. 

fini

This is used by C++ programs that require destructors. 

An optional section, .comment, may also be produced.

The section associated with the translated statement is .text unless the original statement occurs after a section control pseudo operation has directed the assembler to associate the statement with another section.