Blob Blame History Raw
From af1a3ea3c2ca8023fd51e0b7190da43e3aaa1a95 Mon Sep 17 00:00:00 2001
From: Nigel Croxon <nigel.croxon@hpe.com>
Date: Thu, 7 Jan 2016 09:35:42 -0500
Subject: [PATCH 08/10] From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
 Subject: [PATCH v2] ARM/AARCH64: define C99 types explicitly when building
 against older standard

This adds support for the C99 uintXX_t types when building for
older versions of the standard, like the other architectures
already implement.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
---
 inc/aarch64/efibind.h | 33 ++++++++++++++++++++++++++++++++-
 inc/arm/efibind.h     | 31 +++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/inc/aarch64/efibind.h b/inc/aarch64/efibind.h
index 693fe52..ef7148d 100644
--- a/inc/aarch64/efibind.h
+++ b/inc/aarch64/efibind.h
@@ -1,5 +1,36 @@
-
+/*
+ * Copright (C) 2014 - 2015 Linaro Ltd.
+ * Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice and this list of conditions, without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License as published by the Free Software Foundation;
+ * either version 2 of the License, or (at your option) any later version.
+ */
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+
+// ANSI C 1999/2000 stdint.h integer width declarations
+
+typedef unsigned long       uint64_t;
+typedef long                int64_t;
+typedef unsigned int        uint32_t;
+typedef int                 int32_t;
+typedef unsigned short      uint16_t;
+typedef short               int16_t;
+typedef unsigned char       uint8_t;
+typedef signed char         int8_t;   // unqualified 'char' is unsigned on ARM
+
+#else
 #include <stdint.h>
+#endif
 
 //
 // Basic EFI types of various widths
diff --git a/inc/arm/efibind.h b/inc/arm/efibind.h
index cc4b5c5..8c37f64 100644
--- a/inc/arm/efibind.h
+++ b/inc/arm/efibind.h
@@ -1,5 +1,36 @@
+/*
+ * Copright (C) 2014 - 2015 Linaro Ltd.
+ * Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice and this list of conditions, without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License as published by the Free Software Foundation;
+ * either version 2 of the License, or (at your option) any later version.
+ */
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
 
+// ANSI C 1999/2000 stdint.h integer width declarations
+
+typedef unsigned long long  uint64_t;
+typedef long long           int64_t;
+typedef unsigned int        uint32_t;
+typedef int                 int32_t;
+typedef unsigned short      uint16_t;
+typedef short               int16_t;
+typedef unsigned char       uint8_t;
+typedef signed char         int8_t;   // unqualified 'char' is unsigned on ARM
+
+#else
 #include <stdint.h>
+#endif
 
 /*
  * This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32
-- 
2.5.0