<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.8">
<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">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
@import url("../raisonance.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">
<p>
<a name="Environment"></a>
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-283"></a><a name="index-default-input-format-284"></a><code>GNUTARGET</code> determines the input-file object format if you don't
use `<samp><span class="samp">-b</span></samp>' (or its synonym `<samp><span class="samp">--format</span></samp>').  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-285"></a><a name="index-default-emulation-286"></a><a name="index-emulation_002c-default-287"></a><code>LDEMULATION</code> determines the default emulation if you don't use the
`<samp><span class="samp">-m</span></samp>' option.  The emulation can affect various aspects of linker
behaviour, particularly the default linker script.  You can list the
available emulations with the `<samp><span class="samp">--verbose</span></samp>' or `<samp><span class="samp">-V</span></samp>' options.  If
the `<samp><span class="samp">-m</span></samp>' 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-288"></a><a name="index-demangling_002c-default-289"></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 `<samp><span class="samp">--demangle</span></samp>' and `<samp><span class="samp">--no-demangle</span></samp>'
options.

<!-- man end -->
</body></html>

