3 # Copyright (C) 2007, 2008, 2010, 2011 Free Software Foundation, Inc.
4 # This file is part of GCC.
6 # GCC is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
11 # GCC is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GCC; see the file COPYING3. If not see
18 # <http://www.gnu.org/licenses/>.
20 # Invoke as, ld or nm from the build tree.
22 ORIGINAL_AS_FOR_TARGET
="@ORIGINAL_AS_FOR_TARGET@"
23 ORIGINAL_LD_FOR_TARGET
="@ORIGINAL_LD_FOR_TARGET@"
24 ORIGINAL_GOLD_FOR_TARGET
="@ORIGINAL_GOLD_FOR_TARGET@"
25 ORIGINAL_PLUGIN_LD_FOR_TARGET
="@ORIGINAL_PLUGIN_LD_FOR_TARGET@"
26 ORIGINAL_NM_FOR_TARGET
="@ORIGINAL_NM_FOR_TARGET@"
28 fast_install
=@enable_fast_install@
32 invoked
=`basename "$0"`
36 original
=$ORIGINAL_AS_FOR_TARGET
42 # Look for the a command line option
43 # specifying the linker to be used.
46 original
=$ORIGINAL_GOLD_FOR_TARGET
49 *\
-use-ld\
* |
*\
-use-ld.bfd\
*)
50 original
=$ORIGINAL_LD_FOR_TARGET
54 original
=$ORIGINAL_PLUGIN_LD_FOR_TARGET
58 original
=$ORIGINAL_LD_FOR_TARGET
63 # If the selected linker has not been configured then
64 # try using the others, in the order PLUGIN-LD, LD, GOLD.
65 if test x
"$original" = x
; then
66 if test x
"$ORIGINAL_PLUGIN_LD_FOR_TARGET" != x
; then
67 original
=$ORIGINAL_PLUGIN_LD_FOR_TARGET
69 elif test x
"$ORIGINAL_LD_FOR_TARGET" != x
; then
70 original
=$ORIGINAL_LD_FOR_TARGET
72 elif test x
"$ORIGINAL_GOLD_FOR_TARGET" != x
; then
73 original
=$ORIGINAL_GOLD_FOR_TARGET
75 # Otherwise do nothing - the case statement below
76 # will issue an error message for us.
82 original
=$ORIGINAL_NM_FOR_TARGET
90 # compute absolute path of the location of this script
92 scriptdir
=`cd "$tdir" && pwd`
94 if test -x $scriptdir/..
/$dir/$prog; then
95 if test "$fast_install" = yes; then
96 # If libtool did everything it needs to do, there's a fast path.
97 lt_prog
=$scriptdir/..
/$dir/$objdir/lt-
$prog
99 if test -x $lt_prog; then
102 # Libtool has not relinked ld-new yet, but we cannot just use the
103 # previous stage (because then the relinking would just never happen!).
104 # So we take extra care to use prev-ld/ld-new *on recursive calls*.
105 eval LT_RCU
="\${LT_RCU_$id}"
106 if test x
"$LT_RCU" = x
"1"; then
107 original
=$scriptdir/..
/prev-
$dir/$prog
113 echo "$invoked $version"
114 echo $scriptdir/..
/$dir/$prog $
*
117 $scriptdir/..
/$dir/$prog ${1+"$@"}
123 original
=$scriptdir/..
/$dir/$prog
126 original
=$scriptdir/..
/prev-
$dir/$prog
130 echo "$invoked: executable not configured"
135 # If -v has been used then display our version number
136 # and then echo the command we are about to invoke.
139 echo "$invoked $version"
144 if test -x $original; then
145 exec "$original" ${1+"$@"}
147 echo "$invoked: unable to locate executable: $original"