1<html lang="en"> 2<head> 3<title>Type - Using as</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Using as"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Pseudo-Ops.html#Pseudo-Ops" title="Pseudo Ops"> 9<link rel="prev" href="Title.html#Title" title="Title"> 10<link rel="next" href="Uleb128.html#Uleb128" title="Uleb128"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<!-- 13This file documents the GNU Assembler "as". 14 15Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 162000, 2001, 2002, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, 17Inc. 18 19Permission is granted to copy, distribute and/or modify this document 20under the terms of the GNU Free Documentation License, Version 1.3 21or any later version published by the Free Software Foundation; 22with no Invariant Sections, with no Front-Cover Texts, and with no 23Back-Cover Texts. A copy of the license is included in the 24section entitled ``GNU Free Documentation License''. 25 26--> 27<meta http-equiv="Content-Style-Type" content="text/css"> 28<style type="text/css"><!-- 29 pre.display { font-family:inherit } 30 pre.format { font-family:inherit } 31 pre.smalldisplay { font-family:inherit; font-size:smaller } 32 pre.smallformat { font-family:inherit; font-size:smaller } 33 pre.smallexample { font-size:smaller } 34 pre.smalllisp { font-size:smaller } 35 span.sc { font-variant:small-caps } 36 span.roman { font-family:serif; font-weight:normal; } 37 span.sansserif { font-family:sans-serif; font-weight:normal; } 38--></style> 39<link rel="stylesheet" type="text/css" href="../cs.css"> 40</head> 41<body> 42<div class="node"> 43<a name="Type"></a> 44<p> 45Next: <a rel="next" accesskey="n" href="Uleb128.html#Uleb128">Uleb128</a>, 46Previous: <a rel="previous" accesskey="p" href="Title.html#Title">Title</a>, 47Up: <a rel="up" accesskey="u" href="Pseudo-Ops.html#Pseudo-Ops">Pseudo Ops</a> 48<hr> 49</div> 50 51<h3 class="section">7.113 <code>.type</code></h3> 52 53<p>This directive is used to set the type of a symbol. 54 55<!-- only print the extra heading if both COFF and ELF are set --> 56<h4 class="subheading">COFF Version</h4> 57 58 <p><a name="index-COFF-symbol-type-485"></a><a name="index-symbol-type_002c-COFF-486"></a><a name="index-g_t_0040code_007btype_007d-directive-_0028COFF-version_0029-487"></a>For COFF targets, this directive is permitted only within 59<code>.def</code>/<code>.endef</code> pairs. It is used like this: 60 61<pre class="smallexample"> .type <var>int</var> 62</pre> 63 <p>This records the integer <var>int</var> as the type attribute of a symbol table 64entry. 65 66<!-- only print the extra heading if both COFF and ELF are set --> 67<h4 class="subheading">ELF Version</h4> 68 69 <p><a name="index-ELF-symbol-type-488"></a><a name="index-symbol-type_002c-ELF-489"></a><a name="index-g_t_0040code_007btype_007d-directive-_0028ELF-version_0029-490"></a>For ELF targets, the <code>.type</code> directive is used like this: 70 71<pre class="smallexample"> .type <var>name</var> , <var>type description</var> 72</pre> 73 <p>This sets the type of symbol <var>name</var> to be either a 74function symbol or an object symbol. There are five different syntaxes 75supported for the <var>type description</var> field, in order to provide 76compatibility with various other assemblers. 77 78 <p>Because some of the characters used in these syntaxes (such as ‘<samp><span class="samp">@</span></samp>’ and 79‘<samp><span class="samp">#</span></samp>’) are comment characters for some architectures, some of the syntaxes 80below do not work on all architectures. The first variant will be accepted by 81the GNU assembler on all architectures so that variant should be used for 82maximum portability, if you do not need to assemble your code with other 83assemblers. 84 85 <p>The syntaxes supported are: 86 87<pre class="smallexample"> .type <name> STT_<TYPE_IN_UPPER_CASE> 88 .type <name>,#<type> 89 .type <name>,@<type> 90 .type <name>,%<type> 91 .type <name>,"<type>" 92</pre> 93 <p>The types supported are: 94 95 <dl> 96<dt><code>STT_FUNC</code><dt><code>function</code><dd>Mark the symbol as being a function name. 97 98 <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 99processing. (This is only supported on assemblers targeting GNU systems). 100 101 <br><dt><code>STT_OBJECT</code><dt><code>object</code><dd>Mark the symbol as being a data object. 102 103 <br><dt><code>STT_TLS</code><dt><code>tls_object</code><dd>Mark the symbol as being a thead-local data object. 104 105 <br><dt><code>STT_COMMON</code><dt><code>common</code><dd>Mark the symbol as being a common data object. 106 107 <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. 108 109 <br><dt><code>gnu_unique_object</code><dd>Marks the symbol as being a globally unique data object. The dynamic linker 110will make sure that in the entire process there is just one symbol with this 111name and type in use. (This is only supported on assemblers targeting GNU 112systems). 113 114 </dl> 115 116 <p>Note: Some targets support extra types in addition to those listed above. 117 118 </body></html> 119 120