| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <!-- This file documents the GNU Assembler "as". |
| |
| Copyright (C) 1991-2013 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". |
| --> |
| <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ --> |
| <head> |
| <title>Using as: MIPS Symbol Sizes</title> |
| |
| <meta name="description" content="Using as: MIPS Symbol Sizes"> |
| <meta name="keywords" content="Using as: MIPS Symbol Sizes"> |
| <meta name="resource-type" content="document"> |
| <meta name="distribution" content="global"> |
| <meta name="Generator" content="makeinfo"> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <link href="index.html#Top" rel="start" title="Top"> |
| <link href="AS-Index.html#AS-Index" rel="index" title="AS Index"> |
| <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> |
| <link href="MIPS_002dDependent.html#MIPS_002dDependent" rel="up" title="MIPS-Dependent"> |
| <link href="MIPS-Small-Data.html#MIPS-Small-Data" rel="next" title="MIPS Small Data"> |
| <link href="MIPS-Macros.html#MIPS-Macros" rel="prev" title="MIPS Macros"> |
| <style type="text/css"> |
| <!-- |
| a.summary-letter {text-decoration: none} |
| blockquote.smallquotation {font-size: smaller} |
| div.display {margin-left: 3.2em} |
| div.example {margin-left: 3.2em} |
| div.indentedblock {margin-left: 3.2em} |
| div.lisp {margin-left: 3.2em} |
| div.smalldisplay {margin-left: 3.2em} |
| div.smallexample {margin-left: 3.2em} |
| div.smallindentedblock {margin-left: 3.2em; font-size: smaller} |
| div.smalllisp {margin-left: 3.2em} |
| kbd {font-style:oblique} |
| pre.display {font-family: inherit} |
| pre.format {font-family: inherit} |
| pre.menu-comment {font-family: serif} |
| pre.menu-preformatted {font-family: serif} |
| pre.smalldisplay {font-family: inherit; font-size: smaller} |
| pre.smallexample {font-size: smaller} |
| pre.smallformat {font-family: inherit; font-size: smaller} |
| pre.smalllisp {font-size: smaller} |
| span.nocodebreak {white-space:nowrap} |
| span.nolinebreak {white-space:nowrap} |
| span.roman {font-family:serif; font-weight:normal} |
| span.sansserif {font-family:sans-serif; font-weight:normal} |
| ul.no-bullet {list-style: none} |
| --> |
| </style> |
| |
| |
| </head> |
| |
| <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> |
| <a name="MIPS-Symbol-Sizes"></a> |
| <div class="header"> |
| <p> |
| Next: <a href="MIPS-Small-Data.html#MIPS-Small-Data" accesskey="n" rel="next">MIPS Small Data</a>, Previous: <a href="MIPS-Macros.html#MIPS-Macros" accesskey="p" rel="prev">MIPS Macros</a>, Up: <a href="MIPS_002dDependent.html#MIPS_002dDependent" accesskey="u" rel="up">MIPS-Dependent</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p> |
| </div> |
| <hr> |
| <a name="Directives-to-override-the-size-of-symbols"></a> |
| <h4 class="subsection">9.27.3 Directives to override the size of symbols</h4> |
| |
| <a name="index-_002eset-sym32"></a> |
| <a name="index-_002eset-nosym32"></a> |
| <p>The n64 ABI allows symbols to have any 64-bit value. Although this |
| provides a great deal of flexibility, it means that some macros have |
| much longer expansions than their 32-bit counterparts. For example, |
| the non-PIC expansion of ‘<samp>dla $4,sym</samp>’ is usually: |
| </p> |
| <div class="smallexample"> |
| <pre class="smallexample">lui $4,%highest(sym) |
| lui $1,%hi(sym) |
| daddiu $4,$4,%higher(sym) |
| daddiu $1,$1,%lo(sym) |
| dsll32 $4,$4,0 |
| daddu $4,$4,$1 |
| </pre></div> |
| |
| <p>whereas the 32-bit expansion is simply: |
| </p> |
| <div class="smallexample"> |
| <pre class="smallexample">lui $4,%hi(sym) |
| daddiu $4,$4,%lo(sym) |
| </pre></div> |
| |
| <p>n64 code is sometimes constructed in such a way that all symbolic |
| constants are known to have 32-bit values, and in such cases, it’s |
| preferable to use the 32-bit expansion instead of the 64-bit |
| expansion. |
| </p> |
| <p>You can use the <code>.set sym32</code> directive to tell the assembler |
| that, from this point on, all expressions of the form |
| ‘<samp><var>symbol</var></samp>’ or ‘<samp><var>symbol</var> + <var>offset</var></samp>’ |
| have 32-bit values. For example: |
| </p> |
| <div class="smallexample"> |
| <pre class="smallexample">.set sym32 |
| dla $4,sym |
| lw $4,sym+16 |
| sw $4,sym+0x8000($4) |
| </pre></div> |
| |
| <p>will cause the assembler to treat ‘<samp>sym</samp>’, <code>sym+16</code> and |
| <code>sym+0x8000</code> as 32-bit values. The handling of non-symbolic |
| addresses is not affected. |
| </p> |
| <p>The directive <code>.set nosym32</code> ends a <code>.set sym32</code> block and |
| reverts to the normal behavior. It is also possible to change the |
| symbol size using the command-line options <samp>-msym32</samp> and |
| <samp>-mno-sym32</samp>. |
| </p> |
| <p>These options and directives are always accepted, but at present, |
| they have no effect for anything other than n64. |
| </p> |
| |
| |
| |
| </body> |
| </html> |