In preparation for Clang stack depth tracking for KSTACK_ERASE, split the stackleak-specific cflags out of GCC_PLUGINS_CFLAGS into KSTACK_ERASE_CFLAGS.
Showing the changes to scripts (2 of 8 files). Show all
Unified · Split
| @@ -8,20 +8,6 @@ ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY · 7 unmodified lines | |||
| 8 | endif | 8 | endif |
| 9 | export DISABLE_LATENT_ENTROPY_PLUGIN | 9 | export DISABLE_LATENT_ENTROPY_PLUGIN |
| 10 | 10 | ||
| 11 | gcc-plugin-$(CONFIG_GCC_PLUGIN_STACKLEAK) += stackleak_plugin.so | ||
| 12 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \ | ||
| 13 | += -DSTACKLEAK_PLUGIN | ||
| 14 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \ | ||
| 15 | += -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_KSTACK_ERASE_TRACK_MIN_SIZE) | ||
| 16 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \ | ||
| 17 | += -fplugin-arg-stackleak_plugin-arch=$(SRCARCH) | ||
| 18 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE) \ | ||
| 19 | += -fplugin-arg-stackleak_plugin-verbose | ||
| 20 | ifdef CONFIG_GCC_PLUGIN_STACKLEAK | ||
| 21 | DISABLE_KSTACK_ERASE += -fplugin-arg-stackleak_plugin-disable | ||
| 22 | endif | ||
| 23 | export DISABLE_KSTACK_ERASE | ||
| 24 | |||
| 25 | # All the plugin CFLAGS are collected here in case a build target needs to | 11 | # All the plugin CFLAGS are collected here in case a build target needs to |
| 26 | # filter them out of the KBUILD_CFLAGS. | 12 | # filter them out of the KBUILD_CFLAGS. |
| 27 | GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) -DGCC_PLUGINS | 13 | GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) -DGCC_PLUGINS |
| @@ -34,6 +20,8 @@ KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS) · 6 unmodified lines | |||
| 34 | # be included in GCC_PLUGIN so they can get built. | 20 | # be included in GCC_PLUGIN so they can get built. |
| 35 | gcc-plugin-external-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \ | 21 | gcc-plugin-external-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \ |
| 36 | += randomize_layout_plugin.so | 22 | += randomize_layout_plugin.so |
| 23 | gcc-plugin-external-$(CONFIG_GCC_PLUGIN_STACKLEAK) \ | ||
| 24 | += stackleak_plugin.so | ||
| 37 | 25 | ||
| 38 | # All enabled GCC plugins are collected here for building in | 26 | # All enabled GCC plugins are collected here for building in |
| 39 | # scripts/gcc-scripts/Makefile. | 27 | # scripts/gcc-scripts/Makefile. |
| @@ -0,0 +1,15 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ifdef CONFIG_GCC_PLUGIN_STACKLEAK | ||
| 4 | kstack-erase-cflags-y += -fplugin=$(objtree)/scripts/gcc-plugins/stackleak_plugin.so | ||
| 5 | kstack-erase-cflags-y += -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_KSTACK_ERASE_TRACK_MIN_SIZE) | ||
| 6 | kstack-erase-cflags-y += -fplugin-arg-stackleak_plugin-arch=$(SRCARCH) | ||
| 7 | kstack-erase-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE) += -fplugin-arg-stackleak_plugin-verbose | ||
| 8 | DISABLE_KSTACK_ERASE := -fplugin-arg-stackleak_plugin-disable | ||
| 9 | endif | ||
| 10 | |||
| 11 | KSTACK_ERASE_CFLAGS := $(kstack-erase-cflags-y) | ||
| 12 | |||
| 13 | export STACKLEAK_CFLAGS DISABLE_KSTACK_ERASE | ||
| 14 | |||
| 15 | KBUILD_CFLAGS += $(KSTACK_ERASE_CFLAGS) | ||