summaryrefslogtreecommitdiff
path: root/include/system
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2021-03-09 11:42:34 -0500
committerPeter Jones <pjones@redhat.com>2021-03-10 15:54:20 -0500
commitf033a1da9f4c3acf7e3dfef906d01e348b6fcf42 (patch)
tree1c325b0dd61cb1bd78b585ca870298fb74f857d4 /include/system
parent758b795a86589994065099d0af02eb30626a3c21 (diff)
downloadefi-boot-shim-f033a1da9f4c3acf7e3dfef906d01e348b6fcf42.tar.gz
efi-boot-shim-f033a1da9f4c3acf7e3dfef906d01e348b6fcf42.zip
Restructure our includes.
This re-structures our includes so we can be sure everything is always including all the system headers in a uniform, predictable way. Temporarily it also adds a bunch of junk at all the places we use variadic functions to specifically pick either the MS (cdecl) or ELF ABIs. I'm not 100% sure that's all correct (see later patch) but it's enough to allow this to build. Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'include/system')
-rw-r--r--include/system/alloca.h10
-rw-r--r--include/system/ctype.h14
-rw-r--r--include/system/inttypes.h13
-rw-r--r--include/system/stdarg.h31
-rw-r--r--include/system/stdio.h13
-rw-r--r--include/system/stdlib.h16
-rw-r--r--include/system/string.h14
-rw-r--r--include/system/strings.h10
8 files changed, 121 insertions, 0 deletions
diff --git a/include/system/alloca.h b/include/system/alloca.h
new file mode 100644
index 00000000..dc11b60d
--- /dev/null
+++ b/include/system/alloca.h
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+#ifdef SHIM_UNIT_TEST
+#include_next <alloca.h>
+#else
+#ifndef _ALLOCA_H
+#define _ALLOCA_H
+
+#endif /* !_ALLOCA_H */
+#endif
+// vim:fenc=utf-8:tw=75:noet
diff --git a/include/system/ctype.h b/include/system/ctype.h
new file mode 100644
index 00000000..c771bb69
--- /dev/null
+++ b/include/system/ctype.h
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+/*
+ * ctype.h - standard ctype functions
+ */
+#ifdef SHIM_UNIT_TEST
+#include_next <string.h>
+#else
+#ifndef _CTYPE_H
+#define _CTYPE_H
+
+
+#endif /* !_CTYPE_H */
+#endif /* !SHIM_UNIT_TEST */
+// vim:fenc=utf-8:tw=75:noet
diff --git a/include/system/inttypes.h b/include/system/inttypes.h
new file mode 100644
index 00000000..a35b0090
--- /dev/null
+++ b/include/system/inttypes.h
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+#ifdef SHIM_UNIT_TEST
+#include_next <inttypes.h>
+#else
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#endif /* !INTTYPES_H_ */
+#endif
+// vim:fenc=utf-8:tw=75:noet
diff --git a/include/system/stdarg.h b/include/system/stdarg.h
new file mode 100644
index 00000000..346b760d
--- /dev/null
+++ b/include/system/stdarg.h
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+/*
+ * stdarg.h - try to make consistent va_* handling for EFI
+ */
+#ifdef SHIM_UNIT_TEST
+#include_next <stdarg.h>
+#else
+#ifndef _STDARG_H
+#define _STDARG_H
+
+#include <efistdarg.h>
+
+#endif /* !_STDARG_H */
+#endif
+#ifndef SHIM_STDARG_H_
+#define SHIM_STDARG_H_
+
+typedef __builtin_ms_va_list ms_va_list;
+#define ms_va_copy(dest, start) __builtin_ms_va_copy(dest, start)
+#define ms_va_start(marker, arg) __builtin_ms_va_start(marker, arg)
+#define ms_va_arg(marker, type) __builtin_va_arg(marker, type)
+#define ms_va_end(marker) __builtin_ms_va_end(marker)
+
+typedef __builtin_va_list elf_va_list;
+#define elf_va_copy(dest, start) __builtin_va_copy(dest, start)
+#define elf_va_start(marker, arg) __builtin_va_start(marker, arg)
+#define elf_va_arg(marker, type) __builtin_va_arg(marker, type)
+#define elf_va_end(marker) __builtin_va_end(marker)
+
+#endif /* !SHIM_STDARG_H_ */
+// vim:fenc=utf-8:tw=75:noet
diff --git a/include/system/stdio.h b/include/system/stdio.h
new file mode 100644
index 00000000..6ea60d71
--- /dev/null
+++ b/include/system/stdio.h
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+/*
+ * stdio.h - sigh
+ */
+#ifdef SHIM_UNIT_TEST
+#include_next <stdio.h>
+#else
+#ifndef _STDIO_H
+#define _STDIO_H
+
+#endif /* !_STDIO_H */
+#endif
+// vim:fenc=utf-8:tw=75:noet
diff --git a/include/system/stdlib.h b/include/system/stdlib.h
new file mode 100644
index 00000000..f2660f63
--- /dev/null
+++ b/include/system/stdlib.h
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+#ifdef SHIM_UNIT_TEST
+#include_next <stdlib.h>
+#else
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+/*
+ * I don't know why, but openssl expects to get size_t from stdlib.h
+ * instead of stddef.h, so... whatever.
+ */
+#include <stddef.h>
+
+#endif /* !_STDLIB_H */
+#endif
+// vim:fenc=utf-8:tw=75:noet
diff --git a/include/system/string.h b/include/system/string.h
new file mode 100644
index 00000000..21e46c1d
--- /dev/null
+++ b/include/system/string.h
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+#ifdef SHIM_UNIT_TEST
+#include_next <string.h>
+#else
+#ifndef _STRING_H
+#define _STRING_H
+
+#include <stddef.h>
+
+__typeof__(__builtin_memset) memset;
+__typeof__(__builtin_memcpy) memcpy;
+
+#endif /* _STRING_H */
+#endif
diff --git a/include/system/strings.h b/include/system/strings.h
new file mode 100644
index 00000000..c82bd917
--- /dev/null
+++ b/include/system/strings.h
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+#ifdef SHIM_UNIT_TEST
+#include_next <strings.h>
+#else
+#ifndef _STRINGS_H
+#define _STRINGS_H
+
+#endif /* !_STRINGS_H */
+#endif
+// vim:fenc=utf-8:tw=75:noet