From: H.J. Lu Date: Sun, 19 Jun 2011 21:22:16 +0000 (+0000) Subject: Fix misc x32 bugs. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8b7789423cab57f0adc2a1cb374908d73a2f64b8;p=binutils-gdb.git Fix misc x32 bugs. bfd/ 2011-06-19 H.J. Lu * elf64-x86-64.c (elf_backend_post_process_headers): Defined for x32. binutils/testsuite/ 2011-06-19 H.J. Lu * binutils-all/elfedit-1.d: Updated for x32. gas/ 2011-06-19 H.J. Lu * configure.tgt: Support x32. ld/ 2011-06-19 H.J. Lu * configure.tgt: Support x32. ld/testsuite/ 2011-06-19 H.J. Lu * ld-elf/eh1.d: Skip x32. * ld-elf/eh2.d: Likewise. * ld-elf/eh3.d: Likewise. * ld-elf/eh4.d: Likewise. * ld-elfvsb/elfvsb.exp: Only xfail 64bit x86_64-*-linux*. * ld-shared/shared.exp: Likewise. * ld-ifunc/ifunc-1-local-x86.d: Support x32. * ld-ifunc/ifunc-1-x86.d: Likewise. * ld-ifunc/ifunc-3a-x86.d: Likewise. * ld-x86-64/pcrel16.d: Likewise. * ld-x86-64/x86-64.exp (x86_64tests): Add missing -melf_x86_64. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1ce1ac219d1..9536f022aea 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2011-06-19 H.J. Lu + + * elf64-x86-64.c (elf_backend_post_process_headers): Defined + for x32. + 2011-06-16 H.J. Lu * elf64-x86-64.c: Include and CORE_HEADER if diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 23b55591ea7..a9297972960 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -4995,4 +4995,7 @@ elf32_x86_64_elf_object_p (bfd *abfd) #define elf_backend_size_info \ _bfd_elf32_size_info +#undef elf_backend_post_process_headers +#define elf_backend_post_process_headers _bfd_elf_set_osabi + #include "elf32-target.h" diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 94dcdadc71b..d19d1b0f6e6 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-06-19 H.J. Lu + + * binutils-all/elfedit-1.d: Updated for x32. + 2011-05-18 Nick Clifton PR binutils/12753 diff --git a/binutils/testsuite/binutils-all/elfedit-1.d b/binutils/testsuite/binutils-all/elfedit-1.d index 3459315a6df..700d54281b9 100644 --- a/binutils/testsuite/binutils-all/elfedit-1.d +++ b/binutils/testsuite/binutils-all/elfedit-1.d @@ -7,8 +7,8 @@ #... ELF Header: - Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 - Class: ELF64 + Magic: 7f 45 4c 46 0(1|2) 01 01 00 00 00 00 00 00 00 00 00 + Class: ELF(32|64) Data: 2's complement, little endian Version: 1 \(current\) #... diff --git a/gas/ChangeLog b/gas/ChangeLog index 1120cdc5ee2..32cd61feea2 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2011-06-19 H.J. Lu + + * configure.tgt: Support x32. + 2011-06-15 Nick Clifton * NEWS: Mention addition of TILEPRO and TIKE-Gx support. diff --git a/gas/configure.tgt b/gas/configure.tgt index a171a32bbfb..7f7f6118060 100644 --- a/gas/configure.tgt +++ b/gas/configure.tgt @@ -81,7 +81,14 @@ case ${cpu} in sparclite*) cpu_type=sparc arch=sparclite ;; sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c. v850*) cpu_type=v850 ;; - x86_64*) cpu_type=i386 arch=x86_64;; + x86_64*) + cpu_type=i386 + if [ x"$vendor" = xx32 ]; then + arch=x86_64:32 + else + arch=x86_64 + fi + ;; xtensa*) cpu_type=xtensa arch=xtensa ;; *) cpu_type=${cpu} ;; esac diff --git a/ld/ChangeLog b/ld/ChangeLog index 683d18da4d7..099104da019 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,7 @@ +2011-06-19 H.J. Lu + + * configure.tgt: Support x32. + 2011-06-15 Nick Clifton * NEWS: Mention addition of TILEPRO and TIKE-Gx support. diff --git a/ld/configure.tgt b/ld/configure.tgt index f35298cbc88..dd059755c44 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -190,6 +190,11 @@ i[3-7]86-*-linux-*) targ_emul=elf_i386 targ64_extra_libpath=elf_x86_64 targ_extra_libpath=elf32_x86_64 tdir_i386linux=${targ_alias}aout ;; +x86_64-x32-linux-*) targ_emul=elf32_x86_64 + targ_extra_emuls="elf_x86_64 elf_i386 i386linux elf_l1om" + targ_extra_libpath="elf_i386 elf_x86_64 elf_l1om" + tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'` + tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;; x86_64-*-linux-*) targ_emul=elf_x86_64 targ_extra_emuls="elf32_x86_64 elf_i386 i386linux elf_l1om" targ_extra_libpath="elf_i386 elf32_x86_64 elf_l1om" diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 8861d94eebe..4db226f5215 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2011-06-19 H.J. Lu + + * ld-elf/eh1.d: Skip x32. + * ld-elf/eh2.d: Likewise. + * ld-elf/eh3.d: Likewise. + * ld-elf/eh4.d: Likewise. + + * ld-elfvsb/elfvsb.exp: Only xfail 64bit x86_64-*-linux*. + * ld-shared/shared.exp: Likewise. + + * ld-ifunc/ifunc-1-local-x86.d: Support x32. + * ld-ifunc/ifunc-1-x86.d: Likewise. + * ld-ifunc/ifunc-3a-x86.d: Likewise. + * ld-x86-64/pcrel16.d: Likewise. + + * ld-x86-64/x86-64.exp (x86_64tests): Add missing -melf_x86_64. + 2011-06-16 Alan Modra * ld-elfvers/vers2.ver: Don't assume any particular index for diff --git a/ld/testsuite/ld-elf/eh1.d b/ld/testsuite/ld-elf/eh1.d index f0874f73dc2..4275de1c767 100644 --- a/ld/testsuite/ld-elf/eh1.d +++ b/ld/testsuite/ld-elf/eh1.d @@ -2,6 +2,7 @@ #source: eh1a.s #ld: #readelf: -wf +#notarget: x86_64-x32-* #target: x86_64-*-* Contents of the .eh_frame section: diff --git a/ld/testsuite/ld-elf/eh2.d b/ld/testsuite/ld-elf/eh2.d index 1a05d7fc8fb..a7372f04ffc 100644 --- a/ld/testsuite/ld-elf/eh2.d +++ b/ld/testsuite/ld-elf/eh2.d @@ -2,6 +2,7 @@ #source: eh2a.s #ld: #readelf: -wf +#notarget: x86_64-x32-* #target: x86_64-*-* Contents of the .eh_frame section: diff --git a/ld/testsuite/ld-elf/eh3.d b/ld/testsuite/ld-elf/eh3.d index 1f76b8c1756..a9777a21dff 100644 --- a/ld/testsuite/ld-elf/eh3.d +++ b/ld/testsuite/ld-elf/eh3.d @@ -2,6 +2,7 @@ #source: eh3a.s #ld: #readelf: -wf +#notarget: x86_64-x32-* #target: x86_64-*-* Contents of the .eh_frame section: diff --git a/ld/testsuite/ld-elf/eh4.d b/ld/testsuite/ld-elf/eh4.d index b8f9865ebff..b568f3283c7 100644 --- a/ld/testsuite/ld-elf/eh4.d +++ b/ld/testsuite/ld-elf/eh4.d @@ -2,6 +2,7 @@ #source: eh4a.s #ld: -shared #readelf: -wf +#notarget: x86_64-x32-* #target: x86_64-*-* Contents of the .eh_frame section: diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp index d288774adae..3c6478398c8 100644 --- a/ld/testsuite/ld-elfvsb/elfvsb.exp +++ b/ld/testsuite/ld-elfvsb/elfvsb.exp @@ -302,7 +302,9 @@ proc visibility_run {visibility} { setup_xfail "sparc*-*-linux*" } } - setup_xfail "x86_64-*-linux*" + if { [is_elf64 $tmpdir/mainnp.o] } { + setup_xfail "x86_64-*-linux*" + } if { ![istarget hppa*64*-*-linux*] } { setup_xfail "hppa*-*-linux*" } @@ -343,7 +345,9 @@ proc visibility_run {visibility} { setup_xfail "alpha*-*-linux*" setup_xfail "mips*-*-linux*" } - setup_xfail "x86_64-*-linux*" + if { [is_elf64 $tmpdir/mainnp.o] } { + setup_xfail "x86_64-*-linux*" + } if { ![istarget hppa*64*-*-linux*] } { setup_xfail "hppa*-*-linux*" } @@ -415,7 +419,9 @@ proc visibility_run {visibility} { setup_xfail "sparc*-*-linux*" } } - setup_xfail "x86_64-*-linux*" + if { [is_elf64 $tmpdir/mainp.o] } { + setup_xfail "x86_64-*-linux*" + } if { ![istarget hppa*64*-*-linux*] } { setup_xfail "hppa*-*-linux*" } diff --git a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d index 80cbe41a9ad..67ecdaebf3f 100644 --- a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d +++ b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d @@ -3,5 +3,5 @@ #target: x86_64-*-* i?86-*-* #... -[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x200|)@plt> +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x16c|\+0x200|)@plt> #pass diff --git a/ld/testsuite/ld-ifunc/ifunc-1-x86.d b/ld/testsuite/ld-ifunc/ifunc-1-x86.d index 1fa2d565d70..4142402e751 100644 --- a/ld/testsuite/ld-ifunc/ifunc-1-x86.d +++ b/ld/testsuite/ld-ifunc/ifunc-1-x86.d @@ -3,5 +3,5 @@ #target: x86_64-*-* i?86-*-* #... -[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x220|)@plt> +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x184|\+0x220|)@plt> #pass diff --git a/ld/testsuite/ld-ifunc/ifunc-3a-x86.d b/ld/testsuite/ld-ifunc/ifunc-3a-x86.d index 3924dda4752..bcfac6f9b45 100644 --- a/ld/testsuite/ld-ifunc/ifunc-3a-x86.d +++ b/ld/testsuite/ld-ifunc/ifunc-3a-x86.d @@ -4,5 +4,5 @@ #target: x86_64-*-* i?86-*-* #... -[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x258|)@plt> +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x1a8|\+0x258|)@plt> #pass diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp index b77b9cea2a6..1d25d51c927 100644 --- a/ld/testsuite/ld-shared/shared.exp +++ b/ld/testsuite/ld-shared/shared.exp @@ -234,7 +234,9 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainnp.o] } { setup_xfail "sparc*-*-linux*" } - setup_xfail "x86_64-*-linux*" + if { [is_elf64 $tmpdir/mainnp.o] } { + setup_xfail "x86_64-*-linux*" + } setup_xfail "s390x-*-linux*" if [ string match $shared_needs_pic "yes" ] { setup_xfail "arm*-*-linux*" @@ -257,7 +259,9 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainnp.o] } { setup_xfail "sparc*-*-linux*" } - setup_xfail "x86_64-*-linux*" + if { [is_elf64 $tmpdir/mainnp.o] } { + setup_xfail "x86_64-*-linux*" + } setup_xfail "s390x-*-linux*" if [ string match $shared_needs_pic "yes" ] { setup_xfail "arm*-*-linux*" @@ -310,7 +314,9 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/m if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainp.o] } { setup_xfail "sparc*-*-linux*" } - setup_xfail "x86_64-*-linux*" + if { [is_elf64 $tmpdir/mainp.o] } { + setup_xfail "x86_64-*-linux*" + } setup_xfail "s390x-*-linux*" if [ string match $shared_needs_pic "yes" ] { setup_xfail "arm*-*-linux*" diff --git a/ld/testsuite/ld-x86-64/pcrel16.d b/ld/testsuite/ld-x86-64/pcrel16.d index f593657271f..5bbbb3ee162 100644 --- a/ld/testsuite/ld-x86-64/pcrel16.d +++ b/ld/testsuite/ld-x86-64/pcrel16.d @@ -3,7 +3,7 @@ #ld: -Ttext 0x0 #objdump: -drj.text -m i8086 -.*: +file format elf64-x86-64 +.*: +file format elf.*-x86-64 Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 2cb1891a027..bd1991a4762 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -84,7 +84,7 @@ set x86_64tests { "--64" {mixed2a.s} {} "libmixe2a.o"} {"Helper 32bit object 2" "-r -melf_i386" "--32" {mixed2b.s} {} "libmixe2b.o"} - {"Split by file with 'l' flag on section." "-split-by-file -r" + {"Split by file with 'l' flag on section." "-split-by-file -r -melf_x86_64" "--64" {split-by-file1.s split-by-file2.s} {{readelf -SW split-by-file.rd}} "split-by-file.o"} {"TLS X32 IE->LE transition" "-melf32_x86_64"