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.

124 lines
8.1 KiB
HTML

<html lang="en">
<head>
<title>File Commands - 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="Simple-Commands.html#Simple-Commands" title="Simple Commands">
<link rel="prev" href="Entry-Point.html#Entry-Point" title="Entry Point">
<link rel="next" href="Format-Commands.html#Format-Commands" title="Format Commands">
<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="File-Commands"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Format-Commands.html#Format-Commands">Format Commands</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Entry-Point.html#Entry-Point">Entry Point</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Simple-Commands.html#Simple-Commands">Simple Commands</a>
<hr><br>
</div>
<h4 class="subsection">3.4.2 Commands Dealing with Files</h4>
<p><a name="index-linker-script-file-commands-319"></a>Several linker script commands deal with files.
<dl>
<dt><code>INCLUDE </code><var>filename</var><dd><a name="index-INCLUDE-_0040var_007bfilename_007d-320"></a><a name="index-including-a-linker-script-321"></a>Include the linker script <var>filename</var> at this point. The file will
be searched for in the current directory, and in any directory specified
with the <span class="option">-L</span> option. You can nest calls to <code>INCLUDE</code> up to
10 levels deep.
<p>You can place <code>INCLUDE</code> directives at the top level, in <code>MEMORY</code> or
<code>SECTIONS</code> commands, or in output section descriptions.
<br><dt><code>INPUT(</code><var>file</var><code>, </code><var>file</var><code>, ...)</code><dt><code>INPUT(</code><var>file</var> <var>file</var><code> ...)</code><dd><a name="index-INPUT_0028_0040var_007bfiles_007d_0029-322"></a><a name="index-input-files-in-linker-scripts-323"></a><a name="index-input-object-files-in-linker-scripts-324"></a><a name="index-linker-script-input-object-files-325"></a>The <code>INPUT</code> command directs the linker to include the named files
in the link, as though they were named on the command line.
<p>For example, if you always want to include <span class="file">subr.o</span> any time you do
a link, but you can't be bothered to put it on every link command line,
then you can put <span class="samp">INPUT (subr.o)</span> in your linker script.
<p>In fact, if you like, you can list all of your input files in the linker
script, and then invoke the linker with nothing but a <span class="samp">-T</span> option.
<p>In case a <dfn>sysroot prefix</dfn> is configured, and the filename starts
with the <span class="samp">/</span> character, and the script being processed was
located inside the <dfn>sysroot prefix</dfn>, the filename will be looked
for in the <dfn>sysroot prefix</dfn>. Otherwise, the linker will try to
open the file in the current directory. If it is not found, the
linker will search through the archive library search path. See the
description of <span class="samp">-L</span> in <a href="Options.html#Options">Command Line Options</a>.
<p>If you use <span class="samp">INPUT (-l</span><var>file</var><span class="samp">)</span>, <span class="command">ld</span> will transform the
name to <code>lib</code><var>file</var><code>.a</code>, as with the command line argument
<span class="samp">-l</span>.
<p>When you use the <code>INPUT</code> command in an implicit linker script, the
files will be included in the link at the point at which the linker
script file is included. This can affect archive searching.
<br><dt><code>GROUP(</code><var>file</var><code>, </code><var>file</var><code>, ...)</code><dt><code>GROUP(</code><var>file</var> <var>file</var><code> ...)</code><dd><a name="index-GROUP_0028_0040var_007bfiles_007d_0029-326"></a><a name="index-grouping-input-files-327"></a>The <code>GROUP</code> command is like <code>INPUT</code>, except that the named
files should all be archives, and they are searched repeatedly until no
new undefined references are created. See the description of <span class="samp">-(</span>
in <a href="Options.html#Options">Command Line Options</a>.
<br><dt><code>AS_NEEDED(</code><var>file</var><code>, </code><var>file</var><code>, ...)</code><dt><code>AS_NEEDED(</code><var>file</var> <var>file</var><code> ...)</code><dd><a name="index-AS_005fNEEDED_0028_0040var_007bfiles_007d_0029-328"></a>This construct can appear only inside of the <code>INPUT</code> or <code>GROUP</code>
commands, among other filenames. The files listed will be handled
as if they appear directly in the <code>INPUT</code> or <code>GROUP</code> commands,
with the exception of ELF shared libraries, that will be added only
when they are actually needed. This construct essentially enables
<span class="option">--as-needed</span> option for all the files listed inside of it
and restores previous <span class="option">--as-needed</span> resp. <span class="option">--no-as-needed</span>
setting afterwards.
<br><dt><code>OUTPUT(</code><var>filename</var><code>)</code><dd><a name="index-OUTPUT_0028_0040var_007bfilename_007d_0029-329"></a><a name="index-output-file-name-in-linker-script-330"></a>The <code>OUTPUT</code> command names the output file. Using
<code>OUTPUT(</code><var>filename</var><code>)</code> in the linker script is exactly like using
<span class="samp">-o </span><var>filename</var> on the command line (see <a href="Options.html#Options">Command Line Options</a>). If both are used, the command line option takes
precedence.
<p>You can use the <code>OUTPUT</code> command to define a default name for the
output file other than the usual default of <span class="file">a.out</span>.
<br><dt><code>SEARCH_DIR(</code><var>path</var><code>)</code><dd><a name="index-SEARCH_005fDIR_0028_0040var_007bpath_007d_0029-331"></a><a name="index-library-search-path-in-linker-script-332"></a><a name="index-archive-search-path-in-linker-script-333"></a><a name="index-search-path-in-linker-script-334"></a>The <code>SEARCH_DIR</code> command adds <var>path</var> to the list of paths where
<span class="command">ld</span> looks for archive libraries. Using
<code>SEARCH_DIR(</code><var>path</var><code>)</code> is exactly like using <span class="samp">-L </span><var>path</var>
on the command line (see <a href="Options.html#Options">Command Line Options</a>). If both
are used, then the linker will search both paths. Paths specified using
the command line option are searched first.
<br><dt><code>STARTUP(</code><var>filename</var><code>)</code><dd><a name="index-STARTUP_0028_0040var_007bfilename_007d_0029-335"></a><a name="index-first-input-file-336"></a>The <code>STARTUP</code> command is just like the <code>INPUT</code> command, except
that <var>filename</var> will become the first input file to be linked, as
though it were specified first on the command line. This may be useful
when using a system in which the entry point is always the start of the
first file.
</dl>
</body></html>