summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2016-01-20 18:36:20 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-02-03 15:00:50 -0800
commitbc404c94b4ab1e6a62e607fd7ef034aa31d6388e (patch)
tree559e85fa8eca3ee7156f9f5333707755c43905c6 /include
parentfc9ed52397f232bfc9f9d2b448e8bc253c87379f (diff)
downloadchrome-ec-bc404c94b4ab1e6a62e607fd7ef034aa31d6388e.tar.gz
Enforce compilation without system headers
This patch introduces HOST_CPPFLAGS to be used for all objects being compiled with HOSTCC rather then the target compiler. Since glibc is not linked into the EC, no glibc include files should be included in the EC code base. Hence, create local definitions for clock_t and wchar_t that match what the glibc include would have done, and remove some unneeded includes. Due to very eager optimization, we have to give gcc a little notch to not kick out memset. Signed-off-by: Stefan Reinauer <reinauer@chromium.org> BUG=chrome-os-partner:43025 BUG=chrome-os-partner:49517 BRANCH=none TEST=compile tested Change-Id: Idf3a2881fa8352756b0927b09c6a97473358f239 Reviewed-on: https://chromium-review.googlesource.com/322435 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/compile_time_macros.h2
-rw-r--r--include/timer.h5
-rw-r--r--include/trng.h2
-rw-r--r--include/util.h2
4 files changed, 7 insertions, 4 deletions
diff --git a/include/compile_time_macros.h b/include/compile_time_macros.h
index 074fb4b256..9b543f9493 100644
--- a/include/compile_time_macros.h
+++ b/include/compile_time_macros.h
@@ -23,4 +23,6 @@
#define offsetof(type, member) __builtin_offsetof(type, member)
#endif
+#define __visible __attribute__((externally_visible))
+
#endif /* __CROS_EC_COMPILE_TIME_MACROS_H */
diff --git a/include/timer.h b/include/timer.h
index 5f92207252..0e7fd7d7ea 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -8,8 +8,6 @@
#ifndef __CROS_EC_TIMER_H
#define __CROS_EC_TIMER_H
-#include <sys/types.h>
-
#include "common.h"
#include "task_id.h"
@@ -28,6 +26,9 @@ typedef union {
} le /* little endian words */;
} timestamp_t;
+/* Data type for POSIX style clock() implementation */
+typedef long clock_t;
+
/**
* Initialize the timer module.
*/
diff --git a/include/trng.h b/include/trng.h
index a35496c3fd..e6dcba644c 100644
--- a/include/trng.h
+++ b/include/trng.h
@@ -5,7 +5,7 @@
#ifndef __EC_INCLUDE_TRNG_H
#define __EC_INCLUDE_TRNG_H
-#include <sys/types.h>
+#include <stddef.h>
/**
* Initialize the true random number generator.
diff --git a/include/util.h b/include/util.h
index 8fec4a14e8..d8967ec0c0 100644
--- a/include/util.h
+++ b/include/util.h
@@ -95,7 +95,7 @@ int isalpha(int c);
int isprint(int c);
int memcmp(const void *s1, const void *s2, size_t len);
void *memcpy(void *dest, const void *src, size_t len);
-void *memset(void *dest, int c, size_t len);
+__visible void *memset(void *dest, int c, size_t len);
void *memmove(void *dest, const void *src, size_t len);
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t size);