Skip to content
Snippets Groups Projects
Commit c834f0e8 authored by Kees Cook's avatar Kees Cook Committed by Masahiro Yamada
Browse files

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: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent f78271df
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment