From patchwork Fri Jan 11 09:18:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 155312 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp348619jaa; Fri, 11 Jan 2019 01:19:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN4WKM2d5M/bH0qtME+82hA1u0XXqV/NRyUJT7GxYKc/quLQL7EK5gXCTx3wzcdSGija6gyk X-Received: by 2002:a63:4c4e:: with SMTP id m14mr10534193pgl.173.1547198391173; Fri, 11 Jan 2019 01:19:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547198391; cv=none; d=google.com; s=arc-20160816; b=YnU+x39m5u650YfNSAYlkP/4gzLKNq95QUpS1/4RBeJdogRjULpOBh3TsKofMItsAQ P9KARIviMTkUZsfxlxViDe8kvyf2rOZ+vuYZXDfR0iOccgRkE5AB7m6yV9ggW/m37GOI Z/im9NeCvNSg4eudpf2YuUlJHa2YSnEW/1PSuoEFW3Eurq59CsT4I1kSMSp5z9gPjyeV rjfHk99qCGi57bOg+gzgoA1blCj2+MSpyYuVuhiCyYVjJW6jdOUfvWtVu7ircoH9E7JQ 2MBZU5wjUlaZLbo+54HL7EX5j9RVeMsKWe6yca3JixWalEz+Utqaq5BP7TrslQN1hG5r ovLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=L0gFzijA0pMSry8KkrGmKcBeXwn0RuYRJlNQgHdkMf4=; b=I7nk/U15TCNqy6WGx3i62eOglsQ+uprIQZkB/U7sFo/Wh1CSDOTYrkPxjKePFvEpcT OH4fS1jSLoM+N55ZKPt8FWRoesCLkT7VnQlyyt2UIRdnouoX0z9MpBIMuJk19JfT3GcX moBnccFAkwrtyMH5RBUOgd26oO3NsjXsU27bAsi18C7mhiAHCyRbBYTy3dDSDB8lSEi8 T5rZzGNiksOMZyQ3f5WRYTYRE5WYG/JKON87I+lp6ep3gn0yS6yx/Bod43uUy2oKukZz sp/OWo8dFWPUBobRc8byrWexEPfrzrVire8XKYmM6sdL0T55DaMiulBvba1et+OT0r/1 9iCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=gYkyiog0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg7si80507plb.149.2019.01.11.01.19.50; Fri, 11 Jan 2019 01:19:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=gYkyiog0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731518AbfAKJTu (ORCPT + 31 others); Fri, 11 Jan 2019 04:19:50 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:36610 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730790AbfAKJTt (ORCPT ); Fri, 11 Jan 2019 04:19:49 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id x0B9J6oI028675; Fri, 11 Jan 2019 18:19:07 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x0B9J6oI028675 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1547198347; bh=L0gFzijA0pMSry8KkrGmKcBeXwn0RuYRJlNQgHdkMf4=; h=From:To:Cc:Subject:Date:From; b=gYkyiog0LnHcKYmbQUB/d+zVerxeHSYtmIzIrNgii/IujcjU/9rrgpi1Tcc1R7w6B h9Zs8v8uqMEtNI0rdSHqZJU89sBTLKgPIda2xLsyum+jWwe0NSbyH1/U0rA2nN/vxL 1RRQ7YD13ajrqhG52rD996ZNdBMSx7L7894Sv6q3dp3gR2ObwNiuKhMVWExRUP3wrv qXeyEU6pJ+qsmYApIk/mrFQX6wmqEcr3PndQD8qzlwtuXBqqijy/hnkZln20mOiwcg 6oC/cKDSSX6zPA4jPBdGnoyfsQ4jCMF/LT4GopwTRhBsuA3e3ieOhPcqIza4B/8MUN 9uRVqBeHmKAyA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Kees Cook , kernel-hardening@lists.openwall.com, Emese Revfy , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] kbuild: clean up hostprogs rules with hostld_flags and hostld_libs Date: Fri, 11 Jan 2019 18:18:46 +0900 Message-Id: <1547198328-26359-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add hostld_flags and hostld_libs shorthands. No function change. Signed-off-by: Masahiro Yamada --- scripts/Makefile.host | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) -- 2.7.4 Acked-by: Kees Cook diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 0393f75..f2e15de 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -78,23 +78,26 @@ endif hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags) hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) +hostld_flags = $(KBUILD_HOSTLDFLAGS) +hostld_libs = $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) + ##### # Compile programs on the host # Create executable from a single .c file # host-csingle -> Executable quiet_cmd_host-csingle = HOSTCC $@ - cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \ - $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) + cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(hostld_flags) -o $@ $< \ + $(hostld_libs) $(host-csingle): $(obj)/%: $(src)/%.c FORCE $(call if_changed_dep,host-csingle) # Link an executable based on list of .o files, all plain c # host-cmulti -> executable quiet_cmd_host-cmulti = HOSTLD $@ - cmd_host-cmulti = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ \ + cmd_host-cmulti = $(HOSTCC) $(hostld_flags) -o $@ \ $(addprefix $(obj)/,$($(@F)-objs)) \ - $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) + $(hostld_libs) $(host-cmulti): FORCE $(call if_changed,host-cmulti) $(call multi_depend, $(host-cmulti), , -objs) @@ -109,10 +112,10 @@ $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE # Link an executable based on list of .o files, a mixture of .c and .cc # host-cxxmulti -> executable quiet_cmd_host-cxxmulti = HOSTLD $@ - cmd_host-cxxmulti = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -o $@ \ + cmd_host-cxxmulti = $(HOSTCXX) $(hostld_flags) -o $@ \ $(foreach o,objs cxxobjs,\ $(addprefix $(obj)/,$($(@F)-$(o)))) \ - $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) + $(hostld_libs) $(host-cxxmulti): FORCE $(call if_changed,host-cxxmulti) $(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs) @@ -143,9 +146,9 @@ $(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE # Link a shared library, based on position independent .o files # *.o -> .so shared library (host-cshlib) quiet_cmd_host-cshlib = HOSTLLD -shared $@ - cmd_host-cshlib = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \ + cmd_host-cshlib = $(HOSTCC) $(hostld_flags) -shared -o $@ \ $(addprefix $(obj)/,$($(@F:.so=-objs))) \ - $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) + $(hostld_libs) $(host-cshlib): FORCE $(call if_changed,host-cshlib) $(call multi_depend, $(host-cshlib), .so, -objs) @@ -153,9 +156,9 @@ $(call multi_depend, $(host-cshlib), .so, -objs) # Link a shared library, based on position independent .o files # *.o -> .so shared library (host-cxxshlib) quiet_cmd_host-cxxshlib = HOSTLLD -shared $@ - cmd_host-cxxshlib = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \ + cmd_host-cxxshlib = $(HOSTCXX) $(hostld_flags) -shared -o $@ \ $(addprefix $(obj)/,$($(@F:.so=-objs))) \ - $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) + $(hostld_libs) $(host-cxxshlib): FORCE $(call if_changed,host-cxxshlib) $(call multi_depend, $(host-cxxshlib), .so, -objs) From patchwork Fri Jan 11 09:18:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 155313 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp348623jaa; Fri, 11 Jan 2019 01:19:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN7+wGCUL8biiYW1qtuxkjbLQ914DztGMysTAWTXbMCEwhG7Abu/mGtR2CxJKcZFkso+j+CT X-Received: by 2002:a17:902:b406:: with SMTP id x6mr13283073plr.329.1547198391646; Fri, 11 Jan 2019 01:19:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547198391; cv=none; d=google.com; s=arc-20160816; b=IXVKDvkILk/xtlWnbAhqb11rRaNVKBJCmVbBvcfWNXINjvYsONfourTO/cgVep0GVw MZVS3zj/O90OOYN3ajjonOL1/X+4LdkOfzuYq5sqVweNlf/h/z/+dHe+Duo4Fu6cm06V FZoNuL27tATFnsNZHITVjEOXNqH9mWmYRen3ZkXSjgO2vA/XFK0HZTOEKsY4LYAitFms J/wictPldjEekHtZh4E+neLA6OmlNX1ZNvusSrImZWERP75t0cE/l1Vag6F/4Ghlr7Q3 KvX1/UHVpmDNRYye2xDzQqMq1LwhDpwxhlbFdIPGHdiC4vrOVyLhXS5pq0zUPpWRjTFi YgPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=Qs7YIVojkKyJtreTzu//aKchbHUzPKQWCV5FkDF/H08=; b=f/lwnSeyuWruLetxod4AscT4HGq13Tifx/rJfvRkoIZlsV9BpXU72fxLToLWj5ByPt GliQ9sof7TlaW5T9OREzjAWLNtnsDxcnIoufbhDVgKIy3oTvthaLfw6gXGj1NaDGe2G+ 7i3FIG1g3y4mZhXH0/CnalBkzLuRK1JMCVZ2uzU8byP/s017ygoxr8wX77FxhiSynmgN hNz2zBT21eKFouMsrZ5gNbdz4JklWOtwriGf2Sf/JIdWXtAM/sjgmVobqaCPxtSr6t8I OBg/7T5CJwA7epqsNDuB2Z/6f1f9XF6uY0fnOh57giSLCVvm5sjvF9yb0oPHCqntsbOL KR5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=F2zEtjEy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg7si80507plb.149.2019.01.11.01.19.51; Fri, 11 Jan 2019 01:19:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=F2zEtjEy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731534AbfAKJTu (ORCPT + 31 others); Fri, 11 Jan 2019 04:19:50 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:36618 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731169AbfAKJTt (ORCPT ); Fri, 11 Jan 2019 04:19:49 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id x0B9J6oJ028675; Fri, 11 Jan 2019 18:19:07 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x0B9J6oJ028675 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1547198348; bh=Qs7YIVojkKyJtreTzu//aKchbHUzPKQWCV5FkDF/H08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2zEtjEy33dV7FSAuYpFMXHnEfIMwlK6ROeLeStDnas7WIsRFakjc/zFhszVBM/Db KdcvP6/1aMTyVxXH2Sm+781HgStb6ngh8bNke8ETMPhOigqW/7+94ddFR7EDkWFIE4 BCGZ5R+RQtsJKLJjE+eObZZov7KCGO5igzdFPhPIM4XJdNkeBO3V4a8yRgL2YlwlQU nkKfGSD7LKnFvFxweCXK2jPIP7wdvfrItZi0HoVfl0eShOfYD0C/G+WOWo48HZ5N+j PLBn6y4dm6DZMV9HQXs3zyUENof3j+3RDQAG+sPKi9WTQ3L2CUC0LUovO7w+qg71gz Dem4yj1vjcgZQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Kees Cook , kernel-hardening@lists.openwall.com, Emese Revfy , Masahiro Yamada , linux-kernel@vger.kernel.org, Michal Marek Subject: [PATCH 2/2] kbuild: simplify GCC plugin build rules Date: Fri, 11 Jan 2019 18:18:47 +0900 Message-Id: <1547198328-26359-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547198328-26359-1-git-send-email-yamada.masahiro@socionext.com> References: <1547198328-26359-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GCC-plugin is the only user of the shared library build rules in scripts/Makefile.host. Hence, those rules do not need to be treewide available. The build rules in scripts/Makefile.host are written in a too generic way. I guess the main reason is because commit 24403874316a ("Shared library support") revived the code ripped off by commit 62e2210798ed ("kbuild: drop shared library support from Makefile.host"). Currently, every plugin is built from a single C file. So, all we need is a pattern rule to create %.so from %.c. Signed-off-by: Masahiro Yamada --- I want Acked-by from GCC plugin folks, so this series can go into kbuild tree. scripts/Makefile.build | 2 +- scripts/Makefile.clean | 4 +--- scripts/Makefile.host | 49 +------------------------------------------- scripts/gcc-plugins/Makefile | 28 ++++++++++++++----------- 4 files changed, 19 insertions(+), 64 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index fd03d60..d71a4ed 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -44,7 +44,7 @@ include $(kbuild-file) include scripts/Makefile.lib # Do not include host rules unless needed -ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),) +ifneq ($(hostprogs-y)$(hostprogs-m),) include scripts/Makefile.host endif diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 0b80e320..032160a 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -38,9 +38,7 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) __clean-files := $(extra-y) $(extra-m) $(extra-) \ $(always) $(targets) $(clean-files) \ - $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \ - $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \ - $(hostcxxlibs-y) $(hostcxxlibs-m) + $(hostprogs-y) $(hostprogs-m) $(hostprogs-) __clean-files := $(filter-out $(no-clean-files), $(__clean-files)) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index f2e15de..0486180 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -22,8 +22,6 @@ # They are linked as C++ code to the executable qconf __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) -host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m)) -host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m)) # C code # Executables compiled from a single .c file @@ -45,19 +43,11 @@ host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m))) # C++ Object (.o) files compiled from .cc files host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) -# Object (.o) files used by the shared libaries -host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) -host-cxxshobjs := $(sort $(foreach m,$(host-cxxshlib),$($(m:.so=-objs)))) - host-csingle := $(addprefix $(obj)/,$(host-csingle)) host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) -host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) -host-cxxshlib := $(addprefix $(obj)/,$(host-cxxshlib)) -host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) -host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs)) ##### # Handle options to gcc. Support building with separate output directory @@ -126,42 +116,5 @@ quiet_cmd_host-cxxobjs = HOSTCXX $@ $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE $(call if_changed_dep,host-cxxobjs) -# Compile .c file, create position independent .o file -# host-cshobjs -> .o -quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ - cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< -$(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE - $(call if_changed_dep,host-cshobjs) - -# Compile .c file, create position independent .o file -# Note that plugin capable gcc versions can be either C or C++ based -# therefore plugin source files have to be compilable in both C and C++ mode. -# This is why a C++ compiler is invoked on a .c file. -# host-cxxshobjs -> .o -quiet_cmd_host-cxxshobjs = HOSTCXX -fPIC $@ - cmd_host-cxxshobjs = $(HOSTCXX) $(hostcxx_flags) -fPIC -c -o $@ $< -$(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE - $(call if_changed_dep,host-cxxshobjs) - -# Link a shared library, based on position independent .o files -# *.o -> .so shared library (host-cshlib) -quiet_cmd_host-cshlib = HOSTLLD -shared $@ - cmd_host-cshlib = $(HOSTCC) $(hostld_flags) -shared -o $@ \ - $(addprefix $(obj)/,$($(@F:.so=-objs))) \ - $(hostld_libs) -$(host-cshlib): FORCE - $(call if_changed,host-cshlib) -$(call multi_depend, $(host-cshlib), .so, -objs) - -# Link a shared library, based on position independent .o files -# *.o -> .so shared library (host-cxxshlib) -quiet_cmd_host-cxxshlib = HOSTLLD -shared $@ - cmd_host-cxxshlib = $(HOSTCXX) $(hostld_flags) -shared -o $@ \ - $(addprefix $(obj)/,$($(@F:.so=-objs))) \ - $(hostld_libs) -$(host-cxxshlib): FORCE - $(call if_changed,host-cxxshlib) -$(call multi_depend, $(host-cxxshlib), .so, -objs) - targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ - $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) $(host-cxxshlib) $(host-cxxshobjs) + $(host-cxxmulti) $(host-cxxobjs) diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile index aa0d0ec..a09404d 100644 --- a/scripts/gcc-plugins/Makefile +++ b/scripts/gcc-plugins/Makefile @@ -3,18 +3,17 @@ PLUGINCC := $(CONFIG_PLUGIN_HOSTCC:"%"=%) GCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin) ifeq ($(PLUGINCC),$(HOSTCC)) - HOSTLIBS := hostlibs - HOST_EXTRACFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu99 -ggdb - export HOST_EXTRACFLAGS + quiet_cmd_plugin = HOSTCC $@ + pluginc_flags = $(hostc_flags) -std=gnu99 else - HOSTLIBS := hostcxxlibs - HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti - HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb - HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable - export HOST_EXTRACXXFLAGS + quiet_cmd_plugin = HOSTCXX $@ + pluginc_flags = $(hostcxx_flags) -std=gnu++98 -fno-rtti -fno-exceptions \ + -fasynchronous-unwind-tables -Wno-narrowing -Wno-unused-variable endif -$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h +pluginc_flags += -I$(GCC_PLUGINS_DIR)/include -I$(src) -ggdb -fPIC + +$(obj)/randomize_layout_plugin.so: $(objtree)/$(obj)/randomize_layout_seed.h quiet_cmd_create_randomize_layout_seed = GENSEED $@ cmd_create_randomize_layout_seed = \ $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h @@ -22,9 +21,14 @@ $(objtree)/$(obj)/randomize_layout_seed.h: FORCE $(call if_changed,create_randomize_layout_seed) targets = randomize_layout_seed.h randomize_layout_hash.h -$(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p))) -always := $($(HOSTLIBS)-y) +extra-y := $(GCC_PLUGIN) + +cmd_plugin = $(PLUGINCC) $(pluginc_flags) -shared $(hostld_flags) \ + -o $@ $< $(hostld_libs) + +$(obj)/%.so: $(src)/%.c FORCE + $(call if_changed_dep,plugin) -$(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o)) +hostprogs-y += dummy_to_include_scripts/Makefile.host clean-files += *.so