www.delorie.com/gnu/docs/binutils/as_135.html   search  
 
Buy GNU books!


Using as

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.67 .section name (ELF version)

This is one of the ELF section stack manipulation directives. The others are .subsection (see section 7.79 .subsection name), .pushsection (see section 7.61 .pushsection name , subsection), .popsection (see section 7.56 .popsection), and .previous (see section 7.55 .previous).

For ELF targets, the .section directive is used like this:

 
.section name [, "flags"[, @type[, @entsize]]]

The optional flags argument is a quoted string which may contain any combination of the following characters:

a
section is allocatable
w
section is writable
x
section is executable
M
section is mergeable
S
section contains zero terminated strings

The optional type argument may contain one of the following constants:

@progbits
section contains data
@nobits
section does not contain data (i.e., section only occupies space)

If flags contains M flag, type argument must be specified as well as entsize argument. Sections with M flag but not S flag must contain fixed size constants, each entsize octets long. Sections with both M and S must contain zero terminated strings where each character is entsize bytes long. The linker may remove duplicates within sections with the same name, same entity size and same flags.

If no flags are specified, the default flags depend upon the section name. If the section name is not recognized, the default will be for the section to have none of the above flags: it will not be allocated in memory, nor writable, nor executable. The section will contain data.

For ELF targets, the assembler supports another type of .section directive for compatibility with the Solaris assembler:

 
.section "name"[, flags...]

Note that the section name is quoted. There may be a sequence of comma separated flags:

#alloc
section is allocatable
#write
section is writable
#execinstr
section is executable

This directive replaces the current section and subsection. The replaced section and subsection are pushed onto the section stack. See the contents of the gas testsuite directory gas/testsuite/gas/elf for some examples of how this directive and the other section stack directives work.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003