44
Chapter 8. Assembler Directives
8.4.
.ascii "string"
. . .
.ascii
expects zero or more string literals (Section 4.6.1.1 Strings) separated by commas. It assem
bles each string (with no automatic trailing zero byte) into consecutive addresses.
8.5.
.asciz "string"
. . .
.asciz
is just like
.ascii
, but each string is followed by a zero byte. The "z" in
.asciz
stands for
"zero".
8.6.
.balign[wl] abs expr, abs expr, abs expr
Pad the location counter (in the current subsection) to a particular storage boundary. The first expres
sion (which must be absolute) is the alignment request in bytes. For example
.balign 8
advances
the location counter until it is a multiple of 8. If the location counter is already a multiple of 8, no
change is needed.
The second expression (also absolute) gives the fill value to be stored in the padding bytes. It (and
the comma) may be omitted. If it is omitted, the padding bytes are normally zero. However, on some
systems, if the section is marked as containing code and the fill value is omitted, the space is filled
with no op instructions.
The third expression is also absolute, and is also optional. If it is present, it is the maximum number of
bytes that should be skipped by this alignment directive. If doing the alignment would require skipping
more bytes than the specified maximum, then the alignment is not done at all. You can omit the fill
value (the second argument) entirely by simply using two commas after the required alignment; this
can be useful if you want the alignment to be filled with no op instructions when appropriate.
The
.balignw
and
.balignl
directives are variants of the
.balign
directive. The
.balignw
di
rective treats the fill pattern as a two byte word value. The
.balignl
directives treats the fill pattern
as a four byte longword value. For example,
.balignw 4,0x368d
will align to a multiple of 4. If it
skips two bytes, they will be filled in with the value 0x368d (the exact placement of the bytes depends
upon the endianness of the processor). If it skips 1 or 3 bytes, the fill value is undefined.
8.7.
.byte expressions
.byte
expects zero or more expressions, separated by commas. Each expression is assembled into
the next byte.
8.8.
.comm symbol, length
.comm
declares a common symbol named
symbol
. When linking, a common symbol in one object
file may be merged with a defined or common symbol of the same name in another object file. If
ld
does not see a definition for the symbol just one or more common symbols then it will allocate
length
bytes of uninitialized memory.
length
must be an absolute expression. If
ld
sees multiple
common symbols with the same name, and they do not all have the same size, it will allocate space
using the largest size.
When using ELF, the
.comm
directive takes an optional third argument. This is the desired alignment
of the symbol, specified as a byte boundary (for example, an alignment of 16 means that the least
significant 4 bits of the address should be zero). The alignment must be an absolute expression, and
it must be a power of two. If
ld
allocates uninitialized memory for the common symbol, it will use
the alignment when placing the symbol. If no alignment is specified,
as
will set the alignment to the
largest power of two less than or equal to the size of the symbol, up to a maximum of 16.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved