summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-03-21 01:14:11 +0100
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-03-21 18:50:25 +0100
commitc834f0e8a8bb3025aac38e802fca2e686720f544 (patch)
treec53de99eef392f795629261ecbcc4c5b7b27c99b
parentkbuild: drop unneeded patterns '.*.orig' and '.*.rej' from distclean (diff)
downloadlinux-c834f0e8a8bb3025aac38e802fca2e686720f544.tar.xz
linux-c834f0e8a8bb3025aac38e802fca2e686720f544.zip
Kbuild: make designated_init attribute fatal
If a structure is marked with __attribute__((designated_init)) from GCC or Sparse, it needs to have all static initializers using designated initialization. Fail the build for any missing cases. This attribute will be used by the randstruct plugin to make sure randomized structures are being correctly initialized. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r--Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 515aeea7e702..ae49fef98ca3 100644
--- a/Makefile
+++ b/Makefile
@@ -795,6 +795,9 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
# enforce correct pointer usage
KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types)
+# Require designated initializers for all marked structures
+KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
+
# use the deterministic mode of AR if available
KBUILD_ARFLAGS := $(call ar-option,D)