Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Masahiro Yamada | 59f5385 | 2018-05-28 18:22:06 +0900 | [diff] [blame] | 2 | PLUGINCC := $(CONFIG_PLUGIN_HOSTCC:"%"=%) |
Emese Revfy | 6b90bd4 | 2016-05-24 00:09:38 +0200 | [diff] [blame] | 3 | GCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin) |
| 4 | |
| 5 | ifeq ($(PLUGINCC),$(HOSTCC)) |
| 6 | HOSTLIBS := hostlibs |
| 7 | HOST_EXTRACFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu99 -ggdb |
| 8 | export HOST_EXTRACFLAGS |
| 9 | else |
| 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 |
| 14 | export HOST_EXTRACXXFLAGS |
| 15 | endif |
| 16 | |
Emese Revfy | caefd8c | 2016-06-26 17:38:20 +0200 | [diff] [blame] | 17 | export HOSTLIBS |
| 18 | |
Kees Cook | 313dd1b6 | 2017-05-05 23:37:45 -0700 | [diff] [blame] | 19 | $(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h |
| 20 | quiet_cmd_create_randomize_layout_seed = GENSEED $@ |
| 21 | cmd_create_randomize_layout_seed = \ |
| 22 | $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h |
| 23 | $(objtree)/$(obj)/randomize_layout_seed.h: FORCE |
| 24 | $(call if_changed,create_randomize_layout_seed) |
| 25 | targets = randomize_layout_seed.h randomize_layout_hash.h |
| 26 | |
Emese Revfy | caefd8c | 2016-06-26 17:38:20 +0200 | [diff] [blame] | 27 | $(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p))) |
Emese Revfy | 6b90bd4 | 2016-05-24 00:09:38 +0200 | [diff] [blame] | 28 | always := $($(HOSTLIBS)-y) |
| 29 | |
Emese Revfy | 7040c83 | 2016-06-26 17:36:43 +0200 | [diff] [blame] | 30 | $(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o)) |
Emese Revfy | 543c37c | 2016-05-24 00:11:37 +0200 | [diff] [blame] | 31 | |
Emese Revfy | caefd8c | 2016-06-26 17:38:20 +0200 | [diff] [blame] | 32 | subdir-y := $(GCC_PLUGIN_SUBDIR) |
| 33 | subdir- += $(GCC_PLUGIN_SUBDIR) |
| 34 | |
Emese Revfy | 6b90bd4 | 2016-05-24 00:09:38 +0200 | [diff] [blame] | 35 | clean-files += *.so |