Next: Uleb128, Previous: Title, Up: Pseudo Ops

### 7.112 `.type`

This directive is used to set the type of a symbol.

#### COFF Version

For COFF targets, this directive is permitted only within `.def`/`.endef` pairs. It is used like this:

         .type int

This records the integer int as the type attribute of a symbol table entry.

#### ELF Version

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

         .type name , type description

This sets the type of symbol name to be either a function symbol or an object symbol. There are five different syntaxes supported for the type description field, in order to provide compatibility with various other assemblers.

Because some of the characters used in these syntaxes (such as ‘`@`’ and ‘`#`’) are comment characters for some architectures, some of the syntaxes below do not work on all architectures. The first variant will be accepted by the GNU assembler on all architectures so that variant should be used for maximum portability, if you do not need to assemble your code with other assemblers.

The syntaxes supported are:

           .type <name> STT_<TYPE_IN_UPPER_CASE>
           .type <name>,#<type>
           .type <name>,@<type>
           .type <name>,%<type>
           .type <name>,"<type>"

The types supported are:

`STT_FUNC`
`function`
  Mark the symbol as being a function name.
`STT_GNU_IFUNC`
`gnu_indirect_function`
  Mark the symbol as an indirect function when evaluated during reloc processing. (This is only supported on Linux targeted assemblers).
`STT_OBJECT`
`object`
  Mark the symbol as being a data object.
`STT_TLS`
`tls_object`
  Mark the symbol as being a thead-local data object.
`STT_COMMON`
`common`
  Mark the symbol as being a common data object.
`STT_NOTYPE`
`notype`
  Does not mark the symbol in any way. It is supported just for completeness.
`gnu_unique_object`
  Marks the symbol as being a globally unique data object. The dynamic linker will make sure that in the entire process there is just one symbol with this name and type in use. (This is only supported on Linux targeted assemblers).

Note: Some targets support extra types in addition to those listed above.