This is the mail archive of the gcc-patches@gcc.gnu.org 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  <aoliva@redhat.com>

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

Index: gcc/configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.ac,v
retrieving revision 2.13
diff -u -p -r2.13 configure.ac
--- gcc/configure.ac 9 Feb 2004 17:40:32 -0000 2.13
+++ gcc/configure.ac 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
 	gcc_cv_ld="$DEFAULT_LINKER"
-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
 	gcc_cv_ld="$LD"
 elif test -x collect-ld$host_exeext; then
 	# Build using linker in the current directory.
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Happy GNU Year!                     oliva@{lsd.ic.unicamp.br, gnu.org}
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
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]