summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-03-20 17:14:11 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-10 11:23:29 +0100
commita250cab009b578679496f53fe3532ef79821fe8f (patch)
tree999ae1435b5bf70ff051298918bb1835b75abe46 /Makefile
parenta67a32da603cba284c0ed96878e19acf00263373 (diff)
Kbuild: make designated_init attribute fatal
[ Upstream commit c834f0e8a8bb3025aac38e802fca2e686720f544 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index b7f6639f4e7a..19c7e3068407 100644
--- a/Makefile
+++ b/Makefile
@@ -834,6 +834,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)