Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp304037pxb; Wed, 15 Sep 2021 02:24:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtnUBMgAI93VILrfX5ph799tqHJ4RbvWfLT/w01HOd/SmM+QacDtCv+hZfNt0BV24XduL8 X-Received: by 2002:a05:6638:14cf:: with SMTP id l15mr18419273jak.8.1631697897772; Wed, 15 Sep 2021 02:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631697897; cv=none; d=google.com; s=arc-20160816; b=nL3V47tSQHdeol4ihDZywBBkc1BO5G7Y5dRJg0rYlqP9tLdkwE+bPBAsGcEIZXbQ/K Ce2ZsnudEL739/JFDwKSpNi+8OIngbcG/lwpb7Rq4s8AukPvnMwb08/16yB8pSH1jZW/ HW7W/KV5v2k3s9XLieAghh2iSy2YS2rRqM60PhQvYp1gYtoA1JC21teDHMmpNZlFKxU7 U7bvjFyhlU50d7fX+G0POQbgvkQ4g4/KgINueojw/d5QY4xmDM/+AHmVyoHpc1XexFR3 2W0lhr3Qd4/78F1fhDPehAdNQxWTZSLrtDOMpY/tO2nvDNm4XZilpCQ5Itt3+aMtbydI 8Y1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=iKw7GqghXZYiutnPhr+470gO19Sjoq5v1v/v4crZs5A=; b=jIwhKSqKLMKYxSeBR4y1sEF9YRTAMdst2mZzMOqJl1ljQ5i3ImeZk1hXy3bv+0QKw+ /GjwWo3cxqC1k4gQ7raCBrAP5i4rbXfqUlxrMI0x4hRPC1qAEUwZnVtanRSjfgspfUri 2wIkLJnz+vkQyLhgR3pc2nvIi8QmcE8HKOdcf4ZeLp1Lb1n4gBVN3iCZazKGtgC+XBVD 5RSVNplnVyCwISAKfvBM0g4z0JEjQu1W2xdCEGxBKKhaB85aQp95wzW8V+Vy62hnvFps a9N11pve5wnS0hiGs1++7N5iFpwbx8u1D7Rl82ZNlm8++0aAqr4A6uUXyXUJSQE4TOad MmDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si12437410ilh.76.2021.09.15.02.24.46; Wed, 15 Sep 2021 02:24:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237010AbhIOJZR (ORCPT + 99 others); Wed, 15 Sep 2021 05:25:17 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:50331 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbhIOJZQ (ORCPT ); Wed, 15 Sep 2021 05:25:16 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=ashimida@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0UoT1MUX_1631697829; Received: from localhost(mailfrom:ashimida@linux.alibaba.com fp:SMTPD_---0UoT1MUX_1631697829) by smtp.aliyun-inc.com(127.0.0.1); Wed, 15 Sep 2021 17:23:55 +0800 From: Dan Li To: masahiroy@kernel.org, michal.lkml@markovi.net, keescook@chromium.org Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Dan Li Subject: [PATCH] [RFC] Add additional include path for gcc plugins Date: Wed, 15 Sep 2021 17:23:47 +0800 Message-Id: <1631697827-96324-1-git-send-email-ashimida@linux.alibaba.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When kernel enables gcc plugin, some header files are missing in some tool chains (as in the following example) These header files can be found in other toolchains, and sometimes the md5hash of these files are same(in most versions). Should we add a parameter to plugin to allow users to import their own header file directories? --- HOSTCXX scripts/gcc-plugins/stackleak_plugin.so In file included from scripts/gcc-plugins/gcc-common.h:103:0, from scripts/gcc-plugins/stackleak_plugin.c:30: /workspace/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/../ lib/gcc/aarch64-none-linux-gnu/9.2.1/plugin/include/builtins.h:23:17: fatal error: mpc.h: No such file or directory #include Signed-off-by: Dan Li --- Makefile | 3 +++ scripts/gcc-plugins/Makefile | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 09bb314..e6134f3 100644 --- a/Makefile +++ b/Makefile @@ -1036,6 +1036,9 @@ include-$(CONFIG_UBSAN) += scripts/Makefile.ubsan include-$(CONFIG_KCOV) += scripts/Makefile.kcov include-$(CONFIG_GCC_PLUGINS) += scripts/Makefile.gcc-plugins +GCC_PLUGINS_EXT_CFLAGS= +export GCC_PLUGINS_EXT_CFLAGS + include $(addprefix $(srctree)/, $(include-y)) # scripts/Makefile.gcc-plugins is intentionally included last. diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile index 1952d3b..0b3e27a 100644 --- a/scripts/gcc-plugins/Makefile +++ b/scripts/gcc-plugins/Makefile @@ -23,7 +23,7 @@ GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin) plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \ -include $(srctree)/include/linux/compiler-version.h \ - -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \ + -I $(GCC_PLUGINS_DIR)/include -I $(obj) $(GCC_PLUGINS_EXT_CFLAGS) -std=gnu++11 \ -fno-rtti -fno-exceptions -fasynchronous-unwind-tables \ -ggdb -Wno-narrowing -Wno-unused-variable \ -Wno-format-diag -- 2.7.4