📄 mips-object.html
字号:
<html lang="en">
<head>
<title>Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.3">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
</head>
<body>
<div class="node">
<p>
Node:<a name="MIPS%20Object">MIPS Object</a>,
Next:<a rel="next" accesskey="n" href="MIPS-Stabs.html#MIPS%20Stabs">MIPS Stabs</a>,
Previous:<a rel="previous" accesskey="p" href="MIPS-Opts.html#MIPS%20Opts">MIPS Opts</a>,
Up:<a rel="up" accesskey="u" href="MIPS-Dependent.html#MIPS-Dependent">MIPS-Dependent</a>
<hr><br>
</div>
<h4 class="section">MIPS ECOFF object code</h4>
<p>Assembling for a <small>MIPS</small> <small>ECOFF</small> 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>When assembling for <small>ECOFF</small>, 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> <code>-G</code> 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 <code>-G 0</code> 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, <code>.extern sym,4</code> declares that the object at <code>sym</code> is 4 bytes
in length, whie leaving <code>sym</code> otherwise undefined.
<p>Using small <small>ECOFF</small> objects requires linker support, and assumes that the
<code>$gp</code> register is correctly initialized (normally done automatically by
the startup code). <small>MIPS</small> <small>ECOFF</small> assembly code must not modify the
<code>$gp</code> register.
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -