This is the mail archive of the binutils@sourceware.org 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]

# Re: [PATCH] scan for i*86 directories on x86_64


Hi,

the underlying problem for the patch is the following:

Debian has dropped support for i386 a while back following the
upstream toolchain. As a consequence the GNU tiplet is now
i486-linux-gnu. So far so good.

Now, when building binutils on Debian i386, the GNU tiplet
i486-linux-gnu is passed to binutils configure script causing it to be
included in the SEARCH_DIR path for ld:

% grep -- -linux /usr/lib/ldscripts/elf_i386.x
SEARCH_DIR("/usr/i486-linux-gnu/lib32"); SEARCH_DIR("/usr/local/lib32"); SEARCH_DIR("/lib32"); SEARCH_DIR("/usr/lib32"); SEARCH_DIR("/usr/i486-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");

On the other hand, when building binutils on Debian amd64, the GNU
triple x86_64-linux-gnu is passed to binutils and binutils converts
that to i386-linux-gnu for the 32bit support:

% grep -- -linux /usr/lib/ldscripts/elf_i386.x 
SEARCH_DIR("/usr/i386-linux-gnu/lib32"); SEARCH_DIR("/usr/local/lib32"); SEARCH_DIR("/lib32"); SEARCH_DIR("/usr/lib32"); SEARCH_DIR("/usr/i386-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");


Having binutils look in different directories for the same target
depending on whether the toolchain is 32bit or 64bit compiled seems
like a really bad idea. So I wrote a dirty patch for this:

diff -urNad binutils-2.17.20070406cvs~/ld/configure.tgt binutils-2.17.20070406cvs/ld/configure.tgt
--- binutils-2.17.20070406cvs~/ld/configure.tgt 2007-04-04 20:02:39.000000000 +0200
+++ binutils-2.17.20070406cvs/ld/configure.tgt  2007-07-26 15:27:59.327631194 +0200
@@ -194,8 +194,8 @@
 x86_64-*-linux-*)      targ_emul=elf_x86_64
                        targ_extra_emuls="elf_i386 i386linux"
                        targ_extra_libpath=elf_i386
-                       tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'`
-                       tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;;
+                       tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i486/'`
+                       tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i486/'` ;;
 i[3-7]86-*-sysv[45]*)  targ_emul=elf_i386 ;;
 i[3-7]86-*-solaris2*)  targ_emul=elf_i386_ldso
                         targ_extra_emuls="elf_i386 elf_x86_64"
@@ -240,9 +240,9 @@
                        targ_extra_emuls="elf_i386_fbsd elf_x86_64 elf_i386"
                        targ_extra_libpath="elf_i386_fbsd"
                        tdir_elf_i386_fbsd=`echo ${targ_alias} \
-                           | sed -e 's/x86_64/i386/'`
+                           | sed -e 's/x86_64/i486/'`
                        tdir_elf_i386=`echo ${targ_alias} \
-                           | sed -e 's/x86_64/i386/'` ;;
+                           | sed -e 's/x86_64/i486/'` ;;
 i[3-7]86-*-sysv*)      targ_emul=i386coff ;;
 i[3-7]86-*-ptx*)       targ_emul=i386coff ;;
 i[3-7]86-*-mach*)      targ_emul=i386mach ;;


Dirty because it exchanges one hardcoded value for another. What would
be needed to fix this properly would be a way to pass different
${targ_alias} strings to binutils configure for the
${targ_extra_emuls} targets. That way Debian could tell binutils that
it wants an i486-linux-gnu target for 32bit support on
x86_64-linux-gnu.

Ideas are welcome.

MfG
        Goswin


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