summaryrefslogtreecommitdiff
path: root/include/linux/compiler-gcc.h
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-04-05 19:49:19 +0300
committerKees Cook <keescook@chromium.org>2017-05-28 20:23:03 +0300
commit0aa5e49c6845ecd82531341085f367767c9f419a (patch)
treedd7b9d4a2bad900e26a42810304ae571df61183a /include/linux/compiler-gcc.h
parent1132e1e448ce51e3b51fc7afdf661633abc4f202 (diff)
downloadlinux-0aa5e49c6845ecd82531341085f367767c9f419a.tar.xz
compiler: Add __designated_init annotation
This allows structure annotations for requiring designated initialization in GCC 5.1.0 and later: https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html The structure randomization layout plugin will be using this to help identify structures that need this form of initialization. Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r--include/linux/compiler-gcc.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 0efef9cf014f..386caf6771ed 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -294,6 +294,14 @@
#define __no_sanitize_address __attribute__((no_sanitize_address))
#endif
+#if GCC_VERSION >= 50100
+/*
+ * Mark structures as requiring designated initializers.
+ * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
+ */
+#define __designated_init __attribute__((designated_init))
+#endif
+
#endif /* gcc version >= 40000 specific checks */
#if !defined(__noclone)