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.
77 lines
4.1 KiB
HTML
77 lines
4.1 KiB
HTML
15 years ago
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>MIPS Object - Using as</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html">
|
||
|
<meta name="description" content="Using as">
|
||
|
<meta name="generator" content="makeinfo 4.7">
|
||
|
<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-Opts.html#MIPS-Opts" title="MIPS Opts">
|
||
|
<link rel="next" href="MIPS-Stabs.html#MIPS-Stabs" title="MIPS Stabs">
|
||
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||
|
<!--
|
||
|
This file documents the GNU Assembler "as".
|
||
|
|
||
|
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002,
|
||
|
2006, 2007 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.1
|
||
|
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''.
|
||
|
|
||
|
man end-->
|
||
|
<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; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="node">
|
||
|
<p>
|
||
|
<a name="MIPS-Object"></a>Next: <a rel="next" accesskey="n" href="MIPS-Stabs.html#MIPS-Stabs">MIPS Stabs</a>,
|
||
|
Previous: <a rel="previous" accesskey="p" href="MIPS-Opts.html#MIPS-Opts">MIPS Opts</a>,
|
||
|
Up: <a rel="up" accesskey="u" href="MIPS_002dDependent.html#MIPS_002dDependent">MIPS-Dependent</a>
|
||
|
<hr><br>
|
||
|
</div>
|
||
|
|
||
|
<h4 class="subsection">9.22.2 MIPS ECOFF object code</h4>
|
||
|
|
||
|
<p><a name="index-ECOFF-sections-1208"></a><a name="index-MIPS-ECOFF-sections-1209"></a>Assembling for a <span class="sc">mips</span> <span class="sc">ecoff</span> target supports some additional sections
|
||
|
besides the usual <code>.text</code>, <code>.data</code> and <code>.bss</code>. The
|
||
|
additional sections are <code>.rdata</code>, used for read-only data,
|
||
|
<code>.sdata</code>, used for small data, and <code>.sbss</code>, used for small
|
||
|
common objects.
|
||
|
|
||
|
<p><a name="index-small-objects_002c-MIPS-ECOFF-1210"></a><a name="index-_0040code_007bgp_007d-register_002c-MIPS-1211"></a>When assembling for <span class="sc">ecoff</span>, the assembler uses the <code>$gp</code> (<code>$28</code>)
|
||
|
register to form the address of a “small object”. Any object in the
|
||
|
<code>.sdata</code> or <code>.sbss</code> sections is considered “small” in this sense.
|
||
|
For external objects, or for objects in the <code>.bss</code> section, you can use
|
||
|
the <code>gcc</code> <span class="samp">-G</span> option to control the size of objects addressed via
|
||
|
<code>$gp</code>; the default value is 8, meaning that a reference to any object
|
||
|
eight bytes or smaller uses <code>$gp</code>. Passing <span class="samp">-G 0</span> to
|
||
|
<code>as</code> prevents it from using the <code>$gp</code> register on the basis
|
||
|
of object size (but the assembler uses <code>$gp</code> for objects in <code>.sdata</code>
|
||
|
or <code>sbss</code> in any case). The size of an object in the <code>.bss</code> section
|
||
|
is set by the <code>.comm</code> or <code>.lcomm</code> directive that defines it. The
|
||
|
size of an external object may be set with the <code>.extern</code> directive. For
|
||
|
example, <span class="samp">.extern sym,4</span> declares that the object at <code>sym</code> is 4 bytes
|
||
|
in length, whie leaving <code>sym</code> otherwise undefined.
|
||
|
|
||
|
<p>Using small <span class="sc">ecoff</span> objects requires linker support, and assumes that the
|
||
|
<code>$gp</code> register is correctly initialized (normally done automatically by
|
||
|
the startup code). <span class="sc">mips</span> <span class="sc">ecoff</span> assembly code must not modify the
|
||
|
<code>$gp</code> register.
|
||
|
|
||
|
</body></html>
|
||
|
|