public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: PATCH: w64 native support
@ 2007-04-11 13:43 Kai Tietz
  2007-04-11 13:58 ` H. J. Lu
  0 siblings, 1 reply; 48+ messages in thread
From: Kai Tietz @ 2007-04-11 13:43 UTC (permalink / raw)
  To: H. J. Lu; +Cc: binutils

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

Hello,

I did the windres.h patch changing the long to int types, so that problem 
#2737 seems to be solved.
Additionally I introduced in bfd-in.h the type "bfd_hostptr_t" and its 
hexadeicmal printf representation in macro "BFD_HOSTPTR_T_PRT_X". For now, 
AFAIS, only WIN64 has a long type lesser than a pointer, therefore I made 
the define dependent on the definiton of _WIN64. The modification in 
splay-tree.h header has the same reason.

ChangeLogs:

For bfd:

2007-04-11 Kai Tietz  <kai.tietz@onevision.com>

        * bfd/bfd-in.h: (bfd_hostptr_t): New type for max(long,void *) 
width.
        (BFD_HOSTPTR_T_PRT_X): Printf a bfd_hostptr_t type.
        * bfd/bfd-in2.h: Regenerate.
        * bfd/coffcode.h: Replace use of long by bfd_hostptr_t.
        * bfd/coffgen.c: Likewise.
        * bfd/elf-eh-frame.c: Likewise.
        * bfd/peicode.h: Likewise.

For binutils:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * binutils/resres.c: Cast sizeof explicit to type "long".
        * binutils/resrc.c: Adjust printf formatter for ints.
        * binutils/windres.c: (main): Assert if sizeof(int) not 4 bytes.
        * binutils/windres.h: Changed windows structure to use
        int type instead of long type.

For gas:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * gas/symbols.c: Replace use of long by bfd_hostptr_t and
          print via BFD_HOSTPTR_T_PRT_X.
        * gas/write.c: Likewise.

For gprof:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * gprof/cg_print.c: Explict cast sizeof to long.
        * gprof/hist.c: Likewise.

For include:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * include/splay-tree.h: (libi_uhostptr_t): New type.
        (libi_shostptr_t): New type.
        (splay_tree_key, splay_tree_value): Use libi_uhostptr_t type.
        * include/coff/internal.h: (_n_zeroes, _n_offset): Type as 
bfd_hostptr_t
        instead of long.


For libiberty:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * libiberty/strerror.c: Undefine sys_nerr and sys_errlist for w64 
sake.

Regards,
 i.A. Kai Tietz



------------------------------------------------------------------------------------------
  OneVision Software Entwicklungs GmbH & Co. KG
  Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
  Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
  Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
  Handelsregister: HRA 6744, Amtsgericht Regensburg
  Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
  Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
  Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer: 
Ulrike Döhler, Manuela Kluger

[-- Attachment #2: bfd-w64-native-2.txt --]
[-- Type: text/plain, Size: 28950 bytes --]

Index: bfd/bfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in.h,v
retrieving revision 1.126
diff -b -u -r1.126 bfd-in.h
--- bfd/bfd-in.h	20 Mar 2007 20:19:07 -0000	1.126
+++ bfd/bfd-in.h	11 Apr 2007 13:25:21 -0000
@@ -96,6 +96,19 @@
 #endif
 #endif
 
+/* Declaring a type wide enough to hold a host long and a host pointer.  */
+#ifndef BFD_HOSTPTR_T
+#define BFD_HOSTPTR_T
+#undef BFD_HOSTPTR_T_PRINT
+#ifdef _WIN64
+typedef unsigned long long bfd_hostptr_t;
+#define BFD_HOSTPTR_T_PRT_X	"%llx"
+#else
+typedef unsigned long bfd_hostptr_t;
+#define BFD_HOSTPTR_T_PRT_X	"%lx"
+#endif
+#endif
+
 /* Forward declaration.  */
 typedef struct bfd bfd;
 
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.418
diff -b -u -r1.418 bfd-in2.h
--- bfd/bfd-in2.h	26 Mar 2007 12:23:03 -0000	1.418
+++ bfd/bfd-in2.h	11 Apr 2007 13:25:25 -0000
@@ -103,6 +103,19 @@
 #endif
 #endif
 
+/* Declaring a type wide enough to hold a host long and a host pointer.  */
+#ifndef BFD_HOSTPTR_T
+#define BFD_HOSTPTR_T
+#undef BFD_HOSTPTR_T_PRINT
+#ifdef _WIN64
+typedef unsigned long long bfd_hostptr_t;
+#define BFD_HOSTPTR_T_PRT_X	"%llx"
+#else
+typedef unsigned long bfd_hostptr_t;
+#define BFD_HOSTPTR_T_PRT_X	"%lx"
+#endif
+#endif
+
 /* Forward declaration.  */
 typedef struct bfd bfd;
 
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.136
diff -b -u -r1.136 coffcode.h
--- bfd/coffcode.h	26 Mar 2007 12:22:59 -0000	1.136
+++ bfd/coffcode.h	11 Apr 2007 13:25:29 -0000
@@ -4380,7 +4380,7 @@
 
 	  dst->symbol.name = (char *) (src->u.syment._n._n_n._n_offset);
 	  /* We use the native name field to point to the cached field.  */
-	  src->u.syment._n._n_n._n_zeroes = (long) dst;
+	  src->u.syment._n._n_n._n_zeroes = (bfd_hostptr_t) dst;
 	  dst->symbol.section = coff_section_from_bfd_index (abfd,
 						     src->u.syment.n_scnum);
 	  dst->symbol.flags = 0;
Index: bfd/coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.56
diff -b -u -r1.56 coffgen.c
--- bfd/coffgen.c	2 Apr 2007 16:51:13 -0000	1.56
+++ bfd/coffgen.c	11 Apr 2007 13:25:31 -0000
@@ -725,8 +725,8 @@
 	    {
 	      /* FIXME: We should use a union here.  */
 	      s->u.syment.n_value =
-		(bfd_vma)((combined_entry_type *)
-			  ((unsigned long) s->u.syment.n_value))->offset;
+		(bfd_hostptr_t) ((combined_entry_type *)
+			  ((bfd_hostptr_t) s->u.syment.n_value))->offset;
 	      s->fix_value = 0;
 	    }
 	  if (s->fix_line)
@@ -1640,7 +1640,7 @@
 		}
 
 	      internal_ptr->u.syment._n._n_n._n_offset =
-		((long)
+		((bfd_hostptr_t)
 		 (string_table
 		  + (internal_ptr + 1)->u.auxent.x_file.x_n.x_offset));
 	    }
@@ -1652,13 +1652,13 @@
 	      if (internal_ptr->u.syment.n_numaux > 1
 		  && coff_data (abfd)->pe)
 		internal_ptr->u.syment._n._n_n._n_offset =
-		  ((long)
+		  ((bfd_hostptr_t)
 		   copy_name (abfd,
 			      (internal_ptr + 1)->u.auxent.x_file.x_fname,
 			      internal_ptr->u.syment.n_numaux * symesz));
 	      else
 		internal_ptr->u.syment._n._n_n._n_offset =
-		  ((long)
+		  ((bfd_hostptr_t)
 		   copy_name (abfd,
 			      (internal_ptr + 1)->u.auxent.x_file.x_fname,
 			      (size_t) bfd_coff_filnmlen (abfd)));
@@ -1682,11 +1682,11 @@
 	      if (newstring == NULL)
 		return NULL;
 	      strncpy (newstring, internal_ptr->u.syment._n._n_name, i);
-	      internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
+	      internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) newstring;
 	      internal_ptr->u.syment._n._n_n._n_zeroes = 0;
 	    }
 	  else if (internal_ptr->u.syment._n._n_n._n_offset == 0)
-	    internal_ptr->u.syment._n._n_n._n_offset = (long int) "";
+	    internal_ptr->u.syment._n._n_n._n_offset = (bfd_vma) "";
 	  else if (!bfd_coff_symname_in_debug (abfd, &internal_ptr->u.syment))
 	    {
 	      /* Long name already.  Point symbol at the string in the
@@ -1698,7 +1698,7 @@
 		    return NULL;
 		}
 	      internal_ptr->u.syment._n._n_n._n_offset =
-		((long int)
+		((bfd_hostptr_t)
 		 (string_table
 		  + internal_ptr->u.syment._n._n_n._n_offset));
 	    }
@@ -1707,7 +1707,7 @@
 	      /* Long name in debug section.  Very similar.  */
 	      if (debug_section == NULL)
 		debug_section = build_debug_section (abfd);
-	      internal_ptr->u.syment._n._n_n._n_offset = (long int)
+	      internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t)
 		(debug_section + internal_ptr->u.syment._n._n_n._n_offset);
 	    }
 	}
@@ -1784,7 +1784,7 @@
   if (coffsymbol (symbol)->native != NULL
       && coffsymbol (symbol)->native->fix_value)
     ret->value = coffsymbol (symbol)->native->u.syment.n_value -
-      (unsigned long) obj_raw_syments (abfd);
+      (bfd_hostptr_t) obj_raw_syments (abfd);
 }
 
 /* Return the COFF syment for a symbol.  */
@@ -1807,7 +1807,7 @@
 
   if (csym->native->fix_value)
     psyment->n_value = psyment->n_value -
-      (unsigned long) obj_raw_syments (abfd);
+      (bfd_hostptr_t) obj_raw_syments (abfd);
 
   /* FIXME: We should handle fix_line here.  */
 
@@ -1893,7 +1893,7 @@
 	  if (! combined->fix_value)
 	    val = (bfd_vma) combined->u.syment.n_value;
 	  else
-	    val = combined->u.syment.n_value - (unsigned long) root;
+	    val = combined->u.syment.n_value - (bfd_hostptr_t) root;
 
 	  fprintf (file, "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x",
 		   combined->u.syment.n_scnum,
Index: bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.54
diff -b -u -r1.54 elf-eh-frame.c
--- bfd/elf-eh-frame.c	4 Jan 2007 13:30:39 -0000	1.54
+++ bfd/elf-eh-frame.c	11 Apr 2007 13:25:32 -0000
@@ -917,7 +917,7 @@
       {
 	if (!ent->cie)
 	  {
-	    ecie = ecies + (unsigned long) ent->cie_inf;
+	    ecie = ecies + (bfd_hostptr_t) ent->cie_inf;
 	    ent->cie_inf = ecie->cie.cie_inf;
 	  }
 	ent->new_offset = offset;
Index: bfd/peicode.h
===================================================================
RCS file: /cvs/src/src/bfd/peicode.h,v
retrieving revision 1.50
diff -b -u -r1.50 peicode.h
--- bfd/peicode.h	20 Sep 2006 11:35:07 -0000	1.50
+++ bfd/peicode.h	11 Apr 2007 13:25:34 -0000
@@ -565,7 +565,7 @@
   /* Initialise the internal symbol structure.  */
   ent->u.syment.n_sclass          = sclass;
   ent->u.syment.n_scnum           = section->target_index;
-  ent->u.syment._n._n_n._n_offset = (long) sym;
+  ent->u.syment._n._n_n._n_offset = (bfd_hostptr_t) sym;
 
   sym->symbol.the_bfd = vars->abfd;
   sym->symbol.name    = vars->string_ptr;
Index: binutils/resrc.c
===================================================================
RCS file: /cvs/src/src/binutils/resrc.c,v
retrieving revision 1.27
diff -b -u -r1.27 resrc.c
--- binutils/resrc.c	8 May 2005 14:17:39 -0000	1.27
+++ binutils/resrc.c	11 Apr 2007 13:25:35 -0000
@@ -1515,9 +1515,9 @@
   /* Print out some COFF information that rc files can't represent.  */
 
   if (rd->time != 0)
-    fprintf (e, "// Time stamp: %lu\n", rd->time);
+    fprintf (e, "// Time stamp: %u\n", rd->time);
   if (rd->characteristics != 0)
-    fprintf (e, "// Characteristics: %lu\n", rd->characteristics);
+    fprintf (e, "// Characteristics: %u\n", rd->characteristics);
   if (rd->major != 0 || rd->minor != 0)
     fprintf (e, "// Version: %d %d\n", rd->major, rd->minor);
 
@@ -1546,7 +1546,7 @@
 	      && re->id.u.id != (unsigned long) (unsigned int) *language
 	      && (re->id.u.id & 0xffff) == re->id.u.id)
 	    {
-	      fprintf (e, "LANGUAGE %lu, %lu\n",
+	      fprintf (e, "LANGUAGE %u, %u\n",
 		       re->id.u.id & ((1 << SUBLANG_SHIFT) - 1),
 		       (re->id.u.id >> SUBLANG_SHIFT) & 0xff);
 	      *language = re->id.u.id;
@@ -1774,9 +1774,9 @@
     }
 
   if (res->coff_info.codepage != 0)
-    fprintf (e, "// Code page: %lu\n", res->coff_info.codepage);
+    fprintf (e, "// Code page: %u\n", res->coff_info.codepage);
   if (res->coff_info.reserved != 0)
-    fprintf (e, "// COFF reserved value: %lu\n", res->coff_info.reserved);
+    fprintf (e, "// COFF reserved value: %u\n", res->coff_info.reserved);
 
   if (name != NULL)
     res_id_print (e, *name, 0);
@@ -1809,7 +1809,7 @@
 	       res->u.dialog->width, res->u.dialog->height);
       if (res->u.dialog->ex != NULL
 	  && res->u.dialog->ex->help != 0)
-	fprintf (e, ", %lu", res->u.dialog->ex->help);
+	fprintf (e, ", %u", res->u.dialog->ex->help);
     }
 
   fprintf (e, "\n");
@@ -1841,11 +1841,11 @@
 		 res->res_info.language & ((1<<SUBLANG_SHIFT)-1),
 		 (res->res_info.language >> SUBLANG_SHIFT) & 0xff);
       if (res->res_info.characteristics != 0)
-	fprintf (e, "%sCHARACTERISTICS %lu\n",
+	fprintf (e, "%sCHARACTERISTICS %u\n",
 		 modifiers ? "// " : "",
 		 res->res_info.characteristics);
       if (res->res_info.version != 0)
-	fprintf (e, "%sVERSION %lu\n",
+	fprintf (e, "%sVERSION %u\n",
 		 modifiers ? "// " : "",
 		 res->res_info.version);
     }
@@ -1981,7 +1981,7 @@
     {
       fprintf (e, "// width: %d; height %d; planes %d; bits %d\n",
 	     gc->width, gc->height, gc->planes, gc->bits);
-      fprintf (e, "// data bytes: %lu; index: %d\n",
+      fprintf (e, "// data bytes: %u; index: %d\n",
 	       gc->bytes, gc->index);
     }
 }
@@ -1993,10 +1993,10 @@
 {
   const struct dialog_control *control;
 
-  fprintf (e, "STYLE 0x%lx\n", dialog->style);
+  fprintf (e, "STYLE 0x%x\n", dialog->style);
 
   if (dialog->exstyle != 0)
-    fprintf (e, "EXSTYLE 0x%lx\n", dialog->exstyle);
+    fprintf (e, "EXSTYLE 0x%x\n", dialog->exstyle);
 
   if ((dialog->class.named && dialog->class.u.n.length > 0)
       || dialog->class.u.id != 0)
@@ -2121,7 +2121,7 @@
       res_id_print (e, control->class, 0);
       if (control->class.named)
 	fprintf (e, "\"");
-      fprintf (e, ", 0x%lx, ", control->style);
+      fprintf (e, ", 0x%x, ", control->style);
     }
 
   fprintf (e, "%d, %d", control->x, control->y);
@@ -2137,10 +2137,10 @@
       /* FIXME: We don't need to print the style if it is the default.
 	 More importantly, in certain cases we actually need to turn
 	 off parts of the forced style, by using NOT.  */
-      fprintf (e, ", 0x%lx", control->style);
+      fprintf (e, ", 0x%x", control->style);
 
       if (control->exstyle != 0 || control->help != 0)
-	fprintf (e, ", 0x%lx, %lu", control->exstyle, control->help);
+	fprintf (e, ", 0x%x, %u", control->exstyle, control->help);
     }
 
   fprintf (e, "\n");
@@ -2176,7 +2176,7 @@
     {
       fprintf (e, "// width: %d; height %d; colors: %d; planes %d; bits %d\n",
 	       gi->width, gi->height, gi->colors, gi->planes, gi->bits);
-      fprintf (e, "// data bytes: %lu; index: %d\n",
+      fprintf (e, "// data bytes: %u; index: %d\n",
 	       gi->bytes, gi->index);
     }
 }
@@ -2187,7 +2187,7 @@
 write_rc_menu (FILE *e, const struct menu *menu, int menuex)
 {
   if (menu->help != 0)
-    fprintf (e, "// Help ID: %lu\n", menu->help);
+    fprintf (e, "// Help ID: %u\n", menu->help);
   write_rc_menuitems (e, menu->items, menuex, 0);
 }
 
@@ -2255,12 +2255,12 @@
 	      fprintf (e, ", %d", mi->id);
 	      if (mi->type != 0 || mi->state != 0 || mi->help != 0)
 		{
-		  fprintf (e, ", %lu", mi->type);
+		  fprintf (e, ", %u", mi->type);
 		  if (mi->state != 0 || mi->help != 0)
 		    {
-		      fprintf (e, ", %lu", mi->state);
+		      fprintf (e, ", %u", mi->state);
 		      if (mi->help != 0)
-			fprintf (e, ", %lu", mi->help);
+			fprintf (e, ", %u", mi->help);
 		    }
 		}
 	    }
@@ -2304,7 +2304,7 @@
 	  break;
 
 	case RCDATA_DWORD:
-	  fprintf (e, "%luL", ri->u.dword);
+	  fprintf (e, "%uL", ri->u.dword);
 	  break;
 
 	case RCDATA_STRING:
@@ -2486,29 +2486,29 @@
 
   f = versioninfo->fixed;
   if (f->file_version_ms != 0 || f->file_version_ls != 0)
-    fprintf (e, " FILEVERSION %lu, %lu, %lu, %lu\n",
+    fprintf (e, " FILEVERSION %u, %u, %u, %u\n",
 	     (f->file_version_ms >> 16) & 0xffff,
 	     f->file_version_ms & 0xffff,
 	     (f->file_version_ls >> 16) & 0xffff,
 	     f->file_version_ls & 0xffff);
   if (f->product_version_ms != 0 || f->product_version_ls != 0)
-    fprintf (e, " PRODUCTVERSION %lu, %lu, %lu, %lu\n",
+    fprintf (e, " PRODUCTVERSION %u, %u, %u, %u\n",
 	     (f->product_version_ms >> 16) & 0xffff,
 	     f->product_version_ms & 0xffff,
 	     (f->product_version_ls >> 16) & 0xffff,
 	     f->product_version_ls & 0xffff);
   if (f->file_flags_mask != 0)
-    fprintf (e, " FILEFLAGSMASK 0x%lx\n", f->file_flags_mask);
+    fprintf (e, " FILEFLAGSMASK 0x%x\n", f->file_flags_mask);
   if (f->file_flags != 0)
-    fprintf (e, " FILEFLAGS 0x%lx\n", f->file_flags);
+    fprintf (e, " FILEFLAGS 0x%x\n", f->file_flags);
   if (f->file_os != 0)
-    fprintf (e, " FILEOS 0x%lx\n", f->file_os);
+    fprintf (e, " FILEOS 0x%x\n", f->file_os);
   if (f->file_type != 0)
-    fprintf (e, " FILETYPE 0x%lx\n", f->file_type);
+    fprintf (e, " FILETYPE 0x%x\n", f->file_type);
   if (f->file_subtype != 0)
-    fprintf (e, " FILESUBTYPE 0x%lx\n", f->file_subtype);
+    fprintf (e, " FILESUBTYPE 0x%x\n", f->file_subtype);
   if (f->file_date_ms != 0 || f->file_date_ls != 0)
-    fprintf (e, "// Date: %lu, %lu\n", f->file_date_ms, f->file_date_ls);
+    fprintf (e, "// Date: %u, %u\n", f->file_date_ms, f->file_date_ls);
 
   fprintf (e, "BEGIN\n");
 
Index: binutils/resres.c
===================================================================
RCS file: /cvs/src/src/binutils/resres.c,v
retrieving revision 1.7
diff -b -u -r1.7 resres.c
--- binutils/resres.c	16 Jun 2005 09:18:19 -0000	1.7
+++ binutils/resres.c	11 Apr 2007 13:25:36 -0000
@@ -475,7 +475,7 @@
   else
     /* named id */
     {
-      if (fseek (fres, -sizeof (ord), SEEK_CUR) != 0)
+      if (fseek (fres, - ((long) sizeof (ord)), SEEK_CUR) != 0)
 	fatal ("%s: %s: could not seek in file", program_name, filename);
       id_s = read_unistring (&len);
       id->named = 1;
Index: binutils/windres.c
===================================================================
RCS file: /cvs/src/src/binutils/windres.c,v
retrieving revision 1.28
diff -b -u -r1.28 windres.c
--- binutils/windres.c	17 Feb 2007 13:33:54 -0000	1.28
+++ binutils/windres.c	11 Apr 2007 13:25:36 -0000
@@ -263,7 +263,7 @@
 res_id_print (FILE *stream, struct res_id id, int quote)
 {
   if (! id.named)
-    fprintf (stream, "%lu", id.u.id);
+    fprintf (stream, "%u", id.u.id);
   else
     {
       if (quote)
@@ -320,12 +320,12 @@
 
       if (*resources == NULL)
 	{
-	  static unsigned long timeval;
+	  static unsigned int timeval;
 
 	  /* Use the same timestamp for every resource created in a
              single run.  */
 	  if (timeval == 0)
-	    timeval = time (NULL);
+	    timeval = (unsigned int) time (NULL);
 
 	  *resources = ((struct res_directory *)
 			res_alloc (sizeof **resources));
@@ -756,6 +756,9 @@
   struct res_directory *resources;
   int use_temp_file;
 
+  /* Check, that the type int has a size of 4 bytes, otherwise fail.  */
+  assert (sizeof (int) == 4);
+
 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
   setlocale (LC_MESSAGES, "");
 #endif
Index: binutils/windres.h
===================================================================
RCS file: /cvs/src/src/binutils/windres.h,v
retrieving revision 1.14
diff -b -u -r1.14 windres.h
--- binutils/windres.h	8 May 2005 14:17:39 -0000	1.14
+++ binutils/windres.h	11 Apr 2007 13:25:38 -0000
@@ -35,9 +35,9 @@
 {
   /* Resource flags.  According to the MS docs, this is currently
      always zero.  */
-  unsigned long characteristics;
+  unsigned int characteristics;
   /* Time/date stamp.  */
-  unsigned long time;
+  unsigned int time;
   /* Major version number.  */
   unsigned short major;
   /* Minor version number.  */
@@ -63,7 +63,7 @@
       unichar *name;
     } n;
     /* If the named field is zero, this is the ID.  */
-    unsigned long id;
+    unsigned int id;
   } u;
 };
 
@@ -127,11 +127,11 @@
      COFF file, the res_directory structure has a characteristics
      field, but I don't know if it's related to the one in the res
      file.  */
-  unsigned long characteristics;
+  unsigned int characteristics;
   /* Version of the resource.  Entirely user defined.  In a COFF file,
      the res_directory structure has a characteristics field, but I
      don't know if it's related to the one in the res file.  */
-  unsigned long version;
+  unsigned int version;
   /* Memory flags.  This is a combination of the MEMFLAG values
      defined below.  Most of these values are historical, and are not
      meaningful for win32.  I don't think there is any way to store
@@ -146,11 +146,11 @@
 {
   /* The code page used for the data.  I don't really know what this
      should be.  */
-  unsigned long codepage;
+  unsigned int codepage;
   /* A resource entry in a COFF file has a reserved field, which we
      record here when reading a COFF file.  When writing a COFF file,
      we set this field to zero.  */
-  unsigned long reserved;
+  unsigned int reserved;
 };
 
 /* Resource data is stored in a res_resource structure.  */
@@ -164,7 +164,7 @@
   {
     struct
     {
-      unsigned long length;
+      unsigned int length;
       const unsigned char *data;
     } data;
     struct accelerator *acc;
@@ -250,7 +250,7 @@
   /* Y coordinate of hotspot.  */
   short yhotspot;
   /* Length of bitmap data.  */
-  unsigned long length;
+  unsigned int length;
   /* Data.  */
   const unsigned char *data;
 };
@@ -270,7 +270,7 @@
   /* Bits per pixel.  */
   unsigned short bits;
   /* Number of bytes in cursor resource.  */
-  unsigned long bytes;
+  unsigned int bytes;
   /* Index of cursor resource.  */
   unsigned short index;
 };
@@ -280,9 +280,9 @@
 struct dialog
 {
   /* Basic window style.  */
-  unsigned long style;
+  unsigned int style;
   /* Extended window style.  */
-  unsigned long exstyle;
+  unsigned int exstyle;
   /* X coordinate.  */
   unsigned short x;
   /* Y coordinate.  */
@@ -312,7 +312,7 @@
 struct dialog_ex
 {
   /* Help ID.  */
-  unsigned long help;
+  unsigned int help;
   /* Font weight.  */
   unsigned short weight;
   /* Whether the font is italic.  */
@@ -482,9 +482,9 @@
   /* ID.  */
   unsigned short id;
   /* Style.  */
-  unsigned long style;
+  unsigned int style;
   /* Extended style.  */
-  unsigned long exstyle;
+  unsigned int exstyle;
   /* X coordinate.  */
   unsigned short x;
   /* Y coordinate.  */
@@ -500,7 +500,7 @@
   /* Extra data for the window procedure.  */
   struct rcdata_item *data;
   /* Help ID.  Only used in an extended dialog.  */
-  unsigned long help;
+  unsigned int help;
 };
 
 /* Control classes.  These can be used as the ID field in a struct
@@ -521,7 +521,7 @@
   /* Index of font entry.  */
   short index;
   /* Length of font information.  */
-  unsigned long length;
+  unsigned int length;
   /* Font information.  */
   const unsigned char *data;
 };
@@ -543,7 +543,7 @@
   /* Bits per pixel.  */
   unsigned short bits;
   /* Number of bytes in cursor resource.  */
-  unsigned long bytes;
+  unsigned int bytes;
   /* Index of cursor resource.  */
   unsigned short index;
 };
@@ -556,7 +556,7 @@
   struct menuitem *items;
   /* Help ID.  I don't think there is any way to set this in an rc
      file, but it can appear in the binary format.  */
-  unsigned long help;
+  unsigned int help;
 };
 
 /* A menu resource is a list of menuitem structures.  */
@@ -567,9 +567,9 @@
   struct menuitem *next;
   /* Type.  In a normal menu, rather than a menuex, this is the flags
      field.  */
-  unsigned long type;
+  unsigned int type;
   /* State.  This is only used in a menuex.  */
-  unsigned long state;
+  unsigned int state;
   /* Id.  */
   unsigned short id;
   /* Unicode text.  */
@@ -577,7 +577,7 @@
   /* Popup menu items for a popup.  */
   struct menuitem *popup;
   /* Help ID.  This is only used in a menuex.  */
-  unsigned long help;
+  unsigned int help;
 };
 
 /* Menu item flags.  These can appear in the flags field of a struct
@@ -613,20 +613,20 @@
   union
   {
     unsigned int word;
-    unsigned long dword;
+    unsigned int dword;
     struct
     {
-      unsigned long length;
+      unsigned int length;
       const char *s;
     } string;
     struct
     {
-      unsigned long length;
+      unsigned int length;
       const unichar *w;
     } wstring;
     struct
     {
-      unsigned long length;
+      unsigned int length;
       const unsigned char *data;
     } buffer;
   } u;
@@ -661,24 +661,24 @@
 struct fixed_versioninfo
 {
   /* The file version, which is two 32 bit integers.  */
-  unsigned long file_version_ms;
-  unsigned long file_version_ls;
+  unsigned int file_version_ms;
+  unsigned int file_version_ls;
   /* The product version, which is two 32 bit integers.  */
-  unsigned long product_version_ms;
-  unsigned long product_version_ls;
+  unsigned int product_version_ms;
+  unsigned int product_version_ls;
   /* The file flags mask.  */
-  unsigned long file_flags_mask;
+  unsigned int file_flags_mask;
   /* The file flags.  */
-  unsigned long file_flags;
+  unsigned int file_flags;
   /* The OS type.  */
-  unsigned long file_os;
+  unsigned int file_os;
   /* The file type.  */
-  unsigned long file_type;
+  unsigned int file_type;
   /* The file subtype.  */
-  unsigned long file_subtype;
+  unsigned int file_subtype;
   /* The date, which in Windows is two 32 bit integers.  */
-  unsigned long file_date_ms;
-  unsigned long file_date_ls;
+  unsigned int file_date_ms;
+  unsigned int file_date_ls;
 };
 
 /* A list of variable version information.  */
@@ -742,7 +742,7 @@
   /* Next data.  */
   struct bindata *next;
   /* Length of data.  */
-  unsigned long length;
+  unsigned int length;
   /* Data.  */
   unsigned char *data;
 };
Index: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.83
diff -b -u -r1.83 symbols.c
--- gas/symbols.c	15 Mar 2007 12:11:49 -0000	1.83
+++ gas/symbols.c	11 Apr 2007 13:25:42 -0000
@@ -2728,14 +2728,15 @@
   const char *name = S_GET_NAME (sym);
   if (!name || !name[0])
     name = "(unnamed)";
-  fprintf (file, "sym %lx %s", (unsigned long) sym, name);
+  fprintf (file, "sym " BFD_HOSTPTR_T_PRT_X " %s", (bfd_hostptr_t) sym, name);
 
   if (LOCAL_SYMBOL_CHECK (sym))
     {
       struct local_symbol *locsym = (struct local_symbol *) sym;
       if (local_symbol_get_frag (locsym) != &zero_address_frag
 	  && local_symbol_get_frag (locsym) != NULL)
-	fprintf (file, " frag %lx", (long) local_symbol_get_frag (locsym));
+        fprintf (file, " frag " BFD_HOSTPTR_T_PRT_X,
+        	 (bfd_hostptr_t) local_symbol_get_frag (locsym));
       if (local_symbol_resolved_p (locsym))
 	fprintf (file, " resolved");
       fprintf (file, " local");
@@ -2743,7 +2744,7 @@
   else
     {
       if (sym->sy_frag != &zero_address_frag)
-	fprintf (file, " frag %lx", (long) sym->sy_frag);
+        fprintf (file, " frag "BFD_HOSTPTR_T_PRT_X, (bfd_hostptr_t) sym->sy_frag);
       if (sym->written)
 	fprintf (file, " written");
       if (sym->sy_resolved)
@@ -2817,7 +2818,7 @@
 void
 print_expr_1 (FILE *file, expressionS *exp)
 {
-  fprintf (file, "expr %lx ", (long) exp);
+  fprintf (file, "expr " BFD_HOSTPTR_T_PRT_X " ", (bfd_hostptr_t) exp);
   switch (exp->X_op)
     {
     case O_illegal:
Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.112
diff -b -u -r1.112 write.c
--- gas/write.c	26 Mar 2007 12:23:48 -0000	1.112
+++ gas/write.c	11 Apr 2007 13:25:44 -0000
@@ -2486,7 +2486,8 @@
 print_fixup (fixS *fixp)
 {
   indent_level = 1;
-  fprintf (stderr, "fix %lx %s:%d", (long) fixp, fixp->fx_file, fixp->fx_line);
+  fprintf (stderr, "fix " BFD_HOSTPTR_T_PRT_X " %s:%d",
+  	   (bfd_hostptr_t) fixp, fixp->fx_file, fixp->fx_line);
   if (fixp->fx_pcrel)
     fprintf (stderr, " pcrel");
   if (fixp->fx_pcrel_adjust)
@@ -2503,8 +2504,8 @@
     fprintf (stderr, " tcbit");
   if (fixp->fx_done)
     fprintf (stderr, " done");
-  fprintf (stderr, "\n    size=%d frag=%lx where=%ld offset=%lx addnumber=%lx",
-	   fixp->fx_size, (long) fixp->fx_frag, (long) fixp->fx_where,
+  fprintf (stderr, "\n    size=%d frag=" BFD_HOSTPTR_T_PRT_X " where=%ld offset=%lx addnumber=%lx",
+	   fixp->fx_size, (bfd_hostptr_t) fixp->fx_frag, (long) fixp->fx_where,
 	   (long) fixp->fx_offset, (long) fixp->fx_addnumber);
   fprintf (stderr, "\n    %s (%d)", bfd_get_reloc_code_name (fixp->fx_r_type),
 	   fixp->fx_r_type);
Index: gprof/cg_print.c
===================================================================
RCS file: /cvs/src/src/gprof/cg_print.c,v
retrieving revision 1.12
diff -b -u -r1.12 cg_print.c
--- gprof/cg_print.c	9 May 2005 06:55:24 -0000	1.12
+++ gprof/cg_print.c	11 Apr 2007 13:26:04 -0000
@@ -76,7 +76,7 @@
     }
 
   printf (_("\ngranularity: each sample hit covers %ld byte(s)"),
-	  (long) hist_scale * sizeof (UNIT));
+	  (long) hist_scale * (long) sizeof (UNIT));
 
   if (print_time > 0.0)
     printf (_(" for %.2f%% of %.2f seconds\n\n"),
Index: gprof/hist.c
===================================================================
RCS file: /cvs/src/src/gprof/hist.c,v
retrieving revision 1.17
diff -b -u -r1.17 hist.c
--- gprof/hist.c	10 Apr 2007 08:47:50 -0000	1.17
+++ gprof/hist.c	11 Apr 2007 13:26:04 -0000
@@ -464,7 +464,7 @@
   if (bsd_style_output)
     {
       printf (_("\ngranularity: each sample hit covers %ld byte(s)"),
-	      (long) hist_scale * sizeof (UNIT));
+	      (long) hist_scale * (long) sizeof (UNIT));
       if (total_time > 0.0)
 	{
 	  printf (_(" for %.2f%% of %.2f %s\n\n"),
Index: include/splay-tree.h
===================================================================
RCS file: /cvs/src/src/include/splay-tree.h,v
retrieving revision 1.13
diff -b -u -r1.13 splay-tree.h
--- include/splay-tree.h	10 May 2005 10:21:08 -0000	1.13
+++ include/splay-tree.h	11 Apr 2007 13:26:05 -0000
@@ -36,6 +36,14 @@
 
 #include "ansidecl.h"
 
+#ifndef _WIN64
+  typedef unsigned long int libi_uhostptr_t;
+  typedef long int libi_shostptr_t;
+#else
+  typedef unsigned long long libi_uhostptr_t;
+  typedef long long libi_shostptr_t;
+#endif
+
 #ifndef GTY
 #define GTY(X)
 #endif
@@ -44,8 +52,8 @@
    these types, if necessary.  These types should be sufficiently wide
    that any pointer or scalar can be cast to these types, and then
    cast back, without loss of precision.  */
-typedef unsigned long int splay_tree_key;
-typedef unsigned long int splay_tree_value;
+typedef libi_uhostptr_t splay_tree_key;
+typedef libi_uhostptr_t splay_tree_value;
 
 /* Forward declaration for a node in the tree.  */
 typedef struct splay_tree_node_s *splay_tree_node;
Index: include/coff/internal.h
===================================================================
RCS file: /cvs/src/src/include/coff/internal.h,v
retrieving revision 1.21
diff -b -u -r1.21 internal.h
--- include/coff/internal.h	19 Mar 2007 23:06:06 -0000	1.21
+++ include/coff/internal.h	11 Apr 2007 13:26:06 -0000
@@ -419,8 +419,8 @@
     char _n_name[SYMNMLEN];	/* old COFF version	*/
     struct
     {
-      long _n_zeroes;		/* new == 0		*/
-      long _n_offset;		/* offset into string table */
+      bfd_hostptr_t _n_zeroes;		/* new == 0		*/
+      bfd_hostptr_t _n_offset;		/* offset into string table */
     }      _n_n;
     char *_n_nptr[2];		/* allows for overlaying	*/
   }     _n;
Index: libiberty/strerror.c
===================================================================
RCS file: /cvs/src/src/libiberty/strerror.c,v
retrieving revision 1.12
diff -b -u -r1.12 strerror.c
--- libiberty/strerror.c	28 Mar 2005 02:09:01 -0000	1.12
+++ libiberty/strerror.c	11 Apr 2007 13:26:17 -0000
@@ -469,6 +469,9 @@
 
 #else
 
+#undef sys_nerr
+#undef sys_errlist
+
 extern int sys_nerr;
 extern char *sys_errlist[];
 
=

^ permalink raw reply	[flat|nested] 48+ messages in thread
* PATCH: w64 native support
@ 2007-04-10 16:06 Kai Tietz
  2007-04-10 16:13 ` H. J. Lu
  0 siblings, 1 reply; 48+ messages in thread
From: Kai Tietz @ 2007-04-10 16:06 UTC (permalink / raw)
  To: binutils

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

Hello,

trying to build libbfd and the other binutils tools native for x86_64 
mingw, I noticed some bugs in libbfd and other places, where the type 
"long" was used instead of the bfd_vma type for may pointer values. Also I 
introduced for libiberty "splay-tree.h" a necessary patch about 
pointer/long sizes.

ChangeLogs:

For bfd:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * bfd/coffcode.h: Replace use of long by bfd_vma.
        * bfd/coffgen.c: Likewise.
        * bfd/elf-eh-frame.c: Likewise.
        * bfd/peicode.h: Likewise.

For binutils:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * binutils/resres.c: Cast sizeof explicit to type "long".

For gas:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * gas/symbols.c: Replace use of long by bfd_vma and
          print via fprintf_vma.
        * gas/write.c: Likewise.

For gprof:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * gprof/cg_print.c: Explict cast sizeof to long.
        * gprof/hist.c: Likewise.

For include:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * include/splay-tree.h: (libi_uhostptr_t): New type.
        (libi_shostptr_t): New type.
        (splay_tree_key, splay_tree_value): Use libi_uhostptr_t type.
        * include/coff/internal.h: (_n_zeroes, _n_offset): Type vma_bfd.


For libiberty:

2007-04-10 Kai Tietz  <kai.tietz@onevision.com>

        * libiberty/strerror.c: Undefine sys_nerr and sys_errlist for w64 
sake.

Regards,
 i.A. Kai Tietz



------------------------------------------------------------------------------------------
  OneVision Software Entwicklungs GmbH & Co. KG
  Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
  Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
  Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
  Handelsregister: HRA 6744, Amtsgericht Regensburg
  Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
  Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
  Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer: 
Ulrike Döhler, Manuela Kluger

[-- Attachment #2: bfd-w64-native.txt --]
[-- Type: text/plain, Size: 12393 bytes --]

Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.136
diff -b -u -r1.136 coffcode.h
--- bfd/coffcode.h	26 Mar 2007 12:22:59 -0000	1.136
+++ bfd/coffcode.h	10 Apr 2007 15:48:23 -0000
@@ -4380,7 +4380,7 @@
 
 	  dst->symbol.name = (char *) (src->u.syment._n._n_n._n_offset);
 	  /* We use the native name field to point to the cached field.  */
-	  src->u.syment._n._n_n._n_zeroes = (long) dst;
+	  src->u.syment._n._n_n._n_zeroes = (bfd_vma) dst;
 	  dst->symbol.section = coff_section_from_bfd_index (abfd,
 						     src->u.syment.n_scnum);
 	  dst->symbol.flags = 0;
Index: bfd/coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.56
diff -b -u -r1.56 coffgen.c
--- bfd/coffgen.c	2 Apr 2007 16:51:13 -0000	1.56
+++ bfd/coffgen.c	10 Apr 2007 15:48:24 -0000
@@ -726,7 +726,7 @@
 	      /* FIXME: We should use a union here.  */
 	      s->u.syment.n_value =
 		(bfd_vma)((combined_entry_type *)
-			  ((unsigned long) s->u.syment.n_value))->offset;
+			  ((bfd_vma) s->u.syment.n_value))->offset;
 	      s->fix_value = 0;
 	    }
 	  if (s->fix_line)
@@ -1640,7 +1640,7 @@
 		}
 
 	      internal_ptr->u.syment._n._n_n._n_offset =
-		((long)
+		((bfd_vma)
 		 (string_table
 		  + (internal_ptr + 1)->u.auxent.x_file.x_n.x_offset));
 	    }
@@ -1652,13 +1652,13 @@
 	      if (internal_ptr->u.syment.n_numaux > 1
 		  && coff_data (abfd)->pe)
 		internal_ptr->u.syment._n._n_n._n_offset =
-		  ((long)
+		  ((bfd_vma)
 		   copy_name (abfd,
 			      (internal_ptr + 1)->u.auxent.x_file.x_fname,
 			      internal_ptr->u.syment.n_numaux * symesz));
 	      else
 		internal_ptr->u.syment._n._n_n._n_offset =
-		  ((long)
+		  ((bfd_vma)
 		   copy_name (abfd,
 			      (internal_ptr + 1)->u.auxent.x_file.x_fname,
 			      (size_t) bfd_coff_filnmlen (abfd)));
@@ -1682,11 +1682,11 @@
 	      if (newstring == NULL)
 		return NULL;
 	      strncpy (newstring, internal_ptr->u.syment._n._n_name, i);
-	      internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
+	      internal_ptr->u.syment._n._n_n._n_offset = (bfd_vma) newstring;
 	      internal_ptr->u.syment._n._n_n._n_zeroes = 0;
 	    }
 	  else if (internal_ptr->u.syment._n._n_n._n_offset == 0)
-	    internal_ptr->u.syment._n._n_n._n_offset = (long int) "";
+	    internal_ptr->u.syment._n._n_n._n_offset = (bfd_vma) "";
 	  else if (!bfd_coff_symname_in_debug (abfd, &internal_ptr->u.syment))
 	    {
 	      /* Long name already.  Point symbol at the string in the
@@ -1698,7 +1698,7 @@
 		    return NULL;
 		}
 	      internal_ptr->u.syment._n._n_n._n_offset =
-		((long int)
+		((bfd_vma)
 		 (string_table
 		  + internal_ptr->u.syment._n._n_n._n_offset));
 	    }
@@ -1707,7 +1707,7 @@
 	      /* Long name in debug section.  Very similar.  */
 	      if (debug_section == NULL)
 		debug_section = build_debug_section (abfd);
-	      internal_ptr->u.syment._n._n_n._n_offset = (long int)
+	      internal_ptr->u.syment._n._n_n._n_offset = (bfd_vma)
 		(debug_section + internal_ptr->u.syment._n._n_n._n_offset);
 	    }
 	}
@@ -1784,7 +1784,7 @@
   if (coffsymbol (symbol)->native != NULL
       && coffsymbol (symbol)->native->fix_value)
     ret->value = coffsymbol (symbol)->native->u.syment.n_value -
-      (unsigned long) obj_raw_syments (abfd);
+      (bfd_vma) obj_raw_syments (abfd);
 }
 
 /* Return the COFF syment for a symbol.  */
@@ -1807,7 +1807,7 @@
 
   if (csym->native->fix_value)
     psyment->n_value = psyment->n_value -
-      (unsigned long) obj_raw_syments (abfd);
+      (bfd_vma) obj_raw_syments (abfd);
 
   /* FIXME: We should handle fix_line here.  */
 
@@ -1893,7 +1893,7 @@
 	  if (! combined->fix_value)
 	    val = (bfd_vma) combined->u.syment.n_value;
 	  else
-	    val = combined->u.syment.n_value - (unsigned long) root;
+	    val = combined->u.syment.n_value - (bfd_vma) root;
 
 	  fprintf (file, "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x",
 		   combined->u.syment.n_scnum,
Index: bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.54
diff -b -u -r1.54 elf-eh-frame.c
--- bfd/elf-eh-frame.c	4 Jan 2007 13:30:39 -0000	1.54
+++ bfd/elf-eh-frame.c	10 Apr 2007 15:48:25 -0000
@@ -917,7 +917,7 @@
       {
 	if (!ent->cie)
 	  {
-	    ecie = ecies + (unsigned long) ent->cie_inf;
+	    ecie = ecies + (bfd_vma) ent->cie_inf;
 	    ent->cie_inf = ecie->cie.cie_inf;
 	  }
 	ent->new_offset = offset;
Index: bfd/peicode.h
===================================================================
RCS file: /cvs/src/src/bfd/peicode.h,v
retrieving revision 1.50
diff -b -u -r1.50 peicode.h
--- bfd/peicode.h	20 Sep 2006 11:35:07 -0000	1.50
+++ bfd/peicode.h	10 Apr 2007 15:48:26 -0000
@@ -565,7 +565,7 @@
   /* Initialise the internal symbol structure.  */
   ent->u.syment.n_sclass          = sclass;
   ent->u.syment.n_scnum           = section->target_index;
-  ent->u.syment._n._n_n._n_offset = (long) sym;
+  ent->u.syment._n._n_n._n_offset = (bfd_vma) sym;
 
   sym->symbol.the_bfd = vars->abfd;
   sym->symbol.name    = vars->string_ptr;
Index: binutils/resres.c
===================================================================
RCS file: /cvs/src/src/binutils/resres.c,v
retrieving revision 1.7
diff -b -u -r1.7 resres.c
--- binutils/resres.c	16 Jun 2005 09:18:19 -0000	1.7
+++ binutils/resres.c	10 Apr 2007 15:48:27 -0000
@@ -475,7 +475,7 @@
   else
     /* named id */
     {
-      if (fseek (fres, -sizeof (ord), SEEK_CUR) != 0)
+      if (fseek (fres, - ((long) sizeof (ord)), SEEK_CUR) != 0)
 	fatal ("%s: %s: could not seek in file", program_name, filename);
       id_s = read_unistring (&len);
       id->named = 1;
Index: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.83
diff -b -u -r1.83 symbols.c
--- gas/symbols.c	15 Mar 2007 12:11:49 -0000	1.83
+++ gas/symbols.c	10 Apr 2007 15:48:29 -0000
@@ -2728,14 +2728,20 @@
   const char *name = S_GET_NAME (sym);
   if (!name || !name[0])
     name = "(unnamed)";
-  fprintf (file, "sym %lx %s", (unsigned long) sym, name);
+
+  fprintf (file, "sym ");
+  fprintf_vma (file, (bfd_vma) sym);
+  fprintf (file, " %s", name);
 
   if (LOCAL_SYMBOL_CHECK (sym))
     {
       struct local_symbol *locsym = (struct local_symbol *) sym;
       if (local_symbol_get_frag (locsym) != &zero_address_frag
 	  && local_symbol_get_frag (locsym) != NULL)
-	fprintf (file, " frag %lx", (long) local_symbol_get_frag (locsym));
+        {
+	  fprintf (file, " frag ");
+	  fprintf_vma (file, (bfd_vma) local_symbol_get_frag (locsym));
+        }
       if (local_symbol_resolved_p (locsym))
 	fprintf (file, " resolved");
       fprintf (file, " local");
@@ -2743,7 +2749,10 @@
   else
     {
       if (sym->sy_frag != &zero_address_frag)
-	fprintf (file, " frag %lx", (long) sym->sy_frag);
+        {
+	  fprintf (file, " frag ");
+	  fprintf_vma (file, (bfd_vma) sym->sy_frag);
+        }
       if (sym->written)
 	fprintf (file, " written");
       if (sym->sy_resolved)
@@ -2817,7 +2826,9 @@
 void
 print_expr_1 (FILE *file, expressionS *exp)
 {
-  fprintf (file, "expr %lx ", (long) exp);
+  fprintf (file, "expr ");
+  fprintf_vma (file,(bfd_vma) exp);
+  fprintf (file, " ");
   switch (exp->X_op)
     {
     case O_illegal:
Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.112
diff -b -u -r1.112 write.c
--- gas/write.c	26 Mar 2007 12:23:48 -0000	1.112
+++ gas/write.c	10 Apr 2007 15:48:31 -0000
@@ -2486,7 +2486,9 @@
 print_fixup (fixS *fixp)
 {
   indent_level = 1;
-  fprintf (stderr, "fix %lx %s:%d", (long) fixp, fixp->fx_file, fixp->fx_line);
+  fprintf (stderr, "fix ");
+  fprintf_vma (stderr, (bfd_vma) fixp);
+  fprintf (stderr, " %s:%d", fixp->fx_file, fixp->fx_line);
   if (fixp->fx_pcrel)
     fprintf (stderr, " pcrel");
   if (fixp->fx_pcrel_adjust)
@@ -2503,8 +2505,11 @@
     fprintf (stderr, " tcbit");
   if (fixp->fx_done)
     fprintf (stderr, " done");
-  fprintf (stderr, "\n    size=%d frag=%lx where=%ld offset=%lx addnumber=%lx",
-	   fixp->fx_size, (long) fixp->fx_frag, (long) fixp->fx_where,
+  fprintf (stderr, "\n    size=%d frag=",
+	   fixp->fx_size);
+  fprintf_vma (stderr, (bfd_vma) fixp->fx_frag);
+  fprintf (stderr, " where=%ld offset=%lx addnumber=%lx",
+	   (long) fixp->fx_where,
 	   (long) fixp->fx_offset, (long) fixp->fx_addnumber);
   fprintf (stderr, "\n    %s (%d)", bfd_get_reloc_code_name (fixp->fx_r_type),
 	   fixp->fx_r_type);
Index: gprof/cg_print.c
===================================================================
RCS file: /cvs/src/src/gprof/cg_print.c,v
retrieving revision 1.12
diff -b -u -r1.12 cg_print.c
--- gprof/cg_print.c	9 May 2005 06:55:24 -0000	1.12
+++ gprof/cg_print.c	10 Apr 2007 15:48:40 -0000
@@ -76,7 +76,7 @@
     }
 
   printf (_("\ngranularity: each sample hit covers %ld byte(s)"),
-	  (long) hist_scale * sizeof (UNIT));
+	  (long) hist_scale * (long) sizeof (UNIT));
 
   if (print_time > 0.0)
     printf (_(" for %.2f%% of %.2f seconds\n\n"),
Index: gprof/hist.c
===================================================================
RCS file: /cvs/src/src/gprof/hist.c,v
retrieving revision 1.17
diff -b -u -r1.17 hist.c
--- gprof/hist.c	10 Apr 2007 08:47:50 -0000	1.17
+++ gprof/hist.c	10 Apr 2007 15:48:40 -0000
@@ -464,7 +464,7 @@
   if (bsd_style_output)
     {
       printf (_("\ngranularity: each sample hit covers %ld byte(s)"),
-	      (long) hist_scale * sizeof (UNIT));
+	      (long) hist_scale * (long) sizeof (UNIT));
       if (total_time > 0.0)
 	{
 	  printf (_(" for %.2f%% of %.2f %s\n\n"),
Index: include/splay-tree.h
===================================================================
RCS file: /cvs/src/src/include/splay-tree.h,v
retrieving revision 1.13
diff -b -u -r1.13 splay-tree.h
--- include/splay-tree.h	10 May 2005 10:21:08 -0000	1.13
+++ include/splay-tree.h	10 Apr 2007 15:48:40 -0000
@@ -36,6 +36,14 @@
 
 #include "ansidecl.h"
 
+#ifndef _WIN64
+  typedef unsigned long int libi_uhostptr_t;
+  typedef long int libi_shostptr_t;
+#else
+  typedef unsigned long long libi_uhostptr_t;
+  typedef long long libi_shostptr_t;
+#endif
+
 #ifndef GTY
 #define GTY(X)
 #endif
@@ -44,8 +52,8 @@
    these types, if necessary.  These types should be sufficiently wide
    that any pointer or scalar can be cast to these types, and then
    cast back, without loss of precision.  */
-typedef unsigned long int splay_tree_key;
-typedef unsigned long int splay_tree_value;
+typedef libi_uhostptr_t splay_tree_key;
+typedef libi_uhostptr_t splay_tree_value;
 
 /* Forward declaration for a node in the tree.  */
 typedef struct splay_tree_node_s *splay_tree_node;
Index: include/coff/internal.h
===================================================================
RCS file: /cvs/src/src/include/coff/internal.h,v
retrieving revision 1.21
diff -b -u -r1.21 internal.h
--- include/coff/internal.h	19 Mar 2007 23:06:06 -0000	1.21
+++ include/coff/internal.h	10 Apr 2007 15:48:40 -0000
@@ -419,8 +419,8 @@
     char _n_name[SYMNMLEN];	/* old COFF version	*/
     struct
     {
-      long _n_zeroes;		/* new == 0		*/
-      long _n_offset;		/* offset into string table */
+      bfd_vma _n_zeroes;		/* new == 0		*/
+      bfd_vma _n_offset;		/* offset into string table */
     }      _n_n;
     char *_n_nptr[2];		/* allows for overlaying	*/
   }     _n;
Index: libiberty/strerror.c
===================================================================
RCS file: /cvs/src/src/libiberty/strerror.c,v
retrieving revision 1.12
diff -b -u -r1.12 strerror.c
--- libiberty/strerror.c	28 Mar 2005 02:09:01 -0000	1.12
+++ libiberty/strerror.c	10 Apr 2007 15:48:44 -0000
@@ -469,6 +469,9 @@
 
 #else
 
+#undef sys_nerr
+#undef sys_errlist
+
 extern int sys_nerr;
 extern char *sys_errlist[];
 
=

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2007-07-24  4:22 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-11 13:43 PATCH: w64 native support Kai Tietz
2007-04-11 13:58 ` H. J. Lu
2007-04-11 14:07   ` H. J. Lu
2007-04-11 18:22     ` PATCH: windres Kai Tietz
2007-04-12 15:55       ` H. J. Lu
2007-04-12 16:51         ` Kai Tietz
2007-04-12 18:03           ` H. J. Lu
2007-04-13 14:41             ` Kai Tietz
2007-04-13 14:49               ` H. J. Lu
2007-04-16 10:05                 ` Kai Tietz
2007-04-16 21:59                   ` Christopher Faylor
2007-04-16 22:20                     ` H. J. Lu
2007-04-17 10:59                       ` Kai Tietz
2007-04-18  4:34                         ` Christopher Faylor
2007-04-18  9:49                           ` H. J. Lu
2007-04-20 13:34                             ` Kai Tietz
2007-04-20 13:35                               ` H. J. Lu
2007-04-20 13:54                                 ` Kai Tietz
2007-04-20 14:03                                   ` H. J. Lu
2007-04-20 13:40                               ` Dave Korn
2007-04-20 13:51                                 ` Kai Tietz
2007-04-20 13:58                                   ` Dave Korn
2007-04-23 12:26                                     ` Kai Tietz
2007-04-23 12:44                                       ` Christopher Faylor
2007-04-23 13:51                                         ` Kai Tietz
2007-04-23 14:23                                           ` Christopher Faylor
2007-04-23 14:36                                             ` Dave Korn
2007-04-23 14:46                                               ` Kai Tietz
2007-04-23 14:50                                                 ` Christopher Faylor
2007-04-18 11:59     ` PATCH: w64 native support Kai Tietz
2007-06-29  5:37       ` NightStrike
2007-07-12  7:30       ` Nick Clifton
2007-07-24  8:00         ` NightStrike
2007-04-11 14:57   ` Kai Tietz
2007-04-11 15:17     ` Daniel Jacobowitz
2007-04-11 15:24       ` Kai Tietz
2007-04-11 15:43         ` Daniel Jacobowitz
2007-04-11 15:49           ` Kai Tietz
2007-04-11 17:34             ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2007-04-10 16:06 Kai Tietz
2007-04-10 16:13 ` H. J. Lu
2007-04-10 16:23   ` Kai Tietz
2007-04-10 17:01   ` Kai Tietz
2007-04-10 17:18     ` H. J. Lu
2007-04-10 17:52       ` Kai Tietz
2007-04-10 19:35         ` H. J. Lu
2007-04-11  3:40           ` H. J. Lu
2007-04-10 20:55       ` Paul Koning

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