blob: 9e95862f278828dfb0ce49d1bdb5a2a8a12ead9d [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001# SPDX-License-Identifier: GPL-2.0
2PLUGINCC := $(CONFIG_PLUGIN_HOSTCC:"%"=%)
3GCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin)
4
5ifeq ($(PLUGINCC),$(HOSTCC))
6 HOSTLIBS := hostlibs
7 HOST_EXTRACFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu99 -ggdb
8 export HOST_EXTRACFLAGS
9else
10 HOSTLIBS := hostcxxlibs
11 HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
12 HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
13 HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable
Olivier Deprez0e641232021-09-23 10:07:05 +020014 HOST_EXTRACXXFLAGS += -Wno-format-diag
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000015 export HOST_EXTRACXXFLAGS
16endif
17
18$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h
19quiet_cmd_create_randomize_layout_seed = GENSEED $@
20cmd_create_randomize_layout_seed = \
21 $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h
22$(objtree)/$(obj)/randomize_layout_seed.h: FORCE
23 $(call if_changed,create_randomize_layout_seed)
24targets = randomize_layout_seed.h randomize_layout_hash.h
25
26$(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p)))
27always := $($(HOSTLIBS)-y)
28
29$(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o))
30
31clean-files += *.so