Download Compilation Systems Volume 1 (Tools)

Transcript
Assembler and Assembly Language
Section Switching
2
{text | .text}
The location counter is changed to the next available value in the .text section.
Before the first section directive is encountered in an input file, assembly is by
default directed into the .text section.
{data | .data}
The location counter is changed to the next available value in the .data section.
section identifier[,attributes][,sectiontype]
Succeeding bytes are assembled into the section named identifier. One or more flags
comprise a quoted character string of attributes for the section. The attributes flags
are optional. The attributes are indicated in the sh_flags entry of the section
header. The assembler permits another optional parameter, sectiontype, which is
indicated in the sh_type entry in the section header. This section is created, if it
does not already exist, with the given attributes and sectiontype. If the same section
is specified by more than one section directive, the last value of attributes and
sectiontype is assigned to the section.
Any combination of the following flags can be specified in the attributes string.
w
Set the SHF_WRITE flag (0x1)
x
Set the SHF_ALLOC flag (0x2)
a
Set the SHF_EXECINSTR flag (0x4)
The assembler permits one of the following flags to be specified as sectiontype. The
assembler requires that the given value be preceded with an @.
progbits
The section may contain data
nobits
The section contains no data
symtab
The section is a symbol table
strtab
The section is a string table
note
The section is a comment section
vendor
The section is a Concurrent Computer Corporation
vendor section
A hexadecimal integer constant may also be specified as sectiontype, provided it is
preceded by # or @, as described above.
Some of the flags do not have meaning in a PowerMAX OS environment. They are
provided for compatibility with other systems.
As an example,
2-13