neingeist
/
arduinisten
Archived
1
0
Fork 0
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

119 lines
5.8 KiB
HTML

<html lang="en">
<head>
<title>Input Section Basics - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.7">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Input-Section.html#Input-Section" title="Input Section">
<link rel="next" href="Input-Section-Wildcards.html#Input-Section-Wildcards" title="Input Section Wildcards">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU linker LD
(GNU Binutils)
version 2.19.
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000,
2001, 2002, 2003, 2004, 2005, 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''.-->
<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="Input-Section-Basics"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Input-Section-Wildcards.html#Input-Section-Wildcards">Input Section Wildcards</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Input-Section.html#Input-Section">Input Section</a>
<hr><br>
</div>
<h5 class="subsubsection">3.6.4.1 Input Section Basics</h5>
<p><a name="index-input-section-basics-368"></a>An input section description consists of a file name optionally followed
by a list of section names in parentheses.
<p>The file name and the section name may be wildcard patterns, which we
describe further below (see <a href="Input-Section-Wildcards.html#Input-Section-Wildcards">Input Section Wildcards</a>).
<p>The most common input section description is to include all input
sections with a particular name in the output section. For example, to
include all input <span class="samp">.text</span> sections, you would write:
<pre class="smallexample"> *(.text)
</pre>
<p class="noindent">Here the <span class="samp">*</span> is a wildcard which matches any file name. To exclude a list
of files from matching the file name wildcard, EXCLUDE_FILE may be used to
match all files except the ones specified in the EXCLUDE_FILE list. For
example:
<pre class="smallexample"> *(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors)
</pre>
<p>will cause all .ctors sections from all files except <span class="file">crtend.o</span> and
<span class="file">otherfile.o</span> to be included.
<p>There are two ways to include more than one section:
<pre class="smallexample"> *(.text .rdata)
*(.text) *(.rdata)
</pre>
<p class="noindent">The difference between these is the order in which the <span class="samp">.text</span> and
<span class="samp">.rdata</span> input sections will appear in the output section. In the
first example, they will be intermingled, appearing in the same order as
they are found in the linker input. In the second example, all
<span class="samp">.text</span> input sections will appear first, followed by all
<span class="samp">.rdata</span> input sections.
<p>You can specify a file name to include sections from a particular file.
You would do this if one or more of your files contain special data that
needs to be at a particular location in memory. For example:
<pre class="smallexample"> data.o(.data)
</pre>
<p>You can also specify files within archives by writing a pattern
matching the archive, a colon, then the pattern matching the file,
with no whitespace around the colon.
<dl>
<dt><span class="samp">archive:file</span><dd>matches file within archive
<br><dt><span class="samp">archive:</span><dd>matches the whole archive
<br><dt><span class="samp">:file</span><dd>matches file but not one in an archive
</dl>
<p>Either one or both of <span class="samp">archive</span> and <span class="samp">file</span> can contain shell
wildcards. On DOS based file systems, the linker will assume that a
single letter followed by a colon is a drive specifier, so
<span class="samp">c:myfile.o</span> is a simple file specification, not <span class="samp">myfile.o</span>
within an archive called <span class="samp">c</span>. <span class="samp">archive:file</span> filespecs may
also be used within an <code>EXCLUDE_FILE</code> list, but may not appear in
other linker script contexts. For instance, you cannot extract a file
from an archive by using <span class="samp">archive:file</span> in an <code>INPUT</code>
command.
<p>If you use a file name without a list of sections, then all sections in
the input file will be included in the output section. This is not
commonly done, but it may by useful on occasion. For example:
<pre class="smallexample"> data.o
</pre>
<p>When you use a file name which is not an <span class="samp">archive:file</span> specifier
and does not contain any wild card
characters, the linker will first see if you also specified the file
name on the linker command line or in an <code>INPUT</code> command. If you
did not, the linker will attempt to open the file as an input file, as
though it appeared on the command line. Note that this differs from an
<code>INPUT</code> command, because the linker will not search for the file in
the archive search path.
</body></html>