Bug 5715 - Binutils is broken on 32bit mingw host for 64bit target
Summary: Binutils is broken on 32bit mingw host for 64bit target
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.19
: P2 critical
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-02 15:52 UTC by H.J. Lu
Modified: 2008-02-04 20:36 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
A patch (1.35 KB, patch)
2008-02-02 16:24 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2008-02-02 15:52:18 UTC
This patch:

http://sourceware.org/ml/binutils/2008-01/msg00195.html

breaks 32bit mingw host for 64bit target. It has

 #elif BFD_HOST_64BIT_LONG_LONG
+#ifndef _WIN32
 #define sprintf_vma(s,x) sprintf (s, "%016llx", x)
 #define fprintf_vma(f,x) fprintf (f, "%016llx", x)
 #else
+#define sprintf_vma(s,x) sprintf (s, "%016I64x", x)
+#define fprintf_vma(f,x) fprintf (f, "%016I64x", x)
+#endif

You can't use BFD_HOST_64BIT_LONG_LONG to check for win32 vs. win64.
Comment 1 H.J. Lu 2008-02-02 16:24:03 UTC
Created attachment 2228 [details]
A patch

My gcc 4.1 cross compiler for 32bit mingw doesn't understand %I64. This patch
allows me to build binutils hosted on 32bit mingw for 64bit target.

If %ll was never supported on 32bit mingw, mingw should use things like

#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
#define fprintf_vma(s,x) \
  fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
#define sprintf_vma(s,x) \
  sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))

to print out 64bit value.
Comment 2 H.J. Lu 2008-02-04 20:36:49 UTC
Fixed by

http://sourceware.org/ml/binutils/2008-02/msg00037.html