Predefined Section Directives

The predefined section directives define and switch between commonly-used sections. A predefined section directive creates a new section with the default flags and type attributes, and makes that section the current section.

The predefined section directive mnemonics are the same as the section names. The assembler generates section names in lower case, even though directive mnemonics are not case-sensitive.

On some platforms the assembler automatically creates a local symbol with a "section" type attribute for each defined section in the object file. See the Symbol Type Directive section for more information about symbol types.

The linker combines sections with the same name, flags and type attributes. The linker creates two separate output sections for sections with the same name, but different flags and type attributes.

To define a section without the default flags and type attributes, use the .section directive.

The predefined section directives cannot define a new section using the same name as a previously-defined section.

Table Predefined Section Directives below lists the predefined section directives, and their default flags and type attributes. A predefined section directive can have the same name as a section name.

 

Predefined Section Directives

Directive/Section Name

Flags

Type

Usage

.text

"ax"

"progbits"

Read-only object code.

.data

"wa"

"progbits"

Read-write initialized long data.

.sdata

"was"

"progbits"

Read-write initialized short data.

.bss

"wa"

"nobits"

Read-write uninitialized long data.

.sbss

"was"

"nobits"

Read-write uninitialized short data.

.rodata

"a"

"progbits"

Read-only long data (literals). ELF (Unix) format only.

.comment

" "

"progbits"

Comments in the object file. ELF format, and COFF format only when used with the -Q y command-line option.