| <html lang="en"> |
| <head> |
| <title>Type - Using as</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Using as"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Pseudo-Ops.html#Pseudo-Ops" title="Pseudo Ops"> |
| <link rel="prev" href="Title.html#Title" title="Title"> |
| <link rel="next" href="Uleb128.html#Uleb128" title="Uleb128"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| This file documents the GNU Assembler "as". |
| |
| Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 2000, 2001, 2002, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 |
| or any later version published by the Free Software Foundation; |
| with no Invariant Sections, with no Front-Cover Texts, and with no |
| Back-Cover Texts. A copy of the license is included in the |
| section entitled ``GNU Free Documentation License''. |
| |
| --> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| <link rel="stylesheet" type="text/css" href="../cs.css"> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="Type"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="Uleb128.html#Uleb128">Uleb128</a>, |
| Previous: <a rel="previous" accesskey="p" href="Title.html#Title">Title</a>, |
| Up: <a rel="up" accesskey="u" href="Pseudo-Ops.html#Pseudo-Ops">Pseudo Ops</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">7.112 <code>.type</code></h3> |
| |
| <p>This directive is used to set the type of a symbol. |
| |
| <!-- only print the extra heading if both COFF and ELF are set --> |
| <h4 class="subheading">COFF Version</h4> |
| |
| <p><a name="index-COFF-symbol-type-484"></a><a name="index-symbol-type_002c-COFF-485"></a><a name="index-g_t_0040code_007btype_007d-directive-_0028COFF-version_0029-486"></a>For COFF targets, this directive is permitted only within |
| <code>.def</code>/<code>.endef</code> pairs. It is used like this: |
| |
| <pre class="smallexample"> .type <var>int</var> |
| </pre> |
| <p>This records the integer <var>int</var> as the type attribute of a symbol table |
| entry. |
| |
| <!-- only print the extra heading if both COFF and ELF are set --> |
| <h4 class="subheading">ELF Version</h4> |
| |
| <p><a name="index-ELF-symbol-type-487"></a><a name="index-symbol-type_002c-ELF-488"></a><a name="index-g_t_0040code_007btype_007d-directive-_0028ELF-version_0029-489"></a>For ELF targets, the <code>.type</code> directive is used like this: |
| |
| <pre class="smallexample"> .type <var>name</var> , <var>type description</var> |
| </pre> |
| <p>This sets the type of symbol <var>name</var> to be either a |
| function symbol or an object symbol. There are five different syntaxes |
| supported for the <var>type description</var> field, in order to provide |
| compatibility with various other assemblers. |
| |
| <p>Because some of the characters used in these syntaxes (such as ‘<samp><span class="samp">@</span></samp>’ and |
| ‘<samp><span class="samp">#</span></samp>’) 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. |
| |
| <p>The syntaxes supported are: |
| |
| <pre class="smallexample"> .type <name> STT_<TYPE_IN_UPPER_CASE> |
| .type <name>,#<type> |
| .type <name>,@<type> |
| .type <name>,%<type> |
| .type <name>,"<type>" |
| </pre> |
| <p>The types supported are: |
| |
| <dl> |
| <dt><code>STT_FUNC</code><dt><code>function</code><dd>Mark the symbol as being a function name. |
| |
| <br><dt><code>STT_GNU_IFUNC</code><dt><code>gnu_indirect_function</code><dd>Mark the symbol as an indirect function when evaluated during reloc |
| processing. (This is only supported on Linux targeted assemblers). |
| |
| <br><dt><code>STT_OBJECT</code><dt><code>object</code><dd>Mark the symbol as being a data object. |
| |
| <br><dt><code>STT_TLS</code><dt><code>tls_object</code><dd>Mark the symbol as being a thead-local data object. |
| |
| <br><dt><code>STT_COMMON</code><dt><code>common</code><dd>Mark the symbol as being a common data object. |
| |
| <br><dt><code>STT_NOTYPE</code><dt><code>notype</code><dd>Does not mark the symbol in any way. It is supported just for completeness. |
| |
| <br><dt><code>gnu_unique_object</code><dd>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). |
| |
| </dl> |
| |
| <p>Note: Some targets support extra types in addition to those listed above. |
| |
| </body></html> |
| |