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.

83 lines
4.4 KiB
HTML

<html lang="en">
<head>
<title>Environment - 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="Invocation.html#Invocation" title="Invocation">
<link rel="prev" href="Options.html#Options" title="Options">
<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="Environment"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Options.html#Options">Options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Invocation.html#Invocation">Invocation</a>
<hr>
</div>
<h3 class="section">2.2 Environment Variables</h3>
<!-- man begin ENVIRONMENT -->
<p>You can change the behaviour of <samp><span class="command">ld</span></samp> with the environment variables
<code>GNUTARGET</code>,
<code>LDEMULATION</code> and <code>COLLECT_NO_DEMANGLE</code>.
<p><a name="index-GNUTARGET-357"></a><a name="index-default-input-format-358"></a><code>GNUTARGET</code> determines the input-file object format if you don't
use &lsquo;<samp><span class="samp">-b</span></samp>&rsquo; (or its synonym &lsquo;<samp><span class="samp">--format</span></samp>&rsquo;). Its value should be one
of the BFD names for an input format (see <a href="BFD.html#BFD">BFD</a>). If there is no
<code>GNUTARGET</code> in the environment, <samp><span class="command">ld</span></samp> uses the natural format
of the target. If <code>GNUTARGET</code> is set to <code>default</code> then BFD
attempts to discover the input format by examining binary input files;
this method often succeeds, but there are potential ambiguities, since
there is no method of ensuring that the magic number used to specify
object-file formats is unique. However, the configuration procedure for
BFD on each system places the conventional format for that system first
in the search-list, so ambiguities are resolved in favor of convention.
<p><a name="index-LDEMULATION-359"></a><a name="index-default-emulation-360"></a><a name="index-emulation_002c-default-361"></a><code>LDEMULATION</code> determines the default emulation if you don't use the
&lsquo;<samp><span class="samp">-m</span></samp>&rsquo; option. The emulation can affect various aspects of linker
behaviour, particularly the default linker script. You can list the
available emulations with the &lsquo;<samp><span class="samp">--verbose</span></samp>&rsquo; or &lsquo;<samp><span class="samp">-V</span></samp>&rsquo; options. If
the &lsquo;<samp><span class="samp">-m</span></samp>&rsquo; option is not used, and the <code>LDEMULATION</code> environment
variable is not defined, the default emulation depends upon how the
linker was configured.
<p><a name="index-COLLECT_005fNO_005fDEMANGLE-362"></a><a name="index-demangling_002c-default-363"></a>Normally, the linker will default to demangling symbols. However, if
<code>COLLECT_NO_DEMANGLE</code> is set in the environment, then it will
default to not demangling symbols. This environment variable is used in
a similar fashion by the <code>gcc</code> linker wrapper program. The default
may be overridden by the &lsquo;<samp><span class="samp">--demangle</span></samp>&rsquo; and &lsquo;<samp><span class="samp">--no-demangle</span></samp>&rsquo;
options.
<!-- man end -->
</body></html>