public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Kai Tietz <Kai.Tietz@onevision.com>
To: Pedro Alves <pedro_alves@portugalmail.pt>
Cc: binutils@sourceware.org
Subject: Re: PE+ and new COFF format for x86_64 target for XP64 and Vista binaries
Date: Wed, 13 Sep 2006 11:54:00 -0000	[thread overview]
Message-ID: <OFF81DBC5B.124B2DB1-ONC12571E8.00410092-C12571E8.00415D1C@onevision.de> (raw)
In-Reply-To: <4507E339.6090102@portugalmail.pt>

[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]

Hallo Pedro,

here comes the third part of the patch for binutils (This is a small one)

Change log modifications for binutils:

        * configure.in: Add new target x86_64-pc-mingw64
        * dlltool.c:    Adjust include for this target
                DLLTOOL_MX86_64:        Added macro to handle target 
specific code
                mname:                                  Added default 
target static as "i386:x86-64"
                MX86:                                   Added macro for 
target ident
                mtable:                         Added target specific 
definitions
                rvaafter:                       Add handling of MX86
                rvabefore:                      Add handling of MX86
                asmprefix:                      Add handling of MX86

Changes log modifcations for binutils/testsuite:

        * binutils-all/dlltool.exp:     Add support for target 
x86_64-pc-mingw64
        * binutils-all/objcopy.exp:     Add support for target 
x86_64-pc-mingw64
        * binutils-all/windres/windres.exp:     Add support for target 
x86_64-pc-mingw64
        * binutils-all/windres/lang.rc: xfail it as long as there is no 
windows.h
        * binutils-all/windres/strtab1.rc:      xfail it as long as there 
is no windows.h
        * lib/utils-lib.exp:    Adjust executable prefix detection (as 
.exe)
 i.A. Kai Tietz


[-- Attachment #2: binutils-2.17.pex-64.060913_binutils.diff --]
[-- Type: application/octet-stream, Size: 13001 bytes --]

diff -rNbu binutils_060913_org/binutils/ChangeLog binutils_060913/binutils/ChangeLog
--- binutils_060913_org/binutils/ChangeLog	2006-09-11 16:40:39.000000000 +0200
+++ binutils_060913/binutils/ChangeLog	2006-09-13 11:06:00.000000000 +0200
@@ -1,3 +1,15 @@
+2006-09-13	Kai Tietz	<Kai.Tietz@onevision.com>
+
+	* configure.in:	Add new target x86_64-pc-mingw64
+	* dlltool.c:	Adjust include for this target
+		DLLTOOL_MX86_64:	Added macro to handle target specific code
+		mname:					Added default target static as "i386:x86-64"
+		MX86:					Added macro for target ident
+		mtable:				Added target specific definitions
+		rvaafter:			Add handling of MX86
+		rvabefore:			Add handling of MX86
+		asmprefix:			Add handling of MX86
+
 2006-09-09  Nick Clifton  <nickc@redhat.com>
 
 	PR binutils/3110
diff -rNbu binutils_060913_org/binutils/configure binutils_060913/binutils/configure
--- binutils_060913_org/binutils/configure	2006-08-21 10:12:45.000000000 +0200
+++ binutils_060913/binutils/configure	2006-09-11 13:50:34.000000000 +0200
@@ -8451,6 +8451,12 @@
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
 	  BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
 	  ;;
+	x86_64-*-mingw64*)
+  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
+	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
+	  BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
+	  ;;
 	i[3-7]86-*-interix)
 	  BUILD_DLLTOOL='$(DLLTOOL_PROG)'
 	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
diff -rNbu binutils_060913_org/binutils/configure.in binutils_060913/binutils/configure.in
--- binutils_060913_org/binutils/configure.in	2006-08-21 10:12:45.000000000 +0200
+++ binutils_060913/binutils/configure.in	2006-09-11 13:33:20.000000000 +0200
@@ -265,6 +265,14 @@
 	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
 	  BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
 	  ;;
+	x86_64-*-mingw64*)
+changequote([,])dnl
+  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
+	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
+	  BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
+	  ;;
+changequote(,)dnl
 changequote(,)dnl
 	i[3-7]86-*-interix)
 changequote([,])dnl
diff -rNbu binutils_060913_org/binutils/dlltool.c binutils_060913/binutils/dlltool.c
--- binutils_060913_org/binutils/dlltool.c	2006-08-21 10:12:45.000000000 +0200
+++ binutils_060913/binutils/dlltool.c	2006-09-11 13:47:12.000000000 +0200
@@ -261,6 +261,9 @@
 #include "coff/arm.h"
 #include "coff/internal.h"
 #endif
+#ifdef DLLTOOL_MX86_64
+#include "coff/x86_64.h"
+#endif
 
 /* Forward references.  */
 static char *look_for_prog (const char *, const char *, int);
@@ -398,6 +401,10 @@
 static const char *mname = "i386";
 #endif
 
+#ifdef DLLTOOL_MX86_64
+static const char *mname = "i386:x86-64";
+#endif
+
 #ifdef DLLTOOL_PPC
 static const char *mname = "ppc";
 #endif
@@ -640,6 +647,14 @@
     arm_jtab, sizeof (arm_jtab), 8
   }
   ,
+  {
+#define MX86 11
+    "i386:x86-64", ".byte", ".short", ".long", ".asciz", "#",
+    "jmp *", ".global", ".space", ".align\t2",".align\t4", "",
+    "pe-x86-64",bfd_arch_i386,
+    i386_jtab, sizeof (i386_jtab), 2
+  }
+  ,
   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
 };
 
@@ -763,6 +778,7 @@
     {
     case MARM:
     case M386:
+	case MX86:
     case MPPC:
     case MTHUMB:
     case MARM_INTERWORK:
@@ -788,6 +804,7 @@
     {
     case MARM:
     case M386:
+	case MX86:
     case MPPC:
     case MTHUMB:
     case MARM_INTERWORK:
@@ -823,6 +840,7 @@
     case MARM_WINCE:
       break;
     case M386:
+	case MX86:
       /* Symbol names starting with ? do not have a leading underscore. */
       if (name && *name == '?')
         break;
@@ -1701,9 +1719,18 @@
     {
       fprintf (filvar, "listone%d:\n", headindex);
       for ( funcindex = 0; funcindex < headptr->nfuncs; funcindex++ )
+#ifdef DLLTOOL_MX86_64
+	fprintf (filvar, "\t%sfuncptr%d_%d%s\n%s\t0\n",
+		 ASM_RVA_BEFORE, headindex, funcindex, ASM_RVA_AFTER,ASM_LONG);
+#else
 	fprintf (filvar, "\t%sfuncptr%d_%d%s\n",
 		 ASM_RVA_BEFORE, headindex, funcindex, ASM_RVA_AFTER);
+#endif
+#ifdef DLLTOOL_MX86_64
+      fprintf (filvar,"\t%s\t0\n\t%s\t0\n", ASM_LONG, ASM_LONG); /* NULL terminating list */
+#else
       fprintf (filvar,"\t%s\t0\n", ASM_LONG); /* NULL terminating list */
+#endif
       headindex++;
     }
 
@@ -1713,9 +1740,18 @@
     {
       fprintf (filvar, "listtwo%d:\n", headindex);
       for ( funcindex = 0; funcindex < headptr->nfuncs; funcindex++ )
+#ifdef DLLTOOL_MX86_64
+	fprintf (filvar, "\t%sfuncptr%d_%d%s\n%s\t0\n",
+		 ASM_RVA_BEFORE, headindex, funcindex, ASM_RVA_AFTER,ASM_LONG);
+#else
 	fprintf (filvar, "\t%sfuncptr%d_%d%s\n",
 		 ASM_RVA_BEFORE, headindex, funcindex, ASM_RVA_AFTER);
-      fprintf (filvar, "\t%s\t0\n", ASM_LONG); /* NULL terminating list */
+#endif
+#ifdef DLLTOOL_MX86_64
+      fprintf (filvar,"\t%s\t0\n\t%s\t0\n", ASM_LONG, ASM_LONG); /* NULL terminating list */
+#else
+      fprintf (filvar,"\t%s\t0\n", ASM_LONG); /* NULL terminating list */
+#endif
       headindex++;
     }
 
@@ -2388,6 +2424,36 @@
 	  /* An idata$4 or idata$5 is one word long, and has an
 	     rva to idata$6.  */
 
+#ifdef DLLTOOL_MX86_64
+	  si->data = xmalloc (8);
+	  si->size = 8;
+
+	  if (exp->noname)
+	    {
+	      si->data[0] = exp->ordinal ;
+	      si->data[1] = exp->ordinal >> 8;
+	      si->data[2] = exp->ordinal >> 16;
+		  si->data[3] = exp->ordinal >> 24;
+		  si->data[4] = 0;
+		  si->data[5] = 0;
+		  si->data[6] = 0;
+	      si->data[7] = 0x80;
+	    }
+	  else
+	    {
+	      sec->reloc_count = 1;
+	      memset (si->data, 0, si->size);
+	      rel = xmalloc (sizeof (arelent));
+	      rpp = xmalloc (sizeof (arelent *) * 2);
+	      rpp[0] = rel;
+	      rpp[1] = 0;
+	      rel->address = 0;
+	      rel->addend = 0;
+	      rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_RVA);
+	      rel->sym_ptr_ptr = secdata[IDATA6].sympp;
+	      sec->orelocation = rpp;
+	    }
+#else
 	  si->data = xmalloc (4);
 	  si->size = 4;
 
@@ -2412,7 +2478,7 @@
 	      rel->sym_ptr_ptr = secdata[IDATA6].sympp;
 	      sec->orelocation = rpp;
 	    }
-
+#endif
 	  break;
 
 	case IDATA6:
@@ -2626,7 +2692,11 @@
   if (!no_idata5)
     {
       fprintf (f, "\t.section\t.idata$5\n");
-      fprintf (f, "\t%s\t0\n", ASM_LONG);
+#ifdef DLLTOOL_MX86_64
+      fprintf (f,"\t%s\t0\n\t%s\t0\n", ASM_LONG, ASM_LONG); /* NULL terminating list */
+#else
+      fprintf (f,"\t%s\t0\n", ASM_LONG); /* NULL terminating list */
+#endif
       fprintf (f, "fthunk:\n");
     }
 
@@ -2634,7 +2704,11 @@
     {
       fprintf (f, "\t.section\t.idata$4\n");
 
-      fprintf (f, "\t%s\t0\n", ASM_LONG);
+#ifdef DLLTOOL_MX86_64
+      fprintf (f,"\t%s\t0\n\t%s\t0\n", ASM_LONG, ASM_LONG); /* NULL terminating list */
+#else
+      fprintf (f,"\t%s\t0\n", ASM_LONG); /* NULL terminating list */
+#endif
       fprintf (f, "\t.section	.idata$4\n");
       fprintf (f, "hname:\n");
     }
@@ -2660,13 +2734,21 @@
   if (!no_idata4)
     {
       fprintf (f, "\t.section	.idata$4\n");
-      fprintf (f, "\t%s\t0\n", ASM_LONG);
+#ifdef DLLTOOL_MX86_64
+      fprintf (f,"\t%s\t0\n\t%s\t0\n", ASM_LONG, ASM_LONG); /* NULL terminating list */
+#else
+      fprintf (f,"\t%s\t0\n", ASM_LONG); /* NULL terminating list */
+#endif
     }
 
   if (!no_idata5)
     {
       fprintf (f, "\t.section	.idata$5\n");
-      fprintf (f, "\t%s\t0\n", ASM_LONG);
+#ifdef DLLTOOL_MX86_64
+      fprintf (f,"\t%s\t0\n\t%s\t0\n", ASM_LONG, ASM_LONG); /* NULL terminating list */
+#else
+      fprintf (f,"\t%s\t0\n", ASM_LONG); /* NULL terminating list */
+#endif
     }
 
 #ifdef DLLTOOL_PPC
diff -rNbu binutils_060913_org/binutils/testsuite/ChangeLog binutils_060913/binutils/testsuite/ChangeLog
--- binutils_060913_org/binutils/testsuite/ChangeLog	2006-08-15 20:23:10.000000000 +0200
+++ binutils_060913/binutils/testsuite/ChangeLog	2006-09-13 11:06:25.000000000 +0200
@@ -1,3 +1,12 @@
+2006-09-13	Kai Tietz	<Kai.Tietz@onevision.com>
+
+	* binutils-all/dlltool.exp:	Add support for target x86_64-pc-mingw64
+	* binutils-all/objcopy.exp:	Add support for target x86_64-pc-mingw64
+	* binutils-all/windres/windres.exp:	Add support for target x86_64-pc-mingw64
+	* binutils-all/windres/lang.rc:	xfail it as long as there is no windows.h
+	* binutils-all/windres/strtab1.rc:	xfail it as long as there is no windows.h
+	* lib/utils-lib.exp:	Adjust executable prefix detection (as .exe)
+
 2006-08-15  Thiemo Seufer  <ths@mips.com>
             Nigel Stephens  <nigel@mips.com>
             David Ung  <davidu@mips.com>
diff -rNbu binutils_060913_org/binutils/testsuite/binutils-all/copy-3.d binutils_060913/binutils/testsuite/binutils-all/copy-3.d
--- binutils_060913_org/binutils/testsuite/binutils-all/copy-3.d	2006-05-03 18:45:59.000000000 +0200
+++ binutils_060913/binutils/testsuite/binutils-all/copy-3.d	2006-09-11 15:53:34.000000000 +0200
@@ -3,7 +3,7 @@
 #objcopy: --set-section-flags .text=alloc,data
 #name: copy with setting section flags 3
 #source: bintest.s
-#not-target: *-*-aout *-*-*pe *-*-*coff i*86-*-cygwin* i*86-*-mingw32*
+#not-target: *-*-aout *-*-*pe *-*-*coff i*86-*-cygwin* i*86-*-mingw32* x86_64-*-mingw64*
 # The .text # section in PE/COFF has a fixed set of flags and these
 # cannot be changed.  We skip it for them.
 
diff -rNbu binutils_060913_org/binutils/testsuite/binutils-all/dlltool.exp binutils_060913/binutils/testsuite/binutils-all/dlltool.exp
--- binutils_060913_org/binutils/testsuite/binutils-all/dlltool.exp	2005-05-08 16:17:40.000000000 +0200
+++ binutils_060913/binutils/testsuite/binutils-all/dlltool.exp	2006-09-11 13:53:24.000000000 +0200
@@ -14,13 +14,14 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 
-if {![istarget "i*86-*-*"]} {
+if {![istarget "i*86-*-*"] && ![istarget "x86_64-*-mingw64*"] } {
     return
 }
 
 if {![istarget "i*86-*-*pe*"] \
     && ![istarget "i*86-*-cygwin*"] \
-    && ![istarget "i*86-*-mingw32*"] } {
+    && ![istarget "i*86-*-mingw32*"] \
+    && ![istarget "x86_64-*-mingw64*"] } {
     set target_xfail "yes"
 } else {
     set target_xfail "no"
diff -rNbu binutils_060913_org/binutils/testsuite/binutils-all/objcopy.exp binutils_060913/binutils/testsuite/binutils-all/objcopy.exp
--- binutils_060913_org/binutils/testsuite/binutils-all/objcopy.exp	2006-06-23 18:23:09.000000000 +0200
+++ binutils_060913/binutils/testsuite/binutils-all/objcopy.exp	2006-09-11 13:54:42.000000000 +0200
@@ -443,7 +443,7 @@
 
 # Build a final executable.
 
-if { [istarget *-*-cygwin] || [istarget *-*-mingw32] } {
+if { [istarget *-*-cygwin] || [istarget *-*-mingw*] } {
     set test_prog "testprog.exe"
 } else {
     set test_prog "testprog"
diff -rNbu binutils_060913_org/binutils/testsuite/binutils-all/windres/lang.rc binutils_060913/binutils/testsuite/binutils-all/windres/lang.rc
--- binutils_060913_org/binutils/testsuite/binutils-all/windres/lang.rc	2001-07-19 01:56:41.000000000 +0200
+++ binutils_060913/binutils/testsuite/binutils-all/windres/lang.rc	2006-09-11 13:55:32.000000000 +0200
@@ -1,3 +1,4 @@
+//#xfail *-*-mingw64
 #include "windows.h"
 
 LANGUAGE 0, 0
diff -rNbu binutils_060913_org/binutils/testsuite/binutils-all/windres/strtab1.rc binutils_060913/binutils/testsuite/binutils-all/windres/strtab1.rc
--- binutils_060913_org/binutils/testsuite/binutils-all/windres/strtab1.rc	2001-07-19 01:56:41.000000000 +0200
+++ binutils_060913/binutils/testsuite/binutils-all/windres/strtab1.rc	2006-09-11 13:55:58.000000000 +0200
@@ -1,3 +1,4 @@
+//#xfail *-*-mingw64
 #include "windows.h"
 
 LANGUAGE 0, 0
diff -rNbu binutils_060913_org/binutils/testsuite/binutils-all/windres/windres.exp binutils_060913/binutils/testsuite/binutils-all/windres/windres.exp
--- binutils_060913_org/binutils/testsuite/binutils-all/windres/windres.exp	2005-05-08 16:17:41.000000000 +0200
+++ binutils_060913/binutils/testsuite/binutils-all/windres/windres.exp	2006-09-11 13:56:48.000000000 +0200
@@ -19,13 +19,14 @@
 
 # Written by DJ Delorie <dj@redhat.com>
 
-if {![istarget "i*86-*-*"]} {
+if {![istarget "i*86-*-*"] && ![istarget "x86_64-*-mingw64"] } {
     return
 }
 
 if {![istarget "i*86-*-*pe*"] \
     && ![istarget "i*86-*-cygwin*"] \
-    && ![istarget "i*86-*-mingw32*"] } {
+    && ![istarget "i*86-*-mingw32*"] \
+    && ![istarget "x86_64-*-mingw64*"] } {
     set target_xfail "yes"
 } else {
     set target_xfail "no"
diff -rNbu binutils_060913_org/binutils/testsuite/lib/utils-lib.exp binutils_060913/binutils/testsuite/lib/utils-lib.exp
--- binutils_060913_org/binutils/testsuite/lib/utils-lib.exp	2006-04-26 15:37:05.000000000 +0200
+++ binutils_060913/binutils/testsuite/lib/utils-lib.exp	2006-09-11 13:57:44.000000000 +0200
@@ -161,7 +161,7 @@
 #	Returns target executable extension, if any.
 #
 proc exe_ext {} {
-    if { [istarget *-*-mingw32] || [istarget *-*-cygwin*] } {
+    if { [istarget *-*-mingw*] || [istarget *-*-cygwin*] } {
         return ".exe"
     } else {
         return ""

  parent reply	other threads:[~2006-09-13 11:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-13  9:43 Kai Tietz
2006-09-13 10:52 ` Pedro Alves
2006-09-13 11:50   ` Kai Tietz
2006-09-13 11:54   ` Kai Tietz [this message]
2006-09-13 12:02   ` Kai Tietz
2006-09-13 12:07   ` Kai Tietz
2006-09-20 13:06     ` Nick Clifton
2006-09-20 18:49       ` Kai Tietz
     [not found] <OF549439E3.7A0AEA72-ONC12571E2.005485EF-C12571E2.0057AE96@LocalDomain>
2006-09-07 16:03 ` Kai Tietz
  -- strict thread matches above, loose matches on Subject: below --
2006-08-17 16:25 Kai Tietz
2006-08-17 16:45 ` H. J. Lu
2006-09-07 13:41   ` Kai Tietz
2006-09-07 15:04     ` H. J. Lu
2006-09-08  9:48 ` Pedro Alves
2006-09-08 10:23   ` Kai Tietz
2006-09-08 17:46     ` Phil Lello
2006-09-11  7:26       ` Kai Tietz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OFF81DBC5B.124B2DB1-ONC12571E8.00410092-C12571E8.00415D1C@onevision.de \
    --to=kai.tietz@onevision.com \
    --cc=binutils@sourceware.org \
    --cc=pedro_alves@portugalmail.pt \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).