summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/arch/i386/include/bits/stdint.h4
-rw-r--r--src/arch/x86_64/include/bits/stdint.h2
-rw-r--r--src/include/stdint.h10
3 files changed, 13 insertions, 3 deletions
diff --git a/src/arch/i386/include/bits/stdint.h b/src/arch/i386/include/bits/stdint.h
index 6ccf09717..9eb72e9c4 100644
--- a/src/arch/i386/include/bits/stdint.h
+++ b/src/arch/i386/include/bits/stdint.h
@@ -1,8 +1,8 @@
#ifndef _BITS_STDINT_H
#define _BITS_STDINT_H
-typedef unsigned int size_t;
-typedef signed int ssize_t;
+typedef __SIZE_TYPE__ size_t;
+typedef signed long ssize_t;
typedef signed long off_t;
typedef unsigned char uint8_t;
diff --git a/src/arch/x86_64/include/bits/stdint.h b/src/arch/x86_64/include/bits/stdint.h
index 23bae9c46..9eb72e9c4 100644
--- a/src/arch/x86_64/include/bits/stdint.h
+++ b/src/arch/x86_64/include/bits/stdint.h
@@ -1,7 +1,7 @@
#ifndef _BITS_STDINT_H
#define _BITS_STDINT_H
-typedef unsigned long size_t;
+typedef __SIZE_TYPE__ size_t;
typedef signed long ssize_t;
typedef signed long off_t;
diff --git a/src/include/stdint.h b/src/include/stdint.h
index 4b0e44f2e..dc4bd8c76 100644
--- a/src/include/stdint.h
+++ b/src/include/stdint.h
@@ -1,6 +1,16 @@
#ifndef _STDINT_H
#define _STDINT_H
+/*
+ * This is a standard predefined macro on all gcc's I've seen. It's
+ * important that we define size_t in the same way as the compiler,
+ * because that's what it's expecting when it checks %zd/%zx printf
+ * format specifiers.
+ */
+#ifndef __SIZE_TYPE__
+#define __SIZE_TYPE__ unsigned long /* safe choice on most systems */
+#endif
+
#include <bits/stdint.h>
typedef int8_t s8;