rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | GCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin) |
| 3 | |
| 4 | ifeq ($(PLUGINCC),$(HOSTCC)) |
| 5 | HOSTLIBS := hostlibs |
| 6 | HOST_EXTRACFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu99 -ggdb |
| 7 | export HOST_EXTRACFLAGS |
| 8 | else |
| 9 | HOSTLIBS := hostcxxlibs |
| 10 | HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti |
| 11 | HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb |
| 12 | HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable |
| 13 | HOST_EXTRACXXFLAGS += -Wno-format-diag |
| 14 | export HOST_EXTRACXXFLAGS |
| 15 | endif |
| 16 | |
| 17 | ifneq ($(CFLAGS_KCOV), $(SANCOV_PLUGIN)) |
| 18 | GCC_PLUGIN := $(filter-out $(SANCOV_PLUGIN), $(GCC_PLUGIN)) |
| 19 | endif |
| 20 | |
| 21 | export HOSTLIBS |
| 22 | |
| 23 | $(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h |
| 24 | quiet_cmd_create_randomize_layout_seed = GENSEED $@ |
| 25 | cmd_create_randomize_layout_seed = \ |
| 26 | $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h |
| 27 | $(objtree)/$(obj)/randomize_layout_seed.h: FORCE |
| 28 | $(call if_changed,create_randomize_layout_seed) |
| 29 | targets = randomize_layout_seed.h randomize_layout_hash.h |
| 30 | |
| 31 | $(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p))) |
| 32 | always := $($(HOSTLIBS)-y) |
| 33 | |
| 34 | $(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o)) |
| 35 | |
| 36 | subdir-y := $(GCC_PLUGIN_SUBDIR) |
| 37 | subdir- += $(GCC_PLUGIN_SUBDIR) |
| 38 | |
| 39 | clean-files += *.so |