Blame SOURCES/0004-Make-sure-stdint.h-is-always-used-with-MSVC-on-ARM-A.patch

67650e
From 39ce220cb6fde14bedf2ef61695f3d20726e41ef Mon Sep 17 00:00:00 2001
67650e
From: Nigel Croxon <ncroxon@redhat.com>
67650e
Date: Mon, 6 Nov 2017 09:26:05 -0500
67650e
Subject: [PATCH 04/25] Make sure stdint.h is always used with MSVC on
67650e
 ARM/ARM64, since all the versions of Visual Studio that support ARM or ARM64
67650e
 have that header. Without this, uint64_t would be defined to unsigned long,
67650e
 which is 32-bits in the Microsoft world.
67650e
67650e
Also fix aarch64/initplat.c so that memset/memcpy only apply
67650e
to gcc. Otherwise MSVC throws an error for __SIZE_TYPE__.
67650e
67650e
Updating this patch to v2, since it turns out MSVC will also emit
67650e
memset and memcpy intrinsics that we can use an implementation for.
67650e
This is true for both ARM and ARM64.
67650e
To make this work, I'm defining __SIZE_TYPE__ to UINTN if not
67650e
already defined.
67650e
67650e
Signed-off-by: Pete Batard <pete@akeo.ie>
67650e
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
67650e
---
67650e
 lib/aarch64/initplat.c | 4 ++++
67650e
 lib/arm/initplat.c     | 6 +++++-
67650e
 inc/aarch64/efibind.h  | 2 +-
67650e
 inc/arm/efibind.h      | 2 +-
67650e
 4 files changed, 11 insertions(+), 3 deletions(-)
67650e
67650e
diff --git a/lib/aarch64/initplat.c b/lib/aarch64/initplat.c
67650e
index 4b118656d7c..25207f42c8f 100644
67650e
--- a/lib/aarch64/initplat.c
67650e
+++ b/lib/aarch64/initplat.c
67650e
@@ -25,6 +25,10 @@ InitializeLibPlatform (
67650e
 {
67650e
 }
67650e
 
67650e
+#ifndef __SIZE_TYPE__
67650e
+#define __SIZE_TYPE__ UINTN
67650e
+#endif
67650e
+
67650e
 /*
67650e
  * Calls to these functions may be emitted implicitly by GCC even when
67650e
  * -ffreestanding is in effect.
67650e
diff --git a/lib/arm/initplat.c b/lib/arm/initplat.c
67650e
index 09f06a9c871..c77d26d9045 100644
67650e
--- a/lib/arm/initplat.c
67650e
+++ b/lib/arm/initplat.c
67650e
@@ -25,7 +25,10 @@ InitializeLibPlatform (
67650e
 {
67650e
 }
67650e
 
67650e
-#ifdef __GNUC__
67650e
+#ifndef __SIZE_TYPE__
67650e
+#define __SIZE_TYPE__ UINTN
67650e
+#endif
67650e
+
67650e
 /*
67650e
  * Calls to these functions may be emitted implicitly by GCC even when
67650e
  * -ffreestanding is in effect.
67650e
@@ -51,6 +54,7 @@ void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n)
67650e
     return dest;
67650e
 }
67650e
 
67650e
+#ifdef __GNUC__
67650e
 void __div0(void)
67650e
 {
67650e
 	// TODO handle divide by zero fault
67650e
diff --git a/inc/aarch64/efibind.h b/inc/aarch64/efibind.h
67650e
index ef7148d5312..182a2109062 100644
67650e
--- a/inc/aarch64/efibind.h
67650e
+++ b/inc/aarch64/efibind.h
67650e
@@ -15,7 +15,7 @@
67650e
  * either version 2 of the License, or (at your option) any later version.
67650e
  */
67650e
 
67650e
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
67650e
+#if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ))
67650e
 
67650e
 // ANSI C 1999/2000 stdint.h integer width declarations
67650e
 
67650e
diff --git a/inc/arm/efibind.h b/inc/arm/efibind.h
67650e
index 06f6ea1aeb8..40a5a9cd428 100644
67650e
--- a/inc/arm/efibind.h
67650e
+++ b/inc/arm/efibind.h
67650e
@@ -15,7 +15,7 @@
67650e
  * either version 2 of the License, or (at your option) any later version.
67650e
  */
67650e
 
67650e
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
67650e
+#if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ))
67650e
 
67650e
 // ANSI C 1999/2000 stdint.h integer width declarations
67650e
 
67650e
-- 
67650e
2.15.0
67650e