34
Chapter 5. Sections and Relocation
Each subsection is zero padded up to a multiple of four bytes. (Subsections may be padded a different
amount on different flavors of
as
.)
Subsections appear in your object file in numeric order, lowest numbered to highest. (All this to be
compatible with other people's assemblers.) The object file contains no representation of subsections;
ld
and other programs that manipulate object files see no trace of them. They just see all your text
subsections as a text section, and all your data subsections as a data section.
To specify which subsection you want subsequent statements assembled into, use a numeric argument
to specify it, in a
.text expression
or a
.data expression
statement. When generating COFF
output, you can also use an extra subsection argument with arbitrary named sections:
.section
name, expression
. When generating ELF output, you can also use the
.subsection
directive (Sec 
tion 8.89
.subsection name
) to specify a subsection:
.subsection expression
.
Expression
should be an absolute expression. (Chapter 7 Expressions.) If you just say
.text
then
.text 0
is
assumed. Likewise
.data
means
.data 0
. Assembly begins in
text 0
. For instance:
.text 0
# The default subsection is text 0 anyway.
.ascii "This lives in the first text subsection. *"
.text 1
.ascii "But this lives in the second text subsection."
.data 0
.ascii "This lives in the data section,"
.ascii "in the first data subsection."
.text 0
.ascii "This lives in the first text section,"
.ascii "immediately following the asterisk (*)."
Each section has a location counter incremented by one for every byte assembled into that section.
Because subsections are merely a convenience restricted to
as
there is no concept of a subsection
location counter. There is no way to directly manipulate a location counter  but the
.align
directive
changes it, and any label definition captures its current value. The location counter of the section
where statements are being assembled is said to be the active location counter.
5.5. bss Section
The bss section is used for local common variable storage. You may allocate address space in the bss
section, but you may not dictate data to load into it before your program executes. When your program
starts running, all the contents of the bss section are zeroed bytes.
The
.lcomm
pseudo op defines a symbol in the bss section; see Section 8.52
.lcomm symbol,
length
.
The
.comm
pseudo op may be used to declare a common symbol, which is another form of uninitial 
ized symbol; see Section 8.8
.comm symbol, length
.
When assembling for a target which supports multiple sections, such as ELF or COFF, you may switch
into the
.bss
section and define symbols as usual; see Section 8.78
.section name
. You may only
assemble zero values into the section. Typically the section will only contain symbol definitions and
.skip
directives (Section 8.84
.skip size, fill
).






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

canadian web hosting

 

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