summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/stddef.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin/stddef.h b/builtin/stddef.h
index 505dd9f515..343b0f6adf 100644
--- a/builtin/stddef.h
+++ b/builtin/stddef.h
@@ -27,4 +27,13 @@ typedef __SIZE_TYPE__ ssize_t;
#endif
typedef __WCHAR_TYPE__ wchar_t;
+/* This macro definition is duplicated in compile_time_macros.h. It still needs
+ * to be defined here to support code that expects offsetof to be defined in the
+ * standard location (this file). Both definitions are guarded by a #ifndef
+ * check for safety.
+ */
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
+#endif
+
#endif /* __CROS_EC_STDDEF_H__ */