This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: PR ld/3966: 32bit address wrap around doesn't work with 32bit host
On Sat, Feb 03, 2007 at 12:40:05PM -0800, H. J. Lu wrote:
>
> Unfortunately, the testcase failed on 32bit host due to the 32bit
> address wrap around bug on 32bit host:
>
> http://sourceware.org/bugzilla/show_bug.cgi?id=3966
>
>
To support ia32 address wrap around, we need 64bit BFD. This patch
enables 64bit BFD for ia32. For Linux/i386, config.bfd has
i[3-7]86-*-linux-*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
targ64_selvecs=bfd_elf64_x86_64_vec
that is ELF/x86-64 is included. However, ld doesn't check want64
set in bfd. As the result, Linux/i386 gas supports 64bit, but not
ld. I included a linker patch to check want64 in bfd for enabling
64bit support.
Alan, Martin, if you aren't comfortable with my ld change, I can
limit it to Linux/i386.
Thanks.
H.J.
---
bfd/
2076-02-04 H.J. Lu <hongjiu.lu@intel.com>
PR ld/3966
* config.bfd: Set want64 to true for i[3-7]86.
ld/
2076-02-04 H.J. Lu <hongjiu.lu@intel.com>
* configure.in (targ_extra_emuls): Add $targ64_extra_emuls if
want64 is true.
(targ_extra_libpath): Add $targ64_extra_libpath if want64 is
true
* configure: Regenerated.
* configure.tgt (i[3-7]86-*-linux-*): Set targ64_extra_emuls
and targ64_extra_libpath.
(powerpc*-*-linux*): Likewise.
(s390-*-linux*): Likewise.
--- binutils/bfd/config.bfd.wrap 2007-01-08 09:28:56.000000000 -0800
+++ binutils/bfd/config.bfd 2007-02-04 14:47:34.000000000 -0800
@@ -81,7 +81,8 @@ crx*) targ_archs=bfd_crx_arch ;;
dlx*) targ_archs=bfd_dlx_arch ;;
fido*) targ_archs=bfd_m68k_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
-i[3-7]86) targ_archs=bfd_i386_arch ;;
+# 64bit BFD is needed to support address wrap around. See PR 3966.
+i[3-7]86) targ_archs=bfd_i386_arch; want64=true ;;
i370) targ_archs=bfd_i370_arch ;;
m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;;
m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch" ;;
--- binutils/ld/configure.in.wrap 2006-12-13 06:07:44.000000000 -0800
+++ binutils/ld/configure.in 2007-02-04 15:00:40.000000000 -0800
@@ -175,6 +175,11 @@ do
. ${srcdir}/../bfd/config.bfd
fi
+ if test x${want64} = xtrue; then
+ targ_extra_emuls="$targ_extra_emuls $targ64_extra_emuls"
+ targ_extra_libpath="$targ_extra_libpath $targ64_extra_libpath"
+ fi
+
for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do
case " $all_emuls " in
*" e${i}.o "*) ;;
--- binutils/ld/configure.tgt.wrap 2007-01-08 09:28:56.000000000 -0800
+++ binutils/ld/configure.tgt 2007-02-04 14:57:45.000000000 -0800
@@ -167,10 +167,8 @@ i[3-7]86-*-linux*aout*) targ_emul=i386li
i[3-7]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;;
i[3-7]86-*-linux-*) targ_emul=elf_i386
targ_extra_emuls=i386linux
- if test x${want64} = xtrue; then
- targ_extra_emuls="$targ_extra_emuls elf_x86_64"
- targ_extra_libpath=elf_x86_64
- fi
+ targ64_extra_emuls="$targ_extra_emuls elf_x86_64"
+ targ64_extra_libpath=elf_x86_64
tdir_i386linux=${targ_alias}aout ;;
x86_64-*-linux-*) targ_emul=elf_x86_64
targ_extra_emuls="elf_i386 i386linux"
@@ -411,10 +409,9 @@ powerpc*-*-linux*) case "${targ}" in
*) targ_emul=elf32ppclinux
targ_extra_emuls="elf32ppc elf32ppcsim"
targ_extra_libpath=elf32ppc
- if test "${want64}" = "true"; then
- targ_extra_emuls="$targ_extra_emuls elf64ppc"
- targ_extra_libpath="$targ_extra_libpath elf64ppc"
- fi ;;
+ targ64_extra_emuls="$targ_extra_emuls elf64ppc"
+ targ64_extra_libpath="$targ_extra_libpath elf64ppc"
+ ;;
esac ;;
powerpc*le-*-elf* | powerpc*le-*-eabi* | powerpc*le-*-solaris* \
| powerpc*le-*-sysv* | powerpc*le-*-vxworks*)
@@ -465,11 +462,9 @@ s390x-*-linux*) targ_emul=elf64_
s390x-*-tpf*) targ_emul=elf64_s390
tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'` ;;
s390-*-linux*) targ_emul=elf_s390
- if test "${want64}" = "true"; then
- targ_extra_emuls=elf64_s390
- targ_extra_libpath=$targ_extra_emuls
- tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'`
- fi
+ targ64_extra_emuls=elf64_s390
+ targ64_extra_libpath=$targ_extra_emuls
+ tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'`
;;
score-*-elf) targ_emul=scoreelf ;;
sh-*-linux*) targ_emul=shlelf_linux