You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
4.1 KiB
HTML
96 lines
4.1 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>MIPS Symbol Sizes - 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="MIPS_002dDependent.html#MIPS_002dDependent" title="MIPS-Dependent">
|
|
<link rel="prev" href="MIPS-Macros.html#MIPS-Macros" title="MIPS Macros">
|
|
<link rel="next" href="MIPS-Small-Data.html#MIPS-Small-Data" title="MIPS Small Data">
|
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
|
<!--
|
|
This file documents the GNU Assembler "as".
|
|
|
|
Copyright (C) 1991-2015 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>
|
|
</head>
|
|
<body>
|
|
<div class="node">
|
|
<a name="MIPS-Symbol-Sizes"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="MIPS-Small-Data.html#MIPS-Small-Data">MIPS Small Data</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="MIPS-Macros.html#MIPS-Macros">MIPS Macros</a>,
|
|
Up: <a rel="up" accesskey="u" href="MIPS_002dDependent.html#MIPS_002dDependent">MIPS-Dependent</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h4 class="subsection">9.27.3 Directives to override the size of symbols</h4>
|
|
|
|
<p><a name="index-g_t_0040code_007b_002eset-sym32_007d-1492"></a><a name="index-g_t_0040code_007b_002eset-nosym32_007d-1493"></a>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><span class="samp">dla $4,sym</span></samp>’ is usually:
|
|
|
|
<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>
|
|
<p>whereas the 32-bit expansion is simply:
|
|
|
|
<pre class="smallexample"> lui $4,%hi(sym)
|
|
daddiu $4,$4,%lo(sym)
|
|
</pre>
|
|
<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>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><span class="samp"> + </span><var>offset</var></samp>’
|
|
have 32-bit values. For example:
|
|
|
|
<pre class="smallexample"> .set sym32
|
|
dla $4,sym
|
|
lw $4,sym+16
|
|
sw $4,sym+0x8000($4)
|
|
</pre>
|
|
<p>will cause the assembler to treat ‘<samp><span class="samp">sym</span></samp>’, <code>sym+16</code> and
|
|
<code>sym+0x8000</code> as 32-bit values. The handling of non-symbolic
|
|
addresses is not affected.
|
|
|
|
<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><span class="option">-msym32</span></samp> and
|
|
<samp><span class="option">-mno-sym32</span></samp>.
|
|
|
|
<p>These options and directives are always accepted, but at present,
|
|
they have no effect for anything other than n64.
|
|
|
|
</body></html>
|
|
|