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 18 Apr 2007 09:14:53 -0000 @@ -76,6 +76,7 @@ #define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@ #define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@ +#define BFD_HOST_64BIT_LONG_LONG @BFD_HOST_64BIT_LONG_LONG@ #define BFD_HOST_LONG_LONG @BFD_HOST_LONG_LONG@ #if @BFD_HOST_64_BIT_DEFINED@ #define BFD_HOST_64_BIT @BFD_HOST_64_BIT@ @@ -96,6 +97,10 @@ #endif #endif +/* Declaring a type wide enough to hold a host long and a host pointer. */ +#define BFD_HOSTPTR_T @BFD_HOSTPTR_T@ +typedef BFD_HOSTPTR_T bfd_hostptr_t; + /* Forward declaration. */ typedef struct bfd bfd; @@ -129,6 +134,9 @@ #if BFD_HOST_64BIT_LONG #define sprintf_vma(s,x) sprintf (s, "%016lx", x) #define fprintf_vma(f,x) fprintf (f, "%016lx", x) +#elif BFD_HOST_64BIT_LONG_LONG +#define sprintf_vma(s,x) sprintf (s, "%016llx", x) +#define fprintf_vma(f,x) fprintf (f, "%016llx", x) #else #define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff))) #define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff)) 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 18 Apr 2007 09:15:01 -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 18 Apr 2007 09:15:04 -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/config.in =================================================================== RCS file: /cvs/src/src/bfd/config.in,v retrieving revision 1.32 diff -b -u -r1.32 config.in --- bfd/config.in 5 Jun 2006 12:25:49 -0000 1.32 +++ bfd/config.in 18 Apr 2007 09:15:04 -0000 @@ -245,6 +245,9 @@ /* The size of a `off_t', as computed by sizeof. */ #undef SIZEOF_OFF_T +/* The sizeof of a 'void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS Index: bfd/configure.in =================================================================== RCS file: /cvs/src/src/bfd/configure.in,v retrieving revision 1.227 diff -b -u -r1.227 configure.in --- bfd/configure.in 14 Apr 2007 20:36:56 -0000 1.227 +++ bfd/configure.in 18 Apr 2007 09:15:14 -0000 @@ -99,10 +99,12 @@ AC_PROG_INSTALL BFD_HOST_64BIT_LONG=0 +BFD_HOST_64BIT_LONG_LONG=0 BFD_HOST_LONG_LONG=0 BFD_HOST_64_BIT_DEFINED=0 BFD_HOST_64_BIT= BFD_HOST_U_64_BIT= +BFD_HOSTPTR_T = "unsigned long" AC_MSG_CHECKING([for long long]) AC_CACHE_VAL(bfd_cv_has_long_long, @@ -113,12 +115,21 @@ AC_CHECK_SIZEOF(long long) fi +AC_CHECK_SIZEOF(void *) AC_CHECK_SIZEOF(long) -if test "x${ac_cv_sizeof_long}" = "x8"; then + +if test "x${ac_cv_sizeof_void_p}" = "x8"; then host64=true + if test "x${ac_cv_sizeof_long}" = "x8"; then BFD_HOST_64BIT_LONG=1 test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long" test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long" + elif test "x${ac_cv_sizeof_long_long}" = "x8"; then + BFD_HOST_64BIT_LONG_LONG=1 + test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long" + test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long" + BFD_HOSTPTR_T="unsigned long long" + fi elif test "x${ac_cv_sizeof_long_long}" = "x8"; then test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long" test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long" @@ -131,10 +142,12 @@ fi AC_SUBST(BFD_HOST_64BIT_LONG) +AC_SUBST(BFD_HOST_64BIT_LONG_LONG) AC_SUBST(BFD_HOST_LONG_LONG) AC_SUBST(BFD_HOST_64_BIT_DEFINED) AC_SUBST(BFD_HOST_64_BIT) AC_SUBST(BFD_HOST_U_64_BIT) +AC_SUBST(BFD_HOSTPTR_T) BFD_CC_FOR_BUILD 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 18 Apr 2007 09:15:16 -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 18 Apr 2007 09:15:17 -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: 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 18 Apr 2007 09:15:27 -0000 @@ -2728,14 +2728,19 @@ 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) ((bfd_hostptr_t) 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) ((bfd_hostptr_t) local_symbol_get_frag (locsym))); + } if (local_symbol_resolved_p (locsym)) fprintf (file, " resolved"); fprintf (file, " local"); @@ -2743,7 +2748,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) ((bfd_hostptr_t) sym->sy_frag)); + } if (sym->written) fprintf (file, " written"); if (sym->sy_resolved) @@ -2817,7 +2825,9 @@ void print_expr_1 (FILE *file, expressionS *exp) { - fprintf (file, "expr %lx ", (long) exp); + fprintf (file, "expr "); + fprintf_vma (file, (bfd_vma) ((bfd_hostptr_t) 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 18 Apr 2007 09:15:29 -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)((bfd_hostptr_t) 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,10 @@ 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) ((bfd_hostptr_t) 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 18 Apr 2007 09:15:42 -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 18 Apr 2007 09:15:43 -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 18 Apr 2007 09:15:43 -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 18 Apr 2007 09:15:45 -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 18 Apr 2007 09:15:55 -0000 @@ -469,6 +469,9 @@ #else +#undef sys_nerr +#undef sys_errlist + extern int sys_nerr; extern char *sys_errlist[]; =