This is the mail archive of the binutils@sources.redhat.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]
Other format: [Raw text]

[patch] -dynamic-linker autodetection broken with biarch gcc


I'm seeing several failures testing binutils on an x86 Debian sid system. It 
turns out these are indirectly due to the way Debian configures its biarch 
toolchains.

The problem is that configure.host greps the gcc spec file to determine the 
name of the dynamic linker. This fails in two ways:
- The spec file contains other references to ld*.so, so the grep pattern 
matches multiple lines.
- The non-default -m64 multilib happens to appear first.

Conveniently gcc --help --verbose invokes the linker to obtain a list of 
commandline options, so we can use this to obtain the value instead.

Tested on i686-linux x86_64-linux and powerpc-linux.
Ok?

Paul

2005-07-14  Paul Brook  <paul@codesourcery.com>

	* configure.host (HOSTING_CRT0): Parse output of gcc --help --verbose
	to determine dynamic linker name.
Index: ld/configure.host
===================================================================
RCS file: /var/cvsroot/src-cvs/src/ld/configure.host,v
retrieving revision 1.42
diff -u -p -r1.42 configure.host
--- ld/configure.host	26 May 2005 22:23:15 -0000	1.42
+++ ld/configure.host	14 Jul 2005 16:25:26 -0000
@@ -33,7 +33,7 @@ case "${host}" in
   ;;
 
 *-*-linux*)
-  HOSTING_CRT0='-dynamic-linker `specs=\`${CC} --print-file-name=specs\`; { if [ x"$specs" = xspecs ]; then ${CC} -dumpspecs; else cat "$specs"; fi; } | egrep "ld[^ ]*\.so" | sed -e "s,.*-dynamic-linker[ 	][ 	]*\(.*/ld[^ ]*\.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+  HOSTING_CRT0='-dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld[^ ]*\.so" | sed -e "s,.*-dynamic-linker[ 	][ 	]*\(.*/ld[^ ]*\.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
   HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
   ;;
 

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