aboutsummaryrefslogtreecommitdiff
path: root/payloads/libpayload/include/stdarg.h
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/include/stdarg.h')
-rw-r--r--payloads/libpayload/include/stdarg.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/payloads/libpayload/include/stdarg.h b/payloads/libpayload/include/stdarg.h
index 077645f227..1d7ac051f4 100644
--- a/payloads/libpayload/include/stdarg.h
+++ b/payloads/libpayload/include/stdarg.h
@@ -31,7 +31,20 @@
#define _LIBPAYLOAD_STDARG_H
#include <stddef.h>
+
+/* With GCC we use -nostdinc -ffreestanding to keep out system includes.
+ * Unfortunately this also gets us rid of the _compiler_ includes, like
+ * stdarg.h. To work around the issue, we define varargs directly here.
+ * On LLVM we can still just include stdarg.h.
+ */
+#ifdef __GNUC__
+#define va_start(v,l) __builtin_va_start(v,l)
+#define va_end(v) __builtin_va_end(v)
+#define va_arg(v,l) __builtin_va_arg(v,l)
+typedef __builtin_va_list va_list;
+#else
#include_next <stdarg.h>
+#endif
/**
* @defgroup vprintf Varargs print functions