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.
88 lines
5.0 KiB
HTML
88 lines
5.0 KiB
HTML
4 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.13">
|
||
|
<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="REGION_005fALIAS.html#REGION_005fALIAS" title="REGION_ALIAS">
|
||
|
<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.26.
|
||
|
|
||
|
Copyright (C) 1991-2015 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.3
|
||
|
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; }
|
||
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="node">
|
||
|
<a name="Format-Commands"></a>
|
||
|
<p>
|
||
|
Next: <a rel="next" accesskey="n" href="REGION_005fALIAS.html#REGION_005fALIAS">REGION_ALIAS</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>
|
||
|
</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-394"></a><a name="index-output-file-format-in-linker-script-395"></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 ‘<samp><span class="samp">--oformat </span><var>bfdname</var></samp>’ 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 ‘<samp><span class="samp">-EB</span></samp>’ and ‘<samp><span class="samp">-EL</span></samp>’ command line options.
|
||
|
This permits the linker script to set the output format based on the
|
||
|
desired endianness.
|
||
|
|
||
|
<p>If neither ‘<samp><span class="samp">-EB</span></samp>’ nor ‘<samp><span class="samp">-EL</span></samp>’ are used, then the output format
|
||
|
will be the first argument, <var>default</var>. If ‘<samp><span class="samp">-EB</span></samp>’ is used, the
|
||
|
output format will be the second argument, <var>big</var>. If ‘<samp><span class="samp">-EL</span></samp>’ 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
|
||
|
‘<samp><span class="samp">elf32-bigmips</span></samp>’, but if the user uses the ‘<samp><span class="samp">-EL</span></samp>’ command line
|
||
|
option, the output file will be created in the ‘<samp><span class="samp">elf32-littlemips</span></samp>’
|
||
|
format.
|
||
|
|
||
|
<br><dt><code>TARGET(</code><var>bfdname</var><code>)</code><dd><a name="index-TARGET_0028_0040var_007bbfdname_007d_0029-396"></a><a name="index-input-file-format-in-linker-script-397"></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 ‘<samp><span class="samp">-b </span><var>bfdname</var></samp>’ 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>
|
||
|
|