Blame view

scripts/Makefile.gcc-plugins 1.85 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  # SPDX-License-Identifier: GPL-2.0
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
2

59f53855b   Masahiro Yamada   gcc-plugins: test...
3
  gcc-plugin-$(CONFIG_GCC_PLUGIN_CYC_COMPLEXITY)	+= cyc_complexity_plugin.so
543c37cb1   Emese Revfy   Add sancov plugin
4

59f53855b   Masahiro Yamada   gcc-plugins: test...
5
  gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)	+= latent_entropy_plugin.so
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
6
7
  gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)		\
  		+= -DLATENT_ENTROPY_PLUGIN
59f53855b   Masahiro Yamada   gcc-plugins: test...
8
  ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
9
      DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable
59f53855b   Masahiro Yamada   gcc-plugins: test...
10
  endif
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
11
  export DISABLE_LATENT_ENTROPY_PLUGIN
c61f13eaa   Kees Cook   gcc-plugins: Add ...
12

59f53855b   Masahiro Yamada   gcc-plugins: test...
13
  gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV)		+= sancov_plugin.so
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
14

59f53855b   Masahiro Yamada   gcc-plugins: test...
15
  gcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK)	+= structleak_plugin.so
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
16
17
18
19
20
21
  gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE)	\
  		+= -fplugin-arg-structleak_plugin-verbose
  gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL)	\
  		+= -fplugin-arg-structleak_plugin-byref-all
  gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK)		\
  		+= -DSTRUCTLEAK_PLUGIN
313dd1b62   Kees Cook   gcc-plugins: Add ...
22

59f53855b   Masahiro Yamada   gcc-plugins: test...
23
  gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT)	+= randomize_layout_plugin.so
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
24
25
26
27
  gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT)		\
  		+= -DRANDSTRUCT_PLUGIN
  gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE)	\
  		+= -fplugin-arg-randomize_layout_plugin-performance-mode
6b90bd4ba   Emese Revfy   GCC plugin infras...
28

7ccb95e8f   Kees Cook   gcc-plugins: Regu...
29
30
  # All the plugin CFLAGS are collected here in case a build target needs to
  # filter them out of the KBUILD_CFLAGS.
59f53855b   Masahiro Yamada   gcc-plugins: test...
31
  GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
32
  # The sancov_plugin.so is included via CFLAGS_KCOV, so it is removed here.
59f53855b   Masahiro Yamada   gcc-plugins: test...
33
  GCC_PLUGINS_CFLAGS := $(filter-out %/sancov_plugin.so, $(GCC_PLUGINS_CFLAGS))
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
34
  export GCC_PLUGINS_CFLAGS
ed58c0e9e   Kees Cook   gcc-plugins: abor...
35

7ccb95e8f   Kees Cook   gcc-plugins: Regu...
36
  # Add the flags to the build!
59f53855b   Masahiro Yamada   gcc-plugins: test...
37
  KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
38
39
  
  # All enabled GCC plugins are collected here for building below.
59f53855b   Masahiro Yamada   gcc-plugins: test...
40
  GCC_PLUGIN := $(gcc-plugin-y)
7ccb95e8f   Kees Cook   gcc-plugins: Regu...
41
  export GCC_PLUGIN
6b90bd4ba   Emese Revfy   GCC plugin infras...
42

ed58c0e9e   Kees Cook   gcc-plugins: abor...
43
44
  # Actually do the build, if requested.
  PHONY += gcc-plugins
59f53855b   Masahiro Yamada   gcc-plugins: test...
45
  gcc-plugins: scripts_basic
ed58c0e9e   Kees Cook   gcc-plugins: abor...
46
47
  ifdef CONFIG_GCC_PLUGINS
  	$(Q)$(MAKE) $(build)=scripts/gcc-plugins
6b90bd4ba   Emese Revfy   GCC plugin infras...
48
  endif
ed58c0e9e   Kees Cook   gcc-plugins: abor...
49
  	@: