Fix misc x32 bugs.
authorH.J. Lu <hjl.tools@gmail.com>
Sun, 19 Jun 2011 21:22:16 +0000 (21:22 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 19 Jun 2011 21:22:16 +0000 (21:22 +0000)
bfd/

2011-06-19  H.J. Lu  <hongjiu.lu@intel.com>

* elf64-x86-64.c (elf_backend_post_process_headers): Defined
for x32.

binutils/testsuite/

2011-06-19  H.J. Lu  <hongjiu.lu@intel.com>

* binutils-all/elfedit-1.d: Updated for x32.

gas/

2011-06-19  H.J. Lu  <hongjiu.lu@intel.com>

* configure.tgt: Support x32.

ld/

2011-06-19  H.J. Lu  <hongjiu.lu@intel.com>

* configure.tgt: Support x32.

ld/testsuite/

2011-06-19  H.J. Lu  <hongjiu.lu@intel.com>

* 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.

20 files changed:
bfd/ChangeLog
bfd/elf64-x86-64.c
binutils/testsuite/ChangeLog
binutils/testsuite/binutils-all/elfedit-1.d
gas/ChangeLog
gas/configure.tgt
ld/ChangeLog
ld/configure.tgt
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/eh1.d
ld/testsuite/ld-elf/eh2.d
ld/testsuite/ld-elf/eh3.d
ld/testsuite/ld-elf/eh4.d
ld/testsuite/ld-elfvsb/elfvsb.exp
ld/testsuite/ld-ifunc/ifunc-1-local-x86.d
ld/testsuite/ld-ifunc/ifunc-1-x86.d
ld/testsuite/ld-ifunc/ifunc-3a-x86.d
ld/testsuite/ld-shared/shared.exp
ld/testsuite/ld-x86-64/pcrel16.d
ld/testsuite/ld-x86-64/x86-64.exp

index 1ce1ac219d14999c152c35a557da5bcef7944a88..9536f022aea567f3b8a48d8c11e296b6030be379 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf64-x86-64.c (elf_backend_post_process_headers): Defined
+       for x32.
+
 2011-06-16  H.J. Lu  <hongjiu.lu@intel.com>
 
        * elf64-x86-64.c: Include <stdarg.h> and CORE_HEADER if
index 23b55591ea7b82f2f76f4804af0a159d96596d4a..a929797296048728569dbaf59f002ae6e73e3353 100644 (file)
@@ -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"
index 94dcdadc71b9eb7130470e3e2bf06b57e1a70d9b..d19d1b0f6e6dc7fba9555fef5fbbcee860363e92 100644 (file)
@@ -1,3 +1,7 @@
+2011-06-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * binutils-all/elfedit-1.d: Updated for x32.
+
 2011-05-18  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/12753
index 3459315a6df726726c04f4da567b35e28e3bf73e..700d54281b93b0a4288dff10054a7a479aea473b 100644 (file)
@@ -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\)
 #...
index 1120cdc5ee2f1570454505f956692f40d57a8529..32cd61feea230bcf4726c07b392064ec41fc1446 100644 (file)
@@ -1,3 +1,7 @@
+2011-06-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * configure.tgt: Support x32.
+
 2011-06-15  Nick Clifton  <nickc@redhat.com>
 
        * NEWS: Mention addition of TILEPRO and TIKE-Gx support.
index a171a32bbfbb5a5ad56550cd07eb35eeba55129c..7f7f61180603433b41a5e6354580e035455fdc86 100644 (file)
@@ -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
index 683d18da4d70b6af61c997fc238ba2411b993a19..099104da019015fdace0cdbd677f0d397b4843d9 100644 (file)
@@ -1,3 +1,7 @@
+2011-06-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * configure.tgt: Support x32.
+
 2011-06-15  Nick Clifton  <nickc@redhat.com>
 
        * NEWS: Mention addition of TILEPRO and TIKE-Gx support.
index f35298cbc88bf143ab5eab4d3c96e4595659ee09..dd059755c4445ab88979189028b6afee86e96e33 100644 (file)
@@ -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"
index 8861d94eebe9194a3566a0ecf9d856e030952dce..4db226f5215fd1442732bbaeed093bf252c79167 100644 (file)
@@ -1,3 +1,20 @@
+2011-06-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * 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  <amodra@gmail.com>
 
        * ld-elfvers/vers2.ver: Don't assume any particular index for
index f0874f73dc24e9e4924d4eb6907068ef2465c05f..4275de1c76719b63ec8275f5be15ba029f65d999 100644 (file)
@@ -2,6 +2,7 @@
 #source: eh1a.s
 #ld:
 #readelf: -wf
+#notarget: x86_64-x32-*
 #target: x86_64-*-*
 
 Contents of the .eh_frame section:
index 1a05d7fc8fb310bc5734c999004119d034e21a2c..a7372f04ffcc06dcf47303a2b3e0ce6cfe817305 100644 (file)
@@ -2,6 +2,7 @@
 #source: eh2a.s
 #ld:
 #readelf: -wf
+#notarget: x86_64-x32-*
 #target: x86_64-*-*
 
 Contents of the .eh_frame section:
index 1f76b8c17569949ca209d860f2a402a79e668c0f..a9777a21dff1658d2a89fe19d19b701372247971 100644 (file)
@@ -2,6 +2,7 @@
 #source: eh3a.s
 #ld:
 #readelf: -wf
+#notarget: x86_64-x32-*
 #target: x86_64-*-*
 
 Contents of the .eh_frame section:
index b8f9865ebfff289431cc62bb0d1eaaef4861d91e..b568f3283c780c11b26eed95ab7a81bc967aadce 100644 (file)
@@ -2,6 +2,7 @@
 #source: eh4a.s
 #ld: -shared
 #readelf: -wf
+#notarget: x86_64-x32-*
 #target: x86_64-*-*
 
 Contents of the .eh_frame section:
index d288774adae7d57afe6d983c1923e12664f128e2..3c6478398c81b83d3e8d89b01bc0279de962e59a 100644 (file)
@@ -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*"
                }
index 80cbe41a9ad387ff112d8549b437d4f80be29d1c..67ecdaebf3f2cd286d4d3a4852a030134da900c0 100644 (file)
@@ -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
index 1fa2d565d7050dcbaa89d6cbf557c4998ddf3376..4142402e7511d729717b12489a2ea7eb467bbcdb 100644 (file)
@@ -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
index 3924dda47524d7da4dea20e8789df49e028d5d2c..bcfac6f9b45c4114776a6d587438e94eca98face 100644 (file)
@@ -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
index b77b9cea2a65b8617c1dbd4b296cc545fdb0579b..1d25d51c927a8fe0cc1b154b462688edbd447ccf 100644 (file)
@@ -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*"
index f593657271f216325a50d79f6eec92e3649aff0e..5bbbb3ee162d1fcb2a8cb04bf529235e18aa9834 100644 (file)
@@ -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:
 
index 2cb1891a0271587b78df8ae7d34acfc1cdf7c77c..bd1991a4762d0c0f981b93aeb126c795262c6aac 100644 (file)
@@ -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"