This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


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

Re: [PATCH]: ld/Makefile.am


On Mar 10, 2000, "H . J . Lu" <hjl@lucon.org> wrote:

> 1. The new gcc calls collect2.
> 2. collect2 calls ld/ld-new.
> 3. ld/ld-new uses the new gcc to relink the new ld.

No.  It's using the old GCC, but it is not using the old linker,
because the environment variables that the external compiler driver
sets up: they shouldn't affect the internal compiler that libtool uses
to re-link the executable, but they do.

I think the right thing to do is to arrange for the libtool
wrapper/relinker script to set GCC_EXEC_PREFIX, COMPILER_PATH and
LIBRARY_PATH to the values they had when the wrapper script was
created, if the compiler in use is GCC.

Here's an (untested, because I have to leave right now) patch that
should fix this problem.  I'll make sure a similar (at least in
spirit) patch gets into the libtool CVS tree.  The final (i.e., for
libtool) version should probably only save these variables if GCC is
the compiler in use, but this is not strictly necessary, and it won't
hurt to put is in as-is in the Sourceware CVS repo (assuming it
works :-)  Ok to install?

H.J., thank you so much for your patience and for helping us figure
out what was the real problem.

Index: ChangeLog
from  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
	
	* ltmain.sh: Preserve in relink_command any environment variables
	that may affect the linker behavior.
	
Index: ltmain.sh
===================================================================
RCS file: /cvs/src/src/ltmain.sh,v
retrieving revision 1.2
diff -u -r1.2 ltmain.sh
--- ltmain.sh	2000/02/27 16:46:19	1.2
+++ ltmain.sh	2000/03/11 22:44:48
@@ -2779,6 +2779,11 @@
 
       # Quote the relink command for shipping.
       if test -n "$relink_command"; then
+        # Preserve any variables that may affect compiler behavior
+	variables_saved_for_relink="GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+	for var in $variables_saved_for_relink; do
+	  relink_command="$var=\""`eval \$echo \"X'$'$var\" | $Xsed -e "$sed_quote_subst"`"\"; export $var; $relink_command"
+	done
 	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
       fi
 

-- 
Alexandre Oliva     http://www.ic.unicamp.br/~oliva/     Enjoy Guaranį
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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