blob: 24e283e8989382f25d1d0702d5a276ae4681490d [file] [log] [blame]
Kees Cook613f4b3e2022-05-03 13:55:01 -07001# SPDX-License-Identifier: GPL-2.0
2
3randstruct-cflags-y += -DRANDSTRUCT
4
5ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT
6randstruct-cflags-y \
7 += -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so
8randstruct-cflags-$(CONFIG_RANDSTRUCT_PERFORMANCE) \
9 += -fplugin-arg-randomize_layout_plugin-performance-mode
Kees Cook035f7f82022-05-03 13:55:03 -070010else
11randstruct-cflags-y \
12 += -frandomize-layout-seed-file=$(objtree)/scripts/basic/randstruct.seed
Kees Cook613f4b3e2022-05-03 13:55:01 -070013endif
14
15export RANDSTRUCT_CFLAGS := $(randstruct-cflags-y)
16
17KBUILD_CFLAGS += $(RANDSTRUCT_CFLAGS)