1<html lang="en"> 2<head> 3<title>Environment - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Invocation.html#Invocation" title="Invocation"> 9<link rel="prev" href="Options.html#Options" title="Options"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12This file documents the GNU linker LD 13(Sourcery CodeBench Lite 2013.11-24) 14version 2.23.52. 15 16Copyright (C) 1991-2013 Free Software Foundation, Inc. 17 18Permission is granted to copy, distribute and/or modify this document 19under the terms of the GNU Free Documentation License, Version 1.3 20or any later version published by the Free Software Foundation; 21with no Invariant Sections, with no Front-Cover Texts, and with no 22Back-Cover Texts. A copy of the license is included in the 23section entitled ``GNU Free Documentation License''.--> 24<meta http-equiv="Content-Style-Type" content="text/css"> 25<style type="text/css"><!-- 26 pre.display { font-family:inherit } 27 pre.format { font-family:inherit } 28 pre.smalldisplay { font-family:inherit; font-size:smaller } 29 pre.smallformat { font-family:inherit; font-size:smaller } 30 pre.smallexample { font-size:smaller } 31 pre.smalllisp { font-size:smaller } 32 span.sc { font-variant:small-caps } 33 span.roman { font-family:serif; font-weight:normal; } 34 span.sansserif { font-family:sans-serif; font-weight:normal; } 35--></style> 36<link rel="stylesheet" type="text/css" href="../cs.css"> 37</head> 38<body> 39<div class="node"> 40<a name="Environment"></a> 41<p> 42Previous: <a rel="previous" accesskey="p" href="Options.html#Options">Options</a>, 43Up: <a rel="up" accesskey="u" href="Invocation.html#Invocation">Invocation</a> 44<hr> 45</div> 46 47<h3 class="section">2.2 Environment Variables</h3> 48 49<!-- man begin ENVIRONMENT --> 50<p>You can change the behaviour of <samp><span class="command">ld</span></samp> with the environment variables 51<code>GNUTARGET</code>, 52<code>LDEMULATION</code> and <code>COLLECT_NO_DEMANGLE</code>. 53 54 <p><a name="index-GNUTARGET-342"></a><a name="index-default-input-format-343"></a><code>GNUTARGET</code> determines the input-file object format if you don't 55use ‘<samp><span class="samp">-b</span></samp>’ (or its synonym ‘<samp><span class="samp">--format</span></samp>’). Its value should be one 56of the BFD names for an input format (see <a href="BFD.html#BFD">BFD</a>). If there is no 57<code>GNUTARGET</code> in the environment, <samp><span class="command">ld</span></samp> uses the natural format 58of the target. If <code>GNUTARGET</code> is set to <code>default</code> then BFD 59attempts to discover the input format by examining binary input files; 60this method often succeeds, but there are potential ambiguities, since 61there is no method of ensuring that the magic number used to specify 62object-file formats is unique. However, the configuration procedure for 63BFD on each system places the conventional format for that system first 64in the search-list, so ambiguities are resolved in favor of convention. 65 66 <p><a name="index-LDEMULATION-344"></a><a name="index-default-emulation-345"></a><a name="index-emulation_002c-default-346"></a><code>LDEMULATION</code> determines the default emulation if you don't use the 67‘<samp><span class="samp">-m</span></samp>’ option. The emulation can affect various aspects of linker 68behaviour, particularly the default linker script. You can list the 69available emulations with the ‘<samp><span class="samp">--verbose</span></samp>’ or ‘<samp><span class="samp">-V</span></samp>’ options. If 70the ‘<samp><span class="samp">-m</span></samp>’ option is not used, and the <code>LDEMULATION</code> environment 71variable is not defined, the default emulation depends upon how the 72linker was configured. 73 74 <p><a name="index-COLLECT_005fNO_005fDEMANGLE-347"></a><a name="index-demangling_002c-default-348"></a>Normally, the linker will default to demangling symbols. However, if 75<code>COLLECT_NO_DEMANGLE</code> is set in the environment, then it will 76default to not demangling symbols. This environment variable is used in 77a similar fashion by the <code>gcc</code> linker wrapper program. The default 78may be overridden by the ‘<samp><span class="samp">--demangle</span></samp>’ and ‘<samp><span class="samp">--no-demangle</span></samp>’ 79options. 80 81<!-- man end --> 82 </body></html> 83 84