⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 format-commands.html

📁 gcc手册
💻 HTML
字号:
<html lang="en">

<head>

<title>Untitled</title>

<meta http-equiv="Content-Type" content="text/html">

<meta name="description" content="Untitled">

<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="Format%20Commands">Format Commands</a>,

Next:<a rel="next" accesskey="n" href="Miscellaneous-Commands.html#Miscellaneous%20Commands">Miscellaneous Commands</a>,

Previous:<a rel="previous" accesskey="p" href="File-Commands.html#File%20Commands">File Commands</a>,

Up:<a rel="up" accesskey="u" href="Simple-Commands.html#Simple%20Commands">Simple Commands</a>

<hr><br>

</div>



<h4 class="subsection">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>

     <dd><dt><code>OUTPUT_FORMAT(</code><var>default</var><code>, </code><var>big</var><code>, </code><var>little</var><code>)</code>

     <dd>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 <code>--oformat </code><var>bfdname</var><code></code> 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 <code>-EB</code> and <code>-EL</code> command line options. 

This permits the linker script to set the output format based on the

desired endianness.



     <p>If neither <code>-EB</code> nor <code>-EL</code> are used, then the output format

will be the first argument, <var>default</var>.  If <code>-EB</code> is used, the

output format will be the second argument, <var>big</var>.  If <code>-EL</code> 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>

     This says that the default format for the output file is

<code>elf32-bigmips</code>, but if the user uses the <code>-EL</code> command line

option, the output file will be created in the <code>elf32-littlemips</code>

format.



     <br><dt><code>TARGET(</code><var>bfdname</var><code>)</code>

     <dd>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 <code>-b </code><var>bfdname</var><code></code> 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>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -