📄 ld-sections.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="Ld%20Sections">Ld Sections</a>,
Next:<a rel="next" accesskey="n" href="As-Sections.html#As%20Sections">As Sections</a>,
Previous:<a rel="previous" accesskey="p" href="Secs-Background.html#Secs%20Background">Secs Background</a>,
Up:<a rel="up" accesskey="u" href="Sections.html#Sections">Sections</a>
<hr><br>
</div>
<h3 class="section">Linker Sections</h3>
<p><code>ld</code> deals with just four kinds of sections, summarized below.
<dl>
<br><dt><strong>named sections</strong>
<dd><dt><strong>text section</strong>
<dd><dt><strong>data section</strong>
<dd>These sections hold your program. <code>as</code> and <code>ld</code> treat them as
separate but equal sections. Anything you can say of one section is
true another.
When the program is running, however, it is
customary for the text section to be unalterable. The
text section is often shared among processes: it contains
instructions, constants and the like. The data section of a running
program is usually alterable: for example, C variables would be stored
in the data section.
<br><dt><strong>bss section</strong>
<dd>This section contains zeroed bytes when your program begins running. It
is used to hold uninitialized variables or common storage. The length of
each partial program's bss section is important, but because it starts
out containing zeroed bytes there is no need to store explicit zero
bytes in the object file. The bss section was invented to eliminate
those explicit zeros from object files.
<br><dt><strong>absolute section</strong>
<dd>Address 0 of this section is always "relocated" to runtime address 0.
This is useful if you want to refer to an address that <code>ld</code> must
not change when relocating. In this sense we speak of absolute
addresses being "unrelocatable": they do not change during relocation.
<br><dt><strong>undefined section</strong>
<dd>This "section" is a catch-all for address references to objects not in
the preceding sections.
</dl>
<p>An idealized example of three relocatable sections follows.
The example uses the traditional section names <code>.text</code> and <code>.data</code>.
Memory addresses are on the horizontal axis.
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -