This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

finding ld in unified tree

I've finally got sufficiently annoyed by the problem that GCC's
configure wouldn't consistently find the ld configured to build in a
unified tree.  Sometimes it would use a pre-installed ld that happened
to be in the install prefix; most often, it would end up using ld for
the host, which is unlikely to be a reliable way to determine
properties of the linker for the target (and the difference actually
bit me once, which was how I got started looking into it)

Anyhow, the problem had to do with the fact that the top-level
Makefile sets and passes down LD, which gcc/configure then uses to
find the linker GCC is going to use.  Bad idea for crosses.  So I've
arranged for it to prefer LD_FOR_TARGET and, failing that, LD, but
only if host and target are the same.

I've tested this with native and cross builds (i686-pc-linux-gnu
native and cross to frv-uclinux).  I'm checking it in.

Index: gcc/ChangeLog
from  Alexandre Oliva  <>

	* (gcc_cv_ld): Don't set to LD if target is not
	host, but try LD_FOR_TARGET first.
	* configure: Rebuilt.

Index: gcc/
RCS file: /cvs/gcc/gcc/gcc/,v
retrieving revision 2.13
diff -u -p -r2.13
--- gcc/ 9 Feb 2004 17:40:32 -0000 2.13
+++ gcc/ 13 Feb 2004 00:49:13 -0000
@@ -1678,7 +1678,9 @@ gcc_cv_ld_gld_srcdir=`echo $srcdir | sed
 gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
 if test -x "$DEFAULT_LINKER"; then
-elif test -x "$LD"; then
+elif test -x "$LD_FOR_TARGET"; then
+        gcc_cv_ld="$LD_FOR_TARGET"
+elif test -x "$LD" && test x$host = x$target; then
 elif test -x collect-ld$host_exeext; then
 	# Build using linker in the current directory.
Alexandre Oliva   Enjoy Guarana', see
Happy GNU Year!                     oliva@{,}
Red Hat GCC Developer                 aoliva@{,}
Free Software Evangelist                Professional serial bug killer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]