blob: 214eb2335c31183e8fa438dfd6ad4a9ef3497209 [file] [log] [blame]
Emese Revfy6b90bd42016-05-24 00:09:38 +02001GCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin)
2
3ifeq ($(PLUGINCC),$(HOSTCC))
4 HOSTLIBS := hostlibs
5 HOST_EXTRACFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu99 -ggdb
6 export HOST_EXTRACFLAGS
7else
8 HOSTLIBS := hostcxxlibs
9 HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
10 HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
11 HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable
12 export HOST_EXTRACXXFLAGS
13endif
14
Emese Revfy543c37c2016-05-24 00:11:37 +020015ifneq ($(CFLAGS_KCOV), $(SANCOV_PLUGIN))
16 GCC_PLUGIN := $(filter-out $(SANCOV_PLUGIN), $(GCC_PLUGIN))
17endif
18
Emese Revfycaefd8c2016-06-26 17:38:20 +020019export HOSTLIBS
20
Kees Cook313dd1b62017-05-05 23:37:45 -070021$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h
22quiet_cmd_create_randomize_layout_seed = GENSEED $@
23cmd_create_randomize_layout_seed = \
24 $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h
25$(objtree)/$(obj)/randomize_layout_seed.h: FORCE
26 $(call if_changed,create_randomize_layout_seed)
27targets = randomize_layout_seed.h randomize_layout_hash.h
28
Emese Revfycaefd8c2016-06-26 17:38:20 +020029$(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p)))
Emese Revfy6b90bd42016-05-24 00:09:38 +020030always := $($(HOSTLIBS)-y)
31
Emese Revfy7040c832016-06-26 17:36:43 +020032$(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o))
Emese Revfy543c37c2016-05-24 00:11:37 +020033
Emese Revfycaefd8c2016-06-26 17:38:20 +020034subdir-y := $(GCC_PLUGIN_SUBDIR)
35subdir- += $(GCC_PLUGIN_SUBDIR)
36
Emese Revfy6b90bd42016-05-24 00:09:38 +020037clean-files += *.so