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
@@ -1243,7 +1243,7 @@
 #if BFD_HOST_64BIT_LONG
       ;
 #elif BFD_HOST_64BIT_LONG_LONG
-#ifndef __MSVCRT__
+#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO)
       length = "ll";
 #else
       length = "I64";
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.35/binutils/readelf.c.orig	2020-07-24 11:12:19.000000000 +0200
+++ binutils-2.35/binutils/readelf.c	2020-08-26 22:30:15.008358800 +0200
@@ -1274,7 +1274,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 ",
@@ -13927,7 +13927,7 @@
 	    }
 	  else
 	    {
-#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
@@ -613,7 +613,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);
@@ -632,7 +632,7 @@
 #ifdef HAVE_LONG_LONG
 	    if (sizeof (start) > sizeof (long))
 	      {
-# ifndef __MSVCRT__
+#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO)
 		printf ("%7llu ", (unsigned long long) start);
 # else
 		printf ("%7I64d ", (unsigned long long) start);
@@ -651,7 +651,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<typename T> extern void foo(const char*, ...)
-  __attribute__ ((__format__ (__printf__, 1, 2)));
+  __attribute__ ((__format__ (gnu_printf, 1, 2)));
 template<typename T> void foo(const char* format, ...) {}
 void bar() { foo<int>("%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<typename T> extern void foo(const char*, ...)
-  __attribute__ ((__format__ (__printf__, 1, 2)));
+  __attribute__ ((__format__ (gnu_printf, 1, 2)));
 template<typename T> void foo(const char* format, ...) {}
 void bar() { foo<int>("%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 */
