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.
87 lines
4.8 KiB
HTML
87 lines
4.8 KiB
HTML
15 years ago
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>Format 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="File-Commands.html#File-Commands" title="File Commands">
|
||
|
<link rel="next" href="Miscellaneous-Commands.html#Miscellaneous-Commands" title="Miscellaneous 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="Format-Commands"></a>Next: <a rel="next" accesskey="n" href="Miscellaneous-Commands.html#Miscellaneous-Commands">Miscellaneous Commands</a>,
|
||
|
Previous: <a rel="previous" accesskey="p" href="File-Commands.html#File-Commands">File Commands</a>,
|
||
|
Up: <a rel="up" accesskey="u" href="Simple-Commands.html#Simple-Commands">Simple Commands</a>
|
||
|
<hr><br>
|
||
|
</div>
|
||
|
|
||
|
<h4 class="subsection">3.4.3 Commands Dealing with Object File Formats</h4>
|
||
|
|
||
|
<p>A couple of linker script commands deal with object file formats.
|
||
|
|
||
|
<dl>
|
||
|
<dt><code>OUTPUT_FORMAT(</code><var>bfdname</var><code>)</code><dt><code>OUTPUT_FORMAT(</code><var>default</var><code>, </code><var>big</var><code>, </code><var>little</var><code>)</code><dd><a name="index-OUTPUT_005fFORMAT_0028_0040var_007bbfdname_007d_0029-337"></a><a name="index-output-file-format-in-linker-script-338"></a>The <code>OUTPUT_FORMAT</code> command names the BFD format to use for the
|
||
|
output file (see <a href="BFD.html#BFD">BFD</a>). Using <code>OUTPUT_FORMAT(</code><var>bfdname</var><code>)</code> is
|
||
|
exactly like using <span class="samp">--oformat </span><var>bfdname</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 <code>OUTPUT_FORMAT</code> with three arguments to use different
|
||
|
formats based on the <span class="samp">-EB</span> and <span class="samp">-EL</span> command line options.
|
||
|
This permits the linker script to set the output format based on the
|
||
|
desired endianness.
|
||
|
|
||
|
<p>If neither <span class="samp">-EB</span> nor <span class="samp">-EL</span> are used, then the output format
|
||
|
will be the first argument, <var>default</var>. If <span class="samp">-EB</span> is used, the
|
||
|
output format will be the second argument, <var>big</var>. If <span class="samp">-EL</span> is
|
||
|
used, the output format will be the third argument, <var>little</var>.
|
||
|
|
||
|
<p>For example, the default linker script for the MIPS ELF target uses this
|
||
|
command:
|
||
|
<pre class="smallexample"> OUTPUT_FORMAT(elf32-bigmips, elf32-bigmips, elf32-littlemips)
|
||
|
</pre>
|
||
|
<p>This says that the default format for the output file is
|
||
|
<span class="samp">elf32-bigmips</span>, but if the user uses the <span class="samp">-EL</span> command line
|
||
|
option, the output file will be created in the <span class="samp">elf32-littlemips</span>
|
||
|
format.
|
||
|
|
||
|
<br><dt><code>TARGET(</code><var>bfdname</var><code>)</code><dd><a name="index-TARGET_0028_0040var_007bbfdname_007d_0029-339"></a><a name="index-input-file-format-in-linker-script-340"></a>The <code>TARGET</code> command names the BFD format to use when reading input
|
||
|
files. It affects subsequent <code>INPUT</code> and <code>GROUP</code> commands.
|
||
|
This command is like using <span class="samp">-b </span><var>bfdname</var> on the command line
|
||
|
(see <a href="Options.html#Options">Command Line Options</a>). If the <code>TARGET</code> command
|
||
|
is used but <code>OUTPUT_FORMAT</code> is not, then the last <code>TARGET</code>
|
||
|
command is also used to set the format for the output file. See <a href="BFD.html#BFD">BFD</a>.
|
||
|
</dl>
|
||
|
|
||
|
</body></html>
|
||
|
|