diff -urN binutils-2.27.orig/bfd/bfd-in.h binutils-2.27/bfd/bfd-in.h --- binutils-2.27.orig/bfd/bfd-in.h 2016-08-03 09:36:50.000000000 +0200 +++ binutils-2.27/bfd/bfd-in.h 2016-09-21 21:13:49.177148600 +0200 @@ -137,7 +137,7 @@ #if BFD_HOST_64BIT_LONG #define BFD_VMA_FMT "l" -#elif defined (__MSVCRT__) +#elif defined(__MSVCRT__) && !defined( __USE_MINGW_ANSI_STDIO) #define BFD_VMA_FMT "I64" #else #define BFD_VMA_FMT "ll" diff -urN binutils-2.27.orig/bfd/bfd-in2.h binutils-2.27/bfd/bfd-in2.h --- binutils-2.27.orig/bfd/bfd-in2.h 2016-08-03 09:36:50.000000000 +0200 +++ binutils-2.27/bfd/bfd-in2.h 2016-09-21 21:13:49.185161800 +0200 @@ -144,7 +144,7 @@ #if BFD_HOST_64BIT_LONG #define BFD_VMA_FMT "l" -#elif defined (__MSVCRT__) +#elif defined (__MSVCRT__) && !defined(__USE_MINGW_ANSI_STDIO) #define BFD_VMA_FMT "I64" #else #define BFD_VMA_FMT "ll" diff -urN binutils-2.27.orig/binutils/dwarf.c binutils-2.27/binutils/dwarf.c --- binutils-2.27.orig/binutils/dwarf.c 2016-08-03 09:36:51.000000000 +0200 +++ binutils-2.27/binutils/dwarf.c 2016-09-21 21:13:49.210178100 +0200 @@ -164,7 +164,7 @@ } #if defined HAVE_LONG_LONG && SIZEOF_LONG_LONG > SIZEOF_LONG -# ifndef __MINGW32__ +#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO) # define DWARF_VMA_FMT "ll" # define DWARF_VMA_FMT_LONG "%16.16llx" # else diff -urN binutils-2.27.orig/binutils/nm.c binutils-2.27/binutils/nm.c --- binutils-2.27.orig/binutils/nm.c 2016-08-03 09:36:51.000000000 +0200 +++ binutils-2.27/binutils/nm.c 2016-09-21 21:13:49.221191400 +0200 @@ -170,7 +170,7 @@ #if BFD_HOST_64BIT_LONG static char value_format_64bit[] = "%016lx"; #elif BFD_HOST_64BIT_LONG_LONG -#ifndef __MSVCRT__ +#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO) static char value_format_64bit[] = "%016llx"; #else static char value_format_64bit[] = "%016I64x"; @@ -300,7 +300,7 @@ #if BFD_HOST_64BIT_LONG value_format_64bit[5] = *radix; #elif BFD_HOST_64BIT_LONG_LONG -#ifndef __MSVCRT__ +#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO) value_format_64bit[6] = *radix; #else value_format_64bit[7] = *radix; diff -urN binutils-2.27.orig/binutils/prdbg.c binutils-2.27/binutils/prdbg.c --- binutils-2.27.orig/binutils/prdbg.c 2016-08-03 09:36:51.000000000 +0200 +++ binutils-2.27/binutils/prdbg.c 2016-09-21 21:13:49.229194100 +0200 @@ -502,7 +502,7 @@ #if BFD_HOST_64BIT_LONG_LONG else if (sizeof (vma) <= sizeof (unsigned long long)) { -#ifndef __MSVCRT__ +#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO) if (hexp) sprintf (buf, "0x%llx", (unsigned long long) vma); else if (unsignedp) diff -urN binutils-2.27.orig/binutils/readelf.c binutils-2.27/binutils/readelf.c --- binutils-2.27.orig/binutils/readelf.c 2016-08-03 09:36:51.000000000 +0200 +++ binutils-2.27/binutils/readelf.c 2016-09-21 21:13:49.240194700 +0200 @@ -1154,7 +1154,7 @@ : "%12.12lx %12.12lx ", offset, inf); #elif BFD_HOST_64BIT_LONG_LONG -#ifndef __MSVCRT__ +#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO) printf (do_wide ? "%16.16llx %16.16llx " : "%12.12llx %12.12llx ", @@ -12372,7 +12372,7 @@ { size_t maxlen = end - data; -#ifndef __MSVCRT__ +#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO) /* PR 11128: Use two separate invocations in order to work around bugs in the Solaris 8 implementation of printf. */ printf (" [%6tx] ", data - start); diff -urN binutils-2.27.orig/binutils/strings.c binutils-2.27/binutils/strings.c --- binutils-2.27.orig/binutils/strings.c 2016-08-03 09:36:51.000000000 +0200 +++ binutils-2.27/binutils/strings.c 2016-09-21 21:13:49.251195600 +0200 @@ -595,7 +595,7 @@ #ifdef HAVE_LONG_LONG if (sizeof (start) > sizeof (long)) { -# ifndef __MSVCRT__ +#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO) printf ("%7llo ", (unsigned long long) start); # else printf ("%7I64o ", (unsigned long long) start); @@ -614,7 +614,7 @@ #ifdef HAVE_LONG_LONG if (sizeof (start) > sizeof (long)) { -# ifndef __MSVCRT__ +#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO) printf ("%7lld ", (unsigned long long) start); # else printf ("%7I64d ", (unsigned long long) start); @@ -633,7 +633,7 @@ #ifdef HAVE_LONG_LONG if (sizeof (start) > sizeof (long)) { -# ifndef __MSVCRT__ +#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO) printf ("%7llx ", (unsigned long long) start); # else printf ("%7I64x ", (unsigned long long) start); diff -urN binutils-2.27.orig/gas/as.h binutils-2.27/gas/as.h --- binutils-2.27.orig/gas/as.h 2016-08-03 09:36:51.000000000 +0200 +++ binutils-2.27/gas/as.h 2016-09-21 21:25:33.955958500 +0200 @@ -438,10 +438,10 @@ #define PRINTF_LIKE(FCN) \ void FCN (const char *format, ...) \ - __attribute__ ((__format__ (__printf__, 1, 2))) + __attribute__ ((__format__ (gnu_printf, 1, 2))) #define PRINTF_WHERE_LIKE(FCN) \ void FCN (const char *file, unsigned int line, const char *format, ...) \ - __attribute__ ((__format__ (__printf__, 3, 4))) + __attribute__ ((__format__ (gnu_printf, 3, 4))) #else /* __GNUC__ < 2 || defined(VMS) */ diff -urN binutils-2.27.orig/gas/read.c binutils-2.27/gas/read.c --- binutils-2.27.orig/gas/read.c 2016-08-03 09:36:51.000000000 +0200 +++ binutils-2.27/gas/read.c 2016-09-21 21:13:49.262196200 +0200 @@ -4415,7 +4415,7 @@ { /* Leading bits contain both 0s & 1s. */ #if defined (BFD64) && BFD_HOST_64BIT_LONG_LONG -#ifndef __MSVCRT__ +#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO) as_warn (_("value 0x%llx truncated to 0x%llx"), (unsigned long long) get, (unsigned long long) use); #else diff -urN binutils-2.27.orig/gold/configure binutils-2.27/gold/configure --- binutils-2.27.orig/gold/configure 2016-08-03 09:36:53.000000000 +0200 +++ binutils-2.27/gold/configure 2016-09-21 21:13:49.306197900 +0200 @@ -7558,7 +7558,7 @@ /* end confdefs.h. */ template extern void foo(const char*, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); + __attribute__ ((__format__ (gnu_printf, 1, 2))); template void foo(const char* format, ...) {} void bar() { foo("%s\n", "foo"); } diff -urN binutils-2.27.orig/gold/configure.ac binutils-2.27/gold/configure.ac --- binutils-2.27.orig/gold/configure.ac 2016-08-03 09:36:53.000000000 +0200 +++ binutils-2.27/gold/configure.ac 2016-09-21 21:13:49.317584300 +0200 @@ -635,7 +635,7 @@ [gold_cv_template_attribute], [AC_COMPILE_IFELSE([ template extern void foo(const char*, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); + __attribute__ ((__format__ (gnu_printf, 1, 2))); template void foo(const char* format, ...) {} void bar() { foo("%s\n", "foo"); } ], [gold_cv_template_attribute=yes], [gold_cv_template_attribute=no])]) diff -urN binutils-2.27.orig/include/ansidecl.h binutils-2.27/include/ansidecl.h --- binutils-2.27.orig/include/ansidecl.h 2016-08-03 09:36:53.000000000 +0200 +++ binutils-2.27/include/ansidecl.h 2016-09-21 21:13:49.327082000 +0200 @@ -195,7 +195,7 @@ before GCC 3.3, but as of 3.3 we need to add the `nonnull' attribute to retain this behavior. */ #ifndef ATTRIBUTE_PRINTF -#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m) +#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (gnu_printf, m, n))) ATTRIBUTE_NONNULL(m) #define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) #define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) #define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) @@ -223,7 +223,7 @@ NULL format specifier was allowed as of gcc 3.3. */ #ifndef ATTRIBUTE_NULL_PRINTF # if (GCC_VERSION >= 3003) -# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) +# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (gnu_printf, m, n))) # else # define ATTRIBUTE_NULL_PRINTF(m, n) # endif /* GNUC >= 3.3 */